mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 02:56:01 +00:00
fix: DB list for different connection
This commit is contained in:
@@ -4,6 +4,9 @@
|
|||||||
import { getFormContext } from '../forms/FormProviderCore.svelte';
|
import { getFormContext } from '../forms/FormProviderCore.svelte';
|
||||||
import FormSelectField from '../forms/FormSelectField.svelte';
|
import FormSelectField from '../forms/FormSelectField.svelte';
|
||||||
import { useDatabaseList } from '../utility/metadataLoaders';
|
import { useDatabaseList } from '../utility/metadataLoaders';
|
||||||
|
import uuidv1 from 'uuid/v1';
|
||||||
|
import { temporaryOpenedConnections } from '../stores';
|
||||||
|
import useEffect from '../utility/useEffect';
|
||||||
|
|
||||||
export let conidName;
|
export let conidName;
|
||||||
|
|
||||||
@@ -17,6 +20,16 @@
|
|||||||
})),
|
})),
|
||||||
'label'
|
'label'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const tmpid = uuidv1();
|
||||||
|
|
||||||
|
$: effect = useEffect(() => {
|
||||||
|
temporaryOpenedConnections.update(x => [...x, { tmpid, conid: $values && $values[conidName] }]);
|
||||||
|
return () => {
|
||||||
|
temporaryOpenedConnections.update(x => x.filter(y => y.tmpid != tmpid));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
$: $effect;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FormSelectField {...$$restProps} options={databaseOptions} />
|
<FormSelectField {...$$restProps} options={databaseOptions} />
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export const visibleSelectedWidget = derived(
|
|||||||
export const emptyConnectionGroupNames = writableWithStorage([], 'emptyConnectionGroupNames');
|
export const emptyConnectionGroupNames = writableWithStorage([], 'emptyConnectionGroupNames');
|
||||||
export const collapsedConnectionGroupNames = writableWithStorage([], 'collapsedConnectionGroupNames');
|
export const collapsedConnectionGroupNames = writableWithStorage([], 'collapsedConnectionGroupNames');
|
||||||
export const openedConnections = writable([]);
|
export const openedConnections = writable([]);
|
||||||
|
export const temporaryOpenedConnections = writable([]);
|
||||||
export const openedSingleDatabaseConnections = writable([]);
|
export const openedSingleDatabaseConnections = writable([]);
|
||||||
export const expandedConnections = writable([]);
|
export const expandedConnections = writable([]);
|
||||||
export const currentDatabase = writable(null);
|
export const currentDatabase = writable(null);
|
||||||
@@ -144,6 +145,11 @@ export const activeDbKeysStore = writableWithStorage({}, 'activeDbKeysStore');
|
|||||||
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>
|
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>
|
||||||
$extensions.themes.find(x => x.themeClassName == $currentTheme)
|
$extensions.themes.find(x => x.themeClassName == $currentTheme)
|
||||||
);
|
);
|
||||||
|
export const openedConnectionsWithTemporary = derived(
|
||||||
|
[openedConnections, temporaryOpenedConnections],
|
||||||
|
([$openedConnections, $temporaryOpenedConnections]) =>
|
||||||
|
_.uniq([...$openedConnections, ...$temporaryOpenedConnections.map(x => x.conid)])
|
||||||
|
);
|
||||||
|
|
||||||
let nativeMenuOnStartup = null;
|
let nativeMenuOnStartup = null;
|
||||||
export const visibleTitleBar = derived(useSettings(), $settings => {
|
export const visibleTitleBar = derived(useSettings(), $settings => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { openedConnections, currentDatabase } from '../stores';
|
import { openedConnections, currentDatabase, openedConnectionsWithTemporary } from '../stores';
|
||||||
import { apiCall, strmid } from './api';
|
import { apiCall, strmid } from './api';
|
||||||
import { getConnectionList } from './metadataLoaders';
|
import { getConnectionList } from './metadataLoaders';
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ let openedConnectionsHandle = null;
|
|||||||
let currentDatabaseHandle = null;
|
let currentDatabaseHandle = null;
|
||||||
|
|
||||||
export function subscribeConnectionPingers() {
|
export function subscribeConnectionPingers() {
|
||||||
openedConnections.subscribe(value => {
|
openedConnectionsWithTemporary.subscribe(value => {
|
||||||
doServerPing(value);
|
doServerPing(value);
|
||||||
if (openedConnectionsHandle) window.clearInterval(openedConnectionsHandle);
|
if (openedConnectionsHandle) window.clearInterval(openedConnectionsHandle);
|
||||||
openedConnectionsHandle = window.setInterval(() => doServerPing(value), 20 * 1000);
|
openedConnectionsHandle = window.setInterval(() => doServerPing(value), 20 * 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user