mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
Fix switch workspace (#1370)
This commit is contained in:
parent
f368a61c70
commit
0ec60f5a7b
@ -243,6 +243,7 @@ export class WaveBrowserWindow extends BaseWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async switchWorkspace(workspaceId: string) {
|
async switchWorkspace(workspaceId: string) {
|
||||||
|
console.log("switchWorkspace", workspaceId, this.waveWindowId);
|
||||||
const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
|
const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
|
||||||
if (curWorkspace.tabids.length > 1 && (!curWorkspace.name || !curWorkspace.icon)) {
|
if (curWorkspace.tabids.length > 1 && (!curWorkspace.name || !curWorkspace.icon)) {
|
||||||
const choice = dialog.showMessageBoxSync(this, {
|
const choice = dialog.showMessageBoxSync(this, {
|
||||||
@ -270,16 +271,16 @@ export class WaveBrowserWindow extends BaseWindow {
|
|||||||
if (!newWs) {
|
if (!newWs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("switchWorkspace newWs", newWs);
|
||||||
if (this.allTabViews.size) {
|
if (this.allTabViews.size) {
|
||||||
for (const tab of this.allTabViews.values()) {
|
for (const tab of this.allTabViews.values()) {
|
||||||
tab?.destroy();
|
tab?.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("destroyed all tabs", this.waveWindowId);
|
||||||
this.workspaceId = workspaceId;
|
this.workspaceId = workspaceId;
|
||||||
this.allTabViews = new Map();
|
this.allTabViews = new Map();
|
||||||
const fullConfig = await FileService.GetFullConfig();
|
await this.setActiveTab(newWs.activetabid, false);
|
||||||
const [tabView, tabInitialized] = getOrCreateWebViewForTab(fullConfig, newWs.activetabid);
|
|
||||||
await this.queueTabSwitch(tabView, tabInitialized);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setActiveTab(tabId: string, setInBackend: boolean) {
|
async setActiveTab(tabId: string, setInBackend: boolean) {
|
||||||
|
@ -170,7 +170,7 @@ func (svc *WindowService) SwitchWorkspace(ctx context.Context, windowId string,
|
|||||||
|
|
||||||
updates := waveobj.ContextGetUpdatesRtn(ctx)
|
updates := waveobj.ContextGetUpdatesRtn(ctx)
|
||||||
go func() {
|
go func() {
|
||||||
defer panichandler.PanicHandler("WorkspaceService:SwitchWorkspace:SendUpdateEvents")
|
defer panichandler.PanicHandler("WindowService:SwitchWorkspace:SendUpdateEvents")
|
||||||
wps.Broker.SendUpdateEvents(updates)
|
wps.Broker.SendUpdateEvents(updates)
|
||||||
}()
|
}()
|
||||||
return ws, err
|
return ws, err
|
||||||
|
Loading…
Reference in New Issue
Block a user