Skip to content

refactor: use generic VoltageLevelCreationForm from commons-ui#3769

Open
achour94 wants to merge 11 commits intogridsuite:mainfrom
achour94:claude/genericize-voltage-level-form-IWuc8
Open

refactor: use generic VoltageLevelCreationForm from commons-ui#3769
achour94 wants to merge 11 commits intogridsuite:mainfrom
achour94:claude/genericize-voltage-level-form-IWuc8

Conversation

@achour94
Copy link
Copy Markdown
Contributor

@achour94 achour94 commented Mar 2, 2026

Refactor the voltage level creation form to use the generic VoltageLevelCreationForm from @gridsuite/commons-ui. The study-specific form (StudyVoltageLevelCreationForm) now wraps the generic form and adds:

  • Substation autocomplete with create-inline option
  • Bus bar count, section count, coupling omnibus, switches between sections
  • Attachment point mode support

The dialog is updated to use commons-ui field constants (FieldConstants.EQUIPMENT_ID instead of the local EQUIPMENT_ID) for consistency with the generic form's field naming convention.

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv

PR Summary

claude added 11 commits March 2, 2026 09:05
Refactor the voltage level creation form to use the generic
VoltageLevelCreationForm from @gridsuite/commons-ui. The study-specific
form (StudyVoltageLevelCreationForm) now wraps the generic form and adds:
- Substation autocomplete with create-inline option
- Bus bar count, section count, coupling omnibus, switches between sections
- Attachment point mode support

The dialog is updated to use commons-ui field constants (FieldConstants.EQUIPMENT_ID
instead of the local EQUIPMENT_ID) for consistency with the generic form's
field naming convention.

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
- Rewrite VL creation dialog to use FieldConstants from commons-ui
- Simplify VL creation form using generic VoltageLevelCreationForm
- Use SubstationCreationSection from commons-ui for inline substation creation
- Import SwitchesBetweenSections from commons-ui in topology creation form
- Remove old local coupling-omnibus and switches-between-sections components
- Remove unused voltage-level-creation-utils.js

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
- Remove duplicated schema from gridstudy dialog (now in commons-ui)
- Use voltageLevelCreationFormSchema, voltageLevelCreationEmptyFormData,
  voltageLevelCreationFormToDto from commons-ui
- Replace IS_ATTACHMENT_POINT_CREATION with HIDE_NOMINAL_VOLTAGE and
  HIDE_BUS_BAR_SECTION
- Simplify onSubmit using commons-ui formToDto
- Simplify form wrapper: remove manual SubstationCreationSection toggle
  (handled by VoltageLevelCreationForm internally)
- Keep study-specific logic: substation fetching, custom paper component
  with CreateSubstation button, default country fetching

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
The fetchDefaultCountry logic has been moved to the generic
VoltageLevelCreationForm component in commons-ui.

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
…rmSchemaType

- Replace local FormSchemaType with VoltageLevelCreationFormData from commons-ui
- Map coupling device field names from backend to form field names
- Simplify type casts now that DTO field names match

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
Simplify fromExternalDataToFormValues by delegating field mapping to
commons-ui's unified conversion function that handles both edit data
(VoltageLevelCreationDto) and copy data (VoltageLevelFormInfos).

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
…ialog

Split fromExternalDataToFormValues into fromEditDataToFormValues (using
voltageLevelCreationDtoToForm for editData/useEffect) and
fromSearchCopyToFormValues (using voltageLevelInfosToForm for
useFormSearchCopy). Extract shared attachment point logic into
applyAttachmentPointOverrides helper.

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
…tionForm

Move the showDeleteSubstationButton logic to StudyVoltageLevelCreationForm
and pass it as a prop to the shared VoltageLevelCreationForm component.

https://claude.ai/code/session_01CUA6hVhwcTV96EMWeQrKFv
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.

2 participants