Skip to content

feat(frontend): edit screen and PHP view over the entities slice, with the Options panel - #162

Merged
sgomez merged 3 commits into
frontend-rebuildfrom
agent/frontend/142
Nov 25, 2026
Merged

sgomez merged 3 commits into
frontend-rebuildfrom
agent/frontend/142

Conversation

@sgomez

@sgomez sgomez commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Closes #142.

Summary

The edit screen and the PHP view become a page over the entities slice; screens/edit/ keeps only the add screen, which #143 rebuilds.

 frontend/src/
 ├── domain/
 │   ├── documents/
+│   │   └── generated/options.ts      # root options of each schema: name, title, type, default
 │   └── entities/
 │       ├── port.ts                   # + read, starter, save → SaveResult, validate
 │       │                             # + optional setEnabled, discard, promote, replacePath, hideTidied
+│       └── editor/
+│           ├── StoredEntity.tsx      # the object the URL names: editor, Unreadable, 404
+│           ├── NewEntity.tsx         # starter text (used by screens/edit/AddServiceProvider until #143)
+│           ├── EntityEditor.tsx      # composition
+│           ├── useEditor.ts          # save state machine (saved, race, invalid, failed)
+│           ├── useActions.tsx        # More actions + Enabled, each shown only when the port offers it
+│           ├── OptionsPanel.tsx      # search, "Line N" or Insert
+│           ├── phpText.ts            # lexical walk: option lines, where Insert goes, suggested key
+│           └── EditHeader, Marks, Outcome, PhpCard, SaveBar, UnreadableEntity, marks, useValidation
 ├── pages/EditServiceProviderPage.tsx  # StoredEntity + ReviewChanges slot (publication cannot be imported by entities)
 └── app/
     ├── http/entities.ts              # decodes 409 and 422 into SaveResult
     └── adapters/memory/editing.ts, edited.ts   # every capability of SPEC; `served: true` gives what the API serves

Built now, in production too:

  • Options panel (SPEC 10.11): the options of saml20-sp-remote, from the schemas the build already compiles (npm run generate writes options.ts). A set option shows its line, found by a lexical walk of the text (strings, comments, brackets; nothing is parsed or evaluated). Insert writes 'name' => <default>, on its own line after the cursor's line when that line sits between root options, otherwise last in the array; the cursor lands after it. "type · default X" shows for options with a schema default.
  • Save bar labels of the SPEC 10.8 table: "Saved, not live" for Unpublished, Modified and To be withdrawn, "Published" for Up to date, nothing for Not live. "Discard edits" also shows on a clean object with a Pending change (SPEC 10.9, PhpSaved).
  • More actions: Download, then Delete… set apart (delete dialog from Delete flow over the entities slice #160, wiring unchanged).

Capability-gated (memory adapter in Storybook, hidden in production): Enabled switch, Replace from…, Discard changes… (texts from SPEC 8.3), Promote…, the "tidied" notice with "Do not show again", the unknown option's linked suggestion (puts the key in place on its line), who and when of a lost race ("admin saved it 2 minutes ago. Your edits were not kept.").

#119 (schema errors at open) and #120 (Unreadable stored bytes) keep their behaviour and tests.

Design system: Switch takes labelled (shows "Enabled" in place of On/Off); EditorHandle gains cursor() (null until first focused) and focusAt().

API: unchanged. src/Domain and PHP untouched.

Stories:

Pages/… Stories
Edit service provider FormPhp, PhpSaved, PhpSyntax
…, drafts Opened with a Pending change, Published, Disabled, Saved back to Published, Lost race, Lost race as the API answers today, Not saved (server error), Schema errors of the stored object, Unreadable, Loading, Option inserted
…, actions More actions, More actions as the API serves today, Discard changes, Changes discarded, Promote (sets with a next key), Delete (#98 draft, over the PHP view)

No lone decision under review touches this page.

Evidence

  • npm test: 105 files, 560 tests; coverage 99.11 % lines. Moved tests (screens/edit/Edit*.test.tsx → pages/EditServiceProvider*.test.tsx) keep their assertions except the save-bar labels (SPEC 10.8). New: EditServiceProviderOptions (panel, search, Insert at the cursor and last, production menu), EditServiceProviderCapabilities (memory port: tidied, suggestion, who/when, switch, discard, promote, failure callout), phpText.test.ts.
  • npm run test:visual: 296 pass, three runs after --update, zero diffs. 80 new references; existing ones unchanged.
  • npm run lint, npm run typecheck, composer test, composer static (sizes), composer build and npm run generate: no diff.

Board differences

Compared FormPhp, PhpSaved, PhpSyntax (light, dark; 1440, 400) with the board stories.

Element Board Page Why
Object authsource default-sp, saml:SP, no identifier row Moodle, saml20-sp-remote, entity ID with Copy applied to the SP screen (FormServiceProvider)
Settings / PHP segment, "Settings opens once the text can be read" present absent Settings view is out of scope (#135)
Main padding FormPhp 28/32/40 32/32/64 PhpSaved and PhpSyntax use 32/32/64
Save-state basis FormPhp 280 px 200 px the PHP boards
Set option in Options FormPhp "Set" "Line N" SPEC 10.11 and PhpSaved
Option rows authsource options saml20-sp-remote schema; a "sign" search finds 10 the set's schema
"type · default" line on one row on every option with a schema default the board gives no rule; inferred
Unknown option "is not a known option. Did you mean sign.logout?" production: the server's text ("…is not a cataloged option; it was kept in extra. Did you mean 'sign.logout'?"), no link wording built in src/Domain; board wording only with the suggestion capability
Warnings without a line "Line 13 · Warning · option" entity warnings carry no line or option API data
Enabled, tidied notice, extra menu entries, who/when shown Storybook only capabilities not served
Lost race (DesignSystem) "Your edits are kept below…" "Your edits were not kept." SPEC 10.9
Reveal (SPEC 10.11) absent absent board
Menu popover shows the Menu primitive's focus ring when opened by click design-system Menu (#138)

Other departures to rule on:

  • Promote never applies to saml20-sp-remote (no next-key slot, SPEC 7.7); built gated by nextKey, shown only in a story.
  • Replace from… goes to an unrouted path: its flow (ReplaceFrom board) is later work.
  • The Unreadable screen offers Delete only; SPEC 10.8 also lists Disable and Discard (capabilities).
  • "2 minutes ago" uses its own formatter, not lib/time.ago ("2 min ago"), to match SPEC 10.9's wording.

Merge Danger

Door: two-way

Blast Radius: edit screen

Wording of the save bar changes in production ("Saved, not live", "Published"); the add screen now runs on the slice's editor too.

@sgomez
sgomez merged commit 901fb22 into frontend-rebuild Nov 25, 2026
16 checks passed
@sgomez
sgomez deleted the agent/frontend/142 branch November 25, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant