Add commands for viewing application logs and managing plugins; update settings tab integration

This commit is contained in:
Stela Augustinova
2025-11-28 13:23:02 +01:00
parent 30ddc18eb1
commit 311680c090
4 changed files with 53 additions and 36 deletions

View File

@@ -76,6 +76,8 @@ module.exports = ({ editMenu, isMac }, currentTranslations = null) => [
{ command: 'app.zoomIn', hideDisabled: true },
{ command: 'app.zoomOut', 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 },
{ command: 'app.exportConnections', hideDisabled: true },
{ command: 'app.importConnections', hideDisabled: true },
{ divider: true },
{ command: 'app.managePlugins', hideDisabled: true },
],
},
...(isMac

View File

@@ -11,6 +11,7 @@ import {
promoWidgetPreview,
visibleToolbar,
visibleWidgetSideBar,
selectedWidget,
} from '../stores';
import registerCommand from './registerCommand';
import { get } from 'svelte/store';
@@ -795,14 +796,14 @@ if (hasPermission('settings/change')) {
testEnabled: () => hasPermission('settings/change'),
});
registerCommand({
id: 'settings.show',
category: __t('command.settings', { defaultMessage: 'Settings' }),
name: __t('command.settings.change', { defaultMessage: 'Change' }),
toolbarName: __t('command.settings', { defaultMessage: 'Settings' }),
onClick: () => showModal(SettingsModal),
testEnabled: () => hasPermission('settings/change'),
});
// registerCommand({
// id: 'settings.show',
// category: __t('command.settings', { defaultMessage: 'Settings' }),
// name: __t('command.settings.change', { defaultMessage: 'Change' }),
// toolbarName: __t('command.settings', { defaultMessage: 'Settings' }),
// onClick: () => showModal(SettingsModal),
// testEnabled: () => hasPermission('settings/change'),
// });
}
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();
if (electron) {
electron.addEventListener('run-command', (e, commandId) => runCommand(commandId));

View File

@@ -1,4 +1,8 @@
<script>
<script lang="ts" context="module">
export const matchingProps = [];
</script>
<script lang="ts">
import SettingsMenuControl from "../elements/SettingsMenuControl.svelte";
import GeneralSettings from "../settings/GeneralSettings.svelte";
import SettingsFormProvider from "../forms/SettingsFormProvider.svelte";

View File

@@ -113,33 +113,12 @@
//const handleChangeWidget= e => (selectedWidget.set(item.name))
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({
title: 'Application log',
icon: 'img applog',
tabComponent: 'AppLogTab',
});
},
},
];
currentDropDownMenu.set({ left, top, items });
openNewTab({
title: 'Settings',
icon: 'icon settings',
tabComponent: 'SettingsTab',
props: {},
});
}
function handleCloudAccountMenu() {