mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 15:03:57 +00:00
fixed notifying volatile connections (used for askUser password scenarios)
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
import ErrorMessageModal from './ErrorMessageModal.svelte';
|
import ErrorMessageModal from './ErrorMessageModal.svelte';
|
||||||
import ModalBase from './ModalBase.svelte';
|
import ModalBase from './ModalBase.svelte';
|
||||||
import { closeCurrentModal, showModal } from './modalTools';
|
import { closeCurrentModal, showModal } from './modalTools';
|
||||||
|
import { callServerPing } from '../utility/connectionsPinger';
|
||||||
|
|
||||||
export let conid;
|
export let conid;
|
||||||
export let passwordMode;
|
export let passwordMode;
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
isTesting = false;
|
isTesting = false;
|
||||||
if (resp.msgtype == 'connected') {
|
if (resp.msgtype == 'connected') {
|
||||||
setVolatileConnectionRemapping(conid, resp._id);
|
setVolatileConnectionRemapping(conid, resp._id);
|
||||||
|
await callServerPing();
|
||||||
dispatchCacheChange({ key: `server-status-changed` });
|
dispatchCacheChange({ key: `server-status-changed` });
|
||||||
batchDispatchCacheTriggers(x => x.conid == conid);
|
batchDispatchCacheTriggers(x => x.conid == conid);
|
||||||
closeCurrentModal();
|
closeCurrentModal();
|
||||||
|
|||||||
@@ -209,6 +209,10 @@ export function useApiCall(route, args, defaultValue) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getVolatileConnections() {
|
||||||
|
return Object.values(volatileConnectionMap);
|
||||||
|
}
|
||||||
|
|
||||||
function enableApiLog() {
|
function enableApiLog() {
|
||||||
apiLogging = true;
|
apiLogging = true;
|
||||||
console.log('API loggin enabled');
|
console.log('API loggin enabled');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { openedConnections, currentDatabase, openedConnectionsWithTemporary, getCurrentConfig } from '../stores';
|
import { openedConnections, currentDatabase, openedConnectionsWithTemporary, getCurrentConfig, getOpenedConnections } from '../stores';
|
||||||
import { apiCall, strmid } from './api';
|
import { apiCall, getVolatileConnections, strmid } from './api';
|
||||||
import { getConnectionList } from './metadataLoaders';
|
import { getConnectionList } from './metadataLoaders';
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
|
|
||||||
@@ -11,9 +11,14 @@ import hasPermission from '../utility/hasPermission';
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
const doServerPing = value => {
|
const doServerPing = value => {
|
||||||
|
const conidArray = [...value];
|
||||||
|
if (getCurrentConfig().storageDatabase && hasPermission('internal-storage')) {
|
||||||
|
conidArray.push('__storage');
|
||||||
|
}
|
||||||
|
conidArray.push(...getVolatileConnections());
|
||||||
|
|
||||||
apiCall('server-connections/ping', {
|
apiCall('server-connections/ping', {
|
||||||
conidArray:
|
conidArray,
|
||||||
getCurrentConfig().storageDatabase && hasPermission('internal-storage') ? ['__storage', ...value] : value,
|
|
||||||
strmid,
|
strmid,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -43,3 +48,8 @@ export function subscribeConnectionPingers() {
|
|||||||
currentDatabaseHandle = window.setInterval(() => doDatabasePing(value), 20 * 1000);
|
currentDatabaseHandle = window.setInterval(() => doDatabasePing(value), 20 * 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function callServerPing() {
|
||||||
|
const connections = getOpenedConnections();
|
||||||
|
doServerPing(connections);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user