Repository navigation
Open
Labels
refactorRefactor existing codeRefactor existing code
Milestone
Description
Is your feature request related to a problem?
Three catalog components in frontend/src/features/catalog/ hold page layout, form state, validation mapping, URL state, and many small sub-components in one file:
| File | Lines | Mixed concerns |
|---|---|---|
components/ExecutionDetailsView.tsx |
~1,740 | Read-only field components, artifact and link editing (EditableResourceList), validation error mapping (mapSaveValidationErrors, toValidationPathLabel), form state and update payload building |
CaseDetailsPage.tsx |
~1,580 | Resource grouping and labels, form state and update payload building, save error handling (getUpdateError) |
CasesPage.tsx |
~1,240 | URL search-param parsing and serialization (parseCaseSearchState, serializeCaseSearchState), sorting and paging constants, table rendering |
Duplication:
mergeRowFieldErrorsis defined identically inExecutionDetailsView.tsxandCaseDetailsPage.tsx.- Both detail views define their own
toEditableFormState,normalizeEditableValue, andbuildUpdatePayloadwith the same shape. ExecutionDetailsView.tsxdefinesEditableResourceListinline, next to the existingcomponents/EditableExternalLinkList.tsx.
Related: #306 (backend counterpart).
Describe the solution you'd like
Extract pieces into features/catalog/ without changing behavior.
components/: move reusable sub-components out ofExecutionDetailsView.tsx(FieldRow,ReadonlyInput,ReadonlyText,UserDisplay,ExternalResource*,EditableResourceList).- Utility module (for example,
resourceEditing.ts, alongsideexternalLinkEditing.ts): shared row-error helpers (mergeRowFieldErrors,hasAnyRowErrors) and validation error mapping. hooks/: a hook forCasesPageURL search state (for example,useCaseSearchParams) that wraps the parse and serialize functions.- Keep page files focused on layout and data wiring.
Follow the existing layer rules in frontend/README.md and eslint-plugin-boundaries. Code stays inside features/catalog/ unless it is truly reusable across features, in which case it goes in components/shared/.
Acceptance criteria
mergeRowFieldErrorsand the other duplicated helpers have one definition each.- Each of the three files is substantially smaller and contains mainly page or view composition.
- No UI or behavior change: the catalog pages render and edit as before.
make frontend-lintandmake pre-commit-runpass.
Describe alternatives you've considered
- One generic detail-editing form shared by cases and executions. The fields and payloads differ enough that this would add abstraction too early. Share helpers first.
Additional context
Other large frontend files, possible follow-ups: features/diagnostics/ComparePage.tsx (~860 lines), features/diagnostics/components/RunEditor.tsx (~850), and features/upload/UploadPage.tsx (~750).
Metadata
Metadata
Assignees
Labels
refactorRefactor existing codeRefactor existing code
Activity