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: unify debounce delay value (#16103)
boojack46ecb5b3450b
diff --git a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue b/frontend/src/components/AdvancedSearch/AdvancedSearch.vueindex e517e0ecb6..2496786982 100644--- a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue+++ b/frontend/src/components/AdvancedSearch/AdvancedSearch.vue@@ -91,6 +91,7 @@ import scrollIntoView from "scroll-into-view-if-needed";import { zindexable as vZindexable } from "vdirs";import { reactive, watch, onMounted, ref, computed, nextTick } from "vue";import { useRoute, useRouter } from "vue-router";+import { DEBOUNCE_SEARCH_DELAY } from "@/types";import type { SearchParams, SearchScopeId } from "@/utils";import {emptySearchParams,@@ -253,7 +254,7 @@ const handleSearch = useDebounceFn(async (search: string) => {fetchState.loading = false;state.fetchDataStateMap.set(currentScopeOption.value.id, fetchState);}-});+}, DEBOUNCE_SEARCH_DELAY);watch([() => currentScopeOption.value, () => currentValueForScope.value],diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vueindex fab4929aaf..3e4047fea4 100644--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue@@ -70,7 +70,7 @@ import { DatabaseV1Name, InstanceV1Name } from "@/components/v2";import type { ConditionGroupExpr } from "@/plugins/cel";import { validateSimpleExpr } from "@/plugins/cel";import { useDatabaseV1Store, useDBGroupStore } from "@/store";-import { isValidDatabaseName } from "@/types";+import { DEBOUNCE_SEARCH_DELAY, isValidDatabaseName } from "@/types";interface DatabaseMatchList {index: number;@@ -188,7 +188,7 @@ const updateDatabaseMatchingState = useDebounceFn(async () => {} finally {state.loading = false;}-}, 500);+}, DEBOUNCE_SEARCH_DELAY);watch([() => props.project, () => props.expr],diff --git a/frontend/src/components/ExprEditor/components/MultiSelect.vue b/frontend/src/components/ExprEditor/components/MultiSelect.vueindex 3aa12188a1..ab545454b3 100644--- a/frontend/src/components/ExprEditor/components/MultiSelect.vue+++ b/frontend/src/components/ExprEditor/components/MultiSelect.vue@@ -32,6 +32,7 @@ import { NCheckbox, NSelect } from "naive-ui";import type { SelectOption } from "naive-ui";import { toRef, watch, reactive, computed, watchEffect } from "vue";import { type ConditionExpr } from "@/plugins/cel";+import { DEBOUNCE_SEARCH_DELAY } from "@/types";import { useExprEditorContext } from "../context";import { useSelectOptionConfig } from "./common";@@ -113,7 +114,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);watch(() => factor.value,diff --git a/frontend/src/components/ExprEditor/components/SingleSelect.vue b/frontend/src/components/ExprEditor/components/SingleSelect.vueindex 522e0617bd..c1260790b4 100644--- a/frontend/src/components/ExprEditor/components/SingleSelect.vue+++ b/frontend/src/components/ExprEditor/components/SingleSelect.vue@@ -21,6 +21,7 @@ import { NSelect } from "naive-ui";import type { SelectOption } from "naive-ui";import { toRef, watch, reactive } from "vue";import { type ConditionExpr } from "@/plugins/cel";+import { DEBOUNCE_SEARCH_DELAY } from "@/types";import { useExprEditorContext } from "../context";import { useSelectOptionConfig } from "./common";@@ -74,7 +75,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);watch(() => factor.value,diff --git a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vueindex d3a3ebe37b..c673637d2e 100644--- a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue+++ b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue@@ -44,7 +44,7 @@ import {instanceNamePrefix,environmentNamePrefix,} from "@/store/modules/v1/common";-import type { ComposedDatabase, DatabaseResource } from "@/types";+import { DEBOUNCE_SEARCH_DELAY, type ComposedDatabase, type DatabaseResource } from "@/types";import { engineFromJSON } from "@/types/proto/v1/common";import {getDefaultPagination,@@ -215,7 +215,7 @@ const fetchDatabaseList = useDebounceFn(async () => {} finally {fetchDataState.value.loading = false;}-}, 500);+}, DEBOUNCE_SEARCH_DELAY);watch(() => databaseFilter.value,diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vueindex 3cc693e58d..71b14500c2 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue@@ -43,7 +43,7 @@ import { computed, h, nextTick, ref, reactive, watch } from "vue";import { updateIssueSubscribers, useIssueContext } from "@/components/IssueV1";import UserAvatar from "@/components/User/UserAvatar.vue";import { useUserStore } from "@/store";-import { unknownUser } from "@/types";+import { DEBOUNCE_SEARCH_DELAY, unknownUser } from "@/types";import { State } from "@/types/proto/v1/common";import { type User } from "@/types/proto/v1/user_service";import { UserType } from "@/types/proto/v1/user_service";@@ -184,7 +184,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-});+}, DEBOUNCE_SEARCH_DELAY);watch(() => keyword.value, handleSearch, { immediate: true });</script>diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vueindex 7475a71213..6d9bd08c94 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue@@ -66,6 +66,7 @@ import { computed, ref, reactive, watch } from "vue";import { BBSpin } from "@/bbkit";import { useVerticalScrollState } from "@/composables/useScrollState";import { batchGetOrFetchDatabases } from "@/store";+import { DEBOUNCE_SEARCH_DELAY } from "@/types";import type { Task_Status } from "@/types/proto/v1/rollout_service";import type { Advice_Status } from "@/types/proto/v1/sql_service";import { isDev } from "@/utils";@@ -180,7 +181,7 @@ const loadMore = useDebounceFn(async () => {initialized: true,});}-}, 500);+}, DEBOUNCE_SEARCH_DELAY);const loadNextPage = async () => {if (stageState.value.isRequesting) {diff --git a/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue b/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vueindex 5e21118b10..a07e81960c 100644--- a/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue+++ b/frontend/src/components/Plan/components/SpecListSection/SpecListSection.vue@@ -60,6 +60,7 @@ import { computed, reactive, ref, watch } from "vue";import { BBSpin } from "@/bbkit";import { useVerticalScrollState } from "@/composables/useScrollState";import { batchGetOrFetchDatabases, useDBGroupStore } from "@/store";+import { DEBOUNCE_SEARCH_DELAY } from "@/types";import type { Advice_Status } from "@/types/proto/v1/sql_service";import { isDev } from "@/utils";import {@@ -167,7 +168,7 @@ const loadMore = useDebounceFn(async () => {state.isRequesting = false;}}-}, 500);+}, DEBOUNCE_SEARCH_DELAY);watch(() => plan.value.name,diff --git a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vueindex db9a2e081e..d8ce6f91ac 100644--- a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue+++ b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue@@ -75,7 +75,11 @@ import { useRecentVisit } from "@/router/useRecentVisit";import { useProjectV1Store } from "@/store";import { getProjectName } from "@/store/modules/v1/common";import type { ComposedProject } from "@/types";-import { isValidProjectName, DEFAULT_PROJECT_NAME } from "@/types";+import {+ isValidProjectName,+ DEFAULT_PROJECT_NAME,+ DEBOUNCE_SEARCH_DELAY,+} from "@/types";import {filterProjectV1ListByKeyword,hasWorkspacePermissionV2,@@ -158,7 +162,7 @@ watch(} finally {state.loading = false;}- }, 500),+ }, DEBOUNCE_SEARCH_DELAY),{ immediate: true });diff --git a/frontend/src/components/v2/Select/DatabaseSelect.vue b/frontend/src/components/v2/Select/DatabaseSelect.vueindex 66866e23e8..edb93cfa97 100644--- a/frontend/src/components/v2/Select/DatabaseSelect.vue+++ b/frontend/src/components/v2/Select/DatabaseSelect.vue@@ -23,7 +23,11 @@ import { useI18n } from "vue-i18n";import { useDatabaseV1Store } from "@/store";import { workspaceNamePrefix } from "@/store/modules/v1/common";import type { ComposedDatabase } from "@/types";-import { isValidDatabaseName, unknownDatabase } from "@/types";+import {+ DEBOUNCE_SEARCH_DELAY,+ isValidDatabaseName,+ unknownDatabase,+} from "@/types";import { type Engine } from "@/types/proto/v1/common";import {instanceV1Name,@@ -127,7 +131,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);watch(() => [props.environmentName, props.allowedEngineTypeList],diff --git a/frontend/src/components/v2/Select/InstanceSelect.vue b/frontend/src/components/v2/Select/InstanceSelect.vueindex e9b5eaf909..242364b1e4 100644--- a/frontend/src/components/v2/Select/InstanceSelect.vue+++ b/frontend/src/components/v2/Select/InstanceSelect.vue@@ -22,6 +22,7 @@ import { computed, h, watch, reactive } from "vue";import { useI18n } from "vue-i18n";import { useInstanceV1Store } from "@/store";import {+ DEBOUNCE_SEARCH_DELAY,UNKNOWN_INSTANCE_NAME,isValidInstanceName,unknownInstance,@@ -106,7 +107,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);watch([diff --git a/frontend/src/components/v2/Select/ProjectSelect.vue b/frontend/src/components/v2/Select/ProjectSelect.vueindex cd98191239..ac927f2d91 100644--- a/frontend/src/components/v2/Select/ProjectSelect.vue+++ b/frontend/src/components/v2/Select/ProjectSelect.vue@@ -35,6 +35,7 @@ import {DEFAULT_PROJECT_NAME,UNKNOWN_PROJECT_NAME,isValidProjectName,+ DEBOUNCE_SEARCH_DELAY,} from "@/types";import type { Project } from "@/types/proto/v1/project_service";import { hasWorkspacePermissionV2, getDefaultPagination } from "@/utils";@@ -166,7 +167,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);onMounted(async () => {await handleSearch("");diff --git a/frontend/src/components/v2/Select/UserSelect.vue b/frontend/src/components/v2/Select/UserSelect.vueindex fdbdb7b9b5..e94809a8a2 100644--- a/frontend/src/components/v2/Select/UserSelect.vue+++ b/frontend/src/components/v2/Select/UserSelect.vue@@ -28,6 +28,7 @@ import UserAvatar from "@/components/User/UserAvatar.vue";import ServiceAccountTag from "@/components/misc/ServiceAccountTag.vue";import { extractUserId, useUserStore, type UserFilter } from "@/store";import {+ DEBOUNCE_SEARCH_DELAY,SYSTEM_BOT_USER_NAME,UNKNOWN_USER_NAME,allUsersUser,@@ -141,7 +142,7 @@ const handleSearch = useDebounceFn(async (search: string) => {} finally {state.loading = false;}-}, 200);+}, DEBOUNCE_SEARCH_DELAY);onMounted(async () => {await handleSearch("");diff --git a/frontend/src/store/modules/sqlEditor/editor.ts b/frontend/src/store/modules/sqlEditor/editor.tsindex 46a10d3f5c..fc0e392b19 100644--- a/frontend/src/store/modules/sqlEditor/editor.ts+++ b/frontend/src/store/modules/sqlEditor/editor.ts@@ -2,7 +2,11 @@ import { useLocalStorage, useDebounceFn } from "@vueuse/core";import { defineStore } from "pinia";import { computed, ref, watch, watchEffect } from "vue";import { useDatabaseV1Store, type DatabaseFilter } from "@/store";-import { type ComposedDatabase, isValidProjectName } from "@/types";+import {+ type ComposedDatabase,+ DEBOUNCE_SEARCH_DELAY,+ isValidProjectName,+} from "@/types";import { QueryOption_RedisRunCommandsOn } from "@/types/proto/v1/sql_service";import { hasWorkspacePermissionV2, getDefaultPagination } from "@/utils";@@ -66,7 +70,7 @@ export const useSQLEditorStore = defineStore("sqlEditor", () => {} finally {fetchDataState.value.loading = false;}- }, 500);+ }, DEBOUNCE_SEARCH_DELAY);const prepareDatabases = async (filter?: DatabaseFilter) => {fetchDataState.value.nextPageToken = "";diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex e2b17a4576..06c245ea3d 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -7,8 +7,8 @@ export const SYSTEM_BOT_ID = 1;// System bot emailexport const SYSTEM_BOT_EMAIL = "[email protected]";-// For text input, we do validation if there is no further keystroke after 1s-export const TEXT_VALIDATION_DELAY = 1000;+// The delay for debouncing search input.+export const DEBOUNCE_SEARCH_DELAY = 300;// Link to inquire enterprise planexport const ENTERPRISE_INQUIRE_LINK =diff --git a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vueindex 484fc83863..29ffc44d83 100644--- a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue+++ b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue@@ -83,7 +83,11 @@ import {useSQLEditorStore,type QueryHistoryFilter,} from "@/store";-import { getDateForPbTimestamp, type SQLEditorTab } from "@/types";+import {+ DEBOUNCE_SEARCH_DELAY,+ getDateForPbTimestamp,+ type SQLEditorTab,+} from "@/types";import type { QueryHistory } from "@/types/proto/v1/sql_service";import { getHighlightHTMLByKeyWords, defer } from "@/utils";@@ -129,7 +133,7 @@ const fetchQueryHistoryListList = useDebounceFn(async () => {} finally {state.loading = false;}-}, 500);+}, DEBOUNCE_SEARCH_DELAY);watch(() => historyQuery.value,diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex 3b27999621..d061ce9b92 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -203,7 +203,11 @@ import {} from "@/store";import { useExportData } from "@/store/modules/export";import type { ComposedDatabase, SQLEditorQueryParams } from "@/types";-import { isValidDatabaseName, isValidInstanceName } from "@/types";+import {+ DEBOUNCE_SEARCH_DELAY,+ isValidDatabaseName,+ isValidInstanceName,+} from "@/types";import { ExportFormat } from "@/types/proto/v1/common";import { Engine } from "@/types/proto/v1/common";import { PolicyType } from "@/types/proto/v1/org_policy_service";@@ -331,7 +335,8 @@ const allowToRequestExportData = computed(() => {// use a debounced value to improve performance when typing rapidlyconst debouncedUpdateKeyword = useDebounceFn((value: string) => {keyword.value = value;-}, 200);+}, DEBOUNCE_SEARCH_DELAY);+const updateKeyword = (value: string) => {state.search = value;debouncedUpdateKeyword(value);