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: deprecate useProjectV1List (#15585)
ecmadao439da8b403e7
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex ccda9205eb..23228131cd 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -138,6 +138,13 @@ func getListProjectFilter(filter string) (*store.ListResourceFilter, error) {return fmt.Sprintf("project.resource_id != $%d", len(positionalArgs)), nil}return "TRUE", nil+ case "state":+ v1State, ok := v1pb.State_value[value.(string)]+ if !ok {+ return "", status.Errorf(codes.InvalidArgument, "invalid state filter %q", value)+ }+ positionalArgs = append(positionalArgs, v1pb.State(v1State) == v1pb.State_DELETED)+ return fmt.Sprintf("project.deleted = $%d", len(positionalArgs)), nildefault:return "", status.Errorf(codes.InvalidArgument, "unsupport variable %q", variable)}diff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.tsindex 3ebcf73428..f88a15b877 100644--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts+++ b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts@@ -1,5 +1,5 @@import type { VNode } from "vue";-import { computed, h, unref } from "vue";+import { computed, h, unref, ref, watchEffect } from "vue";import {InstanceV1Name,ProjectV1Name,@@ -11,9 +11,9 @@ import {useEnvironmentV1List,useEnvironmentV1Store,useInstanceResourceList,- useProjectV1List,+ useProjectV1Store,} from "@/store";-import { type MaybeRef } from "@/types";+import type { MaybeRef, ComposedProject } from "@/types";import { engineToJSON } from "@/types/proto/v1/common";import type { SearchScopeId } from "@/utils";import {@@ -22,15 +22,29 @@ import {extractInstanceResourceName,extractProjectResourceName,supportedEngineV1List,+ getDefaultPagination,} from "@/utils";import type { ScopeOption, ValueOption } from "./types";export const useCommonSearchScopeOptions = (supportOptionIdList: MaybeRef<SearchScopeId[]>) => {+ const projectStore = useProjectV1Store();const environmentStore = useEnvironmentV1Store();const environmentList = useEnvironmentV1List();- const { projectList } = useProjectV1List();+ const projectList = ref<ComposedProject[]>([]);++ watchEffect(async () => {+ try {+ const { projects } = await projectStore.fetchProjectList({+ showDeleted: false,+ pageSize: getDefaultPagination(),+ });+ projectList.value = projects;+ } catch {+ // do nothing+ }+ });const instanceList = computed(() => useInstanceResourceList().value);diff --git a/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue b/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vueindex 6ad4e16de3..f47290936c 100644--- a/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue+++ b/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue@@ -29,11 +29,15 @@ import SystemBotTag from "@/components/misc/SystemBotTag.vue";import YouTag from "@/components/misc/YouTag.vue";import { ProjectV1Name } from "@/components/v2";import { ALL_METHODS_WITH_AUDIT } from "@/grpcweb/methods";-import { useCurrentUserV1, useProjectV1List, useUserStore } from "@/store";-import { SYSTEM_BOT_USER_NAME } from "@/types";+import { useCurrentUserV1, useProjectV1Store, useUserStore } from "@/store";+import { SYSTEM_BOT_USER_NAME, type ComposedProject } from "@/types";import { AuditLog_Severity } from "@/types/proto/v1/audit_log_service";import { State, stateToJSON } from "@/types/proto/v1/common";-import { User, UserType, userTypeToJSON } from "@/types/proto/v1/user_service";+import {+ type User,+ UserType,+ userTypeToJSON,+} from "@/types/proto/v1/user_service";import {getDefaultPagination,extractProjectResourceName,@@ -50,18 +54,26 @@ defineEmits<{const { t } = useI18n();const me = useCurrentUserV1();const userStore = useUserStore();-const { projectList } = useProjectV1List();+const projectStore = useProjectV1Store();const activeUserList = ref<User[]>([]);+const projectList = ref<ComposedProject[]>([]);const showTimeRange = ref(false);onMounted(async () => {- const { users } = await userStore.fetchUserList({- pageSize: getDefaultPagination(),- showDeleted: false,- filter: `state == "${stateToJSON(State.ACTIVE)}" && user_type == "${userTypeToJSON(UserType.USER)}"`,- });- activeUserList.value = users;+ const [listUsersResponse, listProjectsResponse] = await Promise.all([+ userStore.fetchUserList({+ pageSize: getDefaultPagination(),+ showDeleted: false,+ filter: `state == "${stateToJSON(State.ACTIVE)}" && user_type == "${userTypeToJSON(UserType.USER)}"`,+ }),+ projectStore.fetchProjectList({+ showDeleted: false,+ pageSize: getDefaultPagination(),+ }),+ ]);+ activeUserList.value = listUsersResponse.users;+ projectList.value = listProjectsResponse.projects;});const principalSearchValueOptions = computed(() => {diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vueindex 066b82be38..43998ac535 100644--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue@@ -2,7 +2,7 @@<BBGridclass="border w-full":column-list="COLUMN_LIST"- :data-source="filteredApprovalRuleList"+ :data-source="store.config.rules":row-clickable="false":show-placeholder="true"row-key="uid"@@ -11,10 +11,7 @@<template #item="{ item: rule }: { item: LocalApprovalRule }"><div class="bb-grid-cell whitespace-nowrap">{{ rule.template?.title }}- <SystemLabel- v-if="creatorOfRule(rule).name === SYSTEM_BOT_USER_NAME"- class="ml-1"- />+ <SystemLabel v-if="isReadonlyApprovalRule(rule)" class="ml-1" /></div><div class="bb-grid-cell justify-center"><NButton@@ -31,7 +28,7 @@{{ rule.template?.description }}</div><div class="bb-grid-cell gap-x-2">- <template v-if="creatorOfRule(rule).name !== SYSTEM_BOT_USER_NAME">+ <template v-if="!isReadonlyApprovalRule(rule)"><NButton size="small" @click="editApprovalTemplate(rule)">{{ allowAdmin ? $t("common.edit") : $t("common.view") }}</NButton>@@ -67,9 +64,8 @@ import { BBGrid, BBModal, type BBGridColumn } from "@/bbkit";import SystemLabel from "@/components/SystemLabel.vue";import { pushNotification, useWorkspaceApprovalSettingStore } from "@/store";import type { LocalApprovalRule } from "@/types";-import { SYSTEM_BOT_USER_NAME } from "@/types";import type { ApprovalFlow } from "@/types/proto/store/approval";-import { creatorOfRule } from "@/utils";+import { isReadonlyApprovalRule } from "@/utils";import { SpinnerButton } from "../../common";import { StepsTable } from "../common";import { useCustomApprovalContext } from "../context";@@ -104,15 +100,6 @@ const COLUMN_LIST = computed(() => {return columns;});-const filteredApprovalRuleList = computed(() => {- // const { searchText } = approvalConfigContext.value;- const list = [...store.config.rules];- // if (searchText) {- // list = list.filter((ap) => ap.template?.title.includes(searchText));- // }- return list;-});-const editApprovalTemplate = (rule: LocalApprovalRule) => {if (!hasFeature.value) {showFeatureModal.value = true;diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleDialog.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleDialog.vueindex 8c4a08eccf..5db30b427a 100644--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleDialog.vue+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleDialog.vue@@ -29,8 +29,7 @@ import { useI18n } from "vue-i18n";import { BBModal, BBSpin } from "@/bbkit";import { pushNotification, useWorkspaceApprovalSettingStore } from "@/store";import type { LocalApprovalRule } from "@/types";-import { SYSTEM_BOT_USER_NAME } from "@/types";-import { creatorOfRule, defer } from "@/utils";+import { isReadonlyApprovalRule, defer } from "@/utils";import { useCustomApprovalContext } from "../context";import RuleForm from "./RuleForm.vue";@@ -53,7 +52,7 @@ const allowEditRule = computed(() => {if (!allowAdmin.value) return false;const rule = dialog.value?.rule;if (!rule) return false;- return creatorOfRule(rule).name !== SYSTEM_BOT_USER_NAME;+ return !isReadonlyApprovalRule(rule);});const title = computed(() => {diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleForm.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleForm.vueindex 813caa3a5e..9581f24bd3 100644--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleForm.vue+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RuleDialog/RuleForm.vue@@ -73,8 +73,7 @@ import { cloneDeep } from "lodash-es";import { NButton, NInput } from "naive-ui";import { computed, nextTick, onMounted, ref } from "vue";import type { LocalApprovalRule } from "@/types";-import { SYSTEM_BOT_USER_NAME } from "@/types";-import { creatorOfRule } from "@/utils";+import { isReadonlyApprovalRule } from "@/utils";import { RequiredStar } from "../../common";import { StepsTable } from "../common";import { useCustomApprovalContext } from "../context";@@ -115,7 +114,7 @@ const state = ref(resolveLocalState());const allowEditRule = computed(() => {if (!allowAdmin.value) return false;- return creatorOfRule(rule.value).name !== SYSTEM_BOT_USER_NAME;+ return !isReadonlyApprovalRule(rule.value);});const allowCreateOrUpdate = computed(() => {diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vueindex 86bf6acb96..42b5834e71 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue@@ -1,19 +1,16 @@<template><NPopselect- :remote="true":loading="state.loading":multiple="true":value="issue.subscribers":options="options":render-label="renderLabel":scrollable="true"- :filterable="true"trigger="click"placement="left":disabled="readonly"- @search="handleSearch"+ :node-props="nodeProps"@update:show="onUpdateShow"- @update:value="onUpdateSubscribers"><NButton quaternary><div class="flex items-center gap-x-1">@@ -28,7 +25,7 @@</div></NButton>- <template v-if="false" #action>+ <template #action><NInputref="filterInputRef"v-model:value="keyword"@@ -42,7 +39,7 @@import { useDebounceFn } from "@vueuse/core";import type { SelectOption, SelectGroupOption } from "naive-ui";import { NButton, NPopselect, NInput } from "naive-ui";-import { computed, h, nextTick, ref, onMounted, reactive } from "vue";+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";@@ -68,7 +65,7 @@ interface LocalState {}const state = reactive<LocalState>({- loading: false,+ loading: true,rawUserList: [],});@@ -83,6 +80,22 @@ const subscriberList = computed(() => {});});+const nodeProps = (option: SelectOption | SelectGroupOption) => {+ return {+ onClick(_: MouseEvent) {+ if (option.disabled || !option.value) return;+ const value = option.value as string;+ const subscribers = new Set(issue.value.subscribers);+ if (subscribers.has(value)) {+ subscribers.delete(value);+ } else {+ subscribers.add(value);+ }+ onUpdateSubscribers([...subscribers]);+ },+ };+};+const options = computed(() => {const subscribers = new Set(issue.value.subscribers);const options = state.rawUserList@@ -142,7 +155,7 @@ const renderLabel = (option: SelectOption | SelectGroupOption) => {const onUpdateSubscribers = async (subscribers: string[]) => {try {await updateIssueSubscribers(issue.value, subscribers);- keyword.value = "";+ nextTick(() => (keyword.value = ""));} finally {// Nothing}@@ -156,8 +169,6 @@ const onUpdateShow = (show: boolean) => {}};-// TODO(ed): I found the NPopselect NOT support search.-// We need to use the NSelector instead.const handleSearch = useDebounceFn(async (search: string) => {const filter = [`state == "${stateToJSON(State.ACTIVE)}"`,@@ -181,7 +192,5 @@ const handleSearch = useDebounceFn(async (search: string) => {}});-onMounted(async () => {- await handleSearch("");-});+watch(() => keyword.value, handleSearch, { immediate: true });</script>diff --git a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.tsindex 9c36b10cc1..5d477ebb06 100644--- a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts+++ b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts@@ -11,7 +11,7 @@ import { RichDatabaseName } from "@/components/v2";import {useCurrentUserV1,useDatabaseV1Store,- useProjectV1List,+ useProjectV1Store,} from "@/store";import {SYSTEM_BOT_USER_NAME,@@ -19,7 +19,7 @@ import {isValidProjectName,type ComposedDatabase,} from "@/types";-import { Label } from "@/types/proto/v1/project_service";+import { type Label } from "@/types/proto/v1/project_service";import { User } from "@/types/proto/v1/user_service";import type { SearchParams, SearchScopeId } from "@/utils";import {@@ -44,25 +44,6 @@ export type ValueOption = {render: RenderFunction;};-const useProjectLabels = (params: Ref<SearchParams>) => {- const { projectList } = useProjectV1List();- const projectName = params.value.scopes.find(- (scope) => scope.id === "project"- )?.value;-- const labels = new Map<string, Label>();- for (const project of projectList.value) {- if (projectName && project.name !== `projects/${projectName}`) {- continue;- }- for (const label of project.issueLabels) {- const key = `${label.value}-${label.color}`;- labels.set(key, label);- }- }- return [...labels.values()];-};-export const useIssueSearchScopeOptions = (params: Ref<SearchParams>,supportOptionIdList: Ref<SearchScopeId[]>,@@ -72,8 +53,9 @@ export const useIssueSearchScopeOptions = (const route = useRoute();const me = useCurrentUserV1();const databaseV1Store = useDatabaseV1Store();+ const projectStore = useProjectV1Store();- const project = computed(() => {+ const projectName = computed(() => {const { projectId } = route?.params ?? {};if (projectId && typeof projectId === "string") {return `projects/${projectId}`;@@ -88,14 +70,30 @@ export const useIssueSearchScopeOptions = (});const databaseList = ref<ComposedDatabase[]>([]);+ const projectLabels = ref<Label[]>([]);++ watchEffect(async () => {+ if (!isValidProjectName(projectName.value)) {+ return;+ }+ const project = await projectStore.getOrFetchProjectByName(+ projectName.value!+ );+ const labels = new Map<string, Label>();+ for (const label of project.issueLabels) {+ const key = `${label.value}-${label.color}`;+ labels.set(key, label);+ }+ projectLabels.value = [...labels.values()];+ });watchEffect(async () => {- if (!isValidProjectName(project.value)) {+ if (!isValidProjectName(projectName.value)) {return;}const { databases } = await databaseV1Store.fetchDatabases({pageSize: getDefaultPagination(),- parent: project.value!,+ parent: projectName.value!,});databaseList.value = databases;});@@ -243,7 +241,7 @@ export const useIssueSearchScopeOptions = (id: "label",title: t("issue.advanced-search.scope.label.title"),description: t("issue.advanced-search.scope.label.description"),- options: useProjectLabels(params).map((label) => {+ options: projectLabels.value.map((label) => {return {value: label.value,keywords: [label.value],diff --git a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vueindex 7e7333081e..c4eb813e04 100644--- a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue+++ b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue@@ -17,7 +17,7 @@<div class="flex flex-row justify-end items-center gap-x-2"><SearchBoxv-model:value="state.searchText"- :placeholder="$t('common.filter-by-name')"+ :placeholder="$t('common.search-by-name')":autofocus="false"class="!w-40"size="small"@@ -72,7 +72,7 @@ import { SearchBox, ProjectV1Table } from "@/components/v2";import { PROJECT_V1_ROUTE_DETAIL } from "@/router/dashboard/projectV1";import { WORKSPACE_ROUTE_LANDING } from "@/router/dashboard/workspaceRoutes";import { useRecentVisit } from "@/router/useRecentVisit";-import { useProjectV1List, useProjectV1Store } from "@/store";+import { useProjectV1Store } from "@/store";import { getProjectName } from "@/store/modules/v1/common";import type { ComposedProject } from "@/types";import { isValidProjectName, DEFAULT_PROJECT_NAME } from "@/types";@@ -104,21 +104,10 @@ const state = reactive<LocalState>({allProjects: [],});const projectStore = useProjectV1Store();-const { projectList, ready } = useProjectV1List();const { recentViewProjects } = useRecentProjects();const router = useRouter();const { record } = useRecentVisit();-watch(- () => ready.value,- () => {- if (ready.value) {- state.allProjects = [...projectList.value];- }- },- { immediate: true }-);-const params = computed(() => {const route = router.currentRoute.value;return {@@ -156,10 +145,6 @@ const allowToCreateProject = computed(() =>watch(() => state.searchText,useDebounceFn(async () => {- if (!state.searchText) {- state.allProjects = [...projectList.value];- return;- }state.loading = true;try {const { projects } = await projectStore.fetchProjectList({@@ -170,7 +155,8 @@ watch(} finally {state.loading = false;}- }, 500)+ }, 500),+ { immediate: true });const tabList = computed(diff --git a/frontend/src/components/ProvideDashboardContext.vue b/frontend/src/components/ProvideDashboardContext.vueindex 40607e27ae..76cbe00e2a 100644--- a/frontend/src/components/ProvideDashboardContext.vue+++ b/frontend/src/components/ProvideDashboardContext.vue@@ -1,20 +1,12 @@<template><slot v-if="!isInitializing" /><MaskSpinner v-else class="!bg-white" />-- <div- v-if="!isInitializing && isSwitchingProject"- class="fixed inset-0 z-[1000000] bg-white/50 flex flex-col items-center justify-center"- >- <NSpin />- </div></template><script lang="ts" setup>-import { NSpin } from "naive-ui";import { ref, onMounted } from "vue";import { onUnmounted } from "vue";-import { useRoute, useRouter } from "vue-router";+import { useRouter } from "vue-router";import {AUTH_MFA_MODULE,AUTH_PASSWORD_FORGOT_MODULE,@@ -23,7 +15,6 @@ import {AUTH_SIGNIN_MODULE,AUTH_SIGNUP_MODULE,} from "@/router/auth";-import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";import {useEnvironmentV1Store,usePolicyV1Store,@@ -32,26 +23,15 @@ import {useUserStore,useUIStateStore,useGroupStore,- useProjectV1List,} from "@/store";import { PolicyResourceType } from "@/types/proto/v1/org_policy_service";-import { wrapRefAsPromise } from "@/utils";import MaskSpinner from "./misc/MaskSpinner.vue";-const route = useRoute();const router = useRouter();const isInitializing = ref<boolean>(true);-const isSwitchingProject = ref(false);const policyStore = usePolicyV1Store();-const prepareProjects = async () => {- const routeName = route.name?.toString() || "";- if (!routeName.startsWith(`${PROJECT_V1_ROUTE_DASHBOARD}.`)) {- await wrapRefAsPromise(useProjectV1List().ready, true);- }-};-let unregisterBeforeEachHook: (() => void) | undefined;onMounted(async () => {await router.isReady();@@ -70,7 +50,6 @@ onMounted(async () => {useUserStore().refreshUserStat(),useGroupStore().fetchGroupList(),useEnvironmentV1Store().fetchEnvironments(),- prepareProjects(),]);useUIStateStore().restoreState();@@ -96,13 +75,6 @@ onMounted(async () => {console.debug(`[ProvideDashboardContext] project switched ${fromProject} -> ${toProject}`);- isSwitchingProject.value = true;- if (toProject === undefined) {- // Prepare projects if the project is not specified.- // This is useful when the user navigates to the workspace dashboard from project detail.- await wrapRefAsPromise(useProjectV1List().ready, true);- }- isSwitchingProject.value = false;next();return;}diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vueindex a54980210b..700595d647 100644--- a/frontend/src/components/ProvideSQLEditorContext.vue+++ b/frontend/src/components/ProvideSQLEditorContext.vue@@ -46,7 +46,6 @@ import {useGroupStore,pushNotification,useAppFeature,- useProjectV1List,} from "@/store";import type { SQLEditorConnection } from "@/types";import {@@ -69,7 +68,7 @@ import {worksheetNameFromSlug,extractWorksheetUID,extractInstanceResourceName,- wrapRefAsPromise,+ getDefaultPagination,} from "@/utils";import {extractWorksheetConnection,@@ -99,16 +98,12 @@ const {const hideProjects = useAppFeature("bb.feature.sql-editor.hide-projects");const fallbackToFirstProject = async () => {- const { projectList, ready } = useProjectV1List();- await wrapRefAsPromise(ready, true);- const projectListWithoutDefaultProject = projectList.value.filter(- (proj) => proj.name !== DEFAULT_PROJECT_NAME- );- return (- head(projectListWithoutDefaultProject)?.name ??- head(projectList.value)?.name ??- ""- );+ const { projects } = await projectStore.fetchProjectList({+ showDeleted: false,+ pageSize: getDefaultPagination(),+ excludeDefault: true,+ });+ return head(projects)?.name ?? DEFAULT_PROJECT_NAME;};const initializeProjects = async () => {@@ -179,8 +174,6 @@ const handleProjectSwitched = async () => {const { project } = editorStore;if (project) {await projectStore.getOrFetchProjectByName(project, true /* silent */);- } else {- await wrapRefAsPromise(useProjectV1List().ready, true);}tabStore.maybeInitProject(project);};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex ae3499ba91..8717dd6f51 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -195,6 +195,7 @@"info": "Info","minutes": "Minutes","filter-by-name": "Filter by name",+ "search-by-name": "Search by name","license": "License","view-details": "View details","force-verb": "Force {verb}",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 5c92768d24..e4a5e68c8d 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -195,6 +195,7 @@"info": "Información","minutes": "Minutos","filter-by-name": "Filtrar por nombre",+ "search-by-name": "Buscar por nombre","license": "Licencia","view-details": "Ver detalles","force-verb": "forzar {verbo}",@@ -1237,8 +1238,8 @@},"no-params-yet-add-above": "No hay parámetros configurados todavía. \nAgregue parámetros usando el formulario anterior.","no-extra-params-configured": "No hay parámetros de conexión adicionales configurados",- "parameter-value-placeholder": "Valor de parámetro",- "parameter-name-placeholder": "Nombre de parámetro"+ "parameter-name-placeholder": "Nombre de parámetro",+ "parameter-value-placeholder": "Valor de parámetro"},"environment": {"select": "Seleccionar entorno",@@ -2589,4 +2590,4 @@"last-visit": "Última visita","changelog-for-version": "Registro de cambios para {version}"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 0dfbf155aa..714c796a1e 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -195,6 +195,7 @@"info": "情報","minutes": "分","filter-by-name": "名前でフィルタリングする",+ "search-by-name": "名前で検索","license": "ライセンス","view-details": "詳細を確認する","force-verb": "フォース{verb}",@@ -1237,8 +1238,8 @@},"no-params-yet-add-above": "まだ構成されていません。\n上記のフォームを使用してパラメーターを追加します。","no-extra-params-configured": "追加の接続パラメーターは構成されていません",- "parameter-value-placeholder": "パラメーター値",- "parameter-name-placeholder": "パラメーター名"+ "parameter-name-placeholder": "パラメーター名",+ "parameter-value-placeholder": "パラメーター値"},"environment": {"select": "環境を選ぶ",@@ -2589,4 +2590,4 @@"last-visit": "最終訪問","changelog-for-version": "{version} の変更履歴"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 9bc15dc08a..e4ad2a67bd 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -195,6 +195,7 @@"info": "Thông tin","minutes": "Phút","filter-by-name": "Lọc theo tên",+ "search-by-name": "Tìm kiếm theo tên","license": "Giấy phép","view-details": "Xem chi tiết","force-verb": "Buộc {verb}",@@ -1237,8 +1238,8 @@},"no-params-yet-add-above": "Chưa có thông số nào được cấu hình. \nThêm tham số bằng cách sử dụng biểu mẫu trên.","no-extra-params-configured": "Không có thông số kết nối bổ sung được cấu hình",- "parameter-value-placeholder": "Giá trị tham số",- "parameter-name-placeholder": "Tên tham số"+ "parameter-name-placeholder": "Tên tham số",+ "parameter-value-placeholder": "Giá trị tham số"},"environment": {"select": "Chọn môi trường",@@ -2589,4 +2590,4 @@"last-visit": "Lần truy cập cuối","changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 2522bb0197..59f4895ede 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -195,6 +195,7 @@"info": "信息","minutes": "分钟","filter-by-name": "按名称过滤",+ "search-by-name": "按名称搜索","license": "证书","view-details": "查看详情","force-verb": "强制{verb}",@@ -1237,8 +1238,8 @@},"no-params-yet-add-above": "尚未配置参数。\n使用上面的形式添加参数。","no-extra-params-configured": "没有配置的额外连接参数",- "parameter-value-placeholder": "参数值",- "parameter-name-placeholder": "参数名称"+ "parameter-name-placeholder": "参数名称",+ "parameter-value-placeholder": "参数值"},"environment": {"select": "选择环境",@@ -2589,4 +2590,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}+}\ No newline at end of filediff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex ac0a5e807c..dc6f9d7859 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -12,13 +12,12 @@ import {DEFAULT_PROJECT_NAME,isValidProjectName,} from "@/types";-import { State } from "@/types/proto/v1/common";+import { State, stateToJSON } from "@/types/proto/v1/common";import type {Project,ListProjectsResponse,} from "@/types/proto/v1/project_service";import { hasWorkspacePermissionV2 } from "@/utils";-import { useListCache } from "./cache";import { useProjectIamPolicyStore } from "./projectIamPolicy";export const useProjectV1Store = defineStore("project_v1", () => {@@ -72,6 +71,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {const getListProjectFilter = (params: {query?: string;excludeDefault?: boolean;+ state?: State;}) => {const list = [];if (params.query) {@@ -82,6 +82,9 @@ export const useProjectV1Store = defineStore("project_v1", () => {if (params.excludeDefault) {list.push("exclude_default == true");}+ if (params.state === State.DELETED) {+ list.push(`state == "${stateToJSON(params.state)}"`);+ }return list.join(" && ");};@@ -92,6 +95,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {query?: string;silent?: boolean;excludeDefault?: boolean;+ state?: State;}): Promise<{projects: ComposedProject[];nextPageToken?: string;@@ -175,45 +179,6 @@ export const useProjectV1Store = defineStore("project_v1", () => {};});-// TODO(ed): deprecate it.-export const useProjectV1List = (showDeleted: boolean = false) => {- const listCache = useListCache("project");- const store = useProjectV1Store();- const cacheKey = listCache.getCacheKey(showDeleted ? "" : "active");-- const cache = computed(() => listCache.getCache(cacheKey));-- watchEffect(async () => {- // Skip if request is already in progress or cache is available.- if (cache.value?.isFetching || cache.value) {- return;- }-- listCache.cacheMap.set(cacheKey, {- timestamp: Date.now(),- isFetching: true,- });- const { projects } = await store.fetchProjectList({- showDeleted,- pageSize: 100,- });- await store.upsertProjectMap(projects);- listCache.cacheMap.set(cacheKey, {- timestamp: Date.now(),- isFetching: false,- });- });-- const projectList = computed(() => {- return store.getProjectList(showDeleted);- });-- return {- projectList,- ready: computed(() => cache.value && !cache.value.isFetching),- };-};-export const useProjectByName = (name: MaybeRef<string>) => {const store = useProjectV1Store();const ready = ref(false);diff --git a/frontend/src/store/modules/workspaceApprovalSetting.ts b/frontend/src/store/modules/workspaceApprovalSetting.tsindex be7450285b..397e501821 100644--- a/frontend/src/store/modules/workspaceApprovalSetting.ts+++ b/frontend/src/store/modules/workspaceApprovalSetting.ts@@ -10,6 +10,7 @@ import {buildWorkspaceApprovalSetting,seedWorkspaceApprovalSetting,} from "@/utils";+import { batchGetOrFetchUsers } from "./user";import { useGracefulRequest } from "./utils";const SETTING_NAME = "settings/bb.workspace.approval";@@ -29,6 +30,9 @@ export const useWorkspaceApprovalSettingStore = defineStore(if (_config.rules.length === 0) {_config.rules.push(...seedWorkspaceApprovalSetting());}+ await batchGetOrFetchUsers(+ _config.rules.map((rule) => rule.template?.creator ?? "")+ );config.value = await resolveLocalApprovalConfig(_config);}};diff --git a/frontend/src/types/proto/v1/project_service.ts b/frontend/src/types/proto/v1/project_service.tsindex ed992d64c7..37e0ded5b0 100644--- a/frontend/src/types/proto/v1/project_service.ts+++ b/frontend/src/types/proto/v1/project_service.ts@@ -66,6 +66,7 @@ export interface SearchProjectsRequest {* - name* - resource_id* - exclude_default: if not include the default project.+ * - state** For example:* name = "project name"@@ -73,6 +74,7 @@ export interface SearchProjectsRequest {* resource_id = "project id"* resource_id.matches("project id")* exclude_default == true+ * state == "DELETED"* You can combine filter conditions like:* name = "project name" && resource_id.matches("project id")* name.matches("project name") || resource_id = "project id"diff --git a/frontend/src/utils/workspaceApprovalSetting.ts b/frontend/src/utils/workspaceApprovalSetting.tsindex 2dcc791d46..da893cb113 100644--- a/frontend/src/utils/workspaceApprovalSetting.ts+++ b/frontend/src/utils/workspaceApprovalSetting.ts@@ -11,10 +11,10 @@ import {import { t, te } from "@/plugins/i18n";import { useUserStore } from "@/store";import { userNamePrefix } from "@/store/modules/v1/common";+import { extractUserId } from "@/store/modules/v1/common";import type { ParsedApprovalRule, UnrecognizedApprovalRule } from "@/types";import {DEFAULT_RISK_LEVEL,- unknownUser,UNKNOWN_USER_NAME,SYSTEM_BOT_EMAIL,} from "@/types";@@ -40,7 +40,7 @@ import {import {batchConvertCELStringToParsedExpr,batchConvertParsedExprToCELString,-} from "@/utils/v1";+} from "@/utils";import { displayRoleTitle } from "./role";export const approvalNodeGroupValueText = (group: ApprovalNode_GroupValue) => {@@ -375,9 +375,7 @@ export const seedWorkspaceApprovalSetting = () => {});};-export const creatorOfRule = (rule: LocalApprovalRule) => {+export const isReadonlyApprovalRule = (rule: LocalApprovalRule) => {const creatorName = rule.template.creator ?? UNKNOWN_USER_NAME;- if (creatorName === UNKNOWN_USER_NAME) return unknownUser();-- return useUserStore().getUserByIdentifier(creatorName) ?? unknownUser();+ return extractUserId(creatorName) === SYSTEM_BOT_EMAIL;};diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vueindex 172332f366..13954de99f 100644--- a/frontend/src/views/Archive.vue+++ b/frontend/src/views/Archive.vue@@ -43,7 +43,7 @@</template><script lang="ts" setup>-import { computed, reactive, watchEffect } from "vue";+import { computed, reactive, watchEffect, ref } from "vue";import { useI18n } from "vue-i18n";import IdentityProviderTable from "@/components/SSO/IdentityProviderTable.vue";import {@@ -57,13 +57,15 @@ import {useEnvironmentV1Store,useIdentityProviderStore,useInstanceV1List,- useProjectV1List,+ useProjectV1Store,} from "@/store";+import { type ComposedProject } from "@/types";import { State } from "@/types/proto/v1/common";import type { IdentityProvider } from "@/types/proto/v1/idp_service";import {filterProjectV1ListByKeyword,hasWorkspacePermissionV2,+ getDefaultPagination,} from "@/utils";type LocalTabType = "PROJECT" | "INSTANCE" | "ENVIRONMENT" | "SSO";@@ -74,6 +76,8 @@ interface LocalState {}const { t } = useI18n();+const projectList = ref<ComposedProject[]>([]);+const projectStore = useProjectV1Store();const environmentStore = useEnvironmentV1Store();const identityProviderStore = useIdentityProviderStore();const state = reactive<LocalState>({@@ -81,9 +85,17 @@ const state = reactive<LocalState>({searchText: "",});-const prepareList = () => {- environmentStore.fetchEnvironments(true /* showDeleted */);- identityProviderStore.fetchIdentityProviderList(true /* showDeleted */);+const prepareList = async () => {+ const [_1, _2, listProjectResponse] = await Promise.all([+ environmentStore.fetchEnvironments(true /* showDeleted */),+ identityProviderStore.fetchIdentityProviderList(true /* showDeleted */),+ projectStore.fetchProjectList({+ showDeleted: true,+ pageSize: getDefaultPagination(),+ state: State.DELETED,+ }),+ ]);+ projectList.value = listProjectResponse.projects;};watchEffect(prepareList);@@ -100,13 +112,6 @@ const instanceList = computed(() => {);});-const projectList = computed(() => {- // TODO(ed): support pagination.- return useProjectV1List(true /** showDeleted */).projectList.value.filter(- (project) => project.state === State.DELETED- );-});-const deletedSSOList = computed(() => {return useIdentityProviderStore().deletedIdentityProviderList;});diff --git a/frontend/src/views/sql-editor/context.ts b/frontend/src/views/sql-editor/context.tsindex 9414bc82b4..74f17c94a1 100644--- a/frontend/src/views/sql-editor/context.ts+++ b/frontend/src/views/sql-editor/context.ts@@ -78,10 +78,11 @@ export const provideSQLEditorContext = () => {pendingInsertAtCaret: ref(),events: new Emittery(),- maybeSwitchProject: (project) => {+ maybeSwitchProject: async (project) => {if (editorStore.project !== project) {editorStore.project = project;- return context.events.once("project-context-ready").then(() => project);+ await context.events.once("project-context-ready");+ return project;}return Promise.resolve(editorStore.project);},diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 0ee8bfd58a..b179b32379 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -12592,6 +12592,7 @@ components:- name- resource_id- exclude_default: if not include the default project.+ - stateFor example:name = "project name"@@ -12599,6 +12600,7 @@ components:resource_id = "project id"resource_id.matches("project id")exclude_default == true+ state == "DELETED"You can combine filter conditions like:name = "project name" && resource_id.matches("project id")name.matches("project name") || resource_id = "project id"diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 5e364239c0..28b6abe49d 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -8289,9 +8289,9 @@ When paginating, all other parameters provided to `ListProjects` must match the| Field | Type | Label | Description || ----- | ---- | ----- | ----------- || show_deleted | [bool](#bool) | | Show deleted projects if specified. |-| filter | [string](#string) | | Filter the project. Supported filters: - name - resource_id - exclude_default: if not include the default project.+| filter | [string](#string) | | Filter the project. Supported filters: - name - resource_id - exclude_default: if not include the default project. - state-For example: name = "project name" name.matches("project name") resource_id = "project id" resource_id.matches("project id") exclude_default == true You can combine filter conditions like: name = "project name" && resource_id.matches("project id") name.matches("project name") || resource_id = "project id" |+For example: name = "project name" name.matches("project name") resource_id = "project id" resource_id.matches("project id") exclude_default == true state == "DELETED" You can combine filter conditions like: name = "project name" && resource_id.matches("project id") name.matches("project name") || resource_id = "project id" |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 4d72bdcfeb..104effb570 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -22835,6 +22835,7 @@ Supported filters:- name- resource_id- exclude_default: if not include the default project.+- stateFor example:name = "project name"@@ -22842,6 +22843,7 @@ name.matches("project name")resource_id = "project id"resource_id.matches("project id")exclude_default == true+state == "DELETED"You can combine filter conditions like:name = "project name" && resource_id.matches("project id")name.matches("project name") || resource_id = "project id" </p></td>diff --git a/proto/generated-go/v1/project_service.pb.go b/proto/generated-go/v1/project_service.pb.goindex 77c82dd144..8dffb238f5 100644--- a/proto/generated-go/v1/project_service.pb.go+++ b/proto/generated-go/v1/project_service.pb.go@@ -414,6 +414,7 @@ type SearchProjectsRequest struct {// - name// - resource_id// - exclude_default: if not include the default project.+ // - state//// For example:// name = "project name"@@ -421,6 +422,7 @@ type SearchProjectsRequest struct {// resource_id = "project id"// resource_id.matches("project id")// exclude_default == true+ // state == "DELETED"// You can combine filter conditions like:// name = "project name" && resource_id.matches("project id")// name.matches("project name") || resource_id = "project id"diff --git a/proto/v1/project_service.proto b/proto/v1/project_service.protoindex cebac3acd8..fdf0b60552 100644--- a/proto/v1/project_service.proto+++ b/proto/v1/project_service.proto@@ -185,6 +185,7 @@ message SearchProjectsRequest {// - name// - resource_id// - exclude_default: if not include the default project.+ // - state//// For example:// name = "project name"@@ -192,6 +193,7 @@ message SearchProjectsRequest {// resource_id = "project id"// resource_id.matches("project id")// exclude_default == true+ // state == "DELETED"// You can combine filter conditions like:// name = "project name" && resource_id.matches("project id")// name.matches("project name") || resource_id = "project id"