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

Function CreateWorkspace

pkg/wcore/workspace.go:53–76  ·  view source on GitHub ↗
(ctx context.Context, name string, icon string, color string, applyDefaults bool, isInitialLaunch bool)

Source from the content-addressed store, hash-verified

51}
52
53func CreateWorkspace(ctx context.Context, name string, icon string, color string, applyDefaults bool, isInitialLaunch bool) (*waveobj.Workspace, error) {
54 ws := &waveobj.Workspace{
55 OID: uuid.NewString(),
56 TabIds: []string{},
57 Name: "",
58 Icon: "",
59 Color: "",
60 }
61 err := wstore.DBInsert(ctx, ws)
62 if err != nil {
63 return nil, fmt.Errorf("error inserting workspace: %w", err)
64 }
65 _, err = CreateTab(ctx, ws.OID, "", true, isInitialLaunch)
66 if err != nil {
67 return nil, fmt.Errorf("error creating tab: %w", err)
68 }
69
70 wps.Broker.Publish(wps.WaveEvent{
71 Event: wps.Event_WorkspaceUpdate,
72 })
73
74 ws, _, err = UpdateWorkspace(ctx, ws.OID, name, icon, color, applyDefaults)
75 return ws, err
76}
77
78// Returns updated workspace, whether it was updated, error.
79func UpdateWorkspace(ctx context.Context, workspaceId string, name string, icon string, color string, applyDefaults bool) (*waveobj.Workspace, bool, error) {

Callers 3

CreateWorkspaceMethod · 0.92
CreateWindowFunction · 0.85
EnsureInitialDataFunction · 0.85

Calls 4

DBInsertFunction · 0.92
CreateTabFunction · 0.85
UpdateWorkspaceFunction · 0.85
PublishMethod · 0.80

Tested by

no test coverage detected