mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-12 12:20:57 -08:00
refactor: only enable some menu item when workspace is main
This commit is contained in:
parent
f66716dbee
commit
f7877b46dc
1 changed files with 17 additions and 12 deletions
|
|
@ -18,7 +18,7 @@ interface IWorkspaceMenuRequiredServices {
|
|||
context: Pick<IContextService, 'isOnline'>;
|
||||
git: Pick<IGitService, 'commitAndSync'>;
|
||||
native: Pick<INativeService, 'open' | 'openInEditor' | 'openInGitGuiApp'>;
|
||||
view: Pick<IViewService, 'reloadViewsWebContents'>;
|
||||
view: Pick<IViewService, 'reloadViewsWebContents' | 'enterSafeModeForViewsWebContents'>;
|
||||
wiki: Pick<IWikiService, 'requestOpenTiddlerInWiki' | 'requestWikiSendActionMessage'>;
|
||||
wikiGitWorkspace: Pick<IWikiGitWorkspaceService, 'removeWorkspace'>;
|
||||
window: Pick<IWindowService, 'open'>;
|
||||
|
|
@ -88,17 +88,6 @@ export async function getWorkspaceMenuTemplate(
|
|||
label: t('WorkspaceSelector.OpenWorkspaceFolderInGitGUI'),
|
||||
click: async () => await service.native.openInGitGuiApp(wikiFolderLocation),
|
||||
},
|
||||
{
|
||||
label: t('ContextMenu.Reload'),
|
||||
click: async () => await service.view.reloadViewsWebContents(id),
|
||||
},
|
||||
{
|
||||
label: t('ContextMenu.RestartService'),
|
||||
click: async () => {
|
||||
await service.workspaceView.restartWorkspaceViewService(id);
|
||||
await service.workspaceView.realignActiveWorkspace(id);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (gitUrl !== null && gitUrl.length > 0 && storageService !== SupportedStorageServices.local) {
|
||||
|
|
@ -125,6 +114,22 @@ export async function getWorkspaceMenuTemplate(
|
|||
});
|
||||
}
|
||||
|
||||
if (!isSubWiki) {
|
||||
template.push(
|
||||
{
|
||||
label: t('ContextMenu.RestartService'),
|
||||
click: async () => {
|
||||
await service.workspaceView.restartWorkspaceViewService(id);
|
||||
await service.workspaceView.realignActiveWorkspace(id);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('ContextMenu.Reload'),
|
||||
click: async () => await service.view.reloadViewsWebContents(id),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (!active && !isSubWiki) {
|
||||
template.splice(1, 0, {
|
||||
label: hibernated ? t('WorkspaceSelector.WakeUpWorkspace') : t('WorkspaceSelector.HibernateWorkspace'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue