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

migrate a few components to NcSelect #38306

Merged
merged 2 commits into from May 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 4 additions & 11 deletions apps/files/src/components/TransferOwnershipDialogue.vue
Expand Up @@ -37,22 +37,15 @@
<label for="targetUser">
<span>{{ t('files', 'New owner') }}</span>
</label>
<NcMultiselect id="targetUser"
<NcSelect input-id="targetUser"
v-model="selectedUser"
:options="formatedUserSuggestions"
:multiple="false"
:searchable="true"
:placeholder="t('files', 'Search for an account')"
:preselect-first="true"
:preserve-search="true"
:loading="loadingUsers"
track-by="user"
label="displayName"
:internal-search="false"
:clear-on-select="false"
:user-select="true"
class="middle-align"
@search-change="findUserDebounced" />
@search="findUserDebounced" />
</p>
<p>
<input type="submit"
Expand All @@ -70,7 +63,7 @@ import axios from '@nextcloud/axios'
import debounce from 'debounce'
import { generateOcsUrl } from '@nextcloud/router'
import { getFilePickerBuilder, showSuccess } from '@nextcloud/dialogs'
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import Vue from 'vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'

Expand All @@ -86,7 +79,7 @@ const picker = getFilePickerBuilder(t('files', 'Choose a file or folder to trans
export default {
name: 'TransferOwnershipDialogue',
components: {
NcMultiselect,
NcSelect,
NcButton,
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/admin.js
@@ -1,5 +1,5 @@
window.addEventListener('DOMContentLoaded', () => {
$('#excludedGroups,#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) {
$('#linksExcludedGroups,#passwordsExcludedGroups').each(function(index, element) {
OC.Settings.setupGroupsSelect($(element))
$(element).change(function(ev) {
let groups = ev.val || []
Expand Down
26 changes: 14 additions & 12 deletions apps/settings/src/components/AdminTwoFactor.vue
Expand Up @@ -19,31 +19,33 @@
{{ t('settings', 'Two-factor authentication is enforced for all members of the following groups.') }}
</p>
<p>
<NcMultiselect v-model="enforcedGroups"
<label for="enforcedGroups">
<span>{{ t('settings', 'Enforced groups') }}</span>
</label>
<NcSelect input-id="enforcedGroups"
v-model="enforcedGroups"
:options="groups"
:placeholder="t('settings', 'Enforced groups')"
:disabled="loading"
:multiple="true"
:searchable="true"
:loading="loadingGroups"
:show-no-options="false"
:close-on-select="false"
@search-change="searchGroup" />
@search="searchGroup" />
</p>
<p class="top-margin">
{{ t('settings', 'Two-factor authentication is not enforced for members of the following groups.') }}
</p>
<p>
<NcMultiselect v-model="excludedGroups"
<label for="excludedGroups">
<span>{{ t('settings', 'Excluded groups') }}</span>
</label>
<NcSelect input-id="excludedGroups"
v-model="excludedGroups"
:options="groups"
:placeholder="t('settings', 'Excluded groups')"
:disabled="loading"
:multiple="true"
:searchable="true"
:loading="loadingGroups"
:show-no-options="false"
:close-on-select="false"
@search-change="searchGroup" />
@search="searchGroup" />
</p>
<p class="top-margin">
<em>
Expand All @@ -65,7 +67,7 @@

<script>
import axios from '@nextcloud/axios'
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
Expand All @@ -77,7 +79,7 @@ import { generateUrl, generateOcsUrl } from '@nextcloud/router'
export default {
name: 'AdminTwoFactor',
components: {
NcMultiselect,
NcSelect,
NcButton,
NcCheckboxRadioSwitch,
NcSettingsSection,
Expand Down
25 changes: 13 additions & 12 deletions apps/settings/src/components/AppDetails.vue
Expand Up @@ -35,22 +35,23 @@
class="group_select"
:title="t('settings', 'All')"
value="">
<NcMultiselect v-if="isLimitedToGroups(app)"
<br />
<label for="limitToGroups">
<span>{{ t('settings', 'Limit app usage to groups') }}</span>
</label>
<NcSelect v-if="isLimitedToGroups(app)"
input-id="limitToGroups"
:options="groups"
:value="appGroups"
:options-limit="5"
:placeholder="t('settings', 'Limit app usage to groups')"
:limit="5"
label="name"
track-by="id"
class="multiselect-vue"
:multiple="true"
:close-on-select="false"
:tag-width="60"
@select="addGroupLimitation"
@remove="removeGroupLimitation"
@search-change="asyncFindGroup">
@option:selected="addGroupLimitation"
@option:deselected="removeGroupLimitation"
@search="asyncFindGroup">
<span slot="noResult">{{ t('settings', 'No results') }}</span>
</NcMultiselect>
</NcSelect>
</div>
<div class="app-details__actions-manage">
<input v-if="app.update"
Expand Down Expand Up @@ -146,7 +147,7 @@
</template>

<script>
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'

import AppManagement from '../mixins/AppManagement.js'
import PrefixMixin from './PrefixMixin.vue'
Expand All @@ -156,7 +157,7 @@ export default {
name: 'AppDetails',

components: {
NcMultiselect,
NcSelect,
Markdown,
},
mixins: [AppManagement, PrefixMixin],
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/src/mixins/AppManagement.js
Expand Up @@ -98,7 +98,8 @@ export default {
}
return true
},
addGroupLimitation(group) {
addGroupLimitation(groupArray) {
const group = groupArray.pop()
const groups = this.app.groups.concat([]).concat([group.id])
this.$store.dispatch('enableApp', { appId: this.app.id, groups })
},
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-personal-settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-personal-settings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-apps-view-7418.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-apps-view-7418.js.map

Large diffs are not rendered by default.