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:
Evan Simkowitz
2024-06-04 13:05:44 -07:00
committed by GitHub
co-authored by Mike Sawka sawka
parent 15527397de
commit c3e71c5c7d
29 changed files with 2469 additions and 369 deletions
+4 -2
View File
@@ -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 {
+1
View File
@@ -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"`
}