mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix wsh view et al, send updates via ws
This commit is contained in:
parent
6e704f74e3
commit
2d883da8f0
@ -135,3 +135,19 @@ func ContextGetUpdatesRtn(ctx context.Context) UpdatesRtnType {
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
|
||||
func ContextPrintUpdates(ctx context.Context) {
|
||||
updatesVal := ctx.Value(waveObjUpdateKey)
|
||||
if updatesVal == nil {
|
||||
log.Print("no updates\n")
|
||||
return
|
||||
}
|
||||
updates := updatesVal.(*contextUpdatesType)
|
||||
log.Printf("updates len:%d\n", len(updates.UpdatesStack))
|
||||
for idx, update := range updates.UpdatesStack {
|
||||
log.Printf(" update[%d]:\n", idx)
|
||||
for k, v := range update {
|
||||
log.Printf(" %s:%s %s\n", k.OType, k.OID, v.UpdateType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,8 +269,6 @@ func (ws *WshServer) CreateBlockCommand(ctx context.Context, data wshrpc.Command
|
||||
return nil, fmt.Errorf("error creating block: %w", err)
|
||||
}
|
||||
blockRef := &waveobj.ORef{OType: waveobj.OType_Block, OID: blockData.OID}
|
||||
updates := waveobj.ContextGetUpdatesRtn(ctx)
|
||||
sendWStoreUpdatesToEventBus(updates)
|
||||
windowId, err := wstore.DBFindWindowForTabId(ctx, tabId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error finding window for tab: %w", err)
|
||||
@ -278,12 +276,17 @@ func (ws *WshServer) CreateBlockCommand(ctx context.Context, data wshrpc.Command
|
||||
if windowId == "" {
|
||||
return nil, fmt.Errorf("no window found for tab")
|
||||
}
|
||||
wlayout.QueueLayoutActionForTab(ctx, tabId, waveobj.LayoutActionData{
|
||||
err = wlayout.QueueLayoutActionForTab(ctx, tabId, waveobj.LayoutActionData{
|
||||
ActionType: wlayout.LayoutActionDataType_Insert,
|
||||
BlockId: blockRef.OID,
|
||||
Magnified: data.Magnified,
|
||||
Focused: true,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error queuing layout action: %w", err)
|
||||
}
|
||||
updates := waveobj.ContextGetUpdatesRtn(ctx)
|
||||
sendWStoreUpdatesToEventBus(updates)
|
||||
return &waveobj.ORef{OType: waveobj.OType_Block, OID: blockRef.OID}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user