Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: computed group list (#16949)
boojack2fc06ae874a5
diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vueindex de083a01f0..95254d4a74 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue@@ -15,7 +15,7 @@<script lang="ts" setup>import { NTag } from "naive-ui";import { computed } from "vue";-import { useGroupStore } from "@/store";+import { useGroupList } from "@/store";import { extractUserId } from "@/store/modules/v1/common";import type { Group } from "@/types/proto-es/v1/group_service_pb";import { type User } from "@/types/proto-es/v1/user_service_pb";@@ -28,11 +28,11 @@ defineEmits<{(event: "select-group", group: Group): void;}>();-const groupStore = useGroupStore();+const groupList = useGroupList();const groups = computed(() => {const groups = [];- for (const group of groupStore.groupList) {+ for (const group of groupList.value) {for (const member of group.members) {if (extractUserId(member.member) === props.user.email) {groups.push(group);diff --git a/frontend/src/components/v2/Select/GroupSelect.vue b/frontend/src/components/v2/Select/GroupSelect.vueindex a0b99da9db..6f3d8f0995 100644--- a/frontend/src/components/v2/Select/GroupSelect.vue+++ b/frontend/src/components/v2/Select/GroupSelect.vue@@ -20,7 +20,7 @@ import {getMemberBindings,} from "@/components/Member/utils";import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";-import { useGroupStore, useProjectV1Store, useWorkspaceV1Store } from "@/store";+import { useGroupList, useProjectV1Store, useWorkspaceV1Store } from "@/store";import { PRESET_WORKSPACE_ROLES } from "@/types";import type { Group } from "@/types/proto-es/v1/group_service_pb";import ResourceSelect from "./ResourceSelect.vue";@@ -50,13 +50,13 @@ defineEmits<{(event: "update:groups", val: string[]): void;}>();-const groupStore = useGroupStore();+const groupList = useGroupList();const projectV1Store = useProjectV1Store();const workspaceStore = useWorkspaceV1Store();-const groupList = computedAsync(async () => {+const filteredGroupList = computedAsync(async () => {if (!props.projectName) {- return groupStore.groupList;+ return groupList.value;}const project = await projectV1Store.getOrFetchProjectByName(props.projectName@@ -82,7 +82,7 @@ const groupList = computedAsync(async () => {}, []);const options = computed(() => {- return groupList.value.map((group) => ({+ return filteredGroupList.value.map((group) => ({value: group.name,label: group.title,resource: group,diff --git a/frontend/src/store/modules/v1/group.ts b/frontend/src/store/modules/v1/group.tsindex 20042dd7f8..e694523d5b 100644--- a/frontend/src/store/modules/v1/group.ts+++ b/frontend/src/store/modules/v1/group.ts@@ -122,3 +122,8 @@ export const useGroupStore = defineStore("group", () => {createGroup,};});++export const useGroupList = () => {+ const groupStore = useGroupStore();+ return computed(() => groupStore.groupList);+};diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vueindex 3bc5ccfc6c..4d199ede64 100644--- a/frontend/src/views/SettingWorkspaceUsers.vue+++ b/frontend/src/views/SettingWorkspaceUsers.vue@@ -43,7 +43,7 @@<p class="text-base font-medium leading-7 text-main"><span>{{ $t("settings.members.groups.self") }}</span><span class="ml-1 font-normal text-control-light">- ({{ groupStore.groupList.length }})+ ({{ groupList.length }})</span></p></div>@@ -204,7 +204,7 @@ import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetimport {featureToRef,useActuatorV1Store,- useGroupStore,+ useGroupList,useSettingV1Store,useSubscriptionV1Store,useUIStateStore,@@ -252,7 +252,7 @@ const { t } = useI18n();const route = useRoute();const router = useRouter();const userStore = useUserStore();-const groupStore = useGroupStore();+const groupList = useGroupList();const uiStateStore = useUIStateStore();const actuatorStore = useActuatorV1Store();const settingV1Store = useSettingV1Store();@@ -357,17 +357,15 @@ onMounted(() => {const name = route.query.name as string;if (name?.startsWith(groupNamePrefix)) {state.typeTab = "GROUPS";- state.editingGroup = groupStore.groupList.find(- (group) => group.name === name- );+ state.editingGroup = groupList.value.find((group) => group.name === name);state.showCreateGroupDrawer = !!state.editingGroup;}});const filteredGroupList = computed(() => {const keyword = state.activeUserFilterText.trim().toLowerCase();- if (!keyword) return groupStore.groupList;- return groupStore.groupList.filter((group) => {+ if (!keyword) return groupList.value;+ return groupList.value.filter((group) => {return (group.title.toLowerCase().includes(keyword) ||group.name.toLowerCase().includes(keyword)