1 parent
fbaf556f3a
commit
4768dbb99a
19 files changed
+192
-7
No files matched your search
@@ -1620,7 +1620,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
return tabs.value.find((tab) => tab.connectionId === connectionId && tab.database === database && tab.title === title && tab.mode === mode && (tab.schema || "") === (schema || "") && (tab.catalog || "") === (catalog || ""));
|
||||
}
|
||||
|
||||
function createTab(connectionId: string, database: string, title?: string, mode: QueryTab["mode"] = "query", schema?: string, initialSql?: string, catalog?: string, options: { forceNew?: boolean; activate?: boolean; forceWordWrap?: boolean } = {}) {
|
||||
function createTab(connectionId: string, database: string, title?: string, mode: QueryTab["mode"] = "query", schema?: string, initialSql?: string, catalog?: string, options: { forceNew?: boolean; activate?: boolean; forceWordWrap?: boolean; insertAfterActive?: boolean } = {}) {
|
||||
if (title && !options.forceNew) {
|
||||
const existing = findTabByIdentity(connectionId, database, title, mode, schema, catalog);
|
||||
if (existing) {
|
||||
@@ -1646,7 +1646,9 @@ export const useQueryStore = defineStore("query", () => {
|
||||
mode,
|
||||
};
|
||||
if (mode === "query") tab.originalSql = initialSql ?? "";
|
||||
tabs.value.push(tab);
|
||||
const activeIndex = options.insertAfterActive ? tabs.value.findIndex((item) => item.id === activeTabId.value) : -1;
|
||||
if (activeIndex >= 0) tabs.value.splice(activeIndex + 1, 0, tab);
|
||||
else tabs.value.push(tab);
|
||||
if (options.activate !== false) activeTabId.value = id;
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user