mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 16:26:00 +00:00
removed dependencies on electron remote
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
<script context="module">
|
||||
const electron = getElectron();
|
||||
|
||||
registerCommand({
|
||||
id: 'commandPalette.show',
|
||||
category: 'Command palette',
|
||||
@@ -20,7 +18,7 @@
|
||||
category: 'Database',
|
||||
toolbarName: 'Database search',
|
||||
name: 'Search',
|
||||
keyText: electron ? 'Ctrl+P' : 'F3',
|
||||
keyText: isElectronAvailable() ? 'Ctrl+P' : 'F3',
|
||||
onClick: () => visibleCommandPalette.set('database'),
|
||||
testEnabled: () => getVisibleCommandPalette() != 'database',
|
||||
});
|
||||
@@ -75,7 +73,7 @@
|
||||
} from '../stores';
|
||||
import clickOutside from '../utility/clickOutside';
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
import getElectron from '../utility/getElectron';
|
||||
import { isElectronAvailable } from '../utility/getElectron';
|
||||
import keycodes from '../utility/keycodes';
|
||||
import { useConnectionList, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||
import { getLocalStorage } from '../utility/storageCache';
|
||||
|
||||
@@ -4,8 +4,6 @@ import getElectron from '../utility/getElectron';
|
||||
import registerCommand from './registerCommand';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
|
||||
const electron = getElectron();
|
||||
|
||||
registerCommand({
|
||||
id: 'database.changeState',
|
||||
category: 'Database',
|
||||
@@ -34,6 +32,7 @@ registerCommand({
|
||||
{
|
||||
text: 'Disconnect',
|
||||
onClick: () => {
|
||||
const electron = getElectron();
|
||||
if (electron) axiosInstance().post('database-connections/disconnect', dbid);
|
||||
currentDatabase.set(null);
|
||||
},
|
||||
|
||||
@@ -26,8 +26,6 @@ import InputTextModal from '../modals/InputTextModal.svelte';
|
||||
import { removeLocalStorage } from '../utility/storageCache';
|
||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||
|
||||
const electron = getElectron();
|
||||
|
||||
function themeCommand(theme: ThemeDefinition) {
|
||||
return {
|
||||
text: theme.themeName,
|
||||
@@ -316,22 +314,22 @@ registerCommand({
|
||||
group: 'redo',
|
||||
});
|
||||
|
||||
if (electron) {
|
||||
registerCommand({
|
||||
id: 'file.open',
|
||||
category: 'File',
|
||||
name: 'Open',
|
||||
keyText: 'Ctrl+O',
|
||||
onClick: openElectronFile,
|
||||
});
|
||||
registerCommand({
|
||||
id: 'file.open',
|
||||
category: 'File',
|
||||
name: 'Open',
|
||||
keyText: 'Ctrl+O',
|
||||
testEnabled: () => getElectron() != null,
|
||||
onClick: openElectronFile,
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'file.openArchive',
|
||||
category: 'File',
|
||||
name: 'Open DB Model/Archive',
|
||||
onClick: openArchiveFolder,
|
||||
});
|
||||
}
|
||||
registerCommand({
|
||||
id: 'file.openArchive',
|
||||
category: 'File',
|
||||
name: 'Open DB Model/Archive',
|
||||
testEnabled: () => getElectron() != null,
|
||||
onClick: openArchiveFolder,
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'file.import',
|
||||
@@ -419,14 +417,13 @@ if (hasPermission('settings/change')) {
|
||||
});
|
||||
}
|
||||
|
||||
if (electron) {
|
||||
registerCommand({
|
||||
id: 'file.exit',
|
||||
category: 'File',
|
||||
name: 'Exit',
|
||||
onClick: () => electron.remote.getCurrentWindow().close(),
|
||||
});
|
||||
}
|
||||
registerCommand({
|
||||
id: 'file.exit',
|
||||
category: 'File',
|
||||
name: 'Exit',
|
||||
testEnabled: () => getElectron() != null,
|
||||
onClick: () => getElectron().send('close-window'),
|
||||
});
|
||||
|
||||
export function registerFileCommands({
|
||||
idPrefix,
|
||||
|
||||
Reference in New Issue
Block a user