mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
Integrate Faraday layout system (#16)
Co-authored-by: Mike Sawka <sawka@users.noreply.github.com> Co-authored-by: sawka <mike.sawka@gmail.com>
This commit is contained in:
co-authored by
Mike Sawka
sawka
parent
15527397de
commit
c3e71c5c7d
@@ -210,7 +210,7 @@ func findStringInSlice(slice []string, val string) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func DeleteBlock(ctx context.Context, tabId string, blockId string) error {
|
||||
func DeleteBlock(ctx context.Context, tabId string, blockId string, newLayout any) error {
|
||||
return WithTx(ctx, func(tx *TxWrap) error {
|
||||
tab, _ := DBGet[*Tab](tx.Context(), tabId)
|
||||
if tab == nil {
|
||||
@@ -221,11 +221,13 @@ func DeleteBlock(ctx context.Context, tabId string, blockId string) error {
|
||||
return nil
|
||||
}
|
||||
tab.BlockIds = append(tab.BlockIds[:blockIdx], tab.BlockIds[blockIdx+1:]...)
|
||||
if newLayout != nil {
|
||||
tab.Layout = newLayout
|
||||
}
|
||||
DBUpdate(tx.Context(), tab)
|
||||
DBDelete(tx.Context(), "block", blockId)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func CloseTab(ctx context.Context, workspaceId string, tabId string) error {
|
||||
|
||||
@@ -88,6 +88,7 @@ type Tab struct {
|
||||
OID string `json:"oid"`
|
||||
Version int `json:"version"`
|
||||
Name string `json:"name"`
|
||||
Layout any `json:"layout,omitempty"`
|
||||
BlockIds []string `json:"blockids"`
|
||||
Meta map[string]any `json:"meta"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user