Skip to content

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

chore(frontend): hide dropped objects in schema editor when diff disabled (#13358)

Liu Ji6baab282f852
diff --git a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
index e2a9cb3217..c932e00802 100644
--- a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
+++ b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
@@ -145,7 +145,7 @@ import type {
TreeNodeForTable,
TreeNodeForGroup,
} from "./common";
-import { buildTree } from "./common";
+import { useBuildTree } from "./common";
import { useContextMenu } from "./context-menu";
interface LocalState {
@@ -203,6 +203,7 @@ const {
queuePendingScrollToTable,
queuePendingScrollToColumn,
} = useSchemaEditorContext();
+const buildTree = useBuildTree();
const state = reactive<LocalState>({
shouldRelocateTreeNode: false,
});
@@ -300,6 +301,9 @@ const debouncedBuildDatabaseTreeData = debounce(buildDatabaseTreeData, 100);
useEmitteryEventListener(events, "rebuild-tree", (params) => {
debouncedBuildDatabaseTreeData(params.openFirstChild);
});
+watch(disableDiffColoring, () =>
+ buildDatabaseTreeData(/* openFirstChild */ true)
+);
const tabWatchKey = computed(() => {
const tab = currentTab.value;
diff --git a/frontend/src/components/SchemaEditorLite/Aside/common.ts b/frontend/src/components/SchemaEditorLite/Aside/common.ts
index 06981f4d7c..caa5344a14 100644
--- a/frontend/src/components/SchemaEditorLite/Aside/common.ts
+++ b/frontend/src/components/SchemaEditorLite/Aside/common.ts
@@ -11,6 +11,7 @@ import type {
} from "@/types/proto/v1/database_service";
import type { InstanceResource } from "@/types/proto/v1/instance_service";
import { groupBy } from "@/utils";
+import { useSchemaEditorContext } from "../context";
import { keyForResource } from "../context/common";
import {
engineSupportsEditFunctions,
@@ -175,377 +176,443 @@ export type BuildTreeOptions = {
byInstance: boolean;
};
-export const buildTree = (
- targets: EditTarget[],
- map: Map<string, TreeNode>,
- options: BuildTreeOptions
-) => {
- map.clear();
- if (options.byInstance) {
- return buildInstanceNodeList(targets, map);
- } else {
- const target = targets[0];
- return buildSchemaNodeList(
- target.metadata.schemas,
- map,
- target.database,
- target.metadata,
- undefined
- );
- }
-};
+export const useBuildTree = () => {
+ const context = useSchemaEditorContext();
-const buildInstanceNodeList = (
- targets: EditTarget[],
- map: Map<string, TreeNode>
-) => {
- const groupedByInstance = groupBy(
- targets,
- (target) => target.database.instance
- );
- return Array.from(groupedByInstance).map(([key, targets]) => {
- const instance = targets[0].database.instanceResource;
- const instanceNode: TreeNodeForInstance = {
- type: "instance",
- key: key,
- label: instance.title,
- isLeaf: false,
- instance,
- children: [],
- };
- map.set(instanceNode.key, instanceNode);
- instanceNode.children = buildDatabaseNodeList(targets, map, instanceNode);
- return instanceNode;
- });
-};
+ const buildTree = (
+ targets: EditTarget[],
+ map: Map<string, TreeNode>,
+ options: BuildTreeOptions
+ ) => {
+ map.clear();
+ if (options.byInstance) {
+ return buildInstanceNodeList(targets, map);
+ } else {
+ const target = targets[0];
+ return buildSchemaNodeList(
+ target.metadata.schemas,
+ map,
+ target.database,
+ target.metadata,
+ undefined
+ );
+ }
+ };
-const buildDatabaseNodeList = (
- targets: EditTarget[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForInstance | undefined
-) => {
- return targets.map((target) => {
- const db = target.database;
- const databaseNode: TreeNodeForDatabase = {
- type: "database",
- key: db.name,
- parent,
- label: db.databaseName,
- isLeaf: false,
- db,
- metadata: {
- database: target.metadata,
- },
- children: [],
- };
- map.set(databaseNode.key, databaseNode);
- databaseNode.children = buildSchemaNodeList(
- target.metadata.schemas,
- map,
- db,
- target.metadata,
- databaseNode
- );
- return databaseNode;
- });
-};
-const buildSchemaNodeList = (
- schemas: SchemaMetadata[],
- map: Map<string, TreeNode>,
- db: ComposedDatabase,
- database: DatabaseMetadata,
- parent: TreeNodeForDatabase | undefined
-) => {
- const mapSchemaChildrenNodes = (
- schema: SchemaMetadata,
- parent: TreeNodeForSchema | TreeNodeForDatabase | undefined
+ const buildInstanceNodeList = (
+ targets: EditTarget[],
+ map: Map<string, TreeNode>
) => {
- const groups: TreeNodeForGroup[] = [];
- const metadata = {
- database,
- schema,
- };
- // Tables
- const tableGroupNode: TreeNodeForGroup<"table"> = {
- type: "group",
- group: "table",
- key: keyForResource(db, metadata, "table-group"),
- parent,
- db,
- metadata,
- label: "Tables",
- children: [],
- isLeaf: false,
- };
- tableGroupNode.children = buildTableNodeList(
- schema.tables,
- map,
- tableGroupNode
+ const groupedByInstance = groupBy(
+ targets,
+ (target) => target.database.instance
);
- if (tableGroupNode.children.length === 0) {
- tableGroupNode.children = [
- buildPlaceholderNode("table", tableGroupNode, map),
- ];
- }
- groups.push(tableGroupNode);
- map.set(tableGroupNode.key, tableGroupNode);
+ return Array.from(groupedByInstance).map(([key, targets]) => {
+ const instance = targets[0].database.instanceResource;
+ const instanceNode: TreeNodeForInstance = {
+ type: "instance",
+ key: key,
+ label: instance.title,
+ isLeaf: false,
+ instance,
+ children: [],
+ };
+ map.set(instanceNode.key, instanceNode);
+ instanceNode.children = buildDatabaseNodeList(targets, map, instanceNode);
+ return instanceNode;
+ });
+ };
- // Views
- if (engineSupportsEditViews(db.instanceResource.engine)) {
- const viewGroupNode: TreeNodeForGroup<"view"> = {
- type: "group",
- group: "view",
- key: keyForResource(db, metadata, "view-group"),
+ const buildDatabaseNodeList = (
+ targets: EditTarget[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForInstance | undefined
+ ) => {
+ return targets.map((target) => {
+ const db = target.database;
+ const databaseNode: TreeNodeForDatabase = {
+ type: "database",
+ key: db.name,
parent,
+ label: db.databaseName,
+ isLeaf: false,
db,
- metadata,
- label: "Views",
+ metadata: {
+ database: target.metadata,
+ },
children: [],
- isLeaf: false,
};
- viewGroupNode.children = buildViewNodeList(
- schema.views,
+ map.set(databaseNode.key, databaseNode);
+ databaseNode.children = buildSchemaNodeList(
+ target.metadata.schemas,
map,
- viewGroupNode
+ db,
+ target.metadata,
+ databaseNode
);
- if (viewGroupNode.children.length === 0) {
- viewGroupNode.children = [
- buildPlaceholderNode("view", viewGroupNode, map),
- ];
- }
- groups.push(viewGroupNode);
- map.set(viewGroupNode.key, viewGroupNode);
+ return databaseNode;
+ });
+ };
+ const buildSchemaNodeList = (
+ schemas: SchemaMetadata[],
+ map: Map<string, TreeNode>,
+ db: ComposedDatabase,
+ database: DatabaseMetadata,
+ parent: TreeNodeForDatabase | undefined
+ ) => {
+ if (context.disableDiffColoring.value) {
+ schemas = schemas.filter((schema) => {
+ const status = context.getSchemaStatus(db, {
+ database,
+ schema,
+ });
+ return status !== "dropped";
+ });
}
- // Procedures
- if (engineSupportsEditProcedures(db.instanceResource.engine)) {
- const procedureGroupNode: TreeNodeForGroup<"procedure"> = {
+
+ const mapSchemaChildrenNodes = (
+ schema: SchemaMetadata,
+ parent: TreeNodeForSchema | TreeNodeForDatabase | undefined
+ ) => {
+ const groups: TreeNodeForGroup[] = [];
+ const metadata = {
+ database,
+ schema,
+ };
+ // Tables
+ const tableGroupNode: TreeNodeForGroup<"table"> = {
type: "group",
- group: "procedure",
- key: keyForResource(db, metadata, "procedure-group"),
+ group: "table",
+ key: keyForResource(db, metadata, "table-group"),
parent,
db,
metadata,
- label: "Procedures",
+ label: "Tables",
children: [],
isLeaf: false,
};
- procedureGroupNode.children = buildProcedureNodeList(
- schema.procedures,
+ tableGroupNode.children = buildTableNodeList(
+ schema.tables,
map,
- procedureGroupNode
+ tableGroupNode
);
- if (procedureGroupNode.children.length === 0) {
- procedureGroupNode.children = [
- buildPlaceholderNode("procedure", procedureGroupNode, map),
+ if (tableGroupNode.children.length === 0) {
+ tableGroupNode.children = [
+ buildPlaceholderNode("table", tableGroupNode, map),
];
}
- groups.push(procedureGroupNode);
- map.set(procedureGroupNode.key, procedureGroupNode);
+ groups.push(tableGroupNode);
+ map.set(tableGroupNode.key, tableGroupNode);
+
+ // Views
+ if (engineSupportsEditViews(db.instanceResource.engine)) {
+ const viewGroupNode: TreeNodeForGroup<"view"> = {
+ type: "group",
+ group: "view",
+ key: keyForResource(db, metadata, "view-group"),
+ parent,
+ db,
+ metadata,
+ label: "Views",
+ children: [],
+ isLeaf: false,
+ };
+ viewGroupNode.children = buildViewNodeList(
+ schema.views,
+ map,
+ viewGroupNode
+ );
+ if (viewGroupNode.children.length === 0) {
+ viewGroupNode.children = [
+ buildPlaceholderNode("view", viewGroupNode, map),
+ ];
+ }
+ groups.push(viewGroupNode);
+ map.set(viewGroupNode.key, viewGroupNode);
+ }
+ // Procedures
+ if (engineSupportsEditProcedures(db.instanceResource.engine)) {
+ const procedureGroupNode: TreeNodeForGroup<"procedure"> = {
+ type: "group",
+ group: "procedure",
+ key: keyForResource(db, metadata, "procedure-group"),
+ parent,
+ db,
+ metadata,
+ label: "Procedures",
+ children: [],
+ isLeaf: false,
+ };
+ procedureGroupNode.children = buildProcedureNodeList(
+ schema.procedures,
+ map,
+ procedureGroupNode
+ );
+ if (procedureGroupNode.children.length === 0) {
+ procedureGroupNode.children = [
+ buildPlaceholderNode("procedure", procedureGroupNode, map),
+ ];
+ }
+ groups.push(procedureGroupNode);
+ map.set(procedureGroupNode.key, procedureGroupNode);
+ }
+ // Functions
+ if (engineSupportsEditFunctions(db.instanceResource.engine)) {
+ const functionGroupNode: TreeNodeForGroup<"function"> = {
+ type: "group",
+ group: "function",
+ key: keyForResource(db, metadata, "function-group"),
+ parent,
+ db,
+ metadata,
+ label: "functions",
+ children: [],
+ isLeaf: false,
+ };
+ functionGroupNode.children = buildFunctionNodeList(
+ schema.functions,
+ map,
+ functionGroupNode
+ );
+ if (functionGroupNode.children.length === 0) {
+ functionGroupNode.children = [
+ buildPlaceholderNode("function", functionGroupNode, map),
+ ];
+ }
+ groups.push(functionGroupNode);
+ map.set(functionGroupNode.key, functionGroupNode);
+ }
+ return groups;
+ };
+
+ // MySQL, TiDB has only one "schema" with empty name
+ if (schemas.length === 1 && schemas[0].name === "") {
+ return mapSchemaChildrenNodes(schemas[0], parent);
}
- // Functions
- if (engineSupportsEditFunctions(db.instanceResource.engine)) {
- const functionGroupNode: TreeNodeForGroup<"function"> = {
- type: "group",
- group: "function",
- key: keyForResource(db, metadata, "function-group"),
- parent,
+
+ return schemas.map((schema) => {
+ const metadata = {
+ database,
+ schema,
+ };
+ const schemaNode: TreeNodeForSchema = {
+ type: "schema",
+ parent: parent,
+ key: keyForResource(db, metadata),
+ label: schema.name,
+ isLeaf: false,
db,
metadata,
- label: "functions",
children: [],
+ };
+ schemaNode.children = mapSchemaChildrenNodes(schema, schemaNode);
+ map.set(schemaNode.key, schemaNode);
+ return schemaNode;
+ });
+ };
+
+ const buildTableNodeList = (
+ tables: TableMetadata[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForGroup<"table">
+ ) => {
+ if (context.disableDiffColoring.value) {
+ tables = tables.filter((table) => {
+ const status = context.getTableStatus(parent.db, {
+ ...parent.metadata,
+ table,
+ });
+ return status !== "dropped";
+ });
+ }
+
+ return tables.map((table) => {
+ const { db } = parent;
+ const metadata = {
+ ...parent.metadata,
+ table,
+ };
+ const tableNode: TreeNodeForTable = {
+ type: "table",
+ parent,
+ key: keyForResource(db, metadata),
+ label: table.name,
isLeaf: false,
+ db,
+ metadata,
+ children: [],
};
- functionGroupNode.children = buildFunctionNodeList(
- schema.functions,
- map,
- functionGroupNode
- );
- if (functionGroupNode.children.length === 0) {
- functionGroupNode.children = [
- buildPlaceholderNode("function", functionGroupNode, map),
- ];
+ map.set(tableNode.key, tableNode);
+ tableNode.children = buildColumnNodeList(table.columns, map, tableNode);
+
+ if (tableNode.children.length === 0) {
+ tableNode.children = [buildPlaceholderNode("column", tableNode, map)];
}
- groups.push(functionGroupNode);
- map.set(functionGroupNode.key, functionGroupNode);
- }
- return groups;
+ return tableNode;
+ });
};
- // MySQL, TiDB has only one "schema" with empty name
- if (schemas.length === 1 && schemas[0].name === "") {
- return mapSchemaChildrenNodes(schemas[0], parent);
- }
+ const buildViewNodeList = (
+ views: ViewMetadata[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForGroup<"view">
+ ) => {
+ if (context.disableDiffColoring.value) {
+ views = views.filter((view) => {
+ const status = context.getViewStatus(parent.db, {
+ ...parent.metadata,
+ view,
+ });
+ return status !== "dropped";
+ });
+ }
+
+ return views.map((view) => {
+ const { db } = parent;
+ const metadata = {
+ ...parent.metadata,
+ view,
+ };
+ const viewNode: TreeNodeForView = {
+ type: "view",
+ parent,
+ key: keyForResource(db, metadata),
+ label: view.name,
+ isLeaf: true,
+ db,
+ metadata,
+ children: undefined,
+ };
+ map.set(viewNode.key, viewNode);
+ return viewNode;
+ });
+ };
- return schemas.map((schema) => {
- const metadata = {
- database,
- schema,
- };
- const schemaNode: TreeNodeForSchema = {
- type: "schema",
- parent: parent,
- key: keyForResource(db, metadata),
- label: schema.name,
- isLeaf: false,
- db,
- metadata,
- children: [],
- };
- schemaNode.children = mapSchemaChildrenNodes(schema, schemaNode);
- map.set(schemaNode.key, schemaNode);
- return schemaNode;
- });
-};
+ const buildProcedureNodeList = (
+ procedures: ProcedureMetadata[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForGroup<"procedure">
+ ) => {
+ if (context.disableDiffColoring.value) {
+ procedures = procedures.filter((procedure) => {
+ const status = context.getProcedureStatus(parent.db, {
+ ...parent.metadata,
+ procedure,
+ });
+ return status !== "dropped";
+ });
+ }
-const buildTableNodeList = (
- tables: TableMetadata[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForGroup<"table">
-) => {
- return tables.map((table) => {
- const { db } = parent;
- const metadata = {
- ...parent.metadata,
- table,
- };
- const tableNode: TreeNodeForTable = {
- type: "table",
- parent,
- key: keyForResource(db, metadata),
- label: table.name,
- isLeaf: false,
- db,
- metadata,
- children: [],
- };
- map.set(tableNode.key, tableNode);
- tableNode.children = buildColumnNodeList(table.columns, map, tableNode);
+ return procedures.map((procedure) => {
+ const { db } = parent;
+ const metadata = {
+ ...parent.metadata,
+ procedure,
+ };
+ const procedureNode: TreeNodeForProcedure = {
+ type: "procedure",
+ parent,
+ key: keyForResource(db, metadata),
+ label: procedure.name,
+ isLeaf: true,
+ db,
+ metadata,
+ children: undefined,
+ };
+ map.set(procedureNode.key, procedureNode);
+ return procedureNode;
+ });
+ };
- if (tableNode.children.length === 0) {
- tableNode.children = [buildPlaceholderNode("column", tableNode, map)];
+ const buildFunctionNodeList = (
+ functions: FunctionMetadata[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForGroup<"function">
+ ) => {
+ if (context.disableDiffColoring.value) {
+ functions = functions.filter((func) => {
+ const status = context.getFunctionStatus(parent.db, {
+ ...parent.metadata,
+ function: func,
+ });
+ return status !== "dropped";
+ });
}
- return tableNode;
- });
-};
-const buildViewNodeList = (
- views: ViewMetadata[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForGroup<"view">
-) => {
- return views.map((view) => {
- const { db } = parent;
- const metadata = {
- ...parent.metadata,
- view,
- };
- const viewNode: TreeNodeForView = {
- type: "view",
- parent,
- key: keyForResource(db, metadata),
- label: view.name,
- isLeaf: true,
- db,
- metadata,
- children: undefined,
- };
- map.set(viewNode.key, viewNode);
- return viewNode;
- });
-};
+ return functions.map((func) => {
+ const { db } = parent;
+ const metadata = {
+ ...parent.metadata,
+ function: func,
+ };
+ const functionNode: TreeNodeForFunction = {
+ type: "function",
+ parent,
+ key: keyForResource(db, metadata),
+ label: func.name,
+ isLeaf: true,
+ db,
+ metadata,
+ children: undefined,
+ };
+ map.set(functionNode.key, functionNode);
+ return functionNode;
+ });
+ };
-const buildProcedureNodeList = (
- procedures: ProcedureMetadata[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForGroup<"procedure">
-) => {
- return procedures.map((procedure) => {
- const { db } = parent;
- const metadata = {
- ...parent.metadata,
- procedure,
- };
- const procedureNode: TreeNodeForProcedure = {
- type: "procedure",
- parent,
- key: keyForResource(db, metadata),
- label: procedure.name,
- isLeaf: true,
- db,
- metadata,
- children: undefined,
- };
- map.set(procedureNode.key, procedureNode);
- return procedureNode;
- });
-};
+ const buildColumnNodeList = (
+ columns: ColumnMetadata[],
+ map: Map<string, TreeNode>,
+ parent: TreeNodeForTable
+ ) => {
+ if (context.disableDiffColoring.value) {
+ columns = columns.filter((column) => {
+ const status = context.getColumnStatus(parent.db, {
+ ...parent.metadata,
+ column,
+ });
+ return status !== "dropped";
+ });
+ }
-const buildFunctionNodeList = (
- functions: FunctionMetadata[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForGroup<"function">
-) => {
- return functions.map((func) => {
- const { db } = parent;
- const metadata = {
- ...parent.metadata,
- function: func,
- };
- const functionNode: TreeNodeForFunction = {
- type: "function",
- parent,
- key: keyForResource(db, metadata),
- label: func.name,
- isLeaf: true,
- db,
- metadata,
- children: undefined,
- };
- map.set(functionNode.key, functionNode);
- return functionNode;
- });
-};
+ return columns.map((column) => {
+ const { db } = parent;
+ const metadata = {
+ ...parent.metadata,
+ column,
+ };
+ const columnNode: TreeNodeForColumn = {
+ type: "column",
+ key: keyForResource(db, metadata),
+ parent,
+ label: column.name,
+ db,
+ metadata,
+ isLeaf: true,
+ children: undefined,
+ };
+ map.set(columnNode.key, columnNode);
+ return columnNode;
+ });
+ };
-const buildColumnNodeList = (
- columns: ColumnMetadata[],
- map: Map<string, TreeNode>,
- parent: TreeNodeForTable
-) => {
- return columns.map((column) => {
- const { db } = parent;
- const metadata = {
- ...parent.metadata,
- column,
- };
- const columnNode: TreeNodeForColumn = {
- type: "column",
- key: keyForResource(db, metadata),
+ const buildPlaceholderNode = <T extends PlaceholderNodeType>(
+ placeholder: T,
+ parent: TreeNode,
+ map: Map<string, TreeNode>
+ ) => {
+ const node: TreeNodeForPlaceholder<T> = {
+ type: "placeholder",
+ key: `${parent.key}/placeholder`,
+ placeholder,
parent,
- label: column.name,
- db,
- metadata,
- isLeaf: true,
+ label: "",
children: undefined,
+ isLeaf: true,
};
- map.set(columnNode.key, columnNode);
- return columnNode;
- });
-};
-
-const buildPlaceholderNode = <T extends PlaceholderNodeType>(
- placeholder: T,
- parent: TreeNode,
- map: Map<string, TreeNode>
-) => {
- const node: TreeNodeForPlaceholder<T> = {
- type: "placeholder",
- key: `${parent.key}/placeholder`,
- placeholder,
- parent,
- label: "",
- children: undefined,
- isLeaf: true,
+ map.set(node.key, node);
+ return node;
};
- map.set(node.key, node);
- return node;
+
+ return buildTree;
};
diff --git a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
index 1a256e9f6a..17c14495ca 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue
@@ -203,6 +203,7 @@ const context = useSchemaEditorContext();
const {
readonly,
selectionEnabled,
+ disableDiffColoring,
events,
addTab,
getSchemaStatus,
@@ -247,12 +248,22 @@ const allowCreateTable = computed(() => {
const schemaSelectorOptionList = computed(() => {
const optionList = [];
- for (const schema of props.database.schemas) {
+ const schemas = disableDiffColoring.value
+ ? props.database.schemas.filter((schema) => {
+ const status = getSchemaStatus(props.db, {
+ database: props.database,
+ schema,
+ });
+ return status !== "dropped";
+ })
+ : props.database.schemas;
+ for (const schema of schemas) {
optionList.push({
label: schema.name,
value: schema.name,
});
}
+
return optionList;
});
diff --git a/frontend/src/components/SchemaEditorLite/Panels/PartitionsEditor/PartitionsEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/PartitionsEditor/PartitionsEditor.vue
index 8f9850bd4a..8562f7ed74 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/PartitionsEditor/PartitionsEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/PartitionsEditor/PartitionsEditor.vue
@@ -149,6 +149,11 @@ const flattenItemList = computed(() => {
partition: TablePartitionMetadata,
parent?: TablePartitionMetadata
) => {
+ if (disableDiffColoring.value) {
+ if (statusForPartition(partition) === "dropped") {
+ return;
+ }
+ }
list.push({
partition,
parent,
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
index 02f379485d..4a1b9de7a4 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
@@ -580,7 +580,14 @@ const columns = computed(() => {
});
const shownColumnList = computed(() => {
- return props.table.columns.filter(props.filterColumn);
+ const filtered = props.table.columns.filter(props.filterColumn);
+ if (disableDiffColoring.value) {
+ return filtered.filter((column) => {
+ const status = statusForColumn(column);
+ return status !== "dropped";
+ });
+ }
+ return filtered;
});
const isColumnPrimaryKey = (column: ColumnMetadata): boolean => {
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
index 3de3b9f8ff..6f04c5cbe6 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
@@ -135,9 +135,17 @@ const state = reactive<LocalState>({
showSchemaTemplateDrawer: false,
});
const filteredTables = computed(() => {
+ const tables = disableDiffColoring.value
+ ? props.tables.filter((table) => {
+ const status = statusForTable(table);
+ return status !== "dropped";
+ })
+ : props.tables;
const keyword = props.searchPattern?.trim();
- if (!keyword) return props.tables;
- return props.tables.filter((table) => table.name.includes(keyword));
+ if (!keyword) {
+ return tables;
+ }
+ return tables.filter((table) => table.name.includes(keyword));
});
const engine = computed(() => {
diff --git a/frontend/src/utils/schemaEditor/filter.ts b/frontend/src/utils/schemaEditor/filter.ts
index fb81aa3a8c..8cc7ab37d8 100644
--- a/frontend/src/utils/schemaEditor/filter.ts
+++ b/frontend/src/utils/schemaEditor/filter.ts
@@ -45,7 +45,6 @@ export const filterColumnMetadata = (column: ColumnMetadata) => {
defaultString: column.defaultString,
onUpdate: column.onUpdate,
nullable: column.nullable,
- position: column.position,
});
};
@@ -159,5 +158,4 @@ export const ComparableColumnFields: (keyof ColumnMetadata)[] = [
"defaultString",
"onUpdate",
"nullable",
- "position",
];