Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add placeholder field to db group (#6509)
boojack5a83265ffb83
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vueindex 2106a72da3..a1bd010c6d 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue@@ -3,13 +3,22 @@<div class="w-full grid grid-cols-3 gap-x-6 pb-6 mb-4 border-b"><div><p class="text-lg mb-2">{{ $t("common.name") }}</p>- <ResourceIdInput- ref="resourceIdInput"- :value="state.resourceId"- :resource-type="resourceIdType"- :readonly="!isCreating"- :validate="validateResourceId"+ <input+ v-model="state.placeholder"+ required+ type="text"+ class="textfield w-full"/>+ <div class="mt-2">+ <ResourceIdField+ ref="resourceIdField"+ :resource-type="formatedResourceType"+ :readonly="!isCreating"+ :value="state.resourceId"+ :resource-title="state.placeholder"+ :validate="validateResourceId"+ />+ </div></div><div><p class="text-lg mb-2">{{ $t("common.environment") }}</p>@@ -96,14 +105,15 @@ import { getErrorCode } from "@/utils/grpcweb";import EnvironmentSelect from "../EnvironmentSelect.vue";import MatchedDatabaseView from "./MatchedDatabaseView.vue";import MatchedTableView from "./MatchedTableView.vue";-import ResourceIdInput from "../v2/Form/ResourceIdInput.vue";import DatabaseGroupSelect from "./DatabaseGroupSelect.vue";import {databaseGroupNamePrefix,getProjectNameAndDatabaseGroupName,getProjectNameAndDatabaseGroupNameAndSchemaGroupName,+ schemaGroupNamePrefix,} from "@/store/modules/v1/common";import { projectNamePrefix } from "@/store/modules/v1/common";+import { ResourceIdField } from "../v2";const props = defineProps<{project: ComposedProject;@@ -113,6 +123,7 @@ const props = defineProps<{type LocalState = {resourceId: string;+ placeholder: string;environmentId?: string;selectedDatabaseGroupId?: string;expr: ConditionGroupExpr;@@ -122,15 +133,19 @@ const { t } = useI18n();const dbGroupStore = useDBGroupStore();const state = reactive<LocalState>({resourceId: "",+ placeholder: "",expr: wrapAsGroup(resolveCELExpr(CELExpr.fromJSON({}))),});-const resourceIdInput = ref<InstanceType<typeof ResourceIdInput>>();+const resourceIdField = ref<InstanceType<typeof ResourceIdField>>();const selectedDatabaseGroupName = computed(() => {const [, databaseGroupName] = getProjectNameAndDatabaseGroupName(state.selectedDatabaseGroupId || "");return databaseGroupName;});+const formatedResourceType = computed(() =>+ props.resourceType === "DATABASE_GROUP" ? "database-group" : "schema-group"+);const isCreating = computed(() => props.databaseGroup === undefined);@@ -145,10 +160,12 @@ onMounted(async () => {}if (props.resourceType === "DATABASE_GROUP") {+ const databaseGroupEntity = databaseGroup as DatabaseGroup;const [, databaseGroupName] = getProjectNameAndDatabaseGroupName(databaseGroup.name);state.resourceId = databaseGroupName;+ state.placeholder = databaseGroupEntity.databasePlaceholder;const composedDatabaseGroup = await dbGroupStore.getOrFetchDBGroupByName(databaseGroup.name);@@ -159,11 +176,14 @@ onMounted(async () => {state.expr = composedDatabaseGroup.simpleExpr;}} else {- const schemaGroup = databaseGroup as SchemaGroup;- const expression = schemaGroup.tableExpr?.expression ?? "";+ const schemaGroupEntity = databaseGroup as SchemaGroup;+ const expression = schemaGroupEntity.tableExpr?.expression ?? "";const [projectName, databaseGroupName, schemaGroupName] =- getProjectNameAndDatabaseGroupNameAndSchemaGroupName(schemaGroup.name);+ getProjectNameAndDatabaseGroupNameAndSchemaGroupName(+ schemaGroupEntity.name+ );state.resourceId = schemaGroupName;+ state.placeholder = schemaGroupEntity.tablePlaceholder;state.selectedDatabaseGroupId = `${projectNamePrefix}${projectName}/${databaseGroupNamePrefix}${databaseGroupName}`;const expr = await convertCELStringToExpr(expression);state.expr = expr;@@ -188,12 +208,12 @@ const validateResourceId = async (let request = undefined;if (props.resourceType === "DATABASE_GROUP") {request = dbGroupStore.getOrFetchDBGroupByName(- `${props.project.name}/databaseGroups/${resourceId}`+ `${props.project.name}/${databaseGroupNamePrefix}${resourceId}`);} else if (props.resourceType === "SCHEMA_GROUP") {if (state.selectedDatabaseGroupId) {request = dbGroupStore.getOrFetchSchemaGroupByName(- `${state.selectedDatabaseGroupId}/schemaGroups/${resourceId}`+ `${state.selectedDatabaseGroupId}/${schemaGroupNamePrefix}${resourceId}`);}}@@ -227,7 +247,7 @@ defineExpose({getFormState: () => {return {...state,- resourceId: resourceIdInput.value?.resourceId || "",+ resourceId: resourceIdField.value?.resourceId || "",};},});diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vueindex aa57de8605..b30b00ff0f 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue@@ -100,10 +100,13 @@ const allowConfirm = computed(() => {const formState = formRef.value.getFormState();if (props.resourceType === "DATABASE_GROUP") {- return formState.resourceId && formState.environmentId;+ return (+ formState.resourceId && formState.placeholder && formState.environmentId+ );} else if (props.resourceType === "SCHEMA_GROUP") {return (formState.resourceId &&+ formState.placeholder &&formState.environmentId &&formState.selectedDatabaseGroupId);@@ -175,7 +178,7 @@ const doConfirm = async () => {props.project.name,{name: `${props.project.name}/databaseGroups/${resourceId}`,- databasePlaceholder: resourceId,+ databasePlaceholder: formState.placeholder,databaseExpr: Expr.fromJSON({expression: celString,}),@@ -192,7 +195,7 @@ const doConfirm = async () => {});await dbGroupStore.updateDatabaseGroup({...props.databaseGroup!,- databasePlaceholder: "",+ databasePlaceholder: formState.placeholder,databaseExpr: Expr.fromJSON({expression: celString,}),@@ -210,7 +213,7 @@ const doConfirm = async () => {formState.selectedDatabaseGroupId,{name: `${formState.selectedDatabaseGroupId}/schemaGroups/${resourceId}`,- tablePlaceholder: resourceId,+ tablePlaceholder: formState.placeholder,tableExpr: Expr.fromJSON({expression: celString,}),@@ -221,7 +224,7 @@ const doConfirm = async () => {const celString = convertToCELString(formState.expr);await dbGroupStore.updateSchemaGroup({...props.databaseGroup!,- tablePlaceholder: "",+ tablePlaceholder: formState.placeholder,tableExpr: Expr.fromJSON({expression: celString,}),diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vueindex d74357a2b1..c5893e44bb 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupTable.vue@@ -9,7 +9,7 @@><template #item="{ item }: { item: ComposedDatabaseGroup }"><div class="bb-grid-cell">- {{ item.databaseGroupName }}+ {{ item.databasePlaceholder }}</div><div class="bb-grid-cell">{{ item.environment.title }}</div><div v-if="props.showEdit" class="bb-grid-cell gap-x-2 justify-end">diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vueindex d0dceae2a1..e590c6533a 100644--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue@@ -139,7 +139,7 @@ const updateMatchingState = useDebounceFn(async () => {const result = await projectServiceClient.createDatabaseGroup({parent: props.project.name,databaseGroup: {- name: `${props.project.name}/${databaseGroupNamePrefix}/${validateOnlyResourceId}`,+ name: `${props.project.name}/${databaseGroupNamePrefix}${validateOnlyResourceId}`,databasePlaceholder: validateOnlyResourceId,databaseExpr: Expr.fromJSON({expression: celString,diff --git a/frontend/src/components/DatabaseGroup/SelectSchemaGroupsTable.vue b/frontend/src/components/DatabaseGroup/SelectSchemaGroupsTable.vueindex 05f39691af..5b88208fd7 100644--- a/frontend/src/components/DatabaseGroup/SelectSchemaGroupsTable.vue+++ b/frontend/src/components/DatabaseGroup/SelectSchemaGroupsTable.vue@@ -18,7 +18,7 @@</NRadio></div><div class="bb-grid-cell">- {{ dbGroup.databaseGroupName }}+ {{ dbGroup.databasePlaceholder }}</div><div class="bb-grid-cell">{{ dbGroup.project.title }}</div><div class="bb-grid-cell">{{ dbGroup.environment.title }}</div>diff --git a/frontend/src/components/v2/Form/ResourceIdField.vue b/frontend/src/components/v2/Form/ResourceIdField.vueindex 74ed8ea1e6..24044f5331 100644--- a/frontend/src/components/v2/Form/ResourceIdField.vue+++ b/frontend/src/components/v2/Form/ResourceIdField.vue@@ -85,7 +85,8 @@ type ResourceType =| "project"| "idp"| "role"- | "database-group";+ | "database-group"+ | "schema-group";const props = withDefaults(defineProps<{diff --git a/frontend/src/components/v2/Model/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table.vueindex 1b9e7c6d1c..e9ed6e50de 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table.vue@@ -54,7 +54,7 @@<div class="bb-grid-cell"><div class="flex items-center space-x-2"><SQLEditorButtonV1 :disabled="true" :tooltip="true" />- <span>{{ getDatabaseGroup(database).databaseGroupName }}</span>+ <span>{{ getDatabaseGroup(database).databasePlaceholder }}</span><BBBadge text="GROUP" :can-remove="false" class="text-xs" /></div></div>diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 746bd21687..1028b88b69 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2172,7 +2172,9 @@"instance": "Instancia","project": "Proyecto","idp": "Proveedor de Identidad",- "role": "Rol"+ "role": "Rol",+ "database-group": "grupo de bases de datos",+ "schema-group": "grupo de mesas"},"resource-id": {"self": "ID de {resource}",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 699b44a0e2..84f59d68f9 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2189,7 +2189,9 @@"instance": "实例","project": "项目","idp": "身份提供商",- "role": "角色"+ "role": "角色",+ "database-group": "数据库分组",+ "schema-group": "表分组"},"resource-id": {"self": "{resource} ID",diff --git a/frontend/src/store/modules/dbGroup.ts b/frontend/src/store/modules/dbGroup.tsindex 39268da457..b2c560389c 100644--- a/frontend/src/store/modules/dbGroup.ts+++ b/frontend/src/store/modules/dbGroup.ts@@ -130,8 +130,6 @@ export const useDBGroupStore = defineStore("db-group", () => {>,name: string) => {- // Note: use resource id as placeholder right now.- databaseGroup.databasePlaceholder = name;const createdDatabaseGroup = await projectServiceClient.createDatabaseGroup({parent: projectName,@@ -218,8 +216,6 @@ export const useDBGroupStore = defineStore("db-group", () => {schemaGroup: Pick<SchemaGroup, "name" | "tablePlaceholder" | "tableExpr">,name: string) => {- // Note: use resource id as placeholder right now.- schemaGroup.tablePlaceholder = name;const createdSchemaGroup = await projectServiceClient.createSchemaGroup({parent: dbGroupName,schemaGroup,