feat(forms): preview a saved form from its row #495
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-744-row-preview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follows #494, which put Preview inside the editor only. I had argued against the row action there; that was the wrong call, and this adds it.
Why the row is the better place
Asking "what does this one look like?" meant opening an edit form you did not intend to change. That is a detour, and it is a way to leave unsaved edits behind by accident.
What this adds
A Preview action on each definition row, between Edit and Send, opening the same modal the editor does.
preview_from_definitionis the sibling ofpreview_form: one builds from the saved definition, one from the live editor state, both feed the same modal and the same client component, so the two entry points cannot disagree about what a client sees.Two details the row can get wrong and the editor cannot:
sort_order, not trusted in arrival order. Sorted is how the client is served them, and order is the one thing the Fields column ("3") cannot tell you, so getting it wrong here would defeat the point.Preview is offered for retired forms too. Looking at one is harmless, and it is exactly what you want before deciding whether to bring it back. Send stays hidden for them.
The modal now states whether it is showing saved or unsaved work, so two entry points into the same view are not mistaken for one another.
Verification
cargo check --all-targets,cargo clippy --all-targets(clean),cargo fmt --all --check(clean),cargo test --lib(268 passed).One new test pins the two row-specific behaviours: sort order and the dropped unknown rule, plus the unlabelled-field and whitespace-description fallbacks.