25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(grid): add direct table structure navigation
t8y2d2df8d1633ab
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex efbf60231c..93e68ba1e9 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -12259,6 +12259,22 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val><template #leading><slot v-if="hasResultToolbarActionsSlot" name="result-toolbar-actions" :compact="compactDataGridToolbar" />+ <Tooltip v-if="props.context === 'table-data' && canOpenTableStructureEditor">+ <TooltipTrigger as-child>+ <Button+ data-grid-edit-table-structure-action+ variant="ghost"+ size="sm"+ :class="['data-grid-topbar-action-button h-5 shrink-0 px-1.5 text-xs', compactDataGridToolbar ? 'data-grid-topbar-action-button--compact' : '']"+ :aria-label="t('contextMenu.editStructure')"+ @click="openTableStructureEditor"+ >+ <PencilRuler class="data-grid-topbar-action-icon h-3 w-3" />+ <span class="data-grid-topbar-action-label" :class="{ 'data-grid-topbar-action-label--compact': compactDataGridToolbar }">{{ t("contextMenu.editStructure") }}</span>+ </Button>+ </TooltipTrigger>+ <TooltipContent side="bottom">{{ t("contextMenu.editStructure") }}</TooltipContent>+ </Tooltip><Tooltip v-if="showQueryEditReadOnlyBadge"><TooltipTrigger as-child><div class="flex h-5 items-center gap-1 rounded border border-muted-foreground/30 bg-muted/60 px-1.5 text-xs font-medium text-muted-foreground">diff --git a/apps/desktop/src/components/grid/__tests__/DataGridEditTableStructureShortcut.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridEditTableStructureShortcut.spec.tsindex 191bd45810..042b84d881 100644--- a/apps/desktop/src/components/grid/__tests__/DataGridEditTableStructureShortcut.spec.ts+++ b/apps/desktop/src/components/grid/__tests__/DataGridEditTableStructureShortcut.spec.ts@@ -152,6 +152,21 @@ afterEach(() => {});describe("DataGrid edit-table-structure shortcut", () => {+ it("opens the structure editor from the table-data toolbar", async () => {+ const { host, openTableStructure } = mountGrid();+ await settle();+ const action = host.querySelector<HTMLButtonElement>("[data-grid-edit-table-structure-action]");++ expect(action).not.toBeNull();+ expect(action?.getAttribute("aria-label")).toBe("Edit Structure");+ expect(action?.textContent).toContain("Edit Structure");+ action?.click();+ await settle();++ expect(openTableStructure).toHaveBeenCalledOnce();+ expect(openTableStructure).toHaveBeenCalledWith("connection-1", "app", "public", "users", "ddl", undefined, "warehouse", "table");+ });+it("opens the existing structure editor route for an eligible table-data grid", async () => {const { host, openTableStructure } = mountGrid();await settle();@@ -206,6 +221,7 @@ describe("DataGrid edit-table-structure shortcut", () => {expect(event.defaultPrevented).toBe(false);expect(bubbled).toHaveBeenCalledOnce();expect(openTableStructure).not.toHaveBeenCalled();+ expect(host.querySelector("[data-grid-edit-table-structure-action]")).toBeNull();});it("leaves editable text targets untouched", async () => {@@ -259,6 +275,7 @@ describe("DataGrid edit-table-structure shortcut", () => {expect(keydown).toMatch(/if \(!targetAllowsNativeClipboard && props\.context === "table-data" && canOpenTableStructureEditor\.value && isEditTableStructureShortcut\(event, settingsStore\.editorSettings\.shortcuts\)\) \{[\s\S]*?event\.preventDefault\(\);[\s\S]*?event\.stopPropagation\(\);[\s\S]*?openTableStructureEditor\(\);[\s\S]*?return;/,);+ expect(dataGridSource).toMatch(/data-grid-edit-table-structure-action[\s\S]*?@click="openTableStructureEditor"/);expect(dataGridSource).toMatch(/<Button v-if="canOpenTableStructureEditor"[^>]*@click="openTableStructureEditor">/);});});