mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
Found another erroneous layout bootstrap (#1442)
CreateTab already bootstraps its own layout, don't need BootstrapNewWorkspaceLayout
This commit is contained in:
parent
43c134ea9a
commit
7c799d74eb
@ -152,18 +152,6 @@ func ApplyPortableLayout(ctx context.Context, tabId string, layout PortableLayou
|
||||
return nil
|
||||
}
|
||||
|
||||
func BootstrapNewWorkspaceLayout(ctx context.Context, workspace *waveobj.Workspace) error {
|
||||
log.Printf("BootstrapNewWorkspaceLayout, workspace: %v\n", workspace)
|
||||
tabId := workspace.ActiveTabId
|
||||
newTabLayout := GetNewTabLayout()
|
||||
|
||||
err := ApplyPortableLayout(ctx, tabId, newTabLayout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error applying new window layout: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func BootstrapStarterLayout(ctx context.Context) error {
|
||||
ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second)
|
||||
defer cancelFn()
|
||||
|
@ -80,15 +80,6 @@ func CreateWindow(ctx context.Context, winSize *waveobj.WinSize, workspaceId str
|
||||
return nil, fmt.Errorf("error creating workspace: %w", err)
|
||||
}
|
||||
ws = ws1
|
||||
err = BootstrapNewWorkspaceLayout(ctx, ws)
|
||||
if err != nil {
|
||||
errStr := fmt.Errorf("error bootstrapping new workspace layout: %w", err)
|
||||
_, err = DeleteWorkspace(ctx, ws.OID, true)
|
||||
if err != nil {
|
||||
errStr = fmt.Errorf("%s\nerror deleting workspace: %w", errStr, err)
|
||||
}
|
||||
return nil, errStr
|
||||
}
|
||||
} else {
|
||||
ws1, err := GetWorkspace(ctx, workspaceId)
|
||||
if err != nil {
|
||||
|
@ -31,17 +31,18 @@ func CreateWorkspace(ctx context.Context, name string, icon string, color string
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error inserting workspace: %w", err)
|
||||
}
|
||||
|
||||
_, err = CreateTab(ctx, ws.OID, "", true, false, isInitialLaunch)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating tab: %w", err)
|
||||
}
|
||||
|
||||
wps.Broker.Publish(wps.WaveEvent{
|
||||
Event: wps.Event_WorkspaceUpdate})
|
||||
|
||||
ws, err = GetWorkspace(ctx, ws.OID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting updated workspace: %w", err)
|
||||
}
|
||||
wps.Broker.Publish(wps.WaveEvent{
|
||||
Event: wps.Event_WorkspaceUpdate})
|
||||
return ws, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user