Skip to content

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

chore: optimize advanced search (#16630)

ecmadaoaf8212dbc03e
diff --git a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue b/frontend/src/components/AdvancedSearch/AdvancedSearch.vue
index e27be1aca7..5d1acd8428 100644
--- a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue
+++ b/frontend/src/components/AdvancedSearch/AdvancedSearch.vue
@@ -64,12 +64,14 @@
@hover-item="menuIndex = $event"
/>
<ValueMenu
- v-if="visibleValueOptions.length > 0 || currentScopeOption?.search"
:show="state.menuView === 'value'"
:scope-option="currentScopeOption"
:value-options="visibleValueOptions"
:menu-index="menuIndex"
:fetch-state="currentFetchState"
+ :show-empty-placeholder="
+ (currentScopeOption?.options ?? []).length > 0
+ "
@select-value="selectValue"
@hover-item="menuIndex = $event"
@fetch-next-page="() => handleSearch(currentValueForScope)"
@@ -113,11 +115,13 @@ const props = withDefaults(
scopeOptions?: ScopeOption[];
placeholder?: string | undefined;
autofocus?: boolean;
+ overrideRouteQuery?: boolean;
}>(),
{
scopeOptions: () => [],
autofocus: false,
placeholder: undefined,
+ overrideRouteQuery: true,
}
);
@@ -481,7 +485,7 @@ const maybeDeselectMismatchedScope = () => {
};
const maybeEmitIncompleteValue = () => {
- if (inputText.value !== `${state.currentScope}:`) {
+ if (!inputText.value.startsWith(`${state.currentScope}:`)) {
const updated = cloneDeep(props.params);
updated.query = inputText.value;
updateParams(updated);
@@ -490,7 +494,7 @@ const maybeEmitIncompleteValue = () => {
const updateParams = useDebounceFn((params: SearchParams) => {
emit("update:params", params);
-}, DEBOUNCE_SEARCH_DELAY * 2);
+}, DEBOUNCE_SEARCH_DELAY);
const handleInputClick = () => {
maybeSelectMatchedScope();
@@ -675,13 +679,17 @@ watch(visibleValueOptions, (newOptions, oldOptions) => {
watch(
() => props.params,
(params) => {
- inputText.value = params.query || inputText.value;
- router.replace({
- query: {
- ...route.query,
- qs: buildSearchTextBySearchParams(params),
- },
- });
+ if (!inputText.value) {
+ inputText.value = params.query;
+ }
+ if (props.overrideRouteQuery) {
+ router.replace({
+ query: {
+ ...route.query,
+ qs: buildSearchTextBySearchParams(params),
+ },
+ });
+ }
},
{ deep: true }
);
diff --git a/frontend/src/components/AdvancedSearch/ValueMenu.vue b/frontend/src/components/AdvancedSearch/ValueMenu.vue
index f1b9ee5bd7..8d328a13fd 100644
--- a/frontend/src/components/AdvancedSearch/ValueMenu.vue
+++ b/frontend/src/components/AdvancedSearch/ValueMenu.vue
@@ -17,6 +17,7 @@
<div v-if="scopeOption.search" class="textinfolabel">
{{ $t("issue.advanced-search.search") }}
</div>
+ <div v-else class="textinfolabel">{{ scopeOption.description }}</div>
</div>
<div v-if="valueOptions.length > 0">
<NVirtualList
@@ -74,7 +75,7 @@
</template>
</NVirtualList>
</div>
- <div v-if="valueOptions.length === 0" class="pb-2">
+ <div v-else-if="showEmptyPlaceholder" class="pb-2">
<NEmpty />
</div>
</div>
@@ -95,6 +96,7 @@ const props = defineProps<{
scopeOption?: ScopeOption;
valueOptions: ValueOption[];
menuIndex: number;
+ showEmptyPlaceholder?: boolean;
fetchState?: {
loading: boolean;
nextPageToken?: string;
diff --git a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue b/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
index 26703aab69..43503333e4 100644
--- a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
+++ b/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
@@ -11,6 +11,7 @@
:autofocus="false"
:placeholder="$t('database.filter-database')"
:scope-options="scopeOptions"
+ :override-route-query="false"
/>
<PagedDatabaseTable
mode="PROJECT_SHORT"
diff --git a/frontend/src/components/Rollout/RolloutDetail/Panels/TaskAdvancedSearch/TaskAdvancedSearch.vue b/frontend/src/components/Rollout/RolloutDetail/Panels/TaskAdvancedSearch/TaskAdvancedSearch.vue
index 011896040e..8d2dc24f9d 100644
--- a/frontend/src/components/Rollout/RolloutDetail/Panels/TaskAdvancedSearch/TaskAdvancedSearch.vue
+++ b/frontend/src/components/Rollout/RolloutDetail/Panels/TaskAdvancedSearch/TaskAdvancedSearch.vue
@@ -3,6 +3,7 @@
class="flex-1"
:params="params"
:scope-options="scopeOptions"
+ :override-route-query="false"
@update:params="$emit('update:params', $event)"
/>
</template>
@@ -13,11 +14,11 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n";
import AdvancedSearch from "@/components/AdvancedSearch";
import type { ScopeOption } from "@/components/AdvancedSearch/types";
+import { formatEnvironmentName } from "@/types";
import { Task_Status } from "@/types/proto/v1/rollout_service";
import { type SearchParams } from "@/utils";
import { useRolloutDetailContext } from "../../context";
import { databaseForTask } from "../../utils";
-import { formatEnvironmentName } from "@/types";
defineProps<{
params: SearchParams;
diff --git a/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue b/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue
index 8adda37a15..b1885b1073 100644
--- a/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue
+++ b/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue
@@ -17,6 +17,7 @@
:autofocus="false"
:placeholder="$t('database.filter-database')"
:scope-options="scopeOptions"
+ :override-route-query="false"
/>
<PagedDatabaseTable