feat(17-01): tree reorder page and singleton admin controllers
- cabana: config_reorder.yaml (title, nameFrom, modelClass, parentColumn,
sortColumn, maxDepth, partition) with fail-loud boot checks and the
built-in reorder toolbar button; list schema carries reorder
- GET/POST {controller}/reorder: scoped set (ListExtendQuery plus the
partition) locked FOR UPDATE, 409 reorder_stale on any set difference,
422 for duplicates, foreign parents, cycles and maxDepth, both columns
written without model hooks
- pact.AdminSingleton: GET {controller}/singleton (first or create, form
scope checked), form schema singleton, list/create/bulk/delete 404,
no config_list.yaml needed
- swag, inventories, token classes, CSRF walk, conformance cases, backend
lang reorder.stale and load_failed, reorder and singleton smoke tests, docs
This commit is contained in:
@@ -366,6 +366,15 @@ func compileToolbarButtons(ctl pact.AdminController, toolbar *listToolbar, showC
|
||||
out := append([]string(nil), toolbar.Buttons.items...)
|
||||
custom := []ToolbarAction{}
|
||||
for _, name := range out {
|
||||
if name == "reorder" {
|
||||
// The built-in tree reorder page: config_reorder.yaml is checked
|
||||
// in compileReorder, and a registered action may not take the
|
||||
// name.
|
||||
if _, taken := registered[name]; taken {
|
||||
return nil, nil, fmt.Errorf("toolbar.buttons: reorder is the built-in tree reorder; rename the registered action")
|
||||
}
|
||||
continue
|
||||
}
|
||||
if builtinToolbarActions[name] {
|
||||
if name == "delete" && !showCheckboxes {
|
||||
return nil, nil, fmt.Errorf("toolbar.buttons: delete needs showCheckboxes: true")
|
||||
@@ -594,6 +603,13 @@ func (s *ListSchema) Localize(ctx context.Context, tr *phrasebook.Translator) (*
|
||||
sort := *s.DefaultSort
|
||||
out.DefaultSort = &sort
|
||||
}
|
||||
if s.Reorder != nil {
|
||||
reorder := ListReorder{Title: translateKey(ctx, tr, s.Reorder.Title)}
|
||||
if p := s.Reorder.Partition; p != nil {
|
||||
reorder.Partition = &ListReorderPartition{Column: p.Column, Label: translateKey(ctx, tr, p.Label)}
|
||||
}
|
||||
out.Reorder = &reorder
|
||||
}
|
||||
out.Columns = localizeListColumns(ctx, tr, s.Columns)
|
||||
out.Filters = localizeListFilters(ctx, tr, s.Filters)
|
||||
out.RowActions = localizeRowActions(ctx, tr, s.RowActions)
|
||||
|
||||
Reference in New Issue
Block a user