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

Method DeleteBlockCommand

pkg/wshrpc/wshserver/wshserver.go:474–497  ·  view source on GitHub ↗
(ctx context.Context, data wshrpc.CommandDeleteBlockData)

Source from the content-addressed store, hash-verified

472}
473
474func (ws *WshServer) DeleteBlockCommand(ctx context.Context, data wshrpc.CommandDeleteBlockData) error {
475 if data.BlockId == "" {
476 return fmt.Errorf("blockid is required")
477 }
478 ctx = waveobj.ContextWithUpdates(ctx)
479 tabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)
480 if err != nil {
481 return fmt.Errorf("error finding tab for block: %w", err)
482 }
483 if tabId == "" {
484 return fmt.Errorf("no tab found for block")
485 }
486 err = wcore.DeleteBlock(ctx, data.BlockId, true)
487 if err != nil {
488 return fmt.Errorf("error deleting block: %w", err)
489 }
490 wcore.QueueLayoutActionForTab(ctx, tabId, waveobj.LayoutActionData{
491 ActionType: wcore.LayoutActionDataType_Remove,
492 BlockId: data.BlockId,
493 })
494 updates := waveobj.ContextGetUpdatesRtn(ctx)
495 wps.Broker.SendUpdateEvents(updates)
496 return nil
497}
498
499func (ws *WshServer) WaitForRouteCommand(ctx context.Context, data wshrpc.CommandWaitForRouteData) (bool, error) {
500 waitCtx, cancelFn := context.WithTimeout(ctx, time.Duration(data.WaitMs)*time.Millisecond)

Callers

nothing calls this directly

Calls 6

ContextWithUpdatesFunction · 0.92
DBFindTabForBlockIdFunction · 0.92
DeleteBlockFunction · 0.92
QueueLayoutActionForTabFunction · 0.92
ContextGetUpdatesRtnFunction · 0.92
SendUpdateEventsMethod · 0.80

Tested by

no test coverage detected