Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update common search options (#13378)

boojack1b4873a44d84
diff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts
index 96ee95530d..d41f78caed 100644
--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts
+++ b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts
@@ -59,9 +59,7 @@ export const useCommonSearchScopeOptions = (
project.value ? useDatabaseV1List(project.value).databaseList.value : []
);
- const instanceList = computed(() =>
- databaseList.value.length > 0 ? useInstanceResourceList().value : []
- );
+ const instanceList = computed(() => useInstanceResourceList().value);
// fullScopeOptions provides full search scopes and options.
// we need this as the source of truth.
@@ -162,35 +160,22 @@ export const useCommonSearchScopeOptions = (
};
}),
}),
- ["project-assigned"]: () => ({
- id: "project-assigned",
- title: t("issue.advanced-search.scope.project-assigned.title"),
- description: t(
- "issue.advanced-search.scope.project-assigned.description"
- ),
- options: [
- {
- value: "yes",
- keywords: ["yes"],
- render: () =>
- renderSpan(
- t("issue.advanced-search.scope.project-assigned.value.yes")
- ),
- },
- {
- value: "no",
- keywords: ["no"],
- render: () =>
- renderSpan(
- t("issue.advanced-search.scope.project-assigned.value.no")
- ),
- },
- ],
- }),
} as Record<SearchScopeId, () => ScopeOption>;
const scopes: ScopeOption[] = [];
unref(supportOptionIdList).forEach((id) => {
+ // Do not show database scope if there are no databases.
+ if (databaseList.value.length === 0) {
+ if (id === "database") {
+ return;
+ }
+ // Do not show instance scope if there are no instances.
+ if (instanceList.value.length === 0) {
+ if (id === "instance") {
+ return;
+ }
+ }
+ }
const create = scopeCreators[id];
if (create) {
scopes.push(create());
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 5cf561fcec..31d4c8b1c7 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1103,14 +1103,6 @@
"description": "Search by the issue approval status",
"title": "Approval Status"
},
- "project-assigned": {
- "title": "Project Assigned",
- "description": "Search by databases that are assigned to a project.",
- "value": {
- "yes": "yes",
- "no": "no"
- }
- },
"label": {
"title": "Label",
"description": "Filter by issue label"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 005f6031df..e9d32be304 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1103,14 +1103,6 @@
"description": "Buscar por estado de revisión del problema",
"title": "Estado de aprobación"
},
- "project-assigned": {
- "title": "Proyecto asignado",
- "description": "Buscar en las bases de datos con proyecto asignado",
- "value": {
- "yes": "yes",
- "no": "no"
- }
- },
"label": {
"title": "Etiqueta",
"description": "Filtrar por etiqueta de problema"
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index c2d15f4ddf..c3d3995de4 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1103,14 +1103,6 @@
"description": "作業指示書の承認ステータスで検索する",
"title": "承認状況"
},
- "project-assigned": {
- "title": "割り当てられたプロジェクト",
- "description": "データベースのプロジェクト割り当て状況から検索",
- "value": {
- "yes": "はい",
- "no": "いいえ"
- }
- },
"label": {
"title": "ラベル",
"description": "チケットタグで絞り込む"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 69e0f6409f..fd6135a1b5 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1103,14 +1103,6 @@
"description": "按工单的审批状态搜索",
"title": "审批状态"
},
- "project-assigned": {
- "title": "已分配项目",
- "description": "按数据库的项目分配状态搜索",
- "value": {
- "yes": "是",
- "no": "否"
- }
- },
"label": {
"title": "标签",
"description": "按工单标签过滤"
diff --git a/frontend/src/utils/v1/advanced-search/common.ts b/frontend/src/utils/v1/advanced-search/common.ts
index a202110118..b25a9bdc24 100644
--- a/frontend/src/utils/v1/advanced-search/common.ts
+++ b/frontend/src/utils/v1/advanced-search/common.ts
@@ -8,8 +8,6 @@ export const UIIssueFilterScopeIdList = [
"releaser",
] as const;
type UIIssueFilterScopeId = (typeof UIIssueFilterScopeIdList)[number];
-export const DatabaseFilterScopeIdList = ["project-assigned"] as const;
-type DatabaseFilterScopeId = (typeof DatabaseFilterScopeIdList)[number];
export const CommonFilterScopeIdList = ["environment", "instance"] as const;
type CommonFilterScopeId = (typeof CommonFilterScopeIdList)[number];
@@ -35,7 +33,6 @@ export const SearchScopeIdList = [
export type SearchScopeId =
| (typeof SearchScopeIdList)[number]
| UIIssueFilterScopeId
- | DatabaseFilterScopeId
| CommonFilterScopeId;
export type SearchScope = {
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index b8b1c7b2a5..526a52018b 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -118,7 +118,7 @@ const databaseV1Store = useDatabaseV1Store();
const scopeOptions = useCommonSearchScopeOptions(
computed(() => state.params),
- [...CommonFilterScopeIdList, "project", "project-assigned"]
+ [...CommonFilterScopeIdList, "project"]
);
const selectedInstance = computed(() => {
@@ -135,13 +135,6 @@ const selectedEnvironment = computed(() => {
);
});
-const selectedProjectAssigned = computed(() => {
- return (
- state.params.scopes.find((scope) => scope.id === "project-assigned")
- ?.value ?? `${UNKNOWN_ID}`
- );
-});
-
const selectedProject = computed(() => {
return (
state.params.scopes.find((scope) => scope.id === "project")?.value ??
@@ -176,15 +169,6 @@ const filteredDatabaseList = computed(() => {
selectedEnvironment.value
);
}
- if (selectedProjectAssigned.value !== `${UNKNOWN_ID}`) {
- list = list.filter((db) => {
- if (selectedProjectAssigned.value == "yes") {
- return db.project !== DEFAULT_PROJECT_NAME;
- } else {
- return db.project === DEFAULT_PROJECT_NAME;
- }
- });
- }
if (selectedInstance.value !== `${UNKNOWN_ID}`) {
list = list.filter(
(db) =>