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: add show diff checkbox (#10664)
Liu Ji1422abe86432
diff --git a/frontend/src/components/Branch/BranchDetailView.vue b/frontend/src/components/Branch/BranchDetailView.vueindex 05afd8ae2b..67d8d08aed 100644--- a/frontend/src/components/Branch/BranchDetailView.vue+++ b/frontend/src/components/Branch/BranchDetailView.vue@@ -80,13 +80,21 @@<NDivider class="!my-0" /><div- class="w-full flex flex-row justify-between items-center text-sm mt-1 gap-4"+ class="w-full flex flex-row justify-between items-center text-sm gap-4 h-[32px]">- <div class="flex flex-row justify-start items-center opacity-80">- <span class="mr-4 shrink-0"- >{{ $t("schema-designer.baseline-version") }}:</span- >- <DatabaseInfo class="flex-nowrap mr-4 shrink-0" :database="database" />+ <div+ class="flex-1 flex flex-row justify-start items-center opacity-80 whitespace-nowrap"+ >+ <span class="mr-4">{{ $t("schema-designer.baseline-version") }}:</span>+ <DatabaseInfo class="flex-nowrap" :database="database" />+ </div>+ <div+ v-if="!state.isEditing"+ class="flex flex-row justify-end items-center gap-x-1 whitespace-nowrap"+ >+ <NCheckbox v-model:checked="state.showDiff">+ {{ $t("branch.show-diff-with-branch-baseline") }}+ </NCheckbox></div></div>@@ -96,6 +104,7 @@:project="project":readonly="!state.isEditing":branch="dirtyBranch"+ :disable-diff-coloring="!state.isEditing && !state.showDiff"/></div><!-- Don't show delete button in view mode. -->@@ -124,7 +133,7 @@import { asyncComputed } from "@vueuse/core";import dayjs from "dayjs";import { cloneDeep } from "lodash-es";-import { NButton, NDivider, NInput, useDialog } from "naive-ui";+import { NButton, NCheckbox, NDivider, NInput, useDialog } from "naive-ui";import { Status } from "nice-grpc-common";import { CSSProperties, computed, nextTick, reactive, ref, watch } from "vue";import { useI18n } from "vue-i18n";@@ -165,9 +174,9 @@ import { validateBranchName } from "./utils";interface LocalState {branchId: string;+ showDiff: boolean;isEditing: boolean;isEditingBranchId: boolean;- showDiffEditor: boolean;isReverting: boolean;savingStatus: string;applyingToDatabaseStatus: boolean;@@ -190,9 +199,9 @@ const { runSQLCheck } = provideSQLCheckContext();const schemaDesignerRef = ref<InstanceType<typeof SchemaDesignEditorLite>>();const state = reactive<LocalState>({branchId: "",+ showDiff: false,isEditing: false,isEditingBranchId: false,- showDiffEditor: false,isReverting: false,savingStatus: "",applyingToDatabaseStatus: false,diff --git a/frontend/src/components/Branch/SchemaDesignEditorLite.vue b/frontend/src/components/Branch/SchemaDesignEditorLite.vueindex 44c614a211..2f90b798b5 100644--- a/frontend/src/components/Branch/SchemaDesignEditorLite.vue+++ b/frontend/src/components/Branch/SchemaDesignEditorLite.vue@@ -45,6 +45,7 @@:resource-type="'branch'":branch="branch":diff-when-ready="true"+ :disable-diff-coloring="disableDiffColoring"/></div><div@@ -91,6 +92,7 @@ const props = defineProps<{branch: Branch;readonly?: boolean;hideSQLCheckButton?: boolean;+ disableDiffColoring?: boolean;}>();const { t } = useI18n();diff --git a/frontend/src/components/SchemaEditorLite/Aside/BranchTree.vue b/frontend/src/components/SchemaEditorLite/Aside/BranchTree.vuedeleted file mode 100644index 684c3db970..0000000000--- a/frontend/src/components/SchemaEditorLite/Aside/BranchTree.vue+++ /dev/null@@ -1,818 +0,0 @@-<template>- <div- class="w-full h-full px-2 flex flex-col gap-y-2 relative overflow-y-hidden"- >- <div class="w-full flex pt-2 bg-white z-10 space-x-2">- <NInput- v-model:value="searchPattern"- size="small"- :placeholder="$t('schema-designer.search-tables')"- >- <template #prefix>- <heroicons-outline:search class="h-auto text-gray-300" />- </template>- </NInput>- <button- v-if="!readonly"- class="text-gray-400 hover:text-gray-500 disabled:cursor-not-allowed"- @click="handleCreateSchemaOrTable"- >- <heroicons-outline:plus class="w-4 h-auto" />- </button>- </div>- <div- ref="treeContainerElRef"- class="schema-designer-database-tree flex-1 pb-1 text-sm overflow-hidden select-none"- :data-height="treeContainerHeight"- >- <NTree- v-if="treeContainerHeight > 0"- ref="treeRef"- block-line- virtual-scroll- :style="{- height: `${treeContainerHeight}px`,- }"- :data="treeDataRef"- :pattern="searchPattern"- :render-prefix="renderPrefix"- :render-label="renderLabel"- :render-suffix="renderSuffix"- :node-props="nodeProps"- :expanded-keys="expandedKeysRef"- :selected-keys="selectedKeysRef"- :show-irrelevant-nodes="false"- :theme-overrides="{ nodeHeight: '28px' }"- @update:expanded-keys="handleExpandedKeysChange"- />- <NDropdown- trigger="manual"- placement="bottom-start"- :show="contextMenu.showDropdown"- :options="contextMenuOptions"- :x="contextMenu.clientX"- :y="contextMenu.clientY"- to="body"- @select="handleContextMenuDropdownSelect"- @clickoutside="handleDropdownClickoutside"- />- </div>- </div>-- <SchemaNameModal- v-if="state.schemaNameModalContext !== undefined"- :database="state.schemaNameModalContext.database"- :metadata="state.schemaNameModalContext.metadata"- @close="state.schemaNameModalContext = undefined"- />-- <TableNameModal- v-if="state.tableNameModalContext !== undefined"- :database="state.tableNameModalContext.database"- :metadata="state.tableNameModalContext.metadata"- :schema="state.tableNameModalContext.schema"- :table="state.tableNameModalContext.table"- @close="state.tableNameModalContext = undefined"- />-</template>--<script lang="ts" setup>-import { useElementSize } from "@vueuse/core";-import { cloneDeep, debounce, escape, head } from "lodash-es";-import { TreeOption, NEllipsis, NInput, NDropdown, NTree } from "naive-ui";-import { computed, watch, ref, h, reactive, nextTick, onMounted } from "vue";-import { VNodeChild } from "vue";-import { useI18n } from "vue-i18n";-import DuplicateIcon from "~icons/heroicons-outline/document-duplicate";-import EllipsisIcon from "~icons/heroicons-solid/ellipsis-horizontal";-import { SchemaIcon, TableIcon } from "@/components/Icon";-import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";-import { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";-import {- DatabaseMetadata,- SchemaMetadata,- TableMetadata,-} from "@/types/proto/v1/database_service";-import { getHighlightHTMLByKeyWords, isDescendantOf } from "@/utils";-import SchemaNameModal from "../Modals/SchemaNameModal.vue";-import TableNameModal from "../Modals/TableNameModal.vue";-import { useSchemaEditorContext } from "../context";-import { keyForResource, keyForResourceName } from "../context/common";-import { engineHasSchema } from "../engine-specs";-import NodeCheckbox from "./NodeCheckbox";-import {- TreeNode,- TreeNodeForColumn,- TreeNodeForSchema,- TreeNodeForTable,-} from "./types";--interface TreeContextMenu {- showDropdown: boolean;- clientX: number;- clientY: number;- treeNode?: TreeNode;-}--interface LocalState {- shouldRelocateTreeNode: boolean;- schemaNameModalContext?: {- database: ComposedDatabase;- metadata: DatabaseMetadata;- };- tableNameModalContext?: {- database: ComposedDatabase;- metadata: DatabaseMetadata;- schema: SchemaMetadata;- table?: TableMetadata;- };-}--const { t } = useI18n();--const state = reactive<LocalState>({- shouldRelocateTreeNode: false,-});-const {- events,- targets,- readonly,- currentTab,- addTab,- markEditStatus,- removeEditStatus,- getSchemaStatus,- getTableStatus,- getColumnStatus,- upsertTableConfig,- selectionEnabled,- queuePendingScrollToTable,- queuePendingScrollToColumn,-} = useSchemaEditorContext();-const treeContainerElRef = ref<HTMLElement>();-const { height: treeContainerHeight } = useElementSize(- treeContainerElRef,- undefined,- {- box: "content-box",- }-);-const treeRef = ref<InstanceType<typeof NTree>>();-const searchPattern = ref("");-const expandedKeysRef = ref<string[]>([]);-const selectedKeysRef = ref<string[]>([]);-const treeDataRef = ref<TreeNode[]>([]);-const treeNodeMap = new Map<string, TreeNode>();-const contextMenu = reactive<TreeContextMenu>({- showDropdown: false,- clientX: 0,- clientY: 0,- treeNode: undefined,-});--// NOTE: we only support editing one branch for now.-const database = computed(() => {- return targets.value[0].database;-});-const metadata = computed(() => {- return targets.value[0].metadata;-});-const engine = computed(() => {- return database.value.instanceEntity.engine;-});--const schemaList = computed(() => {- return metadata.value.schemas;-});-const flattenTableList = computed(() => {- return metadata.value.schemas.flatMap((schema) => schema.tables);-});--const metadataForSchema = (schema: SchemaMetadata) => {- return {- database: metadata.value,- schema,- };-};-const metadataForTable = (schema: SchemaMetadata, table: TableMetadata) => {- return { ...metadataForSchema(schema), table };-};-const statusForSchema = (schema: SchemaMetadata) => {- return getSchemaStatus(database.value, metadataForSchema(schema));-};--const contextMenuOptions = computed(() => {- const { treeNode } = contextMenu;- if (!treeNode) return;-- if (treeNode.type === "schema") {- const options = [];- if (engine.value === Engine.POSTGRES) {- const { schema } = treeNode.metadata;-- const status = statusForSchema(schema);- const isDropped = status === "dropped";- if (isDropped) {- options.push({- key: "restore",- label: t("schema-editor.actions.restore"),- });- } else {- options.push({- key: "create-table",- label: t("schema-editor.actions.create-table"),- disabled: readonly.value,- });- options.push({- key: "drop",- label: t("schema-editor.actions.drop-schema"),- disabled: readonly.value,- });- }- }- return options;- } else if (treeNode.type === "table") {- const status = getTableStatus(treeNode.db, treeNode.metadata);- const options = [];- if (status === "dropped") {- options.push({- key: "restore",- label: t("schema-editor.actions.restore"),- });- } else {- options.push({- key: "drop",- label: t("schema-editor.actions.drop-table"),- disabled: readonly.value,- });- }- if (status === "created") {- options.push({- key: "rename",- label: t("schema-editor.actions.rename"),- });- }- return options;- }-- return [];-});--const upsertExpandedKeys = (key: string) => {- if (expandedKeysRef.value.includes(key)) return;- expandedKeysRef.value.push(key);-};-const expandNodeRecursively = (node: TreeNode) => {- if (node.type === "column") {- // column nodes are not expandable- expandNodeRecursively(node.parent);- }- if (node.type === "table") {- const key = keyForResource(node.db, node.metadata);- upsertExpandedKeys(key);- expandNodeRecursively(node.parent);- }- if (node.type === "schema") {- const key = keyForResource(node.db, node.metadata);- upsertExpandedKeys(key);- if (node.parent) {- expandNodeRecursively(node.parent);- }- }- if (node.type === "database") {- const key = node.db.name;- upsertExpandedKeys(key);- }-};-const buildBranchTreeData = (openFirstChild = false) => {- treeNodeMap.clear();- const db = database.value;- const treeNodeList = schemaList.value.map((schema) => {- const schemaTreeNode: TreeNodeForSchema = {- type: "schema",- key: keyForResource(db, {- schema,- }),- parent: undefined,- label: schema.name,- isLeaf: false,- db,- metadata: {- database: metadata.value,- schema,- },- children: [],- };- schemaTreeNode.children = schema.tables.map((table) => {- const tableTreeNode: TreeNodeForTable = {- type: "table",- key: keyForResource(db, {- schema,- table,- }),- parent: schemaTreeNode,- label: table.name,- children: [],- isLeaf: false,- db,- metadata: {- database: metadata.value,- schema,- table,- },- };- tableTreeNode.children = table.columns.map((column) => {- const columnTreeNode: TreeNodeForColumn = {- type: "column",- key: keyForResource(db, {- schema,- table,- column,- }),- parent: tableTreeNode,- label: column.name,- children: [],- isLeaf: true,- db,- metadata: {- database: metadata.value,- schema,- table,- column,- },- };- treeNodeMap.set(columnTreeNode.key, columnTreeNode);- return columnTreeNode;- });- if (tableTreeNode.children.length === 0) {- tableTreeNode.isLeaf = true;- }- treeNodeMap.set(tableTreeNode.key, tableTreeNode);- return tableTreeNode;- });- if (schemaTreeNode.children.length === 0) {- schemaTreeNode.isLeaf = true;- }- treeNodeMap.set(schemaTreeNode.key, schemaTreeNode);- return schemaTreeNode;- });- treeDataRef.value = treeNodeList;- if (openFirstChild) {- const firstSchemaNode = head(treeDataRef.value);- if (firstSchemaNode) {- nextTick(() => {- // Auto expand the first tree node.- openTabForTreeNode(firstSchemaNode);- });- }- }-};--onMounted(() => {- buildBranchTreeData(/* openFirstChild */ true);-});--const debouncedBuildBranchTreeData = debounce(buildBranchTreeData, 100);-useEmitteryEventListener(events, "rebuild-tree", (params) => {- debouncedBuildBranchTreeData(params.openFirstChild);-});--const tabWatchKey = computed(() => {- const tab = currentTab.value;- if (!tab) return undefined;- if (tab.type === "database") {- return keyForResourceName(tab.database.name, tab.selectedSchema);- }- return keyForResource(tab.database, tab.metadata);-});-watch(tabWatchKey, () => {- requestAnimationFrame(() => {- const tab = currentTab.value;- if (!tab) {- selectedKeysRef.value = [];- return;- }-- if (tab.type === "database") {- const { database, selectedSchema: schema } = tab;- if (schema) {- const key = keyForResourceName(database.name, schema);- const node = treeNodeMap.get(key);- if (node) {- expandNodeRecursively(node);- }- selectedKeysRef.value = [key];- }- } else if (tab.type === "table") {- const {- database,- metadata: { schema, table },- } = tab;- const tableKey = keyForResource(database, { schema, table });- const node = treeNodeMap.get(tableKey);- if (node) {- expandNodeRecursively(node);- }- selectedKeysRef.value = [tableKey];- }-- if (state.shouldRelocateTreeNode) {- nextTick(() => {- treeRef.value?.scrollTo({- key: selectedKeysRef.value[0],- });- });- }- });-});--// Render prefix icons before label text.-const renderPrefix = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- const children: VNodeChild[] = [];- if (selectionEnabled.value) {- children.push(- h(NodeCheckbox, {- node: treeNode,- })- );- }- if (treeNode.type === "schema") {- children.push(- h(SchemaIcon, {- class: "w-4 h-auto text-gray-400",- })- );- } else if (treeNode.type === "table") {- children.push(- h(TableIcon, {- class: "w-4 h-auto text-gray-400",- })- );- }- if (children.length > 0) {- return h("div", { class: "flex flex-row items-center gap-x-1" }, children);- }- return null;-};--// Render label text.-const renderLabel = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- const additionalClassList: string[] = ["select-none"];- let label = treeNode.label;-- if (treeNode.type === "schema") {- if (engine.value !== Engine.POSTGRES) {- label = t("db.tables");- }- const status = getSchemaStatus(treeNode.db, treeNode.metadata);- additionalClassList.push(status);- } else if (treeNode.type === "table") {- const status = getTableStatus(treeNode.db, treeNode.metadata);- additionalClassList.push(status);- } else if (treeNode.type === "column") {- const { db, metadata } = treeNode;- const status = getColumnStatus(db, metadata);- additionalClassList.push(status);- const { name } = metadata.column;- if (name) {- label = name;- } else {- label = `<${t("common.untitled")}>`;- additionalClassList.push("text-control-placeholder");- }- }-- return h(- NEllipsis,- {- class: additionalClassList.join(" "),- },- () => [- h("span", {- innerHTML: getHighlightHTMLByKeyWords(- escape(label),- escape(searchPattern.value)- ),- }),- ]- );-};--const handleDuplicateTable = (schema: SchemaMetadata, table: TableMetadata) => {- const db = database.value;- const matchPattern = new RegExp(- `^${getOriginalName(table.name)}` + "(_copy[0-9]{0,}){0,1}$"- );- const copiedTableNames = flattenTableList.value- .filter((table) => {- return matchPattern.test(table.name);- })- .sort((t1, t2) => {- return extractDuplicateNumber(t1.name) - extractDuplicateNumber(t2.name);- });- const targetName = copiedTableNames.slice(-1)[0]?.name ?? table.name;-- const newTable = cloneDeep(table);- newTable.name = getDuplicateName(targetName);- schema.tables.push(newTable);- markEditStatus(db, metadataForTable(schema, newTable), "created");- newTable.columns.forEach((newColumn) => {- markEditStatus(- db,- { ...metadataForTable(schema, newTable), column: newColumn },- "created"- );- });- const tableConfig = metadata.value.schemaConfigs- .find((sc) => sc.name === schema.name)- ?.tableConfigs.find((tc) => tc.name === table.name);- if (tableConfig) {- const tableConfigCopy = cloneDeep(tableConfig);- tableConfigCopy.name = newTable.name;- upsertTableConfig(- db,- {- database: metadata.value,- schema,- table: newTable,- },- (config) => {- Object.assign(config, tableConfigCopy);- }- );- }- addTab({- type: "table",- database: db,- metadata: {- database: metadata.value,- schema: schema,- table: newTable,- },- });- queuePendingScrollToTable({- db,- metadata: {- database: metadata.value,- schema: schema,- table: newTable,- },- });- events.emit("rebuild-tree", {- openFirstChild: false,- });-};--// Render a 'menu' icon in the right of the node-const renderSuffix = ({ option }: { option: TreeOption }) => {- if (readonly.value) {- return null;- }-- const treeNode = option as TreeNode;- const menuIcon = h(EllipsisIcon, {- class: "w-4 h-auto text-gray-600",- onClick: (e) => {- handleShowDropdown(e, treeNode);- },- });- const duplicateIcon = h(DuplicateIcon, {- class: "w-4 h-auto mr-2 text-gray-600",- onClick: (e) => {- e.preventDefault();- e.stopPropagation();- e.stopImmediatePropagation();-- const { schema, table } = (treeNode as TreeNodeForTable).metadata;- if (!schema || !table) {- return;- }- handleDuplicateTable(schema, table);- },- });- if (treeNode.type === "schema") {- if (engine.value === Engine.POSTGRES) {- return [menuIcon];- }- } else if (treeNode.type === "table") {- const icons = [menuIcon];- if (!readonly.value) {- icons.unshift(duplicateIcon);- }- return icons;- }- return null;-};--const getOriginalName = (name: string): string => {- return name.replace(/_copy[0-9]{0,}$/, "");-};--const extractDuplicateNumber = (name: string): number => {- const match = /_copy[0-9]{0,}$/.exec(name);- if (!match) {- return -1;- }-- const num = Number(match[0].replace("_copy", "0"));- if (Number.isNaN(num)) {- return -1;- }- return num;-};--const getDuplicateName = (name: string): string => {- const num = extractDuplicateNumber(name);- if (num < 0) {- return `${name}_copy`;- }- return `${getOriginalName(name)}_copy${num + 1}`;-};--const handleShowDropdown = (e: MouseEvent, treeNode: TreeNode) => {- e.preventDefault();- e.stopPropagation();- contextMenu.treeNode = treeNode;- contextMenu.showDropdown = true;- contextMenu.clientX = e.clientX;- contextMenu.clientY = e.clientY;- selectedKeysRef.value = [treeNode.key];-};--const handleCreateSchemaOrTable = () => {- if (!engineHasSchema(engine.value)) {- const schema = head(schemaList.value);- if (schema) {- state.tableNameModalContext = {- database: database.value,- metadata: metadata.value,- schema,- table: undefined,- };- }- } else {- state.schemaNameModalContext = {- database: database.value,- metadata: metadata.value,- };- }-};--// Set event handler to tree nodes.-const nodeProps = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- return {- onClick(e: MouseEvent) {- // Check if clicked on the content part.- // And ignore the fold/unfold arrow.- if (isDescendantOf(e.target as Element, ".n-tree-node-content")) {- openTabForTreeNode(treeNode);- } else {- nextTick(() => {- selectedKeysRef.value = [];- });- }- },- onContextMenu(e: MouseEvent) {- handleShowDropdown(e, treeNode);- },- };-};--const openTabForTreeNode = (node: TreeNode) => {- state.shouldRelocateTreeNode = false;-- if (node.type === "column") {- openTabForTreeNode(node.parent);- queuePendingScrollToColumn({- db: node.db,- metadata: node.metadata,- });- return;- } else if (node.type === "table") {- addTab({- type: "table",- database: database.value,- metadata: node.metadata,- });- expandNodeRecursively(node);- } else if (node.type === "schema") {- expandNodeRecursively(node);- addTab({- type: "database",- database: database.value,- metadata: {- database: metadata.value,- },- selectedSchema: node.metadata.schema.name,- });- }-- state.shouldRelocateTreeNode = true;-};--const handleContextMenuDropdownSelect = async (key: string) => {- const { treeNode } = contextMenu;- if (!treeNode) {- return;- }-- if (treeNode.type === "schema") {- const { schema } = treeNode.metadata;- if (key === "create-table") {- state.tableNameModalContext = {- database: database.value,- metadata: metadata.value,- schema,- };- } else if (key === "drop") {- markEditStatus(database.value, metadataForSchema(schema), "dropped");- } else if (key === "restore") {- removeEditStatus(- database.value,- metadataForSchema(schema),- /* recursive */ false- );- }- } else if (treeNode.type === "table") {- const { schema, table } = treeNode.metadata;- if (key === "rename") {- state.tableNameModalContext = {- database: database.value,- metadata: metadata.value,- schema,- table,- };- } else if (key === "drop") {- // We don't physically remove it, mark it as 'dropped' instead- // If it a 'created' table, it will remains till the page is refreshed.- markEditStatus(- database.value,- metadataForTable(schema, table),- "dropped"- );- } else if (key === "restore") {- removeEditStatus(- database.value,- metadataForTable(schema, table),- /* recursive */ false- );- }- }- contextMenu.showDropdown = false;-};--const handleDropdownClickoutside = (e: MouseEvent) => {- if (- !isDescendantOf(e.target as Element, ".n-tree-node-wrapper") ||- e.button !== 2- ) {- selectedKeysRef.value = [];- contextMenu.showDropdown = false;- }-};--const handleExpandedKeysChange = (expandedKeys: string[]) => {- expandedKeysRef.value = expandedKeys;-};-</script>--<style lang="postcss" scoped>-.schema-designer-database-tree :deep(.n-tree-node-wrapper) {- @apply !p-0;-}-.schema-designer-database-tree :deep(.n-tree-node-content) {- @apply !pl-2 text-sm;-}-.schema-designer-database-tree :deep(.n-tree-node-indent) {- width: 0.25rem;-}-.schema-designer-database-tree :deep(.n-tree-node-content__suffix) {- @apply rounded-sm !hidden hover:opacity-80;-}-.schema-designer-database-tree- :deep(.n-tree-node-wrapper:hover .n-tree-node-content__suffix) {- @apply !flex;-}-.schema-designer-database-tree- :deep(.n-tree-node-wrapper- .n-tree-node--selected- .n-tree-node-content__suffix) {- @apply !flex;-}-.schema-designer-database-tree :deep(.n-tree-node-switcher) {- @apply px-0 !w-4 !h-7;-}-.schema-designer-database-tree :deep(.n-tree-node-content .created) {- @apply text-green-700;-}-.schema-designer-database-tree :deep(.n-tree-node-content .dropped) {- @apply text-red-700 line-through;-}-.schema-designer-database-tree :deep(.n-tree-node-content .updated) {- @apply text-yellow-700;-}-</style>diff --git a/frontend/src/components/SchemaEditorLite/Aside/DatabaseTree.vue b/frontend/src/components/SchemaEditorLite/Aside/DatabaseTree.vuedeleted file mode 100644index 1e2023833e..0000000000--- a/frontend/src/components/SchemaEditorLite/Aside/DatabaseTree.vue+++ /dev/null@@ -1,776 +0,0 @@-<template>- <div- class="w-full h-full pl-1 pr-2 flex flex-col gap-y-2 relative overflow-y-hidden"- >- <div class="w-full sticky top-0 pt-2 h-12 bg-white z-10">- <NInput- v-model:value="searchPattern"- :placeholder="$t('schema-editor.search-database-and-table')"- >- <template #prefix>- <heroicons-outline:search class="w-4 h-auto text-gray-300" />- </template>- </NInput>- </div>- <div- ref="treeContainerElRef"- class="schema-editor-database-tree flex-1 pb-1 text-sm overflow-hidden select-none"- :data-height="treeContainerHeight"- >- <NTree- v-if="treeContainerHeight > 0"- ref="treeRef"- block-line- virtual-scroll- :style="{- height: `${treeContainerHeight}px`,- }"- :data="treeDataRef"- :pattern="searchPattern"- :render-prefix="renderPrefix"- :render-label="renderLabel"- :render-suffix="renderSuffix"- :node-props="nodeProps"- :expanded-keys="expandedKeysRef"- :selected-keys="selectedKeysRef"- :show-irrelevant-nodes="false"- :theme-overrides="{ nodeHeight: '28px' }"- @update:expanded-keys="handleExpandedKeysChange"- />- <NDropdown- trigger="manual"- placement="bottom-start"- :show="contextMenu.showDropdown"- :options="contextMenuOptions"- :x="contextMenu.clientX"- :y="contextMenu.clientY"- to="body"- @select="handleContextMenuDropdownSelect"- @clickoutside="handleDropdownClickoutside"- />- </div>- </div>-- <SchemaNameModal- v-if="state.schemaNameModalContext !== undefined"- :database="state.schemaNameModalContext.db"- :metadata="state.schemaNameModalContext.database"- @close="state.schemaNameModalContext = undefined"- />-- <TableNameModal- v-if="state.tableNameModalContext !== undefined"- :database="state.tableNameModalContext.db"- :metadata="state.tableNameModalContext.database"- :schema="state.tableNameModalContext.schema"- :table="state.tableNameModalContext.table"- @close="state.tableNameModalContext = undefined"- />-</template>--<script lang="ts" setup>-import { useElementSize } from "@vueuse/core";-import { debounce, escape, head } from "lodash-es";-import {- TreeOption,- NEllipsis,- NInput,- NDropdown,- NTree,- DropdownOption,-} from "naive-ui";-import { computed, onMounted, watch, ref, h, reactive, nextTick } from "vue";-import { useI18n } from "vue-i18n";-import EllipsisIcon from "~icons/heroicons-solid/ellipsis-horizontal";-import { DatabaseIcon, SchemaIcon, TableIcon } from "@/components/Icon";-import { InstanceV1EngineIcon } from "@/components/v2";-import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";-import { ComposedDatabase, ComposedInstance } from "@/types";-import { Engine } from "@/types/proto/v1/common";-import {- DatabaseMetadata,- SchemaMetadata,- TableMetadata,-} from "@/types/proto/v1/database_service";-import { getHighlightHTMLByKeyWords, groupBy, isDescendantOf } from "@/utils";-import SchemaNameModal from "../Modals/SchemaNameModal.vue";-import TableNameModal from "../Modals/TableNameModal.vue";-import { useSchemaEditorContext } from "../context";-import { keyForResource, keyForResourceName } from "../context/common";-import { engineHasSchema } from "../engine-specs";-import {- BaseTreeNode,- TreeNodeForDatabase as CommonDatabaseNode,- TreeNodeForSchema as CommonSchemaNode,- TreeNodeForTable as CommonTableNode,- TreeNodeForColumn as CommonColumnNode,-} from "./types";--interface TreeNodeForInstance extends BaseTreeNode {- type: "instance";- instance: ComposedInstance;- children: TreeNodeForDatabase[];-}--interface TreeNodeForDatabase extends CommonDatabaseNode {- parent: TreeNodeForInstance;- instance: ComposedInstance;- children: TreeNodeForSchema[];-}-interface TreeNodeForSchema extends CommonSchemaNode {- parent: TreeNodeForDatabase;- instance: ComposedInstance;- children: TreeNodeForTable[];-}-interface TreeNodeForTable extends CommonTableNode {- parent: TreeNodeForSchema;- instance: ComposedInstance;- children: TreeNodeForColumn[];-}-interface TreeNodeForColumn extends CommonColumnNode {- parent: TreeNodeForTable;- instance: ComposedInstance;- isLeaf: true;-}--type TreeNode =- | TreeNodeForInstance- | TreeNodeForDatabase- | TreeNodeForSchema- | TreeNodeForTable- | TreeNodeForColumn;--interface TreeContextMenu {- showDropdown: boolean;- clientX: number;- clientY: number;- treeNode?: TreeNode;-}--interface LocalState {- shouldRelocateTreeNode: boolean;- schemaNameModalContext?: {- db: ComposedDatabase;- database: DatabaseMetadata;- schema?: SchemaMetadata;- };- tableNameModalContext?: {- db: ComposedDatabase;- database: DatabaseMetadata;- schema: SchemaMetadata;- table?: TableMetadata;- };-}--const { t } = useI18n();-const {- events,- targets,- currentTab,- addTab,- markEditStatus,- removeEditStatus,- getSchemaStatus,- getTableStatus,- getColumnStatus,- queuePendingScrollToColumn,-} = useSchemaEditorContext();-const state = reactive<LocalState>({- shouldRelocateTreeNode: false,-});--const contextMenu = reactive<TreeContextMenu>({- showDropdown: false,- clientX: 0,- clientY: 0,- treeNode: undefined,-});-const treeContainerElRef = ref<HTMLElement>();-const { height: treeContainerHeight } = useElementSize(- treeContainerElRef,- undefined,- {- box: "content-box",- }-);-const treeRef = ref<InstanceType<typeof NTree>>();-const searchPattern = ref("");-const expandedKeysRef = ref<string[]>([]);-const selectedKeysRef = ref<string[]>([]);-const treeDataRef = ref<TreeNode[]>([]);-const treeNodeMap = new Map<string, TreeNode>();--const contextMenuOptions = computed(() => {- const treeNode = contextMenu.treeNode;- if (!treeNode) return [];- const { engine } = treeNode.instance;- if (treeNode.type === "database") {- const options: DropdownOption[] = [];- if (engineHasSchema(engine)) {- options.push({- key: "create-schema",- label: t("schema-editor.actions.create-schema"),- });- } else {- options.push({- key: "create-table",- label: t("schema-editor.actions.create-table"),- });- }- return options;- } else if (treeNode.type === "schema") {- const options: DropdownOption[] = [];- if (engine === Engine.POSTGRES) {- const status = getSchemaStatus(treeNode.db, treeNode.metadata);- if (status === "dropped") {- options.push({- key: "restore",- label: t("schema-editor.actions.restore"),- });- } else {- options.push({- key: "create-table",- label: t("schema-editor.actions.create-table"),- });- options.push({- key: "rename",- label: t("schema-editor.actions.rename"),- });- options.push({- key: "drop-schema",- label: t("schema-editor.actions.drop-schema"),- });- }- }- return options;- } else if (treeNode.type === "table") {- const options: DropdownOption[] = [];- const status = getTableStatus(treeNode.db, treeNode.metadata);- if (status === "dropped") {- options.push({- key: "restore",- label: t("schema-editor.actions.restore"),- });- } else {- options.push({- key: "rename",- label: t("schema-editor.actions.rename"),- });- options.push({- key: "drop",- label: t("schema-editor.actions.drop-table"),- });- }- return options;- }-- return [];-});--const upsertExpandedKeys = (key: string) => {- if (expandedKeysRef.value.includes(key)) return;- expandedKeysRef.value.push(key);-};-const expandNodeRecursively = (node: TreeNode) => {- if (node.type === "column") {- // column nodes are not expandable- expandNodeRecursively(node.parent);- }- if (node.type === "table") {- const key = keyForResource(node.db, node.metadata);- upsertExpandedKeys(key);- expandNodeRecursively(node.parent);- }- if (node.type === "schema") {- const key = keyForResource(node.db, node.metadata);- upsertExpandedKeys(key);- expandNodeRecursively(node.parent);- }- if (node.type === "database") {- const key = node.db.name;- upsertExpandedKeys(key);- expandNodeRecursively(node.parent);- }- if (node.type === "instance") {- const key = node.instance.name;- upsertExpandedKeys(key);- }-};-const buildDatabaseTreeData = (openFirstChild: boolean) => {- const groupedByInstance = groupBy(- targets.value,- (target) => target.database.instance- );- treeNodeMap.clear();- const treeNodeList = Array.from(groupedByInstance).map(([_, targets]) => {- const instance = targets[0].database.instanceEntity;- const instanceNode: TreeNodeForInstance = {- type: "instance",- key: instance.name,- label: instance.title,- isLeaf: false,- instance,- children: [],- };- instanceNode.children = targets.map((target) => {- const db = target.database;- const databaseNode: TreeNodeForDatabase = {- type: "database",- key: db.name,- parent: instanceNode,- label: db.databaseName,- isLeaf: false,- instance,- db,- metadata: {- database: target.metadata,- },- children: [],- };- databaseNode.children = target.metadata.schemas.map((schema) => {- const metadata = {- database: target.metadata,- schema,- };- const schemaNode: TreeNodeForSchema = {- type: "schema",- parent: databaseNode,- key: keyForResource(db, metadata),- label: schema.name,- isLeaf: false,- instance,- db,- metadata,- children: [],- };- schemaNode.children = schema.tables.map((table) => {- const metadata = {- database: target.metadata,- schema,- table,- };- const tableNode: TreeNodeForTable = {- type: "table",- parent: schemaNode,- key: keyForResource(db, metadata),- label: table.name,- isLeaf: false,- instance,- db,- metadata,- children: [],- };- tableNode.children = table.columns.map((column) => {- const metadata = {- database: target.metadata,- schema,- table,- column,- };- const columnNode: TreeNodeForColumn = {- type: "column",- key: keyForResource(db, {- schema,- table,- column,- }),- parent: tableNode,- label: column.name,- children: [],- isLeaf: true,- db,- instance,- metadata,- };- treeNodeMap.set(columnNode.key, columnNode);- return columnNode;- });- treeNodeMap.set(tableNode.key, tableNode);- return tableNode;- });- treeNodeMap.set(schemaNode.key, schemaNode);- return schemaNode;- });- treeNodeMap.set(databaseNode.key, databaseNode);- return databaseNode;- });- treeNodeMap.set(instanceNode.key, instanceNode);- return instanceNode;- });-- treeDataRef.value = treeNodeList;-- if (openFirstChild) {- const firstInstanceNode = head(treeNodeList) as- | TreeNodeForInstance- | undefined;- const firstDatabaseNode = head(firstInstanceNode?.children);- const firstSchemaNode = head(firstDatabaseNode?.children);- if (firstSchemaNode) {- nextTick(() => {- // Auto expand the first tree node.- openTabForTreeNode(firstSchemaNode);- });- }- }-};-const debouncedBuildDatabaseTreeData = debounce(buildDatabaseTreeData, 100);-useEmitteryEventListener(events, "rebuild-tree", (params) => {- debouncedBuildDatabaseTreeData(params.openFirstChild);-});--const tabWatchKey = computed(() => {- const tab = currentTab.value;- if (!tab) return undefined;- if (tab.type === "database") {- return keyForResourceName(tab.database.name, tab.selectedSchema);- }- return keyForResource(tab.database, tab.metadata);-});-// Sync tree expandedKeys and selectedKeys with tabs-watch(tabWatchKey, () => {- requestAnimationFrame(() => {- const tab = currentTab.value;- if (!tab) {- selectedKeysRef.value = [];- return;- }-- if (tab.type === "database") {- const { database, selectedSchema: schema } = tab;- if (schema) {- const key = keyForResourceName(database.name, schema);- const node = treeNodeMap.get(key);- if (node) {- expandNodeRecursively(node);- }- selectedKeysRef.value = [key];- }- } else if (tab.type === "table") {- const {- database,- metadata: { schema, table },- } = tab;- const schemaKey = keyForResource(database, { schema });- const schemaNode = treeNodeMap.get(schemaKey);- if (schemaNode) {- expandNodeRecursively(schemaNode);- }- const tableKey = keyForResource(database, { schema, table });- selectedKeysRef.value = [tableKey];- }-- if (state.shouldRelocateTreeNode) {- nextTick(() => {- treeRef.value?.scrollTo({- key: selectedKeysRef.value[0],- });- });- }- });-});--const openTabForTreeNode = (node: TreeNode) => {- state.shouldRelocateTreeNode = false;-- if (node.type === "column") {- openTabForTreeNode(node.parent);- queuePendingScrollToColumn({- db: node.db,- metadata: node.metadata,- });- return;- } else if (node.type === "table") {- expandNodeRecursively(node);- addTab({- type: "table",- database: node.db,- metadata: node.metadata,- });- } else if (node.type === "schema") {- expandNodeRecursively(node);- addTab({- type: "database",- database: node.db,- metadata: node.metadata,- selectedSchema: node.metadata.schema.name,- });- }-- state.shouldRelocateTreeNode = true;-};--onMounted(() => {- buildDatabaseTreeData(/* openFirstChild */ true);-});--// Render prefix icons before label text.-const renderPrefix = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;-- if (treeNode.type === "instance") {- const { instance } = treeNode;- const children = [- h(InstanceV1EngineIcon, {- instance,- }),- h(- "span",- {- class: "text-gray-500 text-sm",- },- `(${instance.environmentEntity.title})`- ),- ];-- return h("span", { class: "flex items-center gap-x-1" }, children);- } else if (treeNode.type === "database") {- return h("span", { class: "flex items-center gap-x-1" }, [- h(DatabaseIcon, {- class: "w-4 h-auto text-gray-400",- }),- h(- "span",- {- class: "text-gray-500 text-sm",- },- `(${treeNode.db.effectiveEnvironmentEntity.title})`- ),- ]);- } else if (treeNode.type === "schema") {- return h(SchemaIcon, {- class: "w-4 h-auto text-gray-400",- });- } else if (treeNode.type === "table") {- return h(TableIcon, {- class: "w-4 h-auto text-gray-400",- });- }- return null;-};--// Render label text.-const renderLabel = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- const additionalClassList: string[] = ["select-none"];- let label = treeNode.label;-- if (treeNode.type === "schema") {- const { db, metadata } = treeNode;- additionalClassList.push(getSchemaStatus(db, metadata));-- if (db.instanceEntity.engine !== Engine.POSTGRES) {- label = t("db.tables");- } else {- label = metadata.schema.name;- }- } else if (treeNode.type === "table") {- const { db, metadata } = treeNode;- additionalClassList.push(getTableStatus(db, metadata));- label = metadata.table.name;- } else if (treeNode.type === "column") {- const { db, metadata } = treeNode;- additionalClassList.push(getColumnStatus(db, metadata));- const { name } = metadata.column;- if (name) {- label = name;- } else {- label = `<${t("common.untitled")}>`;- additionalClassList.push("text-control-placeholder italic");- }- }-- return h(- NEllipsis,- {- class: additionalClassList.join(" "),- },- () => [- h("span", {- innerHTML: getHighlightHTMLByKeyWords(- escape(label),- escape(searchPattern.value)- ),- }),- ]- );-};--// Render a 'menu' icon in the right of the node-const renderSuffix = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- const icon = h(EllipsisIcon, {- class: "w-4 h-auto text-gray-600",- onClick: (e) => {- handleShowDropdown(e, treeNode);- },- });- const { engine } = treeNode.instance;- if (treeNode.type === "database") {- return icon;- } else if (treeNode.type === "schema") {- if (engine === Engine.POSTGRES) {- return icon;- }- } else if (treeNode.type === "table") {- return icon;- }- return null;-};--const handleShowDropdown = (e: MouseEvent, treeNode: TreeNode) => {- e.preventDefault();- e.stopPropagation();- contextMenu.treeNode = treeNode;- contextMenu.showDropdown = true;- contextMenu.clientX = e.clientX;- contextMenu.clientY = e.clientY;- selectedKeysRef.value = [treeNode.key];-};--// Set event handler to tree nodes.-const nodeProps = ({ option }: { option: TreeOption }) => {- const treeNode = option as TreeNode;- return {- async onClick(e: MouseEvent) {- // Check if clicked on the content part.- // And ignore the fold/unfold arrow.- if (isDescendantOf(e.target as Element, ".n-tree-node-content")) {- state.shouldRelocateTreeNode = false;- if (treeNode.type === "instance") {- expandNodeRecursively(treeNode);- } else if (treeNode.type === "database") {- expandNodeRecursively(treeNode);- addTab({- type: "database",- database: treeNode.db,- metadata: treeNode.metadata,- selectedSchema: head(treeNode.metadata.database.schemas)?.name,- });- } else if (treeNode.type === "schema") {- openTabForTreeNode(treeNode);- } else if (treeNode.type === "table") {- openTabForTreeNode(treeNode);- } else if (treeNode.type === "column") {- openTabForTreeNode(treeNode);- }- } else {- nextTick(() => {- selectedKeysRef.value = [];- });- }- },- oncontextmenu(e: MouseEvent) {- handleShowDropdown(e, treeNode);- },- };-};--const handleContextMenuDropdownSelect = async (key: string) => {- const treeNode = contextMenu.treeNode;- if (!treeNode) return;- if (treeNode.type === "database") {- const engine = treeNode.instance.engine;- if (key === "create-table") {- if (!engineHasSchema(engine)) {- const schema = head(treeNode.metadata.database.schemas);- if (!schema) {- return;- }- state.tableNameModalContext = {- db: treeNode.db,- database: treeNode.metadata.database,- schema: schema,- table: undefined,- };- }- } else if (key === "create-schema") {- if (engineHasSchema(engine)) {- state.schemaNameModalContext = {- db: treeNode.db,- database: treeNode.metadata.database,- schema: undefined,- };- }- }- } else if (treeNode.type === "schema") {- if (key === "create-table") {- state.tableNameModalContext = {- db: treeNode.db,- database: treeNode.metadata.database,- schema: treeNode.metadata.schema,- table: undefined,- };- } else if (key === "drop-schema") {- markEditStatus(treeNode.db, treeNode.metadata, "dropped");- } else if (key === "restore") {- removeEditStatus(treeNode.db, treeNode.metadata, /* recursive */ false);- }- } else if (treeNode.type === "table") {- if (key === "rename") {- state.tableNameModalContext = {- db: treeNode.db,- database: treeNode.metadata.database,- schema: treeNode.metadata.schema,- table: treeNode.metadata.table,- };- } else if (key === "drop") {- markEditStatus(treeNode.db, treeNode.metadata, "dropped");- } else if (key === "restore") {- removeEditStatus(treeNode.db, treeNode.metadata, /* recursive */ false);- }- }- contextMenu.showDropdown = false;-};--const handleDropdownClickoutside = (e: MouseEvent) => {- if (- !isDescendantOf(e.target as Element, ".n-tree-node-wrapper") ||- e.button !== 2- ) {- selectedKeysRef.value = [];- contextMenu.showDropdown = false;- }-};--const handleExpandedKeysChange = (expandedKeys: string[]) => {- expandedKeysRef.value = expandedKeys;-};-</script>--<style lang="postcss" scoped>-.schema-editor-database-tree :deep(.n-tree-node-wrapper) {- @apply !p-0;-}-.schema-editor-database-tree :deep(.n-tree-node-content) {- @apply !pl-2 text-sm;-}-.schema-editor-database-tree :deep(.n-tree-node-indent) {- width: 0.25rem;-}-.schema-editor-database-tree :deep(.n-tree-node-content__prefix) {- @apply shrink-0 !mr-1;-}-.schema-editor-database-tree- :deep(.n-tree-node-wrapper:hover .n-tree-node-content__suffix) {- @apply !flex;-}-.schema-editor-database-tree- :deep(.n-tree-node-wrapper- .n-tree-node--selected- .n-tree-node-content__suffix) {- @apply !flex;-}-.schema-editor-database-tree :deep(.n-tree-node-switcher) {- @apply px-0 !w-4 !h-7;-}-.schema-editor-database-tree :deep(.n-tree-node-content .created) {- @apply text-green-700;-}-.schema-editor-database-tree :deep(.n-tree-node-content .dropped) {- @apply text-red-700 line-through;-}-.schema-editor-database-tree :deep(.n-tree-node-content .updated) {- @apply text-yellow-700;-}-</style>diff --git a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue b/frontend/src/components/SchemaEditorLite/Aside/Tree.vueindex bff8dcb56d..ddd1eb8bbc 100644--- a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue+++ b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue@@ -19,6 +19,7 @@<divref="treeContainerElRef"class="schema-editor-tree flex-1 pb-1 text-sm overflow-hidden select-none"+ :class="[disableDiffColoring && 'disable-diff-coloring']":data-height="treeContainerHeight"><NTree@@ -148,13 +149,14 @@ const {targets,readonly,currentTab,+ disableDiffColoring,+ selectionEnabled,addTab,markEditStatus,removeEditStatus,getSchemaStatus,getTableStatus,getColumnStatus,- selectionEnabled,upsertTableConfig,queuePendingScrollToTable,queuePendingScrollToColumn,@@ -796,13 +798,16 @@ const handleExpandedKeysChange = (expandedKeys: string[]) => {.schema-editor-tree :deep(.n-tree-node-switcher) {@apply px-0 !w-4 !h-7;}-.schema-editor-tree :deep(.n-tree-node-content .created) {+.schema-editor-tree:not(.disable-diff-coloring)+ :deep(.n-tree-node-content .created) {@apply text-green-700;}-.schema-editor-tree :deep(.n-tree-node-content .dropped) {+.schema-editor-tree:not(.disable-diff-coloring)+ :deep(.n-tree-node-content .dropped) {@apply text-red-700 line-through;}-.schema-editor-tree :deep(.n-tree-node-content .updated) {+.schema-editor-tree:not(.disable-diff-coloring)+ :deep(.n-tree-node-content .updated) {@apply text-yellow-700;}</style>diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vueindex 37c6c3b855..75c5502899 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue@@ -20,6 +20,7 @@:bordered="true":bottom-bordered="true"class="schema-editor-table-list"+ :class="[disableDiffColoring && 'disable-diff-coloring']"/></div>@@ -104,6 +105,7 @@ const {project,readonly,selectionEnabled,+ disableDiffColoring,addTab,markEditStatus,removeEditStatus,@@ -418,14 +420,17 @@ useConsumePendingScrollToTable(.schema-editor-table-list :deep(.n-data-table-td.input-cell) {@apply pl-0.5 pr-1 py-0;}-.schema-editor-table-list :deep(.n-data-table-tr.created .n-data-table-td) {+.schema-editor-table-list:not(.disable-diff-coloring)+ :deep(.n-data-table-tr.created .n-data-table-td) {@apply text-green-700 !bg-green-50;}-.schema-editor-table-list :deep(.n-data-table-tr.dropped .n-data-table-td) {+.schema-editor-table-list:not(.disable-diff-coloring)+ :deep(.n-data-table-tr.dropped .n-data-table-td) {@apply text-red-700 !bg-red-50 opacity-70;}-.schema-editor-table-list :deep(.n-data-table-tr.updated .n-data-table-td) {+.schema-editor-table-list:not(.disable-diff-coloring)+ :deep(.n-data-table-tr.updated .n-data-table-td) {@apply text-yellow-700 !bg-yellow-50;}</style>diff --git a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vueindex 0fe3f18930..37c5ad6bc3 100644--- a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue+++ b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue@@ -43,6 +43,7 @@ const props = defineProps<{branch?: Branch;loading?: boolean;diffWhenReady?: boolean;+ disableDiffColoring?: boolean;}>();const emit = defineEmits<{(event: "update:selected-rollout-objects", objects: RolloutObject[]): void;@@ -97,6 +98,7 @@ const context = provideSchemaEditorContext({resourceType: toRef(props, "resourceType"),readonly: toRef(props, "readonly"),selectedRolloutObjects: toRef(props, "selectedRolloutObjects"),+ disableDiffColoring: toRef(props, "disableDiffColoring"),});const { rebuildMetadataEdit, applyMetadataEdit, applySelectedMetadataEdit } =useAlgorithm(context);diff --git a/frontend/src/components/SchemaEditorLite/context/index.ts b/frontend/src/components/SchemaEditorLite/context/index.tsindex 71df1a59da..95f0131cc6 100644--- a/frontend/src/components/SchemaEditorLite/context/index.ts+++ b/frontend/src/components/SchemaEditorLite/context/index.ts@@ -26,6 +26,7 @@ export const provideSchemaEditorContext = (params: {project: Ref<ComposedProject>;targets: Ref<EditTarget[]>;selectedRolloutObjects: Ref<RolloutObject[] | undefined>;+ disableDiffColoring: Ref<boolean>;}) => {const events = new Emittery() as SchemaEditorEvents;const context = {diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex e0eee13112..7980001fbe 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -3452,6 +3452,7 @@"visualized-schema": "Visualized Schema","schema-text": "Schema Text","baseline": "Baseline",- "head": "Head"+ "head": "Head",+ "show-diff-with-branch-baseline": "Show diff with branch baseline"}}diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex a2afc21dd9..7c3ce3746c 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -3449,6 +3449,7 @@"visualized-schema": "Esquema visualizado","schema-text": "Texto del esquema","baseline": "Base",- "head": "Cabeza"+ "head": "Cabeza",+ "show-diff-with-branch-baseline": "Mostrar diferencia con la línea base de la rama"}}diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 0a85802f50..ff0e5e5af8 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -3449,6 +3449,7 @@"visualized-schema": "視覚化されたスキーマ","schema-text": "スキーマテキスト","baseline": "ベースライン",- "head": "頭"+ "head": "頭",+ "show-diff-with-branch-baseline": "ブランチベースラインとの差分を表示"}}diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 08dfaff41e..188e40842d 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -3451,6 +3451,7 @@"visualized-schema": "Lược đồ trực quan","schema-text": "Văn bản lược đồ","baseline": "Đường cơ sở",- "head": "Cái đầu"+ "head": "Cái đầu",+ "show-diff-with-branch-baseline": "Hiển thị sự khác biệt với đường cơ sở của nhánh"}}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 682db47988..261fd36297 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -3444,6 +3444,7 @@"visualized-schema": "可视化 Schema","schema-text": "文本 Schema","baseline": "基线",- "head": "当前"+ "head": "当前",+ "show-diff-with-branch-baseline": "显示与分支基线之间的差异"}}