(ctx context.Context, data wshrpc.CommandDeleteBlockData)
| 472 | } |
| 473 | |
| 474 | func (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 | |
| 499 | func (ws *WshServer) WaitForRouteCommand(ctx context.Context, data wshrpc.CommandWaitForRouteData) (bool, error) { |
| 500 | waitCtx, cancelFn := context.WithTimeout(ctx, time.Duration(data.WaitMs)*time.Millisecond) |
nothing calls this directly
no test coverage detected