mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
multi-window support (#62)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/wavetermdev/thenextwave/pkg/util/utilfn"
|
||||
"github.com/wavetermdev/thenextwave/pkg/wstore"
|
||||
)
|
||||
|
||||
@@ -54,3 +55,21 @@ func (cs *ClientService) GetWindow(windowId string) (*wstore.Window, error) {
|
||||
}
|
||||
return window, nil
|
||||
}
|
||||
|
||||
func (cs *ClientService) MakeWindow(ctx context.Context) (*wstore.Window, error) {
|
||||
return wstore.CreateWindow(ctx)
|
||||
}
|
||||
|
||||
// moves the window to the front of the windowId stack
|
||||
func (cs *ClientService) FocusWindow(ctx context.Context, windowId string) error {
|
||||
client, err := cs.GetClientData()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winIdx := utilfn.SliceIdx(client.WindowIds, windowId)
|
||||
if winIdx == -1 {
|
||||
return nil
|
||||
}
|
||||
client.WindowIds = utilfn.MoveSliceIdxToFront(client.WindowIds, winIdx)
|
||||
return wstore.DBUpdate(ctx, client)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user