mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-01 00:25:38 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user