mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
disconnect command
This commit is contained in:
@@ -21,6 +21,7 @@ module.exports = ({ editMenu }) => [
|
||||
{ divider: true },
|
||||
{ command: 'file.exit', hideDisabled: true },
|
||||
{ command: 'app.logout', hideDisabled: true, skipInApp: true },
|
||||
{ command: 'app.disconnect', hideDisabled: true, skipInApp: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
6
packages/api/env/dblogin/.env
vendored
6
packages/api/env/dblogin/.env
vendored
@@ -6,9 +6,9 @@ SINGLE_CONNECTION=mysql
|
||||
|
||||
LABEL_mysql=MySql localhost
|
||||
SERVER_mysql=localhost
|
||||
USER_mysql=root
|
||||
# USER_mysql=root
|
||||
PORT_mysql=3306
|
||||
PASSWORD_mysql=Pwd2020Db
|
||||
# PASSWORD_mysql=Pwd2020Db
|
||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
||||
# PASSWORD_MODE_mysql=askPassword
|
||||
# PASSWORD_MODE_mysql=askUser
|
||||
PASSWORD_MODE_mysql=askUser
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
const electron = getElectron();
|
||||
const currentDb = getCurrentDatabase();
|
||||
openedConnections.update(list => list.filter(x => x != conid));
|
||||
removeVolatileMapping(conid);
|
||||
if (electron) {
|
||||
apiCall('server-connections/disconnect', { conid });
|
||||
}
|
||||
@@ -100,7 +101,7 @@
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
import { getDatabaseList, useUsedApps } from '../utility/metadataLoaders';
|
||||
import { getLocalStorage } from '../utility/storageCache';
|
||||
import { apiCall } from '../utility/api';
|
||||
import { apiCall, removeVolatileMapping } from '../utility/api';
|
||||
import ImportDatabaseDumpModal from '../modals/ImportDatabaseDumpModal.svelte';
|
||||
import { closeMultipleTabs } from '../widgets/TabsPanel.svelte';
|
||||
import AboutModal from '../modals/AboutModal.svelte';
|
||||
|
||||
@@ -37,6 +37,7 @@ import { openWebLink } from '../utility/exportFileTools';
|
||||
import { getSettings } from '../utility/metadataLoaders';
|
||||
import { isMac } from '../utility/common';
|
||||
import { doLogout, internalRedirectTo } from '../clientAuth';
|
||||
import { disconnectServerConnection } from '../appobj/ConnectionAppObject.svelte';
|
||||
|
||||
// function themeCommand(theme: ThemeDefinition) {
|
||||
// return {
|
||||
@@ -552,6 +553,14 @@ registerCommand({
|
||||
onClick: doLogout,
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'app.disconnect',
|
||||
category: 'App',
|
||||
name: 'Disconnect',
|
||||
testEnabled: () => getCurrentConfig()?.singleConnection != null,
|
||||
onClick: () => disconnectServerConnection(getCurrentConfig()?.singleConnection?._id),
|
||||
});
|
||||
|
||||
export function registerFileCommands({
|
||||
idPrefix,
|
||||
category,
|
||||
|
||||
@@ -39,6 +39,14 @@ export function getVolatileRemappingInv(conid) {
|
||||
return volatileConnectionMapInv[conid] || conid;
|
||||
}
|
||||
|
||||
export function removeVolatileMapping(conid) {
|
||||
const mapped = volatileConnectionMap[conid];
|
||||
if (mapped) {
|
||||
delete volatileConnectionMap[conid];
|
||||
delete volatileConnectionMapInv[mapped];
|
||||
}
|
||||
}
|
||||
|
||||
function wantEventSource() {
|
||||
if (!eventSource) {
|
||||
eventSource = new EventSource(`${resolveApi()}/stream`);
|
||||
|
||||
Reference in New Issue
Block a user