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

Function SetActiveTab

pkg/wcore/workspace.go:353–367  ·  view source on GitHub ↗
(ctx context.Context, workspaceId string, tabId string)

Source from the content-addressed store, hash-verified

351}
352
353func SetActiveTab(ctx context.Context, workspaceId string, tabId string) error {
354 if tabId != "" && workspaceId != "" {
355 workspace, err := GetWorkspace(ctx, workspaceId)
356 if err != nil {
357 return fmt.Errorf("workspace %s not found: %w", workspaceId, err)
358 }
359 tab, _ := wstore.DBGet[*waveobj.Tab](ctx, tabId)
360 if tab == nil {
361 return fmt.Errorf("tab not found: %q", tabId)
362 }
363 workspace.ActiveTabId = tabId
364 wstore.DBUpdate(ctx, workspace)
365 }
366 return nil
367}
368
369func SendActiveTabUpdate(ctx context.Context, workspaceId string, newActiveTabId string) {
370 eventbus.SendEventToElectron(eventbus.WSEventType{

Callers 2

SetActiveTabMethod · 0.92
CreateTabFunction · 0.85

Calls 3

DBGetFunction · 0.92
DBUpdateFunction · 0.92
GetWorkspaceFunction · 0.85

Tested by

no test coverage detected