(ctx context.Context, name string, icon string, color string, applyDefaults bool, isInitialLaunch bool)
| 51 | } |
| 52 | |
| 53 | func 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. |
| 79 | func UpdateWorkspace(ctx context.Context, workspaceId string, name string, icon string, color string, applyDefaults bool) (*waveobj.Workspace, bool, error) { |
no test coverage detected