Skip to content

Move Voltage Level Modification functionality and related components into commons-ui#3820

Open
achour94 wants to merge 5 commits intomainfrom
achour/move-vl-modification-into-commons-ui
Open

Move Voltage Level Modification functionality and related components into commons-ui#3820
achour94 wants to merge 5 commits intomainfrom
achour/move-vl-modification-into-commons-ui

Conversation

@achour94
Copy link
Contributor

PR Summary

…into commons-ui

Signed-off-by: achour94 <berrahmaachour@gmail.com>
@achour94 achour94 self-assigned this Mar 19, 2026
…cation-into-commons-ui

# Conflicts:
#	src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4146e7b0-240e-410a-b2c6-201647cbaa5e

📥 Commits

Reviewing files that changed from the base of the PR and between 2c15592 and 20aa5c4.

📒 Files selected for processing (2)
  • src/services/network-modification-types.ts
  • src/services/study/network-modifications.ts
💤 Files with no reviewable changes (1)
  • src/services/network-modification-types.ts

📝 Walkthrough

Walkthrough

The changes consolidate voltage level modification form logic by transitioning from local implementations to shared abstractions from the @gridsuite/commons-ui library. This includes removing duplicated form schemas, types, and UI components while updating the API service signature and cleaning up unused translation keys.

Changes

Cohort / File(s) Summary
Dialog and Form Refactoring
src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx, src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
Replaced local form models/schemas/transforms with shared @gridsuite/commons-ui abstractions (VoltageLevelModificationDto, form schema, converters). Removed the entire VoltageLevelModificationForm component; dialog now uses shared DTO-to-form converters, updated reset/submit wiring, and FieldConstants keys. Review dialog wiring and props changes.
Type Definitions Consolidation
src/components/dialogs/network-modifications/voltage-level/voltage-level.type.ts, src/services/network-modification-types.ts
Deleted local types (VoltageLevelDto, IdentifiableShortCircuitDto, VoltageLeveModificationInfo) and removed unused SwitchKind import — types are now consumed from commons-ui. Check any remaining references to the removed types.
Service Signature Update
src/services/study/network-modifications.ts
modifyVoltageLevel now accepts a VoltageLevelModificationDto (spread with study/node/modification UUIDs) and sends the DTO as the request body instead of constructing per-field modification operations. Verify API compatibility and DTO shape.
Translation Cleanup
src/translations/en.json, src/translations/fr.json
Removed ModifyVoltageLevel and VoltageLevelModificationError keys from English and French locales (managed upstream). Confirm no remaining usages expect these local keys.
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is empty and provides no information about the changeset. Add a brief description explaining what was moved, why, and any breaking changes or migration steps for developers.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the changeset: moving Voltage Level Modification functionality into commons-ui.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 938 files.

Valid Invalid Ignored Fixed
892 1 45 0
Click to see the invalid file list
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx

Signed-off-by: achour94 <berrahmaachour@gmail.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 938 files.

Valid Invalid Ignored Fixed
892 1 45 0
Click to see the invalid file list
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx`:
- Around line 145-156: When the fetch fails we clear voltageLevelToModify but
leave the selector hidden because selectedId remains set; update the catch block
to also restore the equipment selector by calling setSelectedId(null) (or
setSelectedId(editData?.equipmentId) if you want to fall back to the previous
selection) after setDataFetchStatus(FetchStatus.FAILED) and reset(...). Modify
the catch branch that calls setVoltageLevelToModify(undefined) to also invoke
setSelectedId(...) so the selector becomes visible and the user can pick another
equipment.

In `@src/services/study/network-modifications.ts`:
- Around line 59-61: The import list containing VoltageLevelCreationInfo and
VscCreationInfos has an extra blank line breaking Prettier rules; edit the named
import block that includes VoltageLevelCreationInfo and VscCreationInfos (the
import statement that exports these types) and remove the stray blank line so
the named imports are contiguous on consecutive lines with no empty line between
them.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e90b025-5dd8-462f-8775-158629d61686

📥 Commits

Reviewing files that changed from the base of the PR and between 602ba8e and 2c15592.

📒 Files selected for processing (7)
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
  • src/components/dialogs/network-modifications/voltage-level/voltage-level.type.ts
  • src/services/network-modification-types.ts
  • src/services/study/network-modifications.ts
  • src/translations/en.json
  • src/translations/fr.json
💤 Files with no reviewable changes (5)
  • src/services/network-modification-types.ts
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
  • src/translations/en.json
  • src/translations/fr.json
  • src/components/dialogs/network-modifications/voltage-level/voltage-level.type.ts

Comment on lines 145 to +156
.catch(() => {
setDataFetchStatus(FetchStatus.FAILED);
reset((formValues) => ({ ...formValues, [FieldConstants.EQUIPMENT_ID]: equipmentId }), {
keepDirty: true,
});
if (editData?.equipmentId !== equipmentId) {
setVoltageLevelInfos(null);
setVoltageLevelToModify(undefined);
}
});
} else {
setVoltageLevelInfos(null);
reset(emptyFormData, { keepDefaultValues: true });
setVoltageLevelToModify(undefined);
reset(voltageLevelModificationEmptyFormData, { keepDefaultValues: true });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore the equipment selector after a fetch failure.

If a newly selected or default voltage level fails to load, selectedId stays set while voltageLevelToModify is cleared. Because the selector is only shown when selectedId == null, the dialog gets stuck on an empty form and the user cannot pick another equipment without closing it.

↩️ One simple recovery path
                 .catch(() => {
                     setDataFetchStatus(FetchStatus.FAILED);
                     reset((formValues) => ({ ...formValues, [FieldConstants.EQUIPMENT_ID]: equipmentId }), {
                         keepDirty: true,
                     });
                     if (editData?.equipmentId !== equipmentId) {
                         setVoltageLevelToModify(undefined);
+                        setSelectedId(null);
                     }
                 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx`
around lines 145 - 156, When the fetch fails we clear voltageLevelToModify but
leave the selector hidden because selectedId remains set; update the catch block
to also restore the equipment selector by calling setSelectedId(null) (or
setSelectedId(editData?.equipmentId) if you want to fall back to the previous
selection) after setDataFetchStatus(FetchStatus.FAILED) and reset(...). Modify
the catch branch that calls setVoltageLevelToModify(undefined) to also invoke
setSelectedId(...) so the selector becomes visible and the user can pick another
equipment.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 938 files.

Valid Invalid Ignored Fixed
892 1 45 0
Click to see the invalid file list
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx

@KoloMenek
Copy link
Member

There is an issue with the substationid field being empty in the form. A solution is being implemented. The other components of the form seemed to be working fine.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 938 files.

Valid Invalid Ignored Fixed
892 1 45 0
Click to see the invalid file list
  • src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx

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