feat(sidebar): add table New Query action

This commit is contained in:
Bagus Wahyu Aprianto
2026-08-18 10:50:35 +08:00
committed by GitHub
parent f92497b3d3
commit 840082d73b
@@ -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({