mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 04:16:00 +00:00
focused connection changes
This commit is contained in:
@@ -12,6 +12,7 @@ import { shouldShowTab } from '../tabpanel/TabsPanel.svelte';
|
||||
import { callWhenAppLoaded, getAppLoaded } from './appLoadManager';
|
||||
import { getConnectionInfo } from './metadataLoaders';
|
||||
import { switchCurrentDatabase } from './common';
|
||||
import { extractDbNameFromComposite, isCompositeDbName } from 'dbgate-tools';
|
||||
|
||||
// let lastCurrentTab = null;
|
||||
|
||||
@@ -82,7 +83,10 @@ currentDatabase.subscribe(currentDb => {
|
||||
if (currentDb) {
|
||||
focusedConnectionOrDatabase.set({
|
||||
conid: currentDb.connection?._id,
|
||||
database: currentDb.name,
|
||||
database:
|
||||
currentDb.connection?.useSeparateSchemas && isCompositeDbName(currentDb.name)
|
||||
? extractDbNameFromComposite(currentDb.name)
|
||||
: currentDb.name,
|
||||
connection: currentDb.connection,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -2,10 +2,11 @@ import _ from 'lodash';
|
||||
import uuidv1 from 'uuid/v1';
|
||||
import { getActiveTab, getOpenedTabs, openedTabs } from '../stores';
|
||||
import tabs from '../tabs';
|
||||
import { setSelectedTabFunc } from './common';
|
||||
import { setSelectedTabFunc, switchCurrentDatabase } from './common';
|
||||
import localforage from 'localforage';
|
||||
import stableStringify from 'json-stable-stringify';
|
||||
import { saveAllPendingEditorData } from '../query/useEditorData';
|
||||
import { getConnectionInfo } from './metadataLoaders';
|
||||
|
||||
function findFreeNumber(numbers: number[]) {
|
||||
if (numbers.length == 0) return 1;
|
||||
@@ -21,7 +22,16 @@ export default async function openNewTab(newTab, initialData: any = undefined, o
|
||||
|
||||
let existing = null;
|
||||
|
||||
const { savedFile, savedFolder, savedFilePath } = newTab.props || {};
|
||||
const { savedFile, savedFolder, savedFilePath, conid, database } = newTab.props || {};
|
||||
|
||||
if (conid && database) {
|
||||
const connection = await getConnectionInfo({ conid });
|
||||
await switchCurrentDatabase({
|
||||
connection,
|
||||
name: database,
|
||||
});
|
||||
}
|
||||
|
||||
const { tabPreviewMode } = newTab;
|
||||
if (savedFile || savedFilePath) {
|
||||
existing = oldTabs.find(
|
||||
|
||||
Reference in New Issue
Block a user