Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: cannot apply the template (#16643)

ecmadao2f49b4908988
diff --git a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
index 6eacc334c5..428735a741 100644
--- a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
+++ b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
@@ -22,7 +22,10 @@ import { DatabaseLabelsCell } from "@/components/v2/Model/DatabaseV1Table/cells"
import { useSettingV1Store } from "@/store";
import type { Engine } from "@/types/proto/v1/common";
import type { SchemaTemplateSetting_FieldTemplate } from "@/types/proto/v1/setting_service";
-import { SchemaTemplateSetting, Setting_SettingName } from "@/types/proto/v1/setting_service";
+import {
+ SchemaTemplateSetting,
+ Setting_SettingName,
+} from "@/types/proto/v1/setting_service";
import { EngineIcon } from "../Icon";
import ClassificationLevelBadge from "./ClassificationLevelBadge.vue";
import { classificationConfig } from "./utils";
@@ -110,8 +113,11 @@ const columns = computed(
showCount={2}
/>
),
- },
- {
+ }
+ );
+
+ if (!props.readonly) {
+ cols.push({
title: t("common.operations"),
key: "operations",
width: 160,
@@ -125,35 +131,33 @@ const columns = computed(
>
<PencilIcon class="w-4 h-4" />
</MiniActionButton>
- {!props.readonly && (
- <NPopconfirm onPositiveClick={() => deleteTemplate(item.id)}>
- {{
- trigger: () => (
- <MiniActionButton
- onClick={(e: MouseEvent) => e.stopPropagation()}
- >
- <TrashIcon class="w-4 h-4" />
- </MiniActionButton>
- ),
- default: () => (
- <div class="whitespace-nowrap">
- {t("common.delete")} '{item.column?.name}'?
- </div>
- ),
- }}
- </NPopconfirm>
- )}
+ <NPopconfirm onPositiveClick={() => deleteTemplate(item.id)}>
+ {{
+ trigger: () => (
+ <MiniActionButton
+ onClick={(e: MouseEvent) => e.stopPropagation()}
+ >
+ <TrashIcon class="w-4 h-4" />
+ </MiniActionButton>
+ ),
+ default: () => (
+ <div class="whitespace-nowrap">
+ {t("common.delete")} '{item.column?.name}'?
+ </div>
+ ),
+ }}
+ </NPopconfirm>
</div>
),
- }
- );
+ });
+ }
return cols;
}
);
const rowProps = (row: SchemaTemplateSetting_FieldTemplate) => {
- if (!props.readonly && row.engine === props.engine) {
+ if (row.engine === props.engine) {
return {
style: "cursor: pointer;",
onClick: () => {
diff --git a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue b/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
index 2d8be2f7d7..92d53628cf 100644
--- a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
+++ b/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
@@ -20,7 +20,10 @@ import { MiniActionButton } from "@/components/v2";
import { useSettingV1Store } from "@/store";
import type { Engine } from "@/types/proto/v1/common";
import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto/v1/setting_service";
-import { SchemaTemplateSetting, Setting_SettingName } from "@/types/proto/v1/setting_service";
+import {
+ SchemaTemplateSetting,
+ Setting_SettingName,
+} from "@/types/proto/v1/setting_service";
import { EngineIcon } from "../Icon";
import ClassificationLevelBadge from "./ClassificationLevelBadge.vue";
import { classificationConfig } from "./utils";
@@ -72,13 +75,14 @@ const columns = computed(
});
}
- cols.push(
- {
- title: t("schema-template.form.comment"),
- key: "comment",
- render: (item) => item.table?.userComment ?? "",
- },
- {
+ cols.push({
+ title: t("schema-template.form.comment"),
+ key: "comment",
+ render: (item) => item.table?.userComment ?? "",
+ });
+
+ if (!props.readonly) {
+ cols.push({
title: t("common.operations"),
key: "operations",
width: 160,
@@ -92,35 +96,33 @@ const columns = computed(
>
<PencilIcon class="w-4 h-4" />
</MiniActionButton>
- {!props.readonly && (
- <NPopconfirm onPositiveClick={() => deleteTemplate(item.id)}>
- {{
- trigger: () => (
- <MiniActionButton
- onClick={(e: MouseEvent) => e.stopPropagation()}
- >
- <TrashIcon class="w-4 h-4" />
- </MiniActionButton>
- ),
- default: () => (
- <div class="whitespace-nowrap">
- {t("common.delete")} '{item.table?.name}'?
- </div>
- ),
- }}
- </NPopconfirm>
- )}
+ <NPopconfirm onPositiveClick={() => deleteTemplate(item.id)}>
+ {{
+ trigger: () => (
+ <MiniActionButton
+ onClick={(e: MouseEvent) => e.stopPropagation()}
+ >
+ <TrashIcon class="w-4 h-4" />
+ </MiniActionButton>
+ ),
+ default: () => (
+ <div class="whitespace-nowrap">
+ {t("common.delete")} '{item.table?.name}'?
+ </div>
+ ),
+ }}
+ </NPopconfirm>
</div>
),
- }
- );
+ });
+ }
return cols;
}
);
const rowProps = (row: SchemaTemplateSetting_TableTemplate) => {
- if (!props.readonly && row.engine === props.engine) {
+ if (row.engine === props.engine) {
return {
style: "cursor: pointer;",
onClick: () => {