mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
Fix SwitchWorkspace when no workspaces are saved (#1508)
Also cleans up a workspace created with "Create new workspace" if you hit cancel when switching to it.
This commit is contained in:
parent
247d84e8e8
commit
c34f2da0c0
@ -301,7 +301,7 @@ export class WaveBrowserWindow extends BaseWindow {
|
|||||||
|
|
||||||
// If the workspace is already owned by a window, then we can just call SwitchWorkspace without first prompting the user, since it'll just focus to the other window.
|
// If the workspace is already owned by a window, then we can just call SwitchWorkspace without first prompting the user, since it'll just focus to the other window.
|
||||||
const workspaceList = await WorkspaceService.ListWorkspaces();
|
const workspaceList = await WorkspaceService.ListWorkspaces();
|
||||||
if (!workspaceList.find((wse) => wse.workspaceid === workspaceId)?.windowid) {
|
if (!workspaceList?.find((wse) => wse.workspaceid === workspaceId)?.windowid) {
|
||||||
const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
|
const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
|
||||||
if (showCloseConfirmDialog(curWorkspace)) {
|
if (showCloseConfirmDialog(curWorkspace)) {
|
||||||
const choice = dialog.showMessageBoxSync(this, {
|
const choice = dialog.showMessageBoxSync(this, {
|
||||||
@ -312,6 +312,7 @@ export class WaveBrowserWindow extends BaseWindow {
|
|||||||
});
|
});
|
||||||
if (choice === 0) {
|
if (choice === 0) {
|
||||||
console.log("user cancelled switch workspace", this.waveWindowId);
|
console.log("user cancelled switch workspace", this.waveWindowId);
|
||||||
|
await WorkspaceService.DeleteWorkspace(workspaceId);
|
||||||
return;
|
return;
|
||||||
} else if (choice === 1) {
|
} else if (choice === 1) {
|
||||||
console.log("user chose open in new window", this.waveWindowId);
|
console.log("user chose open in new window", this.waveWindowId);
|
||||||
|
Loading…
Reference in New Issue
Block a user