(ctx context.Context, layoutStateId string, actions ...waveobj.LayoutActionData)
| 80 | } |
| 81 | |
| 82 | func QueueLayoutAction(ctx context.Context, layoutStateId string, actions ...waveobj.LayoutActionData) error { |
| 83 | layoutStateObj, err := wstore.DBGet[*waveobj.LayoutState](ctx, layoutStateId) |
| 84 | if err != nil { |
| 85 | return fmt.Errorf("unable to get layout state for given id %s: %w", layoutStateId, err) |
| 86 | } |
| 87 | |
| 88 | for i := range actions { |
| 89 | if actions[i].ActionId == "" { |
| 90 | actions[i].ActionId = uuid.New().String() |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | if layoutStateObj.PendingBackendActions == nil { |
| 95 | layoutStateObj.PendingBackendActions = &actions |
| 96 | } else { |
| 97 | *layoutStateObj.PendingBackendActions = append(*layoutStateObj.PendingBackendActions, actions...) |
| 98 | } |
| 99 | |
| 100 | err = wstore.DBUpdate(ctx, layoutStateObj) |
| 101 | if err != nil { |
| 102 | return fmt.Errorf("unable to update layout state with new actions: %w", err) |
| 103 | } |
| 104 | return nil |
| 105 | } |
| 106 | |
| 107 | func QueueLayoutActionForTab(ctx context.Context, tabId string, actions ...waveobj.LayoutActionData) error { |
| 108 | layoutStateId, err := GetLayoutIdForTab(ctx, tabId) |
no test coverage detected