Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bug fix in users list #40428

Merged
merged 6 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions apps/settings/src/components/Users/UserRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@
:input-id="'manager' + uniqueId"
:close-on-select="true"
:disabled="isLoadingField"
:loading="idState.loading.manager"
:loading="idState.loadingPossibleManagers || idState.loading.manager"
label="displayname"
:options="idState.possibleManagers"
:placeholder="managerLabel"
class="select-vue"
@open="searchInitialUserManager"
@search="searchUserManager"
@option:selected="updateUserManager"
@input="updateUserManager" />
Expand Down Expand Up @@ -359,6 +360,7 @@ export default {
return {
selectedQuota: false,
rand: Math.random().toString(36).substring(2),
loadingPossibleManagers: false,
possibleManagers: [],
currentManager: '',
editing: false,
Expand Down Expand Up @@ -502,11 +504,13 @@ export default {
},

async beforeMount() {
await this.searchUserManager()

if (this.user.manager) {
await this.initManager(this.user.manager)
}

// Reset loading state before mounting the component.
// This is useful when we disable a user as the loading state cannot be properly reset upon promise resolution.
Object.keys(this.idState.loading).forEach(key => (this.idState.loading[key] = false))
},

methods: {
Expand Down Expand Up @@ -547,6 +551,12 @@ export default {
})
},

async searchInitialUserManager() {
this.idState.loadingPossibleManagers = true
await this.searchUserManager()
this.idState.loadingPossibleManagers = false
},

async searchUserManager(query) {
await this.$store.dispatch('searchUsers', { offset: 0, limit: 10, search: query }).then(response => {
const users = response?.data ? this.filterManagers(Object.values(response?.data.ocs.data.users)) : []
Expand Down
5 changes: 5 additions & 0 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ const mutations = {
},
// update active/disabled counts, groups counts
updateUserCounts(state, { user, actionType }) {
// 0 is a special value
if (state.userCount === 0) {
return
}

const disabledGroup = state.groups.find(group => group.id === 'disabled')
switch (actionType) {
case 'enable':
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/views/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<AccountGroup :size="20" />
</template>
<template #counter>
<NcCounterBubble :type="!selectedGroupDecoded ? 'highlighted' : undefined">
<NcCounterBubble v-if="userCount" :type="!selectedGroupDecoded ? 'highlighted' : undefined">
{{ userCount }}
</NcCounterBubble>
</template>
Expand Down
4 changes: 2 additions & 2 deletions dist/settings-users-8351.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-users-8351.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

Loading