MCPcopy
hub / github.com/wavetermdev/waveterm / switchWorkspace

Method switchWorkspace

emain/emain-window.ts:370–391  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

368 }
369
370 async switchWorkspace(workspaceId: string) {
371 console.log("switchWorkspace", workspaceId, this.waveWindowId);
372 if (workspaceId == this.workspaceId) {
373 console.log("switchWorkspace already on this workspace", this.waveWindowId);
374 return;
375 }
376
377 // 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.
378 const workspaceList = await WorkspaceService.ListWorkspaces();
379 if (!workspaceList?.find((wse) => wse.workspaceid === workspaceId)?.windowid) {
380 const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
381
382 if (curWorkspace && isNonEmptyUnsavedWorkspace(curWorkspace)) {
383 console.log(
384 `existing unsaved workspace ${this.workspaceId} has content, opening workspace ${workspaceId} in new window`
385 );
386 await createWindowForWorkspace(workspaceId);
387 return;
388 }
389 }
390 await this._queueActionInternal({ op: "switchworkspace", workspaceId });
391 }
392
393 async setActiveTab(tabId: string, setInBackend: boolean, primaryStartupTab = false) {
394 console.log(

Callers 5

getWorkspaceMenuFunction · 0.80
emain-window.tsFile · 0.80
createWorkspaceFunction · 0.80
WorkspaceSwitcherItemFunction · 0.80

Calls 5

_queueActionInternalMethod · 0.95
createWindowForWorkspaceFunction · 0.85
ListWorkspacesMethod · 0.45
GetWorkspaceMethod · 0.45

Tested by

no test coverage detected