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: update database filter (#9781)
ecmadao98d04ad5b6fc
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex 1d62b06ac9..4f3582490c 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -345,15 +345,6 @@ const routes: Array<RouteRecordRaw> = [component: () => import("../views/SettingWorkspaceAgent.vue"),props: true,},- {- path: "project",- name: "setting.workspace.project",- meta: {- title: () => t("common.projects"),- },- component: () => import("../views/SettingWorkspaceProject.vue"),- props: true,- },{path: "member",name: "setting.workspace.member",diff --git a/frontend/src/utils/role.ts b/frontend/src/utils/role.tsindex 104749addf..e1394f028f 100644--- a/frontend/src/utils/role.ts+++ b/frontend/src/utils/role.ts@@ -232,11 +232,6 @@ export const hasSettingPagePermission = ("bb.permission.workspace.manage-member",role);- case "setting.workspace.project":- return hasWorkspacePermissionV1(- "bb.permission.workspace.manage-project",- role- );case "setting.workspace.sensitive-data":return hasWorkspacePermissionV1("bb.permission.workspace.manage-sensitive-data",diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vueindex 25ee40bb96..eaea3d0f9c 100644--- a/frontend/src/views/DatabaseDashboard.vue+++ b/frontend/src/views/DatabaseDashboard.vue@@ -1,12 +1,19 @@<template><div class="flex flex-col relative space-y-4">- <AdvancedSearchBox- v-model:params="state.params"- class="px-4"- :autofocus="false"- :placeholder="$t('database.filter-database')"- :support-option-id-list="supportOptionIdList"- />+ <div+ class="w-full px-4 flex flex-col sm:flex-row items-start sm:items-end justify-between gap-2"+ >+ <AdvancedSearchBox+ v-model:params="state.params"+ :autofocus="false"+ :placeholder="$t('database.filter-database')"+ :support-option-id-list="supportOptionIdList"+ />+ <DatabaseLabelFilter+ v-model:selected="state.selectedLabels"+ :database-list="databaseV1List"+ />+ </div><DatabaseOperationsv-if="selectedDatabases.length > 0 || isStandaloneMode"@@ -94,12 +101,14 @@ import {PolicyType,} from "@/types/proto/v1/org_policy_service";import {+ SearchScopeId,SearchParams,filterDatabaseV1ByKeyword,sortDatabaseV1List,CommonFilterScopeIdList,extractEnvironmentResourceName,extractInstanceResourceName,+ extractProjectResourceName,} from "@/utils";interface LocalState {@@ -107,6 +116,7 @@ interface LocalState {loading: boolean;selectedDatabaseIds: Set<string>;params: SearchParams;+ selectedLabels: { key: string; value: string }[];}const uiStateStore = useUIStateStore();@@ -121,6 +131,7 @@ const state = reactive<LocalState>({query: "",scopes: [],},+ selectedLabels: [],});const currentUserV1 = useCurrentUserV1();@@ -155,6 +166,13 @@ const selectedEnvironment = computed(() => {);});+const selectedProject = computed(() => {+ return (+ state.params.scopes.find((scope) => scope.id === "project")?.value ??+ `${UNKNOWN_ID}`+ );+});+onMounted(() => {if (!uiStateStore.getIntroStateByKey("database.visit")) {uiStateStore.saveIntroStateByKey({@@ -216,6 +234,16 @@ const filteredDatabaseList = computed(() => {selectedInstance.value);}+ if (selectedProject.value !== `${UNKNOWN_ID}`) {+ list = list.filter(+ (db) => extractProjectResourceName(db.project) === selectedProject.value+ );+ }+ if (state.selectedLabels.length > 0) {+ list = list.filter((db) => {+ return state.selectedLabels.some((kv) => db.labels[kv.key] === kv.value);+ });+ }if (isStandaloneMode.value) {list = list.filter((db) => db.projectEntity.name !== DEFAULT_PROJECT_V1_NAME@@ -304,5 +332,8 @@ const selectedDatabases = computed((): ComposedDatabase[] => {);});-const supportOptionIdList = computed(() => [...CommonFilterScopeIdList]);+const supportOptionIdList = computed((): SearchScopeId[] => [+ ...CommonFilterScopeIdList,+ "project",+]);</script>diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vueindex 228db9870d..0fe47830df 100644--- a/frontend/src/views/SettingSidebar.vue+++ b/frontend/src/views/SettingSidebar.vue@@ -87,15 +87,6 @@ const settingSidebarItemList = computed((): SidebarItem[] => {path: "/setting/role",type: "route",},- {- title: t("common.projects"),- path: "/setting/project",- hide: !hasSettingPagePermission(- "setting.workspace.project",- currentUserV1.value.userRole- ),- type: "route",- },{title: t("settings.sidebar.subscription"),path: "/setting/subscription",diff --git a/frontend/src/views/SettingWorkspaceProject.vue b/frontend/src/views/SettingWorkspaceProject.vuedeleted file mode 100644index 48dbb60c9e..0000000000--- a/frontend/src/views/SettingWorkspaceProject.vue+++ /dev/null@@ -1,61 +0,0 @@-<template>- <div class="flex flex-col space-y-4">- <BBAttention :style="'INFO'" :title="$t('setting.project.description')" />-- <div class="flex justify-between items-end">- <NCheckbox v-model:checked="state.includesArchived">- <span class="textinfolabel">- {{ $t("setting.project.show-archived") }}- </span>- </NCheckbox>- <SearchBox- v-model:value="state.searchText"- :placeholder="$t('common.filter-by-name')"- :autofocus="true"- />- </div>-- <ProjectV1Table :project-list="filteredProjectList" />- </div>-</template>--<script setup lang="ts">-import { NCheckbox } from "naive-ui";-import { reactive, computed } from "vue";-import { ProjectV1Table, SearchBox } from "@/components/v2";-import { useProjectV1List } from "@/store";-import { State } from "@/types/proto/v1/common";-import { filterProjectV1ListByKeyword } from "@/utils";-import { DEFAULT_PROJECT_V1_NAME } from "../types";--interface LocalState {- searchText: string;- includesArchived: boolean;-}--const { projectList } = useProjectV1List(true /* showDeleted */);--const state = reactive<LocalState>({- searchText: "",- includesArchived: false,-});--const filteredProjectList = computed(() => {- let list = [...projectList.value];- list = filterProjectV1ListByKeyword(list, state.searchText);-- // Put "Unassigned" to the first;- const unassignedIndex = list.findIndex(- (project) => project.name === DEFAULT_PROJECT_V1_NAME- );- if (unassignedIndex >= 0) {- const unassignedProject = list[unassignedIndex];- list.splice(unassignedIndex, 1);- list.unshift(unassignedProject);- }- if (!state.includesArchived) {- list = list.filter((project) => project.state !== State.DELETED);- }- return list;-});-</script>