mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 20:45:59 +00:00
Add commands for viewing application logs and managing plugins; update settings tab integration
This commit is contained in:
@@ -76,6 +76,8 @@ module.exports = ({ editMenu, isMac }, currentTranslations = null) => [
|
|||||||
{ command: 'app.zoomIn', hideDisabled: true },
|
{ command: 'app.zoomIn', hideDisabled: true },
|
||||||
{ command: 'app.zoomOut', hideDisabled: true },
|
{ command: 'app.zoomOut', hideDisabled: true },
|
||||||
{ command: 'app.zoomReset', hideDisabled: true },
|
{ command: 'app.zoomReset', hideDisabled: true },
|
||||||
|
{ divider: true },
|
||||||
|
{ command: 'app.showLogs', hideDisabled: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -95,6 +97,8 @@ module.exports = ({ editMenu, isMac }, currentTranslations = null) => [
|
|||||||
{ divider: true },
|
{ divider: true },
|
||||||
{ command: 'app.exportConnections', hideDisabled: true },
|
{ command: 'app.exportConnections', hideDisabled: true },
|
||||||
{ command: 'app.importConnections', hideDisabled: true },
|
{ command: 'app.importConnections', hideDisabled: true },
|
||||||
|
{ divider: true },
|
||||||
|
{ command: 'app.managePlugins', hideDisabled: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
...(isMac
|
...(isMac
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
promoWidgetPreview,
|
promoWidgetPreview,
|
||||||
visibleToolbar,
|
visibleToolbar,
|
||||||
visibleWidgetSideBar,
|
visibleWidgetSideBar,
|
||||||
|
selectedWidget,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import registerCommand from './registerCommand';
|
import registerCommand from './registerCommand';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
@@ -795,14 +796,14 @@ if (hasPermission('settings/change')) {
|
|||||||
testEnabled: () => hasPermission('settings/change'),
|
testEnabled: () => hasPermission('settings/change'),
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCommand({
|
// registerCommand({
|
||||||
id: 'settings.show',
|
// id: 'settings.show',
|
||||||
category: __t('command.settings', { defaultMessage: 'Settings' }),
|
// category: __t('command.settings', { defaultMessage: 'Settings' }),
|
||||||
name: __t('command.settings.change', { defaultMessage: 'Change' }),
|
// name: __t('command.settings.change', { defaultMessage: 'Change' }),
|
||||||
toolbarName: __t('command.settings', { defaultMessage: 'Settings' }),
|
// toolbarName: __t('command.settings', { defaultMessage: 'Settings' }),
|
||||||
onClick: () => showModal(SettingsModal),
|
// onClick: () => showModal(SettingsModal),
|
||||||
testEnabled: () => hasPermission('settings/change'),
|
// testEnabled: () => hasPermission('settings/change'),
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@@ -1223,6 +1224,35 @@ registerCommand({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ( hasPermission('application-log'))
|
||||||
|
{
|
||||||
|
registerCommand({
|
||||||
|
id: 'app.showLogs',
|
||||||
|
category: __t('command.application', { defaultMessage: 'Application' }),
|
||||||
|
name: __t('command.application.showLogs', { defaultMessage: 'View application logs' }),
|
||||||
|
onClick: () => {
|
||||||
|
openNewTab({
|
||||||
|
title: 'Application log',
|
||||||
|
icon: 'img applog',
|
||||||
|
tabComponent: 'AppLogTab',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPermission('widgets/plugins'))
|
||||||
|
{
|
||||||
|
registerCommand({
|
||||||
|
id: 'app.managePlugins',
|
||||||
|
category: __t('command.application', { defaultMessage: 'Application' }),
|
||||||
|
name: __t('command.application.managePlugins', { defaultMessage: 'Manage plugins' }),
|
||||||
|
onClick: () => {
|
||||||
|
selectedWidget.set('plugins');
|
||||||
|
visibleWidgetSideBar.set(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
if (electron) {
|
if (electron) {
|
||||||
electron.addEventListener('run-command', (e, commandId) => runCommand(commandId));
|
electron.addEventListener('run-command', (e, commandId) => runCommand(commandId));
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<script>
|
<script lang="ts" context="module">
|
||||||
|
export const matchingProps = [];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
import SettingsMenuControl from "../elements/SettingsMenuControl.svelte";
|
import SettingsMenuControl from "../elements/SettingsMenuControl.svelte";
|
||||||
import GeneralSettings from "../settings/GeneralSettings.svelte";
|
import GeneralSettings from "../settings/GeneralSettings.svelte";
|
||||||
import SettingsFormProvider from "../forms/SettingsFormProvider.svelte";
|
import SettingsFormProvider from "../forms/SettingsFormProvider.svelte";
|
||||||
|
|||||||
@@ -113,33 +113,12 @@
|
|||||||
//const handleChangeWidget= e => (selectedWidget.set(item.name))
|
//const handleChangeWidget= e => (selectedWidget.set(item.name))
|
||||||
|
|
||||||
function handleSettingsMenu() {
|
function handleSettingsMenu() {
|
||||||
const rect = domSettings.getBoundingClientRect();
|
|
||||||
const left = rect.right;
|
|
||||||
const top = rect.bottom;
|
|
||||||
const items = [
|
|
||||||
hasPermission('settings/change') && { command: 'settings.show' },
|
|
||||||
hasPermission('settings/change') && { command: 'settings.settingsTab' },
|
|
||||||
{ command: 'theme.changeTheme' },
|
|
||||||
hasPermission('settings/change') && { command: 'settings.commands' },
|
|
||||||
hasPermission('widgets/plugins') && {
|
|
||||||
text: _t('widgets.managePlugins', { defaultMessage: 'Manage plugins' }),
|
|
||||||
onClick: () => {
|
|
||||||
$selectedWidget = 'plugins';
|
|
||||||
$visibleWidgetSideBar = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
hasPermission('application-log') && {
|
|
||||||
text: _t('widgets.viewApplicationLogs', { defaultMessage: 'View application logs' }),
|
|
||||||
onClick: () => {
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: 'Application log',
|
title: 'Settings',
|
||||||
icon: 'img applog',
|
icon: 'icon settings',
|
||||||
tabComponent: 'AppLogTab',
|
tabComponent: 'SettingsTab',
|
||||||
|
props: {},
|
||||||
});
|
});
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
currentDropDownMenu.set({ left, top, items });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCloudAccountMenu() {
|
function handleCloudAccountMenu() {
|
||||||
|
|||||||
Reference in New Issue
Block a user