mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
focused connection changes
This commit is contained in:
@@ -58,6 +58,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseDown(e) {
|
||||
if (e.button == 1) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
function setChecked(value) {
|
||||
if (!value && isChecked) {
|
||||
checkedObjectsStore.update(x => x.filter(y => module?.extractKey(data) != module?.extractKey(y)));
|
||||
@@ -86,6 +93,7 @@
|
||||
draggable={true}
|
||||
on:click={handleClick}
|
||||
on:mouseup={handleMouseUp}
|
||||
on:mousedown={handleMouseDown}
|
||||
on:mousedown
|
||||
on:dblclick
|
||||
use:contextMenu={disableContextMenu ? null : menu}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
|
||||
async function handleFocus() {
|
||||
isListFocused = true;
|
||||
|
||||
// await tick();
|
||||
await sleep(100);
|
||||
// console.log('ON FOCUS AFTER SLEEP');
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
import DropDownButton from '../buttons/DropDownButton.svelte';
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
||||
import { findEngineDriver } from 'dbgate-tools';
|
||||
import { extractDbNameFromComposite, findEngineDriver } from 'dbgate-tools';
|
||||
import {
|
||||
currentDatabase,
|
||||
extensions,
|
||||
@@ -137,7 +137,8 @@
|
||||
$: differentFocusedDb =
|
||||
$focusedConnectionOrDatabase &&
|
||||
($focusedConnectionOrDatabase.conid != conid ||
|
||||
($focusedConnectionOrDatabase?.database && $focusedConnectionOrDatabase?.database != database));
|
||||
($focusedConnectionOrDatabase?.database &&
|
||||
$focusedConnectionOrDatabase?.database != extractDbNameFromComposite(database)));
|
||||
</script>
|
||||
|
||||
{#if $status && $status.name == 'error'}
|
||||
|
||||
Reference in New Issue
Block a user