feat(12.1-02): read-only preview screen with a status hint and record actions
- config_form.yaml preview block (optional headerPartial), reported in the form schema as preview
- fields with context: preview show only on the preview screen and are never written
- form messages preview and edit; recordActions without a preview block stops boot
- SPA route {id}/preview, PreviewView and PreviewField, record actions in the footer
- mapWinterUrl maps preview/:id; the update form returns to the preview
- summer-callout partial style classes for status hints
- README, docs, OpenAPI document, TS types and the embedded build updated
This commit is contained in:
@@ -15,10 +15,7 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
"git.golem15.com/golem15/summercms/modules/compass"
|
||||
"git.golem15.com/golem15/summercms/modules/party"
|
||||
)
|
||||
|
||||
const rosterPeople = "/acme/roster/people"
|
||||
@@ -437,20 +434,9 @@ func TestFormSchemaRecordActionsBoot(t *testing.T) {
|
||||
// A name the controller does not register is refused when the controller
|
||||
// is activated, where the form meets its registered actions.
|
||||
t.Run("unregistered", func(t *testing.T) {
|
||||
fsys := fstest.MapFS{}
|
||||
for _, name := range []string{"controllers/people/config_list.yaml", "models/person/columns.yaml", "models/person/fields.yaml"} {
|
||||
data, err := os.ReadFile(filepath.Join(rosterDir, name))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fsys[name] = &fstest.MapFile{Data: data}
|
||||
}
|
||||
fsys["controllers/people/config_form.yaml"] = &fstest.MapFile{Data: []byte(head + "recordActions: [activate, promote]\n")}
|
||||
cfg, err := compass.Open(compass.Options{Dir: t.TempDir(), Environ: []string{"SUMMER_ENV=development", "SUMMER_ADMIN__JWT__SECRET=" + adminTestSecret}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = cabana.Activate(backpack.New(cfg), []party.Plugin{rosterPlugin{spy: &rosterSpy{}, fsys: fsys}})
|
||||
err := rosterBoot(t, rosterTree(t, map[string]string{
|
||||
"controllers/people/config_form.yaml": head + "preview: {}\nrecordActions: [activate, promote]\n",
|
||||
}))
|
||||
const want = "recordActions: unsupported action promote (want a record action the controller registers)"
|
||||
if err == nil || !strings.Contains(err.Error(), want) || !strings.Contains(err.Error(), "acme.roster.people") || !strings.Contains(err.Error(), "controllers/people/config_form.yaml") {
|
||||
t.Fatalf("error = %v, want %q", err, want)
|
||||
|
||||
Reference in New Issue
Block a user