Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat(sidebar): add table New Query action

Bagus Wahyu Aprianto840082d73b76
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
index 2609cf12fa..aa8d609078 100644
--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
@@ -1558,7 +1558,19 @@ async function newQuery() {
connectionStore.activeConnectionId = node.connectionId;
if (hasTreeNodeDatabaseContext(node)) {
if (node.type === "table" || node.type === "view" || node.type === "materialized_view") {
- await newSelectTemplate();
+ const config = connectionStore.getConfig(node.connectionId);
+ const dbType = config ? effectiveDatabaseTypeForConnection(config) : undefined;
+ const identifierQuote = connectionStore.connectionIdentifierQuote(node.connectionId);
+ const sql = buildTableSelectTemplate({
+ databaseType: dbType,
+ identifierQuote,
+ catalog: node.catalog,
+ database: node.database,
+ schema: node.schema,
+ tableName: node.label,
+ columns: [],
+ });
+ openSqlTemplateTab(node.connectionId, node.database, node.schema, node.catalog, sql);
return;
}
queryStore.createTab(node.connectionId, node.database, undefined, "query", node.schema, undefined, node.catalog);
@@ -4979,6 +4991,7 @@ function buildObjectSidebarMenu(context: SidebarMenuFactoryContext): boolean {
}
const destructiveActions: ContextMenuItem[] = [];
items.push(copyNameMenuItem());
+ items.push({ label: t("contextMenu.newQuery"), action: newQuery, icon: TerminalSquare });
items.push({ label: "", separator: true });
items.push({ label: t("contextMenu.viewData"), action: openDataImmediately, icon: TableProperties });
items.push({