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

[stable26] Improve group multiselect behaviour with multiple and long group names #2946

Merged
merged 3 commits into from
May 16, 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
5 changes: 3 additions & 2 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -531,19 +531,19 @@

const [parent, setting] = key.split('_')
if (parent === 'watermark') {
Vue.set(this.settings[parent], setting, this.initial.settings[key])

Check warning on line 534 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead
} else {
Vue.set(this.settings, key, this.initial.settings[key])

Check warning on line 536 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead
}

}
Vue.set(this.settings, 'data', this.initial.settings)

Check warning on line 540 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead
if (this.settings.wopi_url === '') {
this.serverError = SERVER_STATE_CONNECTION_ERROR
}
Vue.set(this.settings, 'edit_groups', this.settings.edit_groups ? this.settings.edit_groups.split('|') : null)

Check warning on line 544 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead
Vue.set(this.settings, 'use_groups', this.settings.use_groups ? this.settings.use_groups.split('|') : null)

Check warning on line 545 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead
Vue.set(this.settings, 'fonts', this.initial.fonts ? this.initial.fonts : [])

Check warning on line 546 in src/components/AdminSettings.vue

View workflow job for this annotation

GitHub Actions / eslint

Caution: `Vue` also has a named export `set`. Check if you meant to write `import {set} from 'vue'` instead

this.uiVisible.canonical_webroot = !!(this.settings.canonical_webroot && this.settings.canonical_webroot !== '')
this.uiVisible.external_apps = !!(this.settings.external_apps && this.settings.external_apps !== '')
Expand Down Expand Up @@ -765,8 +765,9 @@

input[type='text'],
.multiselect {
width: 100%;
max-width: 400px;
width: auto;
min-width: 200px;
max-width: 100%;
}

input#wopi_url {
Expand Down
16 changes: 12 additions & 4 deletions src/components/SettingsSelectGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
<template>
<NcMultiselect v-model="inputValObjects"
:options="groupsArray"
:options-limit="5"
:auto-limit="false"
:placeholder="label"
track-by="id"
label="displayname"
class="multiselect-vue"
:multiple="true"
:close-on-select="false"
:tag-width="60"
:disabled="disabled"
@input="update"
@search-change="asyncFindGroup">
Expand Down Expand Up @@ -78,7 +77,9 @@ export default {
return 'settings-select-group-' + this.uuid
},
groupsArray() {
return Object.values(this.groups)
return Object.values(this.groups).sort((a, b) => {
return this.inputValObjects.indexOf(b) - this.inputValObjects.indexOf(a)
})
},
},
watch: {
Expand All @@ -89,6 +90,13 @@ export default {
created() {
this.uuid = uuid.toString()
uuid += 1
// Preseed with placeholder entries for groups
this.getValueObject().forEach((element) => {
this.$set(this.groups, element.id, element)
})
this.inputValObjects = this.getValueObject()
// Fetch actual group metadata
this.asyncFindGroup('').then((result) => {
this.inputValObjects = this.getValueObject()
})
Expand All @@ -112,7 +120,7 @@ export default {
},
asyncFindGroup(query) {
query = typeof query === 'string' ? encodeURI(query) : ''
return axios.get(generateOcsUrl(`cloud/groups/details?search=${query}&limit=10`, 2))
return axios.get(generateOcsUrl(`cloud/groups/details?search=${query}&limit=100`, 2))
.then((response) => {
if (Object.keys(response.data.ocs.data.groups).length > 0) {
response.data.ocs.data.groups.forEach((element) => {
Expand Down
Loading