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 error handler for database group requests (#6418)
boojack5f84e3deb909
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 9aa542dbaf..6b3c1bc56d 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -1309,8 +1309,8 @@ func (s *ProjectService) TestWebhook(ctx context.Context, request *v1pb.TestWebh// CreateDatabaseGroup creates a database group.func (s *ProjectService) CreateDatabaseGroup(ctx context.Context, request *v1pb.CreateDatabaseGroupRequest) (*v1pb.DatabaseGroup, error) {- if !s.licenseService.IsFeatureEnabled(api.FeatureSharding) {- return nil, status.Errorf(codes.PermissionDenied, api.FeatureSharding.AccessErrorMessage())+ if !s.licenseService.IsFeatureEnabled(api.FeatureDatabaseGrouping) {+ return nil, status.Errorf(codes.PermissionDenied, api.FeatureDatabaseGrouping.AccessErrorMessage())}projectResourceID, err := getProjectID(request.Parent)if err != nil {@@ -1359,8 +1359,8 @@ func (s *ProjectService) CreateDatabaseGroup(ctx context.Context, request *v1pb.// UpdateDatabaseGroup updates a database group.func (s *ProjectService) UpdateDatabaseGroup(ctx context.Context, request *v1pb.UpdateDatabaseGroupRequest) (*v1pb.DatabaseGroup, error) {- if !s.licenseService.IsFeatureEnabled(api.FeatureSharding) {- return nil, status.Errorf(codes.PermissionDenied, api.FeatureSharding.AccessErrorMessage())+ if !s.licenseService.IsFeatureEnabled(api.FeatureDatabaseGrouping) {+ return nil, status.Errorf(codes.PermissionDenied, api.FeatureDatabaseGrouping.AccessErrorMessage())}projectResourceID, databaseGroupResourceID, err := getProjectIDDatabaseGroupID(request.DatabaseGroup.Name)if err != nil {@@ -1546,8 +1546,8 @@ func (s *ProjectService) GetDatabaseGroup(ctx context.Context, request *v1pb.Get// CreateSchemaGroup creates a database group.func (s *ProjectService) CreateSchemaGroup(ctx context.Context, request *v1pb.CreateSchemaGroupRequest) (*v1pb.SchemaGroup, error) {- if !s.licenseService.IsFeatureEnabled(api.FeatureSharding) {- return nil, status.Errorf(codes.PermissionDenied, api.FeatureSharding.AccessErrorMessage())+ if !s.licenseService.IsFeatureEnabled(api.FeatureDatabaseGrouping) {+ return nil, status.Errorf(codes.PermissionDenied, api.FeatureDatabaseGrouping.AccessErrorMessage())}projectResourceID, databaseGroupResourceID, err := getProjectIDDatabaseGroupID(request.Parent)if err != nil {@@ -1605,8 +1605,8 @@ func (s *ProjectService) CreateSchemaGroup(ctx context.Context, request *v1pb.Cr// UpdateSchemaGroup updates a schema group.func (s *ProjectService) UpdateSchemaGroup(ctx context.Context, request *v1pb.UpdateSchemaGroupRequest) (*v1pb.SchemaGroup, error) {- if !s.licenseService.IsFeatureEnabled(api.FeatureSharding) {- return nil, status.Errorf(codes.PermissionDenied, api.FeatureSharding.AccessErrorMessage())+ if !s.licenseService.IsFeatureEnabled(api.FeatureDatabaseGrouping) {+ return nil, status.Errorf(codes.PermissionDenied, api.FeatureDatabaseGrouping.AccessErrorMessage())}projectResourceID, databaseGroupResourceID, schemaGroupResourceID, err := getProjectIDDatabaseGroupIDSchemaGroupID(request.SchemaGroup.Name)if err != nil {diff --git a/backend/legacyapi/plan.go b/backend/legacyapi/plan.goindex e310eefc32..9ad4aeefa5 100644--- a/backend/legacyapi/plan.go+++ b/backend/legacyapi/plan.go@@ -122,8 +122,8 @@ const (FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time"// FeatureEncryptedSecrets is a feature that allows user to setting the encrypted secrets for the database.FeatureEncryptedSecrets FeatureType = "bb.feature.encrypted-secrets"- // FeatureSharding allows user to create database/schema groups.- FeatureSharding FeatureType = "bb.feature.sharding"+ // FeatureDatabaseGrouping allows user to create database/schema groups.+ FeatureDatabaseGrouping FeatureType = "bb.feature.database-grouping"// VCS Integration.@@ -225,8 +225,8 @@ func (e FeatureType) Name() string {return "Task schedule time"case FeatureEncryptedSecrets:return "Encrypted secrets"- case FeatureSharding:- return "Sharding"+ case FeatureDatabaseGrouping:+ return "Database grouping"// VCS Integrationcase FeatureVCSSchemaWriteBack:return "Schema write-back"@@ -309,7 +309,7 @@ var FeatureMatrix = map[FeatureType][3]bool{FeatureSQLReview: {true, true, true},FeatureTaskScheduleTime: {false, true, true},FeatureEncryptedSecrets: {false, true, true},- FeatureSharding: {false, false, true},+ FeatureDatabaseGrouping: {false, false, true},// VCS IntegrationFeatureVCSSchemaWriteBack: {false, true, true},FeatureVCSSheetSync: {false, true, true},diff --git a/backend/server/issue.go b/backend/server/issue.goindex 249479dc5d..393671db29 100644--- a/backend/server/issue.go+++ b/backend/server/issue.go@@ -939,8 +939,8 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.ConmigrationDetail := c.DetailList[0]var matrix [][]*store.DatabaseMessageif migrationDetail.DatabaseGroupName != "" {- if !s.licenseService.IsFeatureEnabled(api.FeatureSharding) {- return nil, echo.NewHTTPError(http.StatusForbidden, api.FeatureSharding.AccessErrorMessage())+ if !s.licenseService.IsFeatureEnabled(api.FeatureDatabaseGrouping) {+ return nil, echo.NewHTTPError(http.StatusForbidden, api.FeatureDatabaseGrouping.AccessErrorMessage())}if len(migrationDetail.SchemaGroupNames) == 0 {return nil, echo.NewHTTPError(http.StatusBadRequest, "Missing schema groups when specifying database group")diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vueindex 832eb5c830..573d4bf11d 100644--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue@@ -46,7 +46,7 @@><div class="flex flex-row items-center"><span class="mr-1">{{ $t("database-group.self") }}</span>- <FeatureBadge feature="bb.feature.sharding" />+ <FeatureBadge feature="bb.feature.database-grouping" /></div></NRadio></div>@@ -180,7 +180,7 @@><div class="flex flex-row items-center"><span class="mr-1">{{ $t("database-group.self") }}</span>- <FeatureBadge feature="bb.feature.sharding" />+ <FeatureBadge feature="bb.feature.database-grouping" /></div></NRadio></div>@@ -689,9 +689,9 @@ const toggleDatabaseSelection = (database: ComposedDatabase, on: boolean) => {};const handleDatabaseGroupTabSelect = () => {- if (!hasFeature("bb.feature.sharding")) {+ if (!hasFeature("bb.feature.database-grouping")) {state.databaseSelectedTab = "DATABASE";- featureModalContext.value.feature = "bb.feature.sharding";+ featureModalContext.value.feature = "bb.feature.database-grouping";return;}state.databaseSelectedTab = "DATABASE_GROUP";diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vueindex d92f22ebd7..c799d4dabe 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue@@ -90,11 +90,8 @@ import ExprEditor from "./common/ExprEditor";import { ResourceType } from "./common/ExprEditor/context";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";import { ComposedProject, ResourceId, ValidatedMessage } from "@/types";-import {- convertCELStringToExpr,- convertDatabaseGroupExprFromCEL,-} from "@/utils/databaseGroup/cel";-import { useDBGroupStore, useEnvironmentV1Store } from "@/store";+import { convertCELStringToExpr } from "@/utils/databaseGroup/cel";+import { useDBGroupStore } from "@/store";import { getErrorCode } from "@/utils/grpcweb";import EnvironmentSelect from "../EnvironmentSelect.vue";import MatchedDatabaseView from "./MatchedDatabaseView.vue";@@ -123,7 +120,6 @@ type LocalState = {};const { t } = useI18n();-const environmentStore = useEnvironmentV1Store();const dbGroupStore = useDBGroupStore();const state = reactive<LocalState>({resourceId: "",@@ -150,20 +146,19 @@ onMounted(async () => {}if (props.resourceType === "DATABASE_GROUP") {- const expression =- (databaseGroup as DatabaseGroup).databaseExpr?.expression ?? "";const [, databaseGroupName] = getProjectNameAndDatabaseGroupName(databaseGroup.name);state.resourceId = databaseGroupName;- const convertResult = await convertDatabaseGroupExprFromCEL(expression);- if (convertResult.environmentId) {- const environment = environmentStore.getEnvironmentByName(- convertResult.environmentId- );- state.environmentId = environment?.uid;+ const composedDatabaseGroup = await dbGroupStore.getOrFetchDBGroupByName(+ databaseGroup.name+ );+ if (composedDatabaseGroup.environment) {+ state.environmentId = composedDatabaseGroup.environment.uid;+ }+ if (composedDatabaseGroup.simpleExpr) {+ state.expr = composedDatabaseGroup.simpleExpr;}- state.expr = convertResult.conditionGroupExpr;} else {const schemaGroup = databaseGroup as SchemaGroup;const expression = schemaGroup.tableExpr?.expression ?? "";@@ -178,14 +173,8 @@ onMounted(async () => {const relatedDatabaseGroup = await dbGroupStore.getOrFetchDBGroupByName(`${projectNamePrefix}${projectName}/${databaseGroupNamePrefix}${databaseGroupName}`);- const convertResult = await convertDatabaseGroupExprFromCEL(- relatedDatabaseGroup.databaseExpr?.expression ?? ""- );- if (convertResult.environmentId) {- const environment = environmentStore.getEnvironmentByName(- convertResult.environmentId- );- state.environmentId = environment?.uid;+ if (relatedDatabaseGroup.environment) {+ state.environmentId = relatedDatabaseGroup.environment.uid;}}});diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vueindex b5ee86c99c..aa57de8605 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue@@ -41,6 +41,7 @@<script lang="ts" setup>import { NButton, NDrawer, NDrawerContent, useDialog } from "naive-ui";+import { ClientError } from "nice-grpc-common";import { computed, onMounted, ref } from "vue";import { useI18n } from "vue-i18n";import { ComposedProject } from "@/types";@@ -159,74 +160,83 @@ const doConfirm = async () => {return;}- if (props.resourceType === "DATABASE_GROUP") {- if (isCreating.value) {- const environment = environmentStore.getEnvironmentByUID(- formState.environmentId || ""- );- const celString = stringifyDatabaseGroupExpr({- environmentId: environment.name,- conditionGroupExpr: formState.expr,- });- const resourceId = formState.resourceId;- await dbGroupStore.createDatabaseGroup(- props.project.name,- {- name: `${props.project.name}/databaseGroups/${resourceId}`,- databasePlaceholder: resourceId,+ try {+ if (props.resourceType === "DATABASE_GROUP") {+ if (isCreating.value) {+ const environment = environmentStore.getEnvironmentByUID(+ formState.environmentId || ""+ );+ const celString = stringifyDatabaseGroupExpr({+ environmentId: environment.name,+ conditionGroupExpr: formState.expr,+ });+ const resourceId = formState.resourceId;+ await dbGroupStore.createDatabaseGroup(+ props.project.name,+ {+ name: `${props.project.name}/databaseGroups/${resourceId}`,+ databasePlaceholder: resourceId,+ databaseExpr: Expr.fromJSON({+ expression: celString,+ }),+ },+ resourceId+ );+ } else {+ const environment = environmentStore.getEnvironmentByUID(+ formState.environmentId || ""+ );+ const celString = stringifyDatabaseGroupExpr({+ environmentId: environment.name,+ conditionGroupExpr: formState.expr,+ });+ await dbGroupStore.updateDatabaseGroup({+ ...props.databaseGroup!,+ databasePlaceholder: "",databaseExpr: Expr.fromJSON({expression: celString,}),- },- resourceId- );- } else {- const environment = environmentStore.getEnvironmentByUID(- formState.environmentId || ""- );- const celString = stringifyDatabaseGroupExpr({- environmentId: environment.name,- conditionGroupExpr: formState.expr,- });- await dbGroupStore.updateDatabaseGroup({- ...props.databaseGroup!,- databasePlaceholder: "",- databaseExpr: Expr.fromJSON({- expression: celString,- }),- });- }- } else if (props.resourceType === "SCHEMA_GROUP") {- if (isCreating.value) {- if (!formState.selectedDatabaseGroupId) {- return;+ });}-- const celString = convertToCELString(formState.expr);- const resourceId = formState.resourceId;- await dbGroupStore.createSchemaGroup(- formState.selectedDatabaseGroupId,- {- name: `${formState.selectedDatabaseGroupId}/schemaGroups/${resourceId}`,- tablePlaceholder: resourceId,+ } else if (props.resourceType === "SCHEMA_GROUP") {+ if (isCreating.value) {+ if (!formState.selectedDatabaseGroupId) {+ return;+ }++ const celString = convertToCELString(formState.expr);+ const resourceId = formState.resourceId;+ await dbGroupStore.createSchemaGroup(+ formState.selectedDatabaseGroupId,+ {+ name: `${formState.selectedDatabaseGroupId}/schemaGroups/${resourceId}`,+ tablePlaceholder: resourceId,+ tableExpr: Expr.fromJSON({+ expression: celString,+ }),+ },+ resourceId+ );+ } else {+ const celString = convertToCELString(formState.expr);+ await dbGroupStore.updateSchemaGroup({+ ...props.databaseGroup!,+ tablePlaceholder: "",tableExpr: Expr.fromJSON({expression: celString,}),- },- resourceId- );- } else {- const celString = convertToCELString(formState.expr);- await dbGroupStore.updateSchemaGroup({- ...props.databaseGroup!,- tablePlaceholder: "",- tableExpr: Expr.fromJSON({- expression: celString,- }),- });+ });+ }}- } else {- throw new Error("Unknown resource type");+ } catch (error) {+ console.error(error);+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: `Request error occurred`,+ description: (error as ClientError).details,+ });+ return;}emit("close");diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vueindex 7322dbce1e..a3ecee2fd9 100644--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue@@ -10,7 +10,7 @@class="sticky top-0 z-[1] w-full flex flex-row justify-between items-center px-2 py-1 bg-gray-100 border-b cursor-pointer"@click="state.showMatchedDatabaseList = !state.showMatchedDatabaseList">- <div>+ <div class="text-sm font-medium"><span>{{ $t("database-group.matched-database") }}</span><span class="ml-1 text-gray-400">({{ matchedDatabaseList.length }})</span@@ -30,14 +30,18 @@:key="database.name"class="w-full flex flex-row justify-between items-center px-2 py-1 gap-x-2">- <span class="text-sm">{{ database.databaseName }}</span>- <div class="flex flex-row justify-end items-center">+ <NEllipsis class="text-sm" line-clamp="1">+ {{ database.databaseName }}+ </NEllipsis>+ <div class="flex flex-row justify-end items-center shrink-0"><InstanceV1EngineIcon :instance="database.instanceEntity" />- <span class="ml-1 text-sm text-gray-400"- >{{ database.instanceEntity.title }} ({{- database.instanceEntity.environmentEntity.title- }})</span+ <NEllipsis+ class="ml-1 text-sm text-gray-400 max-w-[124px]"+ line-clamp="1">+ ({{ database.instanceEntity.environmentEntity.title }})+ {{ database.instanceEntity.title }}+ </NEllipsis></div></div></div>@@ -47,7 +51,7 @@state.showUnmatchedDatabaseList = !state.showUnmatchedDatabaseList">- <div>+ <div class="text-sm font-medium"><span>{{ $t("database-group.unmatched-database") }}</span><span class="ml-1 text-gray-400">({{ unmatchedDatabaseList.length }})</span@@ -67,14 +71,18 @@:key="database.name"class="w-full flex flex-row justify-between items-center px-2 py-1 gap-x-2">- <span class="text-sm">{{ database.databaseName }}</span>- <div class="flex flex-row justify-end items-center">+ <NEllipsis class="text-sm" line-clamp="1">+ {{ database.databaseName }}+ </NEllipsis>+ <div class="flex flex-row justify-end items-center shrink-0"><InstanceV1EngineIcon :instance="database.instanceEntity" />- <span class="ml-1 text-sm text-gray-400"- >{{ database.instanceEntity.title }} ({{- database.instanceEntity.environmentEntity.title- }})</span+ <NEllipsis+ class="ml-1 text-sm text-gray-400 max-w-[124px]"+ line-clamp="1">+ ({{ database.instanceEntity.environmentEntity.title }})+ {{ database.instanceEntity.title }}+ </NEllipsis></div></div></div>@@ -82,15 +90,13 @@</template><script lang="ts" setup>-import { ref, watch, reactive, computed } from "vue";+import { NEllipsis } from "naive-ui";+import { ref, watch, reactive } from "vue";import { ConditionGroupExpr } from "@/plugins/cel";import { useDatabaseV1Store, useEnvironmentV1Store } from "@/store";import { ComposedDatabase, ComposedProject } from "@/types";import { InstanceV1EngineIcon } from "../v2";-import {- DatabaseGroup,- DatabaseGroupView,-} from "@/types/proto/v1/project_service";+import { DatabaseGroup } from "@/types/proto/v1/project_service";import { projectServiceClient } from "@/grpcweb";import { stringifyDatabaseGroupExpr } from "@/utils/databaseGroup/cel";import { Expr } from "@/types/proto/google/type/expr";@@ -120,67 +126,43 @@ const state = reactive<LocalState>({const matchedDatabaseList = ref<ComposedDatabase[]>([]);const unmatchedDatabaseList = ref<ComposedDatabase[]>([]);-const isCreating = computed(() => props.databaseGroup === undefined);-const updateMatchingState = useDebounceFn(async () => {state.isRequesting = true;- const matchedDatabaseNameList: string[] = [];- const unmatchedDatabaseNameList: string[] = [];- if (isCreating.value) {- const environment = environmentStore.getEnvironmentByUID(- props.environmentId- );- const celString = stringifyDatabaseGroupExpr({- environmentId: environment.name,- conditionGroupExpr: props.expr,- });- const validateOnlyResourceId = "creating-database-group";- const result = await projectServiceClient.createDatabaseGroup({- parent: props.project.name,- databaseGroup: {- name: `${props.project.name}/databaseGroups/${validateOnlyResourceId}`,- databasePlaceholder: validateOnlyResourceId,- databaseExpr: Expr.fromJSON({- expression: celString,- }),- },- databaseGroupId: validateOnlyResourceId,- validateOnly: true,- });- matchedDatabaseNameList.push(- ...result.matchedDatabases.map((item) => item.name)- );- unmatchedDatabaseNameList.push(- ...result.unmatchedDatabases.map((item) => item.name)- );- } else {- const result = await projectServiceClient.getDatabaseGroup({- name: props.databaseGroup!.name,- view: DatabaseGroupView.DATABASE_GROUP_VIEW_FULL,- });- matchedDatabaseNameList.push(- ...result.matchedDatabases.map((item) => item.name)- );- unmatchedDatabaseNameList.push(- ...result.unmatchedDatabases.map((item) => item.name)- );- }+ const environment = environmentStore.getEnvironmentByUID(props.environmentId);+ const celString = stringifyDatabaseGroupExpr({+ environmentId: environment.name,+ conditionGroupExpr: props.expr,+ });+ const validateOnlyResourceId = "creating-database-group";+ const result = await projectServiceClient.createDatabaseGroup({+ parent: props.project.name,+ databaseGroup: {+ name: `${props.project.name}/databaseGroups/${validateOnlyResourceId}`,+ databasePlaceholder: validateOnlyResourceId,+ databaseExpr: Expr.fromJSON({+ expression: celString,+ }),+ },+ databaseGroupId: validateOnlyResourceId,+ validateOnly: true,+ });matchedDatabaseList.value = [];unmatchedDatabaseList.value = [];- for (const name of matchedDatabaseNameList) {- const database = await databaseStore.getOrFetchDatabaseByName(name);+ for (const item of result.matchedDatabases) {+ const database = await databaseStore.getOrFetchDatabaseByName(item.name);if (database) {matchedDatabaseList.value.push(database);}}- for (const name of unmatchedDatabaseNameList) {- const database = await databaseStore.getOrFetchDatabaseByName(name);+ for (const item of result.unmatchedDatabases) {+ const database = await databaseStore.getOrFetchDatabaseByName(item.name);if (database) {unmatchedDatabaseList.value.push(database);}}+state.isRequesting = false;}, 500);diff --git a/frontend/src/components/DatabaseGroup/MatchedTableView.vue b/frontend/src/components/DatabaseGroup/MatchedTableView.vueindex 6fd15f4155..9612c35372 100644--- a/frontend/src/components/DatabaseGroup/MatchedTableView.vue+++ b/frontend/src/components/DatabaseGroup/MatchedTableView.vue@@ -10,7 +10,7 @@class="sticky top-0 z-[1] w-full flex flex-row justify-between items-center px-2 py-1 bg-gray-100 border-b cursor-pointer"@click="state.showMatchedTableList = !state.showMatchedTableList">- <div>+ <div class="text-sm font-medium"><span>{{ $t("database-group.matched-table") }}</span><span class="ml-1 text-gray-400">({{ matchedTableList.length }})</span></div>@@ -38,7 +38,7 @@class="sticky top-8 z-[1] w-full flex flex-row justify-between items-center px-2 py-1 bg-gray-100 border-y cursor-pointer"@click="state.showUnmatchedTableList = !state.showUnmatchedTableList">- <div>+ <div class="text-sm font-medium"><span>{{ $t("database-group.unmatched-table") }}</span><span class="ml-1 text-gray-400">({{ unmatchedTableList.length }})</span@@ -127,6 +127,8 @@ const updateMatchingState = useDebounceFn(async () => {matchedTableList.value = result.matchedTables;unmatchedTableList.value = result.unmatchedTables;} catch (error) {+ matchedTableList.value = [];+ unmatchedTableList.value = [];console.error(error);// do nothing else.}diff --git a/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vueindex 959640130e..39f4080512 100644--- a/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue+++ b/frontend/src/components/DatabaseGroup/ProjectDatabaseGroupPanel.vue@@ -5,7 +5,7 @@<div class="flex flex-row gap-x-2"><NButton @click="handleCreateDatabaseGroup"><span class="mr-1">{{ $t("database-group.create") }}</span>- <FeatureBadge feature="bb.feature.sharding" />+ <FeatureBadge feature="bb.feature.database-grouping" /></NButton></div></div>@@ -28,7 +28,7 @@<FeatureModalv-if="state.showFeatureModal"- feature="bb.feature.sharding"+ feature="bb.feature.database-grouping"@cancel="state.showFeatureModal = false"/></template>@@ -71,7 +71,7 @@ onMounted(async () => {});const handleCreateDatabaseGroup = () => {- if (!hasFeature("bb.feature.sharding")) {+ if (!hasFeature("bb.feature.database-grouping")) {state.showFeatureModal = true;return;}diff --git a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vueindex 50b06c8a65..fa7ed06e98 100644--- a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue+++ b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue@@ -267,7 +267,6 @@ const {getApplicableTaskStatusTransitionList,} = useIssueTransitionLogic(issue as Ref<Issue>);-// TODO(steven): figure out how to show the dropdown for grant request issue.const issueStatusTransitionDropdownOptions = computed(() => {return applicableIssueStatusTransitionList.value.map<ExtraActionOption>((transition) => {diff --git a/frontend/src/components/Issue/logic/assignee.ts b/frontend/src/components/Issue/logic/assignee.tsindex efdfbb9ead..75c7e6f04a 100644--- a/frontend/src/components/Issue/logic/assignee.ts+++ b/frontend/src/components/Issue/logic/assignee.ts@@ -31,7 +31,6 @@ import { User } from "@/types/proto/v1/auth_service";export const useCurrentRollOutPolicyForActiveEnvironment = () => {const { create, issue, activeStageOfPipeline } = useIssueLogic();- // TODO(steven): figure out how to handle this for grant request issues.if (!isDatabaseRelatedIssueType(issue.value.type)) {return computed(() => ({policy: ApprovalStrategy.MANUAL,diff --git a/frontend/src/components/v2/Form/ResourceIdInput.vue b/frontend/src/components/v2/Form/ResourceIdInput.vueindex 40a3ec8093..34ccdbebdb 100644--- a/frontend/src/components/v2/Form/ResourceIdInput.vue+++ b/frontend/src/components/v2/Form/ResourceIdInput.vue@@ -112,7 +112,9 @@ const handleResourceIdChange = async (newValue: string) => {// custom validation for resource id. (e.g. check if the resource id is already used)if (state.validatedMessages.length === 0 && props.validate) {const messages = await props.validate(state.resourceId);- state.validatedMessages.push(...messages);+ if (Array.isArray(messages)) {+ state.validatedMessages.push(...messages);+ }}};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 192a4045ae..e03eadfa36 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2008,9 +2008,9 @@"title": "Encrypted Secrets","desc": "Store your secrets of database and use them in your issue SQL scripts."},- "bb-feature-sharding": {- "title": "Database/schema group",- "desc": "Easy to manage database/table sharding with database groups."+ "bb-feature-database-grouping": {+ "title": "Database/schema grouping",+ "desc": "Support grouping of databases and tables. When changing, you can select database grouping and change its table grouping."},"bb-feature-disallow-signup": {"title": "Disable self-service signup",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 41e576b389..f7718909b1 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1991,9 +1991,9 @@"title": "Secretos Encriptados","desc": "Almacene sus secretos de base de datos y utilícelos en sus scripts de SQL de Incidencias."},- "bb-feature-sharding": {- "title": "Sharding de bases de datos/tablas",- "desc": "Utilice grupos de bases de datos para administrar fácilmente la fragmentación de bases de datos/tablas."+ "bb-feature-database-grouping": {+ "title": "Agrupación de bases de datos",+ "desc": "Admite la agrupación de bases de datos y tablas y, al cambiar, puede seleccionar una agrupación de bases de datos y cambiar su agrupación de tablas."},"bb-feature-disallow-signup": {"title": "Deshabilitar el registro de autoservicio",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 98bcb2cf30..80475b7591 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2004,9 +2004,9 @@"title": "保密变量","desc": "存储数据库的保密变量,并在工单的 SQL 中使用它们。"},- "bb-feature-sharding": {+ "bb-feature-database-grouping": {"title": "数据库/表分组",- "desc": "利用数据库组轻松管理数据库/表分片。"+ "desc": "支持对数据库和表进行分组,变更时可选择数据库分组,对其表分组进行变更。"},"bb-feature-disallow-signup": {"title": "禁用自助注册",diff --git a/frontend/src/store/modules/dbGroup.ts b/frontend/src/store/modules/dbGroup.tsindex a1a3cb4971..39268da457 100644--- a/frontend/src/store/modules/dbGroup.ts+++ b/frontend/src/store/modules/dbGroup.ts@@ -36,6 +36,7 @@ const composeDatabaseGroup = async (project: project,environmentName: convertResult.environmentId ?? "",environment: environment,+ simpleExpr: convertResult.conditionGroupExpr,};};diff --git a/frontend/src/types/dbGroup.ts b/frontend/src/types/dbGroup.tsindex 7a198a2a9b..f3083b40ac 100644--- a/frontend/src/types/dbGroup.ts+++ b/frontend/src/types/dbGroup.ts@@ -1,3 +1,4 @@+import { ConditionGroupExpr } from "@/plugins/cel";import { Environment } from "./proto/v1/environment_service";import {DatabaseGroup,@@ -11,6 +12,7 @@ export interface ComposedDatabaseGroup extends DatabaseGroup {project: Project;environmentName: string;environment: Environment;+ simpleExpr: ConditionGroupExpr;}export interface ComposedSchemaGroup extends SchemaGroup {diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex c4c6297d8b..b00346ba05 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -29,7 +29,7 @@ export type FeatureType =| "bb.feature.sql-review"| "bb.feature.task-schedule-time"| "bb.feature.encrypted-secrets"- | "bb.feature.sharding"+ | "bb.feature.database-grouping"// VCS Integration| "bb.feature.vcs-schema-write-back"| "bb.feature.vcs-sheet-sync"diff --git a/frontend/src/views/DatabaseGroupDetail.vue b/frontend/src/views/DatabaseGroupDetail.vueindex 21bac6b0d4..d1b2fa7d5a 100644--- a/frontend/src/views/DatabaseGroupDetail.vue+++ b/frontend/src/views/DatabaseGroupDetail.vue@@ -32,7 +32,7 @@>{{ $t("common.environment") }} - </span><EnvironmentV1Name- :environment="state.environment"+ :environment="environment"icon-class="textinfolabel"/></dd>@@ -77,7 +77,7 @@<div class="col-span-2"><MatchedDatabaseView:project="project"- :environment-id="state.environment?.name || ''"+ :environment-id="environment.uid":expr="state.expr!":database-group="databaseGroup"/>@@ -113,19 +113,13 @@<script lang="ts" setup>import { onMounted, reactive, computed, watch } from "vue";-import {- useDBGroupStore,- useEnvironmentV1Store,- useProjectV1Store,-} from "@/store";+import { useDBGroupStore, useProjectV1Store } from "@/store";import {databaseGroupNamePrefix,projectNamePrefix,} from "@/store/modules/v1/common";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";-import { convertDatabaseGroupExprFromCEL } from "@/utils/databaseGroup/cel";import { ConditionGroupExpr } from "@/plugins/cel";-import { Environment } from "@/types/proto/v1/environment_service";import DatabaseGroupPanel from "@/components/DatabaseGroup/DatabaseGroupPanel.vue";import ExprEditor from "@/components/DatabaseGroup/common/ExprEditor";import MatchedDatabaseView from "@/components/DatabaseGroup/MatchedDatabaseView.vue";@@ -138,7 +132,6 @@ import { NButton } from "naive-ui";interface LocalState {isLoaded: boolean;- environment?: Environment;expr?: ConditionGroupExpr;}@@ -160,7 +153,6 @@ const props = defineProps({});const router = useRouter();-const environmentStore = useEnvironmentV1Store();const projectStore = useProjectV1Store();const dbGroupStore = useDBGroupStore();const state = reactive<LocalState>({@@ -183,6 +175,7 @@ const schemaGroupList = computed(() => {databaseGroupResourceName.value);});+const environment = computed(() => databaseGroup.value.environment);const project = computed(() => {return projectStore.getProjectByName(`${projectNamePrefix}${props.projectName}`@@ -225,15 +218,11 @@ watch(return;}- const expression = databaseGroup.value.databaseExpr?.expression ?? "";- const convertResult = await convertDatabaseGroupExprFromCEL(expression);- state.environment = environmentStore.getEnvironmentByName(- convertResult.environmentId- );- state.expr = convertResult.conditionGroupExpr;+ state.expr = databaseGroup.value.simpleExpr;await dbGroupStore.getOrFetchSchemaGroupListByDBGroupName(databaseGroup.value.name);+state.isLoaded = true;},{diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vueindex d7fb6406c0..5b3b32a71d 100644--- a/frontend/src/views/EnvironmentDashboard.vue+++ b/frontend/src/views/EnvironmentDashboard.vue@@ -251,8 +251,6 @@ const doCreate = async (order: environmentList.value.length,tier: environmentTier,});- // After creating with v1 store, we need to fetch the latest data in old store.- // TODO(steven): using grpc store.await environmentV1Store.fetchEnvironments();const requests = [