mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 08:43:57 +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) {
|
function setChecked(value) {
|
||||||
if (!value && isChecked) {
|
if (!value && isChecked) {
|
||||||
checkedObjectsStore.update(x => x.filter(y => module?.extractKey(data) != module?.extractKey(y)));
|
checkedObjectsStore.update(x => x.filter(y => module?.extractKey(data) != module?.extractKey(y)));
|
||||||
@@ -86,6 +93,7 @@
|
|||||||
draggable={true}
|
draggable={true}
|
||||||
on:click={handleClick}
|
on:click={handleClick}
|
||||||
on:mouseup={handleMouseUp}
|
on:mouseup={handleMouseUp}
|
||||||
|
on:mousedown={handleMouseDown}
|
||||||
on:mousedown
|
on:mousedown
|
||||||
on:dblclick
|
on:dblclick
|
||||||
use:contextMenu={disableContextMenu ? null : menu}
|
use:contextMenu={disableContextMenu ? null : menu}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { shouldShowTab } from '../tabpanel/TabsPanel.svelte';
|
|||||||
import { callWhenAppLoaded, getAppLoaded } from './appLoadManager';
|
import { callWhenAppLoaded, getAppLoaded } from './appLoadManager';
|
||||||
import { getConnectionInfo } from './metadataLoaders';
|
import { getConnectionInfo } from './metadataLoaders';
|
||||||
import { switchCurrentDatabase } from './common';
|
import { switchCurrentDatabase } from './common';
|
||||||
|
import { extractDbNameFromComposite, isCompositeDbName } from 'dbgate-tools';
|
||||||
|
|
||||||
// let lastCurrentTab = null;
|
// let lastCurrentTab = null;
|
||||||
|
|
||||||
@@ -82,7 +83,10 @@ currentDatabase.subscribe(currentDb => {
|
|||||||
if (currentDb) {
|
if (currentDb) {
|
||||||
focusedConnectionOrDatabase.set({
|
focusedConnectionOrDatabase.set({
|
||||||
conid: currentDb.connection?._id,
|
conid: currentDb.connection?._id,
|
||||||
database: currentDb.name,
|
database:
|
||||||
|
currentDb.connection?.useSeparateSchemas && isCompositeDbName(currentDb.name)
|
||||||
|
? extractDbNameFromComposite(currentDb.name)
|
||||||
|
: currentDb.name,
|
||||||
connection: currentDb.connection,
|
connection: currentDb.connection,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import _ from 'lodash';
|
|||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
import { getActiveTab, getOpenedTabs, openedTabs } from '../stores';
|
import { getActiveTab, getOpenedTabs, openedTabs } from '../stores';
|
||||||
import tabs from '../tabs';
|
import tabs from '../tabs';
|
||||||
import { setSelectedTabFunc } from './common';
|
import { setSelectedTabFunc, switchCurrentDatabase } from './common';
|
||||||
import localforage from 'localforage';
|
import localforage from 'localforage';
|
||||||
import stableStringify from 'json-stable-stringify';
|
import stableStringify from 'json-stable-stringify';
|
||||||
import { saveAllPendingEditorData } from '../query/useEditorData';
|
import { saveAllPendingEditorData } from '../query/useEditorData';
|
||||||
|
import { getConnectionInfo } from './metadataLoaders';
|
||||||
|
|
||||||
function findFreeNumber(numbers: number[]) {
|
function findFreeNumber(numbers: number[]) {
|
||||||
if (numbers.length == 0) return 1;
|
if (numbers.length == 0) return 1;
|
||||||
@@ -21,7 +22,16 @@ export default async function openNewTab(newTab, initialData: any = undefined, o
|
|||||||
|
|
||||||
let existing = null;
|
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;
|
const { tabPreviewMode } = newTab;
|
||||||
if (savedFile || savedFilePath) {
|
if (savedFile || savedFilePath) {
|
||||||
existing = oldTabs.find(
|
existing = oldTabs.find(
|
||||||
|
|||||||
@@ -117,6 +117,7 @@
|
|||||||
|
|
||||||
async function handleFocus() {
|
async function handleFocus() {
|
||||||
isListFocused = true;
|
isListFocused = true;
|
||||||
|
|
||||||
// await tick();
|
// await tick();
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
// console.log('ON FOCUS AFTER SLEEP');
|
// console.log('ON FOCUS AFTER SLEEP');
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
import DropDownButton from '../buttons/DropDownButton.svelte';
|
import DropDownButton from '../buttons/DropDownButton.svelte';
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
||||||
import { findEngineDriver } from 'dbgate-tools';
|
import { extractDbNameFromComposite, findEngineDriver } from 'dbgate-tools';
|
||||||
import {
|
import {
|
||||||
currentDatabase,
|
currentDatabase,
|
||||||
extensions,
|
extensions,
|
||||||
@@ -137,7 +137,8 @@
|
|||||||
$: differentFocusedDb =
|
$: differentFocusedDb =
|
||||||
$focusedConnectionOrDatabase &&
|
$focusedConnectionOrDatabase &&
|
||||||
($focusedConnectionOrDatabase.conid != conid ||
|
($focusedConnectionOrDatabase.conid != conid ||
|
||||||
($focusedConnectionOrDatabase?.database && $focusedConnectionOrDatabase?.database != database));
|
($focusedConnectionOrDatabase?.database &&
|
||||||
|
$focusedConnectionOrDatabase?.database != extractDbNameFromComposite(database)));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $status && $status.name == 'error'}
|
{#if $status && $status.name == 'error'}
|
||||||
|
|||||||
Reference in New Issue
Block a user