mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 04:25:40 +00:00
feat(sidebar): add table New Query action
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user