feat(sidebar): add table management context menu operations (#114)

Add create, drop, empty, truncate, and duplicate structure operations
to the sidebar table right-click menu. Also extends the table structure
editor to support create mode from the database/schema context menu.
This commit is contained in:
t8y2
2026-05-06 21:21:08 +08:00
parent 6a3e8067e1
commit 6523d1b3f6
6 changed files with 387 additions and 11 deletions
+15
View File
@@ -52,7 +52,11 @@ export function useNavigationTargets(dialogs: {
showFieldLineageDialog: { value: boolean };
showDatabaseSearchDialog: { value: boolean };
structurePrefillTable: { value: string };
structurePrefillConnectionId?: { value: string };
structurePrefillDatabase?: { value: string };
structurePrefillSchema?: { value: string };
}) {
const connectionStore = useConnectionStore();
const queryStore = useQueryStore();
async function openLineageTarget(target: NavigationTarget) {
@@ -69,6 +73,17 @@ export function useNavigationTargets(dialogs: {
reloadData: () => Promise<void>,
toast: (msg: string, duration?: number) => void,
) {
if (!dialogs.structurePrefillTable.value) {
const connId = dialogs.structurePrefillConnectionId?.value;
const db = dialogs.structurePrefillDatabase?.value;
const schema = dialogs.structurePrefillSchema?.value;
if (connId && db) {
try {
await connectionStore.loadTables(connId, db, schema || undefined);
} catch {}
}
return;
}
const activeTab = queryStore.tabs.find((t) => t.id === queryStore.activeTabId);
if (activeTab?.mode === "data" && activeTab.tableMeta?.tableName === dialogs.structurePrefillTable.value) {
try {