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 advanced search (#9739)
ecmadao45a1162abc02
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/AdvancedSearchBox.vue b/frontend/src/components/IssueV1/components/IssueSearch/AdvancedSearchBox.vueindex 701cbf5716..4758a4c890 100644--- a/frontend/src/components/IssueV1/components/IssueSearch/AdvancedSearchBox.vue+++ b/frontend/src/components/IssueV1/components/IssueSearch/AdvancedSearchBox.vue@@ -18,7 +18,12 @@'max-width': `calc(${containerWidth}px - 14rem)`,}">- <SearchIcon class="w-4 h-4 text-control-placeholder" />+ <div class="flex items-center space-x-2">+ <FilterIcon class="w-4 h-4 text-control-placeholder" />+ <span class="textinfolabel">+ {{ $t("issue.advanced-search.filter") }}+ </span>+ </div><divref="tagsContainerRef"class="flex-1 flex flex-row items-center flex-nowrap gap-1 overflow-auto hide-scrollbar"@@ -80,7 +85,7 @@<script lang="ts" setup>import { useElementSize } from "@vueuse/core";import { cloneDeep, last } from "lodash-es";-import { SearchIcon } from "lucide-vue-next";+import { FilterIcon } from "lucide-vue-next";import { XIcon } from "lucide-vue-next";import { matchSorter } from "match-sorter";import { InputInst, NInput } from "naive-ui";@@ -115,7 +120,7 @@ const props = withDefaults(params: SearchParams;readonlyScopes?: SearchScope[];autofocus?: boolean;- supportOptionIdList?: { id: SearchScopeId; includeAll: boolean }[];+ supportOptionIdList?: SearchScopeId[];}>(),{readonlyScopes: () => [],diff --git a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vueindex 0d9efd7e74..df15cda383 100644--- a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue+++ b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue@@ -96,10 +96,8 @@ const handleSelectScope = (id: SearchScopeId) => {}};-const supportOptionIdList = computed(() =>- [...UIIssueFilterScopeIdList, ...SearchScopeIdList].map((id) => ({- id,- includeAll: false,- }))-);+const supportOptionIdList = computed(() => [+ ...UIIssueFilterScopeIdList,+ ...SearchScopeIdList,+]);</script>diff --git a/frontend/src/components/IssueV1/components/IssueSearch/useSearchScopeOptions.ts b/frontend/src/components/IssueV1/components/IssueSearch/useSearchScopeOptions.tsindex 895dc4607a..7115df3e76 100644--- a/frontend/src/components/IssueV1/components/IssueSearch/useSearchScopeOptions.ts+++ b/frontend/src/components/IssueV1/components/IssueSearch/useSearchScopeOptions.ts@@ -20,12 +20,7 @@ import {useUserStore,useEnvironmentV1List,} from "@/store";-import {- SYSTEM_BOT_EMAIL,- UNKNOWN_ID,- unknownEnvironment,- unknownInstance,-} from "@/types";+import { SYSTEM_BOT_EMAIL, UNKNOWN_ID } from "@/types";import { engineToJSON } from "@/types/proto/v1/common";import { Workflow } from "@/types/proto/v1/project_service";import {@@ -51,13 +46,9 @@ export type ValueOption = {render: RenderFunction;};-interface LocalScopeOption extends ScopeOption {- optionForAll?: ValueOption;-}-export const useSearchScopeOptions = (params: Ref<SearchParams>,- supportOptionIdList: { id: SearchScopeId; includeAll: boolean }[]+ supportOptionIdList: SearchScopeId[]) => {const { t } = useI18n();const me = useCurrentUserV1();@@ -101,7 +92,7 @@ export const useSearchScopeOptions = (// fullScopeOptions provides full search scopes and options.// we need this as the source of truth.const fullScopeOptions = computed((): ScopeOption[] => {- const scopes: LocalScopeOption[] = [+ const scopes: ScopeOption[] = [{id: "project",title: t("issue.advanced-search.scope.project.title"),@@ -193,21 +184,6 @@ export const useSearchScopeOptions = (id: "instance",title: t("issue.advanced-search.scope.instance.title"),description: t("issue.advanced-search.scope.instance.description"),- optionForAll: {- value: `${UNKNOWN_ID}`,- keywords: [],- custom: true,- render: () =>- h(InstanceV1Name, {- instance: {- ...unknownInstance(),- title: t("instance.all"),- },- icon: false,- link: false,- tooltip: false,- }),- },options: instanceList.value.map((ins) => {const name = extractInstanceResourceName(ins.name);return {@@ -263,21 +239,8 @@ export const useSearchScopeOptions = (},{id: "environment",- title: "Environment",- description: "xxxxxxxx",- optionForAll: {- value: `${UNKNOWN_ID}`,- keywords: [],- custom: true,- render: () =>- h(EnvironmentV1Name, {- environment: {- ...unknownEnvironment(),- title: t("environment.all"),- },- link: false,- }),- },+ title: t("issue.advanced-search.scope.environment.title"),+ description: t("issue.advanced-search.scope.environment.description"),options: environmentList.value.map((env) => {return {value: extractEnvironmentResourceName(env.name),@@ -308,20 +271,8 @@ export const useSearchScopeOptions = (],},];- const supportOptionIdMap = new Map(- supportOptionIdList.map((data) => [data.id, data.includeAll])- );- return scopes- .filter((scope) => supportOptionIdMap.has(scope.id))- .map((scope) => {- if (supportOptionIdMap.get(scope.id) && scope.optionForAll) {- return {- ...scope,- options: [scope.optionForAll, ...scope.options],- };- }- return scope;- });+ const supportOptionIdSet = new Set(supportOptionIdList);+ return scopes.filter((scope) => supportOptionIdSet.has(scope.id));});// filteredScopeOptions will filter search options by chosen scope.diff --git a/frontend/src/components/ProjectDatabasesPanel.vue b/frontend/src/components/ProjectDatabasesPanel.vueindex e429a45956..a6b7beefec 100644--- a/frontend/src/components/ProjectDatabasesPanel.vue+++ b/frontend/src/components/ProjectDatabasesPanel.vue@@ -110,16 +110,7 @@ const state = reactive<LocalState>({selectedLabels: [],params: {query: "",- scopes: [- {- id: "environment",- value: String(UNKNOWN_ID),- },- {- id: "instance",- value: String(UNKNOWN_ID),- },- ],+ scopes: [],},});const policyList = ref<Policy[]>([]);@@ -227,7 +218,5 @@ const selectedDatabases = computed((): ComposedDatabase[] => {);});-const supportOptionIdList = computed(() =>- [...CommonFilterScopeIdList].map((id) => ({ id, includeAll: true }))-);+const supportOptionIdList = computed(() => [...CommonFilterScopeIdList]);</script>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 1f448d1000..ba387a9028 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -968,18 +968,23 @@"view-commit": "View commit","advanced-search": {"self": "Advanced search",+ "filter": "Filter","scope": {"project": {"title": "Project",- "description": "Include only issues from this project"+ "description": "Filter by project"},"instance": {"title": "Instance",- "description": "Include only issues related with the instance"+ "description": "Filter by instance"+ },+ "environment": {+ "title": "Environment",+ "description": "Filter by environment"},"database": {"title": "Database",- "description": "Include only issues related with the database"+ "description": "Filter by database"},"type": {"title": "Change Type",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex c1875ea79c..246a7bfdbc 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -967,18 +967,23 @@"view-commit": "Ver commit","advanced-search": {"self": "Búsqueda Avanzada",+ "filter": "Filtrar","scope": {"project": {"title": "Proyecto",- "description": "Incluir solo ediciones de este proyecto"+ "description": "Filtrar por proyecto"},"instance": {"title": "Instancia",- "description": "Incluir solo problemas relacionados con la instancia"+ "description": "Filtrar por instancia"},"database": {"title": "Base de datos",- "description": "Incluir sólo cuestiones relacionadas con la base de datos"+ "description": "Filtrar por base de datos"+ },+ "environment": {+ "title": "Ambiente",+ "description": "Filtrar por entorno"},"type": {"title": "Tipo de cambio",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 83c6aeea58..5d5f1e9076 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -965,18 +965,23 @@"view-commit": "查看提交","advanced-search": {"self": "高级搜索",+ "filter": "过滤","scope": {"project": {"title": "项目",- "description": "仅搜索某个项目下的工单"+ "description": "根据项目过滤"},"instance": {"title": "实例",- "description": "仅搜索与某个实例关联的工单"+ "description": "根据实例过滤"},"database": {"title": "数据库",- "description": "仅搜索与某个数据库关联的工单"+ "description": "根据数据库过滤"+ },+ "environment": {+ "title": "环境",+ "description": "根据环境过滤"},"type": {"title": "变更类型",diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vueindex 976ee4a4e6..d877697322 100644--- a/frontend/src/views/DatabaseDashboard.vue+++ b/frontend/src/views/DatabaseDashboard.vue@@ -120,16 +120,7 @@ const state = reactive<LocalState>({selectedDatabaseIds: new Set(),params: {query: "",- scopes: [- {- id: "environment",- value: String(UNKNOWN_ID),- },- {- id: "instance",- value: String(UNKNOWN_ID),- },- ],+ scopes: [],},});@@ -316,7 +307,5 @@ const selectedDatabases = computed((): ComposedDatabase[] => {);});-const supportOptionIdList = computed(() =>- [...CommonFilterScopeIdList].map((id) => ({ id, includeAll: true }))-);+const supportOptionIdList = computed(() => [...CommonFilterScopeIdList]);</script>diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vueindex e0a0b81742..3bf6759675 100644--- a/frontend/src/views/InstanceDashboard.vue+++ b/frontend/src/views/InstanceDashboard.vue@@ -54,12 +54,7 @@ const environmentList = useEnvironmentV1List(false /* !showDeleted */);const state = reactive<LocalState>({params: {query: "",- scopes: [- {- id: "environment",- value: String(UNKNOWN_ID),- },- ],+ scopes: [],},});@@ -128,14 +123,7 @@ const instanceCountAttention = computed((): string => {return `${status} ${upgrade}`;});-const supportOptionIdList = computed(- (): { id: SearchScopeId; includeAll: boolean }[] => {- return [- {- id: "environment",- includeAll: true,- },- ];- }-);+const supportOptionIdList = computed((): SearchScopeId[] => {+ return ["environment"];+});</script>