mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fix: DB list for different connection
This commit is contained in:
parent
5c703c786d
commit
d454da325f
@ -4,6 +4,9 @@
|
||||
import { getFormContext } from '../forms/FormProviderCore.svelte';
|
||||
import FormSelectField from '../forms/FormSelectField.svelte';
|
||||
import { useDatabaseList } from '../utility/metadataLoaders';
|
||||
import uuidv1 from 'uuid/v1';
|
||||
import { temporaryOpenedConnections } from '../stores';
|
||||
import useEffect from '../utility/useEffect';
|
||||
|
||||
export let conidName;
|
||||
|
||||
@ -17,6 +20,16 @@
|
||||
})),
|
||||
'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>
|
||||
|
||||
<FormSelectField {...$$restProps} options={databaseOptions} />
|
||||
|
@ -82,6 +82,7 @@ export const visibleSelectedWidget = derived(
|
||||
export const emptyConnectionGroupNames = writableWithStorage([], 'emptyConnectionGroupNames');
|
||||
export const collapsedConnectionGroupNames = writableWithStorage([], 'collapsedConnectionGroupNames');
|
||||
export const openedConnections = writable([]);
|
||||
export const temporaryOpenedConnections = writable([]);
|
||||
export const openedSingleDatabaseConnections = writable([]);
|
||||
export const expandedConnections = writable([]);
|
||||
export const currentDatabase = writable(null);
|
||||
@ -144,6 +145,11 @@ export const activeDbKeysStore = writableWithStorage({}, 'activeDbKeysStore');
|
||||
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>
|
||||
$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;
|
||||
export const visibleTitleBar = derived(useSettings(), $settings => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { openedConnections, currentDatabase } from '../stores';
|
||||
import { openedConnections, currentDatabase, openedConnectionsWithTemporary } from '../stores';
|
||||
import { apiCall, strmid } from './api';
|
||||
import { getConnectionList } from './metadataLoaders';
|
||||
|
||||
@ -26,7 +26,7 @@ let openedConnectionsHandle = null;
|
||||
let currentDatabaseHandle = null;
|
||||
|
||||
export function subscribeConnectionPingers() {
|
||||
openedConnections.subscribe(value => {
|
||||
openedConnectionsWithTemporary.subscribe(value => {
|
||||
doServerPing(value);
|
||||
if (openedConnectionsHandle) window.clearInterval(openedConnectionsHandle);
|
||||
openedConnectionsHandle = window.setInterval(() => doServerPing(value), 20 * 1000);
|
||||
|
Loading…
Reference in New Issue
Block a user