mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
start blockcontrollers on switch tab
This commit is contained in:
parent
4d3ab0e822
commit
ae24e46ece
@ -7,6 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -108,6 +109,19 @@ func (svc *ObjectService) SetActiveTab(uiContext wstore.UIContext, tabId string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error setting active tab: %w", err)
|
return nil, fmt.Errorf("error setting active tab: %w", err)
|
||||||
}
|
}
|
||||||
|
// check all blocks in tab and start controllers (if necessary)
|
||||||
|
tab, err := wstore.DBMustGet[*wstore.Tab](ctx, tabId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error getting tab: %w", err)
|
||||||
|
}
|
||||||
|
for _, blockId := range tab.BlockIds {
|
||||||
|
blockErr := blockcontroller.StartBlockController(ctx, blockId)
|
||||||
|
if blockErr != nil {
|
||||||
|
// we don't want to fail the set active tab operation if a block controller fails to start
|
||||||
|
log.Printf("error starting block controller (blockid:%s): %w", blockId, blockErr)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
return updatesRtn(ctx, nil)
|
return updatesRtn(ctx, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user