[Refactor]: Split large frontend catalog pages into composable pieces

Aperta
#480 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Read frontend/README.md and the eslint-plugin-boundaries config first to learn the layer rules. Start with the duplicated mergeRowFieldErrors in ExecutionDetailsView.tsx and CaseDetailsPage.tsx, then move the shared helpers into a utility module beside externalLinkEditing.ts. Done means each helper has one definition, the three files are much smaller, and make frontend-lint and make pre-commit-run pass with no behavior change.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

refactor
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:

  • mergeRowFieldErrors is defined identically in ExecutionDetailsView.tsx and CaseDetailsPage.tsx.
  • Both detail views define their own toEditableFormState, normalizeEditableValue, and buildUpdatePayload with the same shape.
  • ExecutionDetailsView.tsx defines EditableResourceList inline, next to the existing components/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 of ExecutionDetailsView.tsx (FieldRow, ReadonlyInput, ReadonlyText, UserDisplay, ExternalResource*, EditableResourceList).
  • Utility module (for example, resourceEditing.ts, alongside externalLinkEditing.ts): shared row-error helpers (mergeRowFieldErrors, hasAnyRowErrors) and validation error mapping.
  • hooks/: a hook for CasesPage URL 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
  • mergeRowFieldErrors and 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-lint and make pre-commit-run pass.
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).

Lingua principale
Python
Stelle
2
Fork
2
Merge medio
12h 49m
PR unite (30g)
30

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di E3SM-Project/simboard

Tutte le issue di E3SM-Project/simboard

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.