feat: restart current workspace

This commit is contained in:
tiddlygit-test 2021-10-16 13:33:11 +08:00
parent 992b2d9918
commit 54db442550
4 changed files with 21 additions and 12 deletions

View file

@ -276,6 +276,15 @@ export class WorkspaceView implements IWorkspaceViewService {
this.viewService.removeView(id);
}
public async restartWorkspaceViewService(id?: string): Promise<void> {
const workspaceToRestart = id !== undefined ? await this.workspaceService.get(id) : await this.workspaceService.getActiveWorkspace();
if (workspaceToRestart !== undefined) {
await this.wikiService.restartWiki(workspaceToRestart);
await this.viewService.reloadViewsWebContents(workspaceToRestart.id);
await this.wikiService.wikiOperation(WikiChannel.generalNotification, [i18n.t('ContextMenu.RestartServiceComplete')]);
}
}
public async clearBrowsingDataWithConfirm(): Promise<void> {
const availableWindowToShowDialog = this.windowService.get(WindowNames.preferences) ?? this.windowService.get(WindowNames.main);
if (availableWindowToShowDialog !== undefined) {

View file

@ -30,6 +30,7 @@ export interface IWorkspaceViewService {
printTiddler(tiddlerName?: string | undefined): Promise<void>;
realignActiveWorkspace(): Promise<void>;
removeWorkspaceView(id: string): Promise<void>;
restartWorkspaceViewService(id?: string | undefined): Promise<void>;
setActiveWorkspaceView(id: string): Promise<void>;
setWorkspaceView(id: string, workspaceOptions: IWorkspace): Promise<void>;
setWorkspaceViews(workspaces: Record<string, IWorkspace>): Promise<void>;
@ -48,6 +49,7 @@ export const WorkspaceViewServiceIPCDescriptor = {
printTiddler: ProxyPropertyType.Function,
realignActiveWorkspace: ProxyPropertyType.Function,
removeWorkspaceView: ProxyPropertyType.Function,
restartWorkspaceViewService: ProxyPropertyType.Function,
setActiveWorkspaceView: ProxyPropertyType.Function,
setWorkspaceView: ProxyPropertyType.Function,
setWorkspaceViews: ProxyPropertyType.Function,