-
Notifications
You must be signed in to change notification settings - Fork 190
feat(web-app-admin-settings): [OCISDEV-348] use api groups search #13235
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Enhancement: Use API groups search in admin settings | ||
|
|
||
| We have changed the search behaviour in the admin settings. Instead of filtering the groups in the client, we now use the search parameter of the list groups API endpoint. | ||
|
|
||
| https://github.com/owncloud/web/pull/13235 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,25 +30,49 @@ | |||||
| </template> | ||||||
| <template #mainContent> | ||||||
| <app-loading-spinner v-if="isLoading" /> | ||||||
| <template v-else> | ||||||
| <no-content-message | ||||||
| v-if="!groups.length" | ||||||
| id="admin-settings-groups-empty" | ||||||
| class="files-empty" | ||||||
| icon="user" | ||||||
| > | ||||||
| <template #message> | ||||||
| <span v-translate>No groups in here</span> | ||||||
| <div v-else> | ||||||
| <groups-list> | ||||||
| <template #contextMenu> | ||||||
| <context-actions :action-options="{ resources: selectedGroups }" /> | ||||||
| </template> | ||||||
| <template #filter> | ||||||
| <div class="oc-flex oc-flex-middle"> | ||||||
| <oc-text-input | ||||||
| id="groups-filter" | ||||||
| v-model.trim="filterTerm" | ||||||
|
||||||
| :label="$gettext('Search')" | ||||||
| autocomplete="off" | ||||||
| @enterKeyDown="filterGroups" | ||||||
| /> | ||||||
| <oc-button | ||||||
| id="groups-filter-confirm" | ||||||
| class="oc-ml-xs" | ||||||
| appearance="raw" | ||||||
| @click="filterGroups" | ||||||
| > | ||||||
| <oc-icon name="search" fill-type="line" /> | ||||||
| </oc-button> | ||||||
| </div> | ||||||
| </template> | ||||||
| </no-content-message> | ||||||
| <div v-else> | ||||||
| <groups-list> | ||||||
| <template #contextMenu> | ||||||
| <context-actions :action-options="{ resources: selectedGroups }" /> | ||||||
| </template> | ||||||
| </groups-list> | ||||||
| </div> | ||||||
| </template> | ||||||
| <template #noResults> | ||||||
| <no-content-message | ||||||
| v-if="!groups.length" | ||||||
| id="admin-settings-groups-empty" | ||||||
| class="files-empty" | ||||||
| icon="user" | ||||||
| > | ||||||
| <template #message> | ||||||
| {{ | ||||||
| $pgettext( | ||||||
| 'A message displayed when no groups are found in the groups list in admin settings when there is no filter applied.', | ||||||
| 'No groups in here' | ||||||
| ) | ||||||
| }} | ||||||
| </template> | ||||||
| </no-content-message> | ||||||
| </template> | ||||||
| </groups-list> | ||||||
| </div> | ||||||
| </template> | ||||||
| </app-template> | ||||||
| </div> | ||||||
|
|
@@ -66,6 +90,7 @@ import { useGroupActionsCreateGroup, useGroupActionsDelete } from '../composable | |||||
| import { | ||||||
| AppLoadingSpinner, | ||||||
| NoContentMessage, | ||||||
| queryItemAsString, | ||||||
| SideBarPanel, | ||||||
| SideBarPanelContext, | ||||||
| useClientService, | ||||||
|
|
@@ -77,16 +102,22 @@ import { useTask } from 'vue-concurrency' | |||||
| import { useGettext } from 'vue3-gettext' | ||||||
| import { storeToRefs } from 'pinia' | ||||||
| import { call } from '@ownclouders/web-client' | ||||||
| import { useRoute, useRouter } from 'vue-router' | ||||||
| import { omit } from 'lodash-es' | ||||||
|
|
||||||
| const template = ref() | ||||||
| const groupSettingsStore = useGroupSettingsStore() | ||||||
| const { selectedGroups, groups } = storeToRefs(groupSettingsStore) | ||||||
| const clientService = useClientService() | ||||||
| const { $gettext } = useGettext() | ||||||
| const { sideBarActivePanel, isSideBarOpen } = useSideBar() | ||||||
| const router = useRouter() | ||||||
| const route = useRoute() | ||||||
|
|
||||||
| provide('group', selectedGroups[0]) | ||||||
|
|
||||||
| const filterTerm = ref(queryItemAsString(unref(route).query.q_displayName)) | ||||||
|
|
||||||
| const { actions: createGroupActions } = useGroupActionsCreateGroup() | ||||||
| const createGroupAction = computed(() => unref(createGroupActions)[0]) | ||||||
|
|
||||||
|
|
@@ -95,7 +126,8 @@ const loadResourcesTask = useTask(function* (signal) { | |||||
| clientService.graphAuthenticated.groups.listGroups( | ||||||
| { | ||||||
| orderBy: ['displayName'], | ||||||
| expand: ['members'] | ||||||
| expand: ['members'], | ||||||
| search: queryItemAsString(unref(route).query.q_displayName) | ||||||
| }, | ||||||
| { signal } | ||||||
| ) | ||||||
|
|
@@ -154,6 +186,19 @@ const sideBarAvailablePanels = [ | |||||
| } | ||||||
| ] satisfies SideBarPanel<unknown, unknown, Group>[] | ||||||
|
|
||||||
| async function filterGroups() { | ||||||
| await router.push({ | ||||||
| ...unref(route), | ||||||
| query: { | ||||||
| ...omit(unref(route).query, 'q_displayName'), | ||||||
| q_displayName: unref(filterTerm), | ||||||
|
||||||
| q_displayName: unref(filterTerm), | |
| ...(unref(filterTerm) ? { q_displayName: unref(filterTerm) } : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
unref()call on line 316 is incorrect.filterTermis already a string fromqueryItemAsString()on line 315, not a ref. Remove theunref()wrapper.