Skip to content

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

fix: database tree node selected state (#7182)

boojack4ceef6082e89
diff --git a/frontend/package.json b/frontend/package.json
index 58397fbce6..5092fecfaf 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -45,7 +45,7 @@
"maz-ui": "^3.9.0",
"monaco-editor": "0.34.1",
"monaco-languageclient": "4.0.1",
- "naive-ui": "2.33.5",
+ "naive-ui": "2.34.4",
"nice-grpc-common": "^2.0.0",
"nice-grpc-web": "^3.1.1",
"node-sql-parser": "4.7.0",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 514a6a5af7..98826ae075 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -99,8 +99,8 @@ dependencies:
specifier: 4.0.1
naive-ui:
- specifier: 2.33.5
- version: 2.33.5([email protected])
+ specifier: 2.34.4
+ version: 2.34.4([email protected])
nice-grpc-common:
specifier: ^2.0.0
version: 2.0.2
@@ -1078,6 +1078,10 @@ packages:
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
dev: true
+ resolution: {integrity: sha512-+2FW2CcT0K3P+JMR8YG846bmDwplKUTsWgT2ENwdQ1UdVfRk3GQrh6Mi4sTopy30gI8Uau5CEqHTDZ6YvWIUPA==}
+ dev: false
+
resolution: {integrity: sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==}
@@ -3724,13 +3728,14 @@ packages:
resolution: {integrity: sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==}
dev: true
- resolution: {integrity: sha512-O87zwOduut3Xk9NzGIX+LZYr6sW/Y0oGuNJ6T2dka+14CtHD9iidi8gdxg6obhMpzdwa3SnlxO7nzDLqmXVUwA==}
+ resolution: {integrity: sha512-aPG8PDfhSzIzn/jSC9y3Jb3Pe2wHJ7F0cFV1EWlbImSrZECeUmoc+fIcOSWbizoztkKfaUAeKwYdMl09MKkj1g==}
peerDependencies:
vue: ^3.0.0
dependencies:
'@css-render/plugin-bem': 0.15.12([email protected])
'@css-render/vue3-ssr': 0.15.12([email protected])
+ '@types/katex': 0.14.0
'@types/lodash': 4.14.192
'@types/lodash-es': 4.17.7
async-validator: 4.2.5
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index 295c72b03e..ab25d32cdf 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -12,7 +12,7 @@
<heroicons-outline:plus-sm class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.add-instance") }}
</h3>
@@ -26,7 +26,7 @@
<heroicons-outline:users class="w-5 h-5" />
</router-link>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.manage-user") }}
</h3>
@@ -42,7 +42,7 @@
<heroicons-outline:database class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.new-db") }}
</h3>
@@ -60,7 +60,7 @@
<heroicons-outline:pencil-alt class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("database.alter-schema") }}
</h3>
@@ -74,7 +74,7 @@
<heroicons-outline:pencil class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("database.change-data") }}
</h3>
@@ -88,7 +88,7 @@
<heroicons-outline:table-cells class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("schema-designer.quick-action") }}
</h3>
@@ -103,7 +103,7 @@
<heroicons-outline:hand class="w-5 h-5" />
</router-link>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.troubleshoot") }}
</h3>
@@ -117,7 +117,7 @@
<heroicons-outline:plus-sm class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("environment.create") }}
</h3>
@@ -134,7 +134,7 @@
<heroicons-outline:selector class="transform rotate-90 w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("common.reorder") }}
</h3>
@@ -149,7 +149,7 @@
<heroicons-outline:template class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.new-project") }}
</h3>
@@ -163,7 +163,7 @@
<heroicons-outline:chevron-double-down class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.transfer-in-db") }}
</h3>
@@ -180,7 +180,7 @@
<heroicons-outline:chevron-double-up class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.transfer-out-db") }}
</h3>
@@ -198,7 +198,7 @@
<heroicons-outline:document-search class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.request-query") }}
</h3>
@@ -215,7 +215,7 @@
<heroicons-outline:document-download class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("quick-action.request-export") }}
</h3>
@@ -237,7 +237,7 @@
<heroicons-outline:academic-cap class="w-5 h-5" />
</button>
<h3
- class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
+ class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight whitespace-nowrap"
>
{{ $t("subscription.instance-assignment.assign-license") }}
</h3>
diff --git a/frontend/src/components/SchemaDesigner/DatabaseTree.vue b/frontend/src/components/SchemaDesigner/DatabaseTree.vue
index c7d230b4af..ca670a22ec 100644
--- a/frontend/src/components/SchemaDesigner/DatabaseTree.vue
+++ b/frontend/src/components/SchemaDesigner/DatabaseTree.vue
@@ -32,8 +32,6 @@
:node-props="nodeProps"
:expanded-keys="expandedKeysRef"
:selected-keys="selectedKeysRef"
- :on-update:expanded-keys="handleExpandedKeysChange"
- :on-update:selected-keys="handleSelectedKeysChange"
/>
<NDropdown
trigger="manual"
@@ -152,7 +150,7 @@ const treeData = computed(() => {
for (const table of tableList.value) {
const tableTreeNode: TreeNodeForTable = {
type: "table",
- key: `t-${table.id}`,
+ key: `t-${schema.id}-${table.id}`,
label: table.name,
isLeaf: true,
schemaId: schema.id,
@@ -395,7 +393,7 @@ const nodeProps = ({ option: treeNode }: { option: TreeNode }) => {
nextTick(() => {
if (treeNode.type === "table") {
selectedKeysRef.value = [
- `t-${treeNode.databaseId}-${treeNode.tableId}`,
+ `t-${treeNode.schemaId}-${treeNode.tableId}`,
];
}
state.shouldRelocateTreeNode = true;
@@ -441,14 +439,6 @@ const handleDropdownClickoutside = (e: MouseEvent) => {
contextMenu.showDropdown = false;
}
};
-
-const handleExpandedKeysChange = (expandedKeys: string[]) => {
- expandedKeysRef.value = expandedKeys;
-};
-
-const handleSelectedKeysChange = (selectedKeys: string[]) => {
- selectedKeysRef.value = selectedKeys;
-};
</script>
<style>
diff --git a/frontend/src/components/SchemaDesigner/index.vue b/frontend/src/components/SchemaDesigner/index.vue
index 51289f6224..06cf2110c0 100644
--- a/frontend/src/components/SchemaDesigner/index.vue
+++ b/frontend/src/components/SchemaDesigner/index.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="!state.isLoading" class="w-full h-[32rem] border rounded-lg">
+ <div class="w-full h-[32rem] border rounded-lg">
<Splitpanes
class="default-theme w-full h-full flex flex-row overflow-hidden"
>
@@ -15,7 +15,7 @@
<script lang="ts" setup>
import { Splitpanes, Pane } from "splitpanes";
-import { onMounted, reactive, ref, watch } from "vue";
+import { ref, watch } from "vue";
import { DatabaseMetadata } from "@/types/proto/v1/database_service";
import { SchemaDesign } from "@/types/proto/v1/schema_design_service";
import { Engine } from "@/types/proto/v1/common";
@@ -26,20 +26,12 @@ import Designer from "./Designer.vue";
import { Schema, convertSchemaMetadataList } from "@/types";
import { cloneDeep } from "lodash-es";
-interface LocalState {
- isLoading: boolean;
-}
-
const props = defineProps<{
readonly: boolean;
engine: Engine;
schemaDesign: SchemaDesign;
}>();
-const state = reactive<LocalState>({
- isLoading: true,
-});
-
const readonly = ref(props.readonly);
const engine = ref(props.engine);
const metadata = ref<DatabaseMetadata>(DatabaseMetadata.fromPartial({}));
@@ -51,17 +43,6 @@ const tabState = ref<SchemaDesignerTabState>({
tabMap: new Map(),
});
-onMounted(async () => {
- baselineMetadata.value =
- cloneDeep(props.schemaDesign?.baselineSchemaMetadata) ||
- DatabaseMetadata.fromPartial({});
- metadata.value =
- cloneDeep(props.schemaDesign?.schemaMetadata) ||
- DatabaseMetadata.fromPartial({});
- editableSchemas.value = convertSchemaMetadataList(metadata.value.schemas);
- state.isLoading = false;
-});
-
provideSchemaDesignerContext({
readonly: readonly,
baselineMetadata: baselineMetadata,
@@ -75,10 +56,25 @@ provideSchemaDesignerContext({
watch(
() => props,
() => {
+ baselineMetadata.value =
+ cloneDeep(props.schemaDesign?.baselineSchemaMetadata) ||
+ DatabaseMetadata.fromPartial({});
+ metadata.value =
+ cloneDeep(props.schemaDesign?.schemaMetadata) ||
+ DatabaseMetadata.fromPartial({});
+ editableSchemas.value = convertSchemaMetadataList(metadata.value.schemas);
readonly.value = props.readonly;
engine.value = props.engine;
+ // NOTE: clear tab state in the following cases:
+ // * change baseline schema.
+ // * change selected schema design.
+ // * toggle the editing state.
+ tabState.value = {
+ tabMap: new Map(),
+ };
},
{
+ immediate: true,
deep: true,
}
);
diff --git a/frontend/src/components/SchemaEditor/DatabaseTree.vue b/frontend/src/components/SchemaEditor/DatabaseTree.vue
index 2696013e25..aa4203aed1 100644
--- a/frontend/src/components/SchemaEditor/DatabaseTree.vue
+++ b/frontend/src/components/SchemaEditor/DatabaseTree.vue
@@ -23,7 +23,6 @@
:expanded-keys="expandedKeysRef"
:selected-keys="selectedKeysRef"
:on-update:expanded-keys="handleExpandedKeysChange"
- :on-update:selected-keys="handleSelectedKeysChange"
/>
<NDropdown
trigger="manual"
@@ -788,10 +787,6 @@ const handleDropdownClickoutside = (e: MouseEvent) => {
const handleExpandedKeysChange = (expandedKeys: string[]) => {
expandedKeysRef.value = expandedKeys;
};
-
-const handleSelectedKeysChange = (selectedKeys: string[]) => {
- selectedKeysRef.value = selectedKeys;
-};
</script>
<style>