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: support edit labels in branching and alter schema (#8794)
ecmadao64730e520e6e
diff --git a/frontend/src/components/ColumnTable.vue b/frontend/src/components/ColumnTable.vueindex 9dc19be54c..b7551d5afd 100644--- a/frontend/src/components/ColumnTable.vue+++ b/frontend/src/components/ColumnTable.vue@@ -317,11 +317,7 @@ const onLabelsApply = async (labelsList: { [key: string]: string }[]) => {if (!column) {return;}- try {- await updateColumnConfig(column.name, { labels: labelsList[0] });- } finally {- state.showLabelsDrawer = false;- }+ await updateColumnConfig(column.name, { labels: labelsList[0] });};const onSemanticTypeApply = async (semanticTypeId: string) => {@@ -329,11 +325,7 @@ const onSemanticTypeApply = async (semanticTypeId: string) => {if (!column) {return;}- try {- await updateColumnConfig(column.name, { semanticTypeId });- } finally {- state.showSemanticTypesDrawer = false;- }+ await updateColumnConfig(column.name, { semanticTypeId });};const onSemanticTypeRemove = async (column: string) => {diff --git a/frontend/src/components/LabelEditorDrawer.vue b/frontend/src/components/LabelEditorDrawer.vueindex f4e6ec2433..dd58b9b939 100644--- a/frontend/src/components/LabelEditorDrawer.vue+++ b/frontend/src/components/LabelEditorDrawer.vue@@ -23,7 +23,7 @@v-if="!readonly":disabled="!allowSave"type="primary"- @click="$emit('apply', convertKVListToLabelsList())"+ @click="onSave">{{ $t("common.save") }}</NButton>@@ -51,7 +51,7 @@ const props = defineProps<{[key: string]: string;}[];}>();-defineEmits<{+const emit = defineEmits<{(event: "dismiss"): void;(event: "apply",@@ -156,6 +156,11 @@ const showWarning = computed(() => {return state.kvList.some((kv) => !!kv.message);});+const onSave = () => {+ emit("apply", convertKVListToLabelsList());+ emit("dismiss");+};+watch(() => props.labels,() => {diff --git a/frontend/src/components/SchemaEditorV1/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditorV1/Panels/DatabaseEditor.vueindex 30598968a6..1f6aaa8d4c 100644--- a/frontend/src/components/SchemaEditorV1/Panels/DatabaseEditor.vue+++ b/frontend/src/components/SchemaEditorV1/Panels/DatabaseEditor.vue@@ -115,14 +115,6 @@</DrawerContent></Drawer>- <SelectClassificationDrawer- v-if="classificationConfig"- :show="state.showClassificationDrawer"- :classification-config="classificationConfig"- @dismiss="state.showClassificationDrawer = false"- @select="onClassificationSelect"- />-<FeatureModalfeature="bb.feature.schema-template":open="state.showFeatureModal"@@ -139,7 +131,6 @@ import { Drawer, DrawerContent } from "@/components/v2";import {hasFeature,generateUniqueTabId,- useSettingV1Store,useSchemaEditorV1Store,} from "@/store";import { Engine } from "@/types/proto/v1/common";@@ -178,7 +169,6 @@ interface LocalState {selectedSchemaId: string;showFeatureModal: boolean;showSchemaTemplateDrawer: boolean;- showClassificationDrawer: boolean;tableNameModalContext?: {parentName: string;schemaId: string;@@ -188,14 +178,12 @@ interface LocalState {}const editorStore = useSchemaEditorV1Store();-const settingStore = useSettingV1Store();const currentTab = computed(() => editorStore.currentTab as DatabaseTabContext);const state = reactive<LocalState>({selectedSubtab: "table-list",selectedSchemaId: currentTab.value?.selectedSchemaId ?? "",showFeatureModal: false,showSchemaTemplateDrawer: false,- showClassificationDrawer: false,});const databaseV1 = computed(() => editorStore.currentDatabase ?? emptyDatabase()@@ -227,14 +215,6 @@ const shownTableList = computed(() => {table.name.includes(props.searchPattern.trim()));});-const classificationConfig = computed(() => {- if (!editorStore.project.dataClassificationConfigId) {- return;- }- return settingStore.getProjectClassification(- editorStore.project.dataClassificationConfigId- );-});const shouldShowSchemaSelector = computed(() => {return engine.value === Engine.POSTGRES;});@@ -281,18 +261,6 @@ watch(});-const onClassificationSelect = (classificationId: string) => {- state.showClassificationDrawer = false;- const table = tableList.value.find(- (table) => table.id === state.activeTableId- );- if (!table) {- return;- }- table.classification = classificationId;- state.activeTableId = undefined;-};-const handleChangeTab = (tab: SubtabType) => {state.selectedSubtab = tab;};diff --git a/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor.vue b/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor.vueindex 1bca60176a..6b433ac241 100644--- a/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor.vue+++ b/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor.vue@@ -44,22 +44,23 @@:class="getColumnClassList(column, row)">{{ getColumnSemanticType(column)?.title }}- <button- v-if="!readonly && getColumnSemanticType(column)"- :disabled="disableAlterColumn(column)"- class="w-4 h-4 p-0.5 hover:bg-control-bg-hover rounded cursor-pointer"- @click.prevent="onSemanticTypeRemove(column)"- >- <heroicons-outline:x class="w-3 h-3" />- </button>- <button- v-if="!readonly"- :disabled="disableAlterColumn(column)"- class="w-4 h-4 p-0.5 hover:bg-control-bg-hover rounded cursor-pointer"- @click.prevent="openSemanticTypeDrawer(column)"- >- <heroicons-outline:pencil class="w-3 h-3" />- </button>+ <div v-if="!readonly && !disableChangeTable" class="flex">+ <button+ v-if="getColumnSemanticType(column)"+ :disabled="disableAlterColumn(column)"+ class="w-4 h-4 p-0.5 hover:bg-control-bg-hover rounded cursor-pointer"+ @click.prevent="onSemanticTypeRemove(column)"+ >+ <heroicons-outline:x class="w-3 h-3" />+ </button>+ <button+ :disabled="disableAlterColumn(column)"+ class="w-4 h-4 p-0.5 hover:bg-control-bg-hover rounded cursor-pointer"+ @click.prevent="openSemanticTypeDrawer(column)"+ >+ <heroicons-outline:pencil class="w-3 h-3" />+ </button>+ </div></div><divv-if="classificationConfig"@@ -204,35 +205,48 @@</button></div><div+ v-if="isDev()"+ class="bb-grid-cell flex items-center column-cell"+ :class="getColumnClassList(column, row)"+ >+ <LabelsColumn :labels="column.config.labels" :show-count="1" />+ <button+ v-if="!readonly && !disableChangeTable"+ class="w-4 h-4 p-0.5 hover:bg-control-bg-hover rounded cursor-pointer"+ @click.prevent="openLabelsDrawer(column)"+ >+ <heroicons-outline:pencil class="w-3 h-3" />+ </button>+ </div>+ <div+ v-if="!readonly"class="bb-grid-cell flex justify-end items-center":class="getColumnClassList(column, row)">- <template v-if="!readonly">- <n-tooltip v-if="!isDroppedColumn(column)" trigger="hover">- <template #trigger>- <button- :disabled="disableChangeTable"- class="text-gray-500 cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"- @click="$emit('onDrop', column)"- >- <heroicons:trash class="w-4 h-auto" />- </button>- </template>- <span>{{ $t("schema-editor.actions.drop-column") }}</span>- </n-tooltip>- <n-tooltip v-else trigger="hover">- <template #trigger>- <button- class="text-gray-500 cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"- :disabled="disableChangeTable"- @click="$emit('onRestore', column)"- >- <heroicons:arrow-uturn-left class="w-4 h-auto" />- </button>- </template>- <span>{{ $t("schema-editor.actions.restore") }}</span>- </n-tooltip>- </template>+ <n-tooltip v-if="!isDroppedColumn(column)" trigger="hover">+ <template #trigger>+ <button+ :disabled="disableChangeTable"+ class="text-gray-500 cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"+ @click="$emit('onDrop', column)"+ >+ <heroicons:trash class="w-4 h-auto" />+ </button>+ </template>+ <span>{{ $t("schema-editor.actions.drop-column") }}</span>+ </n-tooltip>+ <n-tooltip v-else trigger="hover">+ <template #trigger>+ <button+ class="text-gray-500 cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"+ :disabled="disableChangeTable"+ @click="$emit('onRestore', column)"+ >+ <heroicons:arrow-uturn-left class="w-4 h-auto" />+ </button>+ </template>+ <span>{{ $t("schema-editor.actions.restore") }}</span>+ </n-tooltip></div></div></template>@@ -250,7 +264,7 @@:show="state.showClassificationDrawer":classification-config="classificationConfig"@dismiss="state.showClassificationDrawer = false"- @select="onClassificationSelect"+ @apply="onClassificationSelect"/><SemanticTypesDrawer@@ -260,6 +274,20 @@@dismiss="state.showSemanticTypesDrawer = false"@apply="onSemanticTypeApply($event)"/>++ <LabelEditorDrawer+ v-if="state.pendingUpdateColumn"+ :show="state.showLabelsDrawer"+ :readonly="false"+ :title="+ $t('db.labels-for-resource', {+ resource: `'${state.pendingUpdateColumn.name}'`,+ })+ "+ :labels="[state.pendingUpdateColumn.config.labels]"+ @dismiss="state.showLabelsDrawer = false"+ @apply="onLabelsApply"+ /></template><script lang="ts" setup>@@ -285,6 +313,7 @@ interface LocalState {pendingUpdateColumn?: Column;showClassificationDrawer: boolean;showSemanticTypesDrawer: boolean;+ showLabelsDrawer: boolean;}const props = withDefaults(@@ -325,6 +354,7 @@ defineEmits<{const state = reactive<LocalState>({showClassificationDrawer: false,showSemanticTypesDrawer: false,+ showLabelsDrawer: false,});const { t } = useI18n();@@ -395,9 +425,15 @@ const columnHeaderList = computed(() => {width: "minmax(auto, 7rem)",hide: !props.showForeignKey,},+ {+ title: t("common.labels"),+ width: "minmax(auto, 1fr)",+ hide: !isDev(),+ },{title: "",width: "30px",+ hide: props.readonly,},].filter((header) => !header.hide);});@@ -516,8 +552,12 @@ const openSemanticTypeDrawer = (column: Column) => {state.showSemanticTypesDrawer = true;};+const openLabelsDrawer = (column: Column) => {+ state.pendingUpdateColumn = column;+ state.showLabelsDrawer = true;+};+const onClassificationSelect = (classificationId: string) => {- state.showClassificationDrawer = false;if (!state.pendingUpdateColumn) {return;}@@ -525,7 +565,6 @@ const onClassificationSelect = (classificationId: string) => {};const onSemanticTypeApply = async (semanticTypeId: string) => {- state.showSemanticTypesDrawer = false;if (!state.pendingUpdateColumn) {return;}@@ -536,6 +575,16 @@ const onSemanticTypeApply = async (semanticTypeId: string) => {});};+const onLabelsApply = (labelsList: { [key: string]: string }[]) => {+ if (!state.pendingUpdateColumn) {+ return;+ }+ state.pendingUpdateColumn.config = ColumnConfig.fromPartial({+ ...state.pendingUpdateColumn.config,+ labels: labelsList[0],+ });+};+const onSemanticTypeRemove = async (column: Column) => {column.config = ColumnConfig.fromPartial({...column.config,diff --git a/frontend/src/components/SchemaEditorV1/Panels/TableList.vue b/frontend/src/components/SchemaEditorV1/Panels/TableList.vueindex 6eeb1ee461..d7a7120806 100644--- a/frontend/src/components/SchemaEditorV1/Panels/TableList.vue+++ b/frontend/src/components/SchemaEditorV1/Panels/TableList.vue@@ -125,7 +125,7 @@:show="state.showClassificationDrawer":classification-config="classificationConfig"@dismiss="state.showClassificationDrawer = false"- @select="onClassificationSelect"+ @apply="onClassificationSelect"/><FeatureModal@@ -234,7 +234,6 @@ const showClassificationDrawer = (table: Table) => {};const onClassificationSelect = (classificationId: string) => {- state.showClassificationDrawer = false;const table = tableList.value.find((table) => table.id === state.activeTableId);diff --git a/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue b/frontend/src/components/SchemaTemplate/FieldTemplateForm.vueindex 8732edaabb..8e393a48e8 100644--- a/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue+++ b/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue@@ -283,7 +283,7 @@:show="state.showClassificationDrawer":classification-config="classificationConfig"@dismiss="state.showClassificationDrawer = false"- @select="onClassificationSelect"+ @apply="onClassificationSelect"/><ColumnDefaultValueExpressionModal@@ -506,7 +506,6 @@ const onClassificationSelect = (id: string) => {return;}state.column.classification = id;- state.showClassificationDrawer = false;};const handleColumnDefaultInputChange = (event: Event) => {@@ -558,7 +557,6 @@ const handleSelectedColumnDefaultValueExpressionChange = (};const onSemanticTypeApply = async (semanticTypeId: string) => {- state.showSemanticTypesDrawer = false;state.config = ColumnConfig.fromPartial({...state.config,semanticTypeId,diff --git a/frontend/src/components/SchemaTemplate/SelectClassificationDrawer.vue b/frontend/src/components/SchemaTemplate/SelectClassificationDrawer.vueindex c2a4ba44ac..986f06a67d 100644--- a/frontend/src/components/SchemaTemplate/SelectClassificationDrawer.vue+++ b/frontend/src/components/SchemaTemplate/SelectClassificationDrawer.vue@@ -54,7 +54,7 @@ const props = defineProps<{const emit = defineEmits<{(event: "dismiss"): void;- (event: "select", classificationId: string): void;+ (event: "apply", classificationId: string): void;}>();interface LocalState {@@ -87,7 +87,8 @@ const nodeProps = ({ option }: { option: TreeOption }) => {if (!option.isLeaf || !option.key) {return;}- emit("select", option.key as string);+ emit("apply", option.key as string);+ emit("dismiss");},};};diff --git a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue b/frontend/src/components/SchemaTemplate/TableTemplateForm.vueindex 61bfeec948..357868cd01 100644--- a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue+++ b/frontend/src/components/SchemaTemplate/TableTemplateForm.vue@@ -204,7 +204,7 @@:show="state.showClassificationDrawer":classification-config="classificationConfig"@dismiss="state.showClassificationDrawer = false"- @select="onClassificationSelect"+ @apply="onClassificationSelect"/></template>@@ -410,6 +410,5 @@ const handleApplyColumnTemplate = (const onClassificationSelect = (id: string) => {state.table.classification = id;- state.showClassificationDrawer = false;};</script>diff --git a/frontend/src/components/SensitiveData/components/SemanticTypesDrawer.vue b/frontend/src/components/SensitiveData/components/SemanticTypesDrawer.vueindex e940cabe8d..46592774c8 100644--- a/frontend/src/components/SensitiveData/components/SemanticTypesDrawer.vue+++ b/frontend/src/components/SensitiveData/components/SemanticTypesDrawer.vue@@ -6,7 +6,7 @@:readonly="true":row-clickable="true":semantic-item-list="semanticItemList"- @on-select="$emit('apply', $event)"+ @on-select="onApply($event)"/></div></DrawerContent>@@ -33,7 +33,7 @@ const props = defineProps<{semanticTypeList: SemanticTypesSetting_SemanticType[];}>();-defineEmits<{+const emit = defineEmits<{(event: "dismiss"): void;(event: "apply", id: string): void;}>();@@ -47,4 +47,9 @@ const semanticItemList = computed((): SemanticItem[] => {};});});++const onApply = (semanticTypeId: string) => {+ emit("apply", semanticTypeId);+ emit("dismiss");+};</script>diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vueindex 8acd88b154..e8a8a1ef97 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue@@ -379,6 +379,5 @@ const onLabelsApply = async (labelsList: { [key: string]: string }[]) => {style: "SUCCESS",title: t("common.updated"),});- state.showLabelEditorDrawer = false;};</script>