Revision docs correct original plans: schedule persistence via API endpoints (not tree_structure), array-index reorder (no display_order), store minimum-one-step invariant, accordion mode, ARIA requirements, and two-stage save orchestration with failure handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5.5 KiB
5.5 KiB
Procedural & Maintenance Editor Redesign - Design Revisions
Date: 2026-02-19 Revises:
docs/plans/2026-02-19-procedural-editor-redesign-design.mdPurpose: Resolve implementation gaps and make the design decision-complete for engineering handoff
Summary
This revision tightens the original design to match current architecture and APIs. It resolves contradictions around maintenance schedule persistence, aligns step-list behavior with store invariants, and defines concrete DnD/accessibility/test expectations.
Revision Decisions (Locked)
- Keep fixed-height editor layout with independent StepList scrolling.
- Use collapsible sections for Details, Intake Form, and Maintenance Schedule.
- Use existing installed
@dnd-kit/*packages (no new dependency work). - Keep
procedure_endas non-draggable and always last. - Keep schedule as optional for maintenance flows (manual batch launch remains valid).
Critical Corrections to Original Design
- Maintenance schedule persistence
- Schedule is not embedded in
tree_structure. - Schedule must be persisted through maintenance schedule endpoints.
- New unsaved flow requires two-stage save:
- Save tree (
treesApi.create/treesApi.update) - Create/update schedule (
maintenanceSchedulesApi.createormaintenanceSchedulesApi.update)
- Save tree (
- One schedule per tree (
uq_maintenance_schedules_tree_id).
- Step empty-state semantics
- Original "0 steps" state conflicts with current store minimum step behavior.
- Revised behavior:
- If minimum-one-step invariant remains, remove "0 steps" UX language.
- Empty-state is only shown if invariant is intentionally changed in store.
- DnD data model correction
- Do not mention recalculating
display_orderfor procedural steps. - Reorder is array-index based only.
- Explicitly block dragging
procedure_end.
- Dependencies section correction
- Replace "New Dependencies" with "Existing Dependencies Used" for
@dnd-kit/core,@dnd-kit/sortable,@dnd-kit/utilities.
- File impact correction
- Add API integration surfaces:
frontend/src/api/maintenanceSchedules.ts- target-list integration file(s) if inline list creation is in scope
- Clarify interaction with
frontend/src/pages/MaintenanceFlowDetailPage.tsx(retain schedule view/edit there or shift entirely to editor).
- Collapsible behavior clarification
- Use single-open accordion mode by default.
- Details defaults expanded for new flows.
- Intake defaults collapsed.
- Maintenance Schedule defaults:
- new maintenance flow: expanded
- existing with schedule: collapsed summary
- existing without schedule: collapsed with "Set Up" affordance
- A11y + keyboard DnD acceptance
- Include keyboard reorder acceptance criteria.
- Include focus order and ARIA labeling criteria for section toggles and drag handles.
Revised Maintenance Schedule Section Spec
New maintenance flow (tree not yet saved)
- Render schedule editor expanded.
- Keep schedule input in local UI draft state.
- On Save Draft / Publish:
- Save tree first.
- If tree save succeeds, create schedule with resulting
tree_id.
- If schedule create fails:
- Tree save remains successful.
- Show actionable error ("Schedule not saved. Retry.").
- Preserve schedule draft state.
Existing maintenance flow
- Load schedule via
maintenanceSchedulesApi.getForTree(treeId). - Edit and persist via
maintenanceSchedulesApi.update(scheduleId, data). - If no schedule exists, show collapsed "No schedule configured" summary + setup button.
Revised StepList Reorder Spec
- Draggable types:
procedure_stepsection_header
- Non-draggable:
procedure_end
- Reorder behavior:
- Move item by array index.
- Preserve all step payload fields.
- No implicit grouped movement under section headers.
- Keyboard behavior:
- Drag handle focusable.
- Enter/Space pick up + drop.
- Arrow keys move while grabbed.
- Escape cancels.
Acceptance Criteria
- Layout
- Toolbar remains visible while StepList scrolls.
- Details/Intake/Schedule sections collapse without shrinking StepList usability.
- Steps
- New step auto-expands.
- New step scrolls into view.
- Reorder works by pointer and keyboard.
procedure_endremains last and fixed.
- Maintenance schedule
- New unsaved maintenance flow can be saved without schedule.
- Schedule can be created immediately after first tree save.
- Existing schedule loads and updates in editor.
- Schedule failure does not roll back successful tree save.
- Accessibility
- Section toggles keyboard operable.
- Drag handles have accessible labels.
- Focus remains stable after reorder.
- Build/Test
npm run buildsucceeds.- Affected component/store tests pass.
Updated File Impact
Modified
frontend/src/pages/ProceduralEditorPage.tsxfrontend/src/components/procedural-editor/StepList.tsxfrontend/src/components/procedural-editor/IntakeFormBuilder.tsxfrontend/src/store/proceduralEditorStore.tsfrontend/src/api/maintenanceSchedules.tsfrontend/src/pages/MaintenanceFlowDetailPage.tsx(if schedule UX ownership changes)
New
frontend/src/components/procedural-editor/CollapsibleEditorSection.tsxfrontend/src/components/procedural-editor/MaintenanceScheduleSection.tsx
Existing dependencies used
@dnd-kit/core@dnd-kit/sortable@dnd-kit/utilities
Out of Scope (unchanged)
- Intake field DnD reorder.
- Procedural undo/redo parity.
- Step templates/presets.
- Bulk step operations.
- Backend schema/model changes for procedural steps.