chore(LineCreation): use form from commons-UI#4062
Conversation
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughMoves line and limits dialogs, DTOs, and helpers to shared ChangesShared types and constants migration
Line segment dialog refactor
Line creation and modification dialogs
Transformer and line-attach updates
Locale cleanup
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
…eation-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
b0074bd to
664a8a7
Compare
…eation-form-from-commons-UI # Conflicts: # package-lock.json # package.json
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx (1)
195-205: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep these translation IDs or switch to existing ones.
titleId="CreateLine"andheaderId: 'LineCreationError'still reference keys that this PR removes fromsrc/translations/en.jsonandsrc/translations/fr.json, so the dialog title and error snackbar will fall back to missing-message output.Also applies to: 235-240
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx` around lines 195 - 205, The dialog still references translation keys that are being removed, so update the line creation UI to use only existing IDs or restore the removed ones. In line-creation-dialog.tsx, review the title setup around titleId="CreateLine" and the error handling in onSubmit/snackWithFallback with headerId: 'LineCreationError', then either switch both to translation keys that still exist in the active locale files or keep those keys in the translation resources. Also check the related usage around the other affected block so the dialog title and snackbar do not fall back to missing-message output.src/components/utils/utils.ts (1)
91-112: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDon’t serialize missing permanent limits as zero.
Line 104 turns a missing
permanentLimitinto an explicit0, so a copied line with no permanent limit can be saved back with a zero current limit. Keep the empty form value, matching the TWT mapping, and reuse the normalized applicability for the row ID.Proposed fix
if (completeLimitsGroups) { for (const elt of completeLimitsGroups) { if (isNotBlankOrEmpty(elt.id)) { + const applicability = elt.applicability ?? ''; formattedCompleteLimitsGroups.push({ - [ID]: elt.id + elt.applicability, + [ID]: elt.id + applicability, [NAME]: elt.id, - [APPLICABILITY_FIELD]: elt.applicability ?? '', + [APPLICABILITY_FIELD]: applicability, [LIMITS_PROPERTIES]: elt.limitsProperties, [CURRENT_LIMITS]: { - permanentLimit: elt.permanentLimit ?? 0, + permanentLimit: (elt.permanentLimit ?? '') as unknown as number, temporaryLimits: addSelectedFieldToRows(elt.temporaryLimits), }, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/utils/utils.ts` around lines 91 - 112, The current limit formatter is coercing a missing permanent limit into 0, which can serialize an empty value back as an explicit zero. Update formatCompleteCurrentLimit in utils.ts so CURRENT_LIMITS.permanentLimit preserves the empty form value when elt.permanentLimit is absent, matching the TWT mapping behavior, and use the normalized applicability value when building the row ID instead of the raw field.src/components/dialogs/network-modifications/line/modification/line-modification-dialog.tsx (1)
335-346: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve the selected OLG IDs when refreshing the equipment.
Lines 335-346 rebuild
LIMITSwithoutSELECTED_OPERATIONAL_LIMITS_GROUP_ID1/2. That fetch runs after the edit-data reset, so an existing modification loses both selections beforeonSubmitserializes them and falls back to"None".Proposed fix
[LIMITS]: formValues?.limits[ENABLE_OLG_MODIFICATION] ? { [ENABLE_OLG_MODIFICATION]: formValues.limits[ENABLE_OLG_MODIFICATION], [OPERATIONAL_LIMITS_GROUPS]: formValues.limits?.operationalLimitsGroups ?? [], + [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]: + formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ?? + null, + [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]: + formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ?? + null, } : { [ENABLE_OLG_MODIFICATION]: false, [OPERATIONAL_LIMITS_GROUPS]: convertToOperationalLimitsGroupFormSchema( line?.currentLimits ?? [] ), + [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]: + formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ?? + null, + [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]: + formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ?? + null, },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/dialogs/network-modifications/line/modification/line-modification-dialog.tsx` around lines 335 - 346, The LIMITS rebuild in line-modification-dialog.tsx is dropping the selected OLG IDs during equipment refresh, so preserve SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 and SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 when constructing the limits object in the refresh/reset path. Update the logic around the LIMITS mapping to carry forward any existing selected OLG values from formValues.limits (or prior edit data) alongside OPERATIONAL_LIMITS_GROUPS, so onSubmit can serialize the real selections instead of defaulting to None.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/dialogs/line-types-catalog/limit-custom-aggrid.tsx`:
- Line 10: The import in limit-custom-aggrid and the same pattern in
line-types-catalog-selector-form and use-row-data is pulling CATEGORIES_TABS and
LineTypeInfo from `@gridsuite/commons-ui` even though that package does not export
them. Update those imports to use the module that actually exports
CATEGORIES_TABS and LineTypeInfo, while keeping CustomAGGrid imported from the
UI package where appropriate.
In `@src/components/dialogs/line-types-catalog/line-type-segment-dialog.tsx`:
- Around line 14-22: The import block in line-type-segment-dialog is pulling
several types that are not exported by `@gridsuite/commons-ui`, so the TypeScript
build will fail. Update the imports in the line-type-segment-dialog component to
use only symbols actually exported by that package, and move
ComputedLineCharacteristics, SegmentSchema, LineSegmentsFormData,
SegmentFormData, and SegmentsFormData to the correct module or remove them if
they are unused. Keep CustomFormProvider and DeepNullable in place if they are
valid exports.
In `@src/components/dialogs/line-types-catalog/line-type-segment-form.tsx`:
- Around line 241-247: The early-return guards in the segment reset flow are
preventing stale state from being cleared when the dialog is reopened with no
segments. Update the reset logic in line-type-segment-form.tsx so the path that
handles empty edit/create data still calls arrayRef.current?.replaceItems([])
and resets APPLY_SEGMENTS_LIMITS, rather than returning before those cleanup
steps. Make sure the same fix is applied in both affected reset blocks so
reopening the mounted dialog always clears old rows, totals, and merged limits.
- Around line 35-54: `AreaTemperatureShapeFactorInfo` is being imported from the
wrong package in the line type segment form dialog. Update the imports in
`line-type-segment-form.tsx` so this type comes from the module that defines it,
while keeping the other `@gridsuite/commons-ui` imports unchanged; use the
`AreaTemperatureShapeFactorInfo` symbol to find both affected import statements.
In
`@src/components/dialogs/line-types-catalog/line-types-catalog-selector-dialog.tsx`:
- Around line 9-19: `AreaTemperatureShapeFactorInfo` is being imported from the
wrong module in `line-types-catalog-selector-dialog.tsx`. Update the import to
come from the package/module that actually exports
`AreaTemperatureShapeFactorInfo`, while keeping the other
`@gridsuite/commons-ui` imports unchanged. Verify the symbol is referenced
consistently in `LineTypesCatalogSelectorDialog` and related types so the file
type-checks again.
In
`@src/components/dialogs/network-modifications/two-windings-transformer/modification/two-windings-transformer-modification-dialog.tsx`:
- Around line 745-759: The LIMITS reset logic in
two-windings-transformer-modification-dialog.tsx is dropping the selected OLG
IDs, so the existing 2WT selections are lost after equipment fetch. Update the
LIMITS rebuild in the reset payload to carry through
SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 and SELECTED_OPERATIONAL_LIMITS_GROUP_ID2
alongside ENABLE_OLG_MODIFICATION and OPERATIONAL_LIMITS_GROUPS, using the
existing LIMITS/convertToOperationalLimitsGroupFormSchema flow so the form
preserves the chosen operational limits groups.
In `@src/translations/en.json`:
- Around line 709-710: The translation values for PermanentCurrentLimitText1 and
PermanentCurrentLimitText2 in en.json are inconsistent with fr.json, so update
the en.json entries to match the same limit type labels used across locales. Use
the PermanentCurrentLimitText1/2 keys in the translation files to align the
wording with fr.json and keep the locale mappings consistent.
---
Outside diff comments:
In
`@src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx`:
- Around line 195-205: The dialog still references translation keys that are
being removed, so update the line creation UI to use only existing IDs or
restore the removed ones. In line-creation-dialog.tsx, review the title setup
around titleId="CreateLine" and the error handling in onSubmit/snackWithFallback
with headerId: 'LineCreationError', then either switch both to translation keys
that still exist in the active locale files or keep those keys in the
translation resources. Also check the related usage around the other affected
block so the dialog title and snackbar do not fall back to missing-message
output.
In
`@src/components/dialogs/network-modifications/line/modification/line-modification-dialog.tsx`:
- Around line 335-346: The LIMITS rebuild in line-modification-dialog.tsx is
dropping the selected OLG IDs during equipment refresh, so preserve
SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 and SELECTED_OPERATIONAL_LIMITS_GROUP_ID2
when constructing the limits object in the refresh/reset path. Update the logic
around the LIMITS mapping to carry forward any existing selected OLG values from
formValues.limits (or prior edit data) alongside OPERATIONAL_LIMITS_GROUPS, so
onSubmit can serialize the real selections instead of defaulting to None.
In `@src/components/utils/utils.ts`:
- Around line 91-112: The current limit formatter is coercing a missing
permanent limit into 0, which can serialize an empty value back as an explicit
zero. Update formatCompleteCurrentLimit in utils.ts so
CURRENT_LIMITS.permanentLimit preserves the empty form value when
elt.permanentLimit is absent, matching the TWT mapping behavior, and use the
normalized applicability value when building the row ID instead of the raw
field.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f0f27f83-2238-4fdc-9164-a0de4a159f61
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (56)
src/components/dialogs/limits/limits-constants.tssrc/components/dialogs/limits/limits-groups-contextual-menu.tsxsrc/components/dialogs/limits/limits-pane-utils.tssrc/components/dialogs/limits/limits-pane.tsxsrc/components/dialogs/limits/limits-properties-side-stack.tsxsrc/components/dialogs/limits/limits-properties-stack.tsxsrc/components/dialogs/limits/limits-side-pane.tsxsrc/components/dialogs/limits/limits-tag-chip.tsxsrc/components/dialogs/limits/limitsChart.tsxsrc/components/dialogs/limits/operational-limits-group-tab-label.tsxsrc/components/dialogs/limits/operational-limits-groups-styles.tssrc/components/dialogs/limits/operational-limits-groups-tabs.tsxsrc/components/dialogs/limits/operational-limits-groups-types.tssrc/components/dialogs/limits/operational-limits-groups-utils.tssrc/components/dialogs/limits/selected-operational-limit-group.tsxsrc/components/dialogs/limits/temporary-limits-table.tsxsrc/components/dialogs/line-types-catalog/limit-custom-aggrid.tsxsrc/components/dialogs/line-types-catalog/line-catalog.type.tssrc/components/dialogs/line-types-catalog/line-type-segment-dialog.tsxsrc/components/dialogs/line-types-catalog/line-type-segment-form.tsxsrc/components/dialogs/line-types-catalog/line-types-catalog-selector-dialog.tsxsrc/components/dialogs/line-types-catalog/line-types-catalog-selector-form.tsxsrc/components/dialogs/line-types-catalog/segment-utils.tssrc/components/dialogs/line-types-catalog/use-row-data.tssrc/components/dialogs/network-modifications/limit-sets/limit-sets-modification-dialog.tsxsrc/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-utils.tssrc/components/dialogs/network-modifications/line-attach-to-voltage-level/line-attach-to-voltage-level-dialog.tsxsrc/components/dialogs/network-modifications/line-attach-to-voltage-level/line-attach-to-voltage-level-form.tsxsrc/components/dialogs/network-modifications/line/characteristics-pane/line-characteristics-pane-utils.tssrc/components/dialogs/network-modifications/line/characteristics-pane/line-characteristics-pane.tsxsrc/components/dialogs/network-modifications/line/creation/line-creation-dialog-utils.tssrc/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsxsrc/components/dialogs/network-modifications/line/creation/line-creation-type.tssrc/components/dialogs/network-modifications/line/line-dialog-tabs.tsxsrc/components/dialogs/network-modifications/line/modification/line-dialog-tabs.tsxsrc/components/dialogs/network-modifications/line/modification/line-modification-dialog-header.tsxsrc/components/dialogs/network-modifications/line/modification/line-modification-dialog-tabs.tsxsrc/components/dialogs/network-modifications/line/modification/line-modification-dialog.tsxsrc/components/dialogs/network-modifications/line/modification/line-modification-type.tssrc/components/dialogs/network-modifications/line/modification/line-utils.tssrc/components/dialogs/network-modifications/tabular/tabular-modification-utils.tssrc/components/dialogs/network-modifications/two-windings-transformer/creation/characteristics-pane/two-windings-transformer-creation-characteristics-pane.tsxsrc/components/dialogs/network-modifications/two-windings-transformer/creation/two-windings-transformer-creation-dialog.tsxsrc/components/dialogs/network-modifications/two-windings-transformer/modification/two-windings-transformer-modification-dialog.tsxsrc/components/dialogs/network-modifications/two-windings-transformer/two-windings-transformer.types.tssrc/components/network/constants.tssrc/components/tooltips/branch/branch-utils.tsxsrc/components/tooltips/equipment-popover-type.tssrc/components/utils/field-constants.tssrc/components/utils/utils.tssrc/services/network-modification-types.tssrc/services/network-modification.tssrc/services/study/network-map.type.tssrc/services/study/network-modifications.tssrc/translations/en.jsonsrc/translations/fr.json
💤 Files with no reviewable changes (24)
- src/components/dialogs/limits/limits-constants.ts
- src/components/dialogs/network-modifications/line/line-dialog-tabs.tsx
- src/components/dialogs/limits/operational-limits-groups-styles.ts
- src/components/network/constants.ts
- src/components/dialogs/network-modifications/line/creation/line-creation-type.ts
- src/components/dialogs/limits/limits-pane.tsx
- src/components/dialogs/limits/selected-operational-limit-group.tsx
- src/components/dialogs/limits/operational-limits-group-tab-label.tsx
- src/components/dialogs/limits/limits-side-pane.tsx
- src/components/dialogs/network-modifications/line/characteristics-pane/line-characteristics-pane.tsx
- src/components/dialogs/limits/limits-tag-chip.tsx
- src/components/dialogs/limits/limits-properties-stack.tsx
- src/components/dialogs/network-modifications/line/characteristics-pane/line-characteristics-pane-utils.ts
- src/components/dialogs/limits/limits-properties-side-stack.tsx
- src/components/dialogs/limits/operational-limits-groups-tabs.tsx
- src/components/dialogs/limits/operational-limits-groups-types.ts
- src/components/dialogs/limits/limits-groups-contextual-menu.tsx
- src/components/dialogs/network-modifications/line/creation/line-creation-dialog-utils.ts
- src/components/dialogs/line-types-catalog/segment-utils.ts
- src/components/dialogs/limits/temporary-limits-table.tsx
- src/components/dialogs/limits/operational-limits-groups-utils.ts
- src/components/dialogs/limits/limitsChart.tsx
- src/components/dialogs/line-types-catalog/line-catalog.type.ts
- src/components/dialogs/limits/limits-pane-utils.ts
| import { ColDef } from 'ag-grid-community'; | ||
| import { RefObject, useMemo } from 'react'; | ||
| import { CustomAGGrid } from '@gridsuite/commons-ui'; | ||
| import { CATEGORIES_TABS, CustomAGGrid, LineTypeInfo } from '@gridsuite/commons-ui'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
PKG='`@gridsuite/commons-ui`'
VER='0.238.0'
ENCODED='`@gridsuite`%2fcommons-ui'
META_JSON="$(curl -fsSL "https://registry.npmjs.org/${ENCODED}/${VER}")"
TARBALL_URL="$(printf '%s' "$META_JSON" | jq -r '.dist.tarball')"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
curl -fsSL "$TARBALL_URL" -o "$TMP_DIR/pkg.tgz"
tar -xzf "$TMP_DIR/pkg.tgz" -C "$TMP_DIR"
echo '--- package exports ---'
jq '.exports // "no exports field"' "$TMP_DIR/package/package.json"
echo '--- symbol search ---'
fd . "$TMP_DIR/package" -e d.ts -e ts -e js | xargs rg -n '\b(CATEGORIES_TABS|LineTypeInfo)\b' || trueRepository: gridsuite/gridstudy-app
Length of output: 397
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- symbol declarations/usages ---\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' '\b(CATEGORIES_TABS|LineTypeInfo)\b' src
printf '\n--- candidate files ---\n'
git ls-files 'src/components/dialogs/line-types-catalog/*'
printf '\n--- outlines ---\n'
for f in \
src/components/dialogs/line-types-catalog/limit-custom-aggrid.tsx \
src/components/dialogs/line-types-catalog/line-types-catalog-selector-form.tsx \
src/components/dialogs/line-types-catalog/use-row-data.ts
do
echo "### $f"
ast-grep outline "$f" --view expanded || true
doneRepository: gridsuite/gridstudy-app
Length of output: 252
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- symbol declarations/usages ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' '\b(CATEGORIES_TABS|LineTypeInfo)\b' src || true
echo
echo '--- candidate files ---'
git ls-files 'src/components/dialogs/line-types-catalog/*'
echo
echo '--- outlines ---'
for f in \
src/components/dialogs/line-types-catalog/limit-custom-aggrid.tsx \
src/components/dialogs/line-types-catalog/line-types-catalog-selector-form.tsx \
src/components/dialogs/line-types-catalog/use-row-data.ts
do
echo "### $f"
ast-grep outline "$f" --view expanded || true
doneRepository: gridsuite/gridstudy-app
Length of output: 8671
Import CATEGORIES_TABS and LineTypeInfo from the module that exports them. @gridsuite/commons-ui 0.238.0 doesn’t export either symbol, so this import breaks the build. The same fix is needed in line-types-catalog-selector-form.tsx and use-row-data.ts.
🧰 Tools
🪛 GitHub Actions: CI / 0_build _ build.txt
[error] 10-10: TypeScript (tsc) failed with TS2305: Module "@gridsuite/commons-ui" has no exported member "CATEGORIES_TABS".
🪛 GitHub Actions: CI / build _ build
[error] 10-10: TypeScript (tsc) failed: TS2305 Module "@gridsuite/commons-ui" has no exported member "CATEGORIES_TABS".
🪛 GitHub Check: build / build
[failure] 10-10:
Module '"@gridsuite/commons-ui"' has no exported member 'LineTypeInfo'.
[failure] 10-10:
Module '"@gridsuite/commons-ui"' has no exported member 'CATEGORIES_TABS'.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/dialogs/line-types-catalog/limit-custom-aggrid.tsx` at line
10, The import in limit-custom-aggrid and the same pattern in
line-types-catalog-selector-form and use-row-data is pulling CATEGORIES_TABS and
LineTypeInfo from `@gridsuite/commons-ui` even though that package does not export
them. Update those imports to use the module that actually exports
CATEGORIES_TABS and LineTypeInfo, while keeping CustomAGGrid imported from the
UI package where appropriate.
Source: Linters/SAST tools
| import { | ||
| ComputedLineCharacteristics, | ||
| CustomFormProvider, | ||
| DeepNullable, | ||
| SegmentSchema, | ||
| LineSegmentsFormData, | ||
| SegmentFormData, | ||
| SegmentsFormData, | ||
| } from '@gridsuite/commons-ui'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cd "$tmpdir"
tarball="$(npm pack `@gridsuite/commons-ui`@0.238.0 --silent)"
tar -xzf "$tarball"
rg -n --glob '*.{d.ts,ts,tsx,js,mjs,cjs}' '\b(ComputedLineCharacteristics|SegmentSchema|LineSegmentsFormData|SegmentFormData|SegmentsFormData)\b' packageRepository: gridsuite/gridstudy-app
Length of output: 161
Fix the @gridsuite/commons-ui imports
ComputedLineCharacteristics, SegmentSchema, LineSegmentsFormData, SegmentFormData, and SegmentsFormData are not exported from @gridsuite/commons-ui@0.238.0, so this import block will break the TypeScript build until those types come from an actual exporting module.
🧰 Tools
🪛 GitHub Check: build / build
[failure] 21-21:
Module '"@gridsuite/commons-ui"' has no exported member 'SegmentsFormData'.
[failure] 20-20:
'"@gridsuite/commons-ui"' has no exported member named 'SegmentFormData'. Did you mean 'emptyFormData'?
[failure] 19-19:
Module '"@gridsuite/commons-ui"' has no exported member 'LineSegmentsFormData'.
[failure] 18-18:
Module '"@gridsuite/commons-ui"' has no exported member 'SegmentSchema'.
[failure] 15-15:
Module '"@gridsuite/commons-ui"' has no exported member 'ComputedLineCharacteristics'.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/dialogs/line-types-catalog/line-type-segment-dialog.tsx`
around lines 14 - 22, The import block in line-type-segment-dialog is pulling
several types that are not exported by `@gridsuite/commons-ui`, so the TypeScript
build will fail. Update the imports in the line-type-segment-dialog component to
use only symbols actually exported by that package, and move
ComputedLineCharacteristics, SegmentSchema, LineSegmentsFormData,
SegmentFormData, and SegmentsFormData to the correct module or remove them if
they are unused. Keep CustomFormProvider and DeepNullable in place if they are
valid exports.
Source: Linters/SAST tools
| AreaTemperatureShapeFactorInfo, | ||
| CurrentLimitsInfo, | ||
| CustomAGGrid, | ||
| DefaultCellRenderer, | ||
| emptyLineSegment, | ||
| ExpandableInput, | ||
| ExpandableInputHandle, | ||
| fetchStudyMetadata, | ||
| LimitSelectedRowData, | ||
| LineTypeInfo, | ||
| type MuiStyles, | ||
| ReadOnlyInput, | ||
| SegmentFormData, | ||
| LineSegmentsFormData, | ||
| snackWithFallback, | ||
| SwitchInput, | ||
| useSnackMessage, | ||
| SegmentInfoFormData, | ||
| SegmentsFormData, | ||
| FieldConstants, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cd "$tmpdir"
tarball="$(npm pack `@gridsuite/commons-ui`@0.238.0 --silent)"
tar -xzf "$tarball"
rg -n --glob '*.{d.ts,ts,tsx,js,mjs,cjs}' '\bAreaTemperatureShapeFactorInfo\b' packageRepository: gridsuite/gridstudy-app
Length of output: 161
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo occurrences =="
rg -n "AreaTemperatureShapeFactorInfo" . || true
echo
echo "== candidate files around imports =="
for f in \
src/components/dialogs/line-types-catalog/line-type-segment-form.tsx \
src/components/dialogs/line-types-catalog/line-types-catalog-selector-dialog.tsx
do
if [ -f "$f" ]; then
echo "--- $f ---"
sed -n '1,120p' "$f"
echo
fi
done
echo "== commons-ui package metadata inspection =="
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cd "$tmpdir"
tarball="$(npm pack `@gridsuite/commons-ui`@0.238.0 --silent)"
tar -xzf "$tarball"
echo "--- package.json ---"
cat package/package.json
echo
echo "--- export-related declarations mentioning commons-ui export names near AreaTemperatureShapeFactorInfo absence ---"
rg -n '"exports"|export .*AreaTemperatureShapeFactorInfo|AreaTemperatureShapeFactorInfo' package || trueRepository: gridsuite/gridstudy-app
Length of output: 16714
Import AreaTemperatureShapeFactorInfo from its defining module AreaTemperatureShapeFactorInfo isn’t exported by @gridsuite/commons-ui, so both dialog imports need to point at the module that actually declares this type.
🧰 Tools
🪛 GitHub Check: build / build
[failure] 35-35:
Module '"@gridsuite/commons-ui"' has no exported member 'AreaTemperatureShapeFactorInfo'.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/dialogs/line-types-catalog/line-type-segment-form.tsx` around
lines 35 - 54, `AreaTemperatureShapeFactorInfo` is being imported from the wrong
package in the line type segment form dialog. Update the imports in
`line-type-segment-form.tsx` so this type comes from the module that defines it,
while keeping the other `@gridsuite/commons-ui` imports unchanged; use the
`AreaTemperatureShapeFactorInfo` symbol to find both affected import statements.
Source: Linters/SAST tools
| if (isModification && !editDataModificationCase?.[FieldConstants.LINE_SEGMENTS]?.length) { | ||
| return; | ||
| } | ||
| if (!isModification && !editDataCreationCase?.length) { | ||
| return; | ||
| } | ||
| arrayRef.current?.replaceItems([]); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Empty edit data no longer clears the previous segment state.
These early returns happen before replaceItems([]) and before resetting APPLY_SEGMENTS_LIMITS, so reopening the mounted dialog with zero segments preserves the old rows, totals, and merged limits. Saving from that state can re-submit segments the parent already cleared.
Suggested fix
useEffect(() => {
- if (isModification && !editDataModificationCase?.[FieldConstants.LINE_SEGMENTS]?.length) {
- return;
- }
- if (!isModification && !editDataCreationCase?.length) {
- return;
- }
arrayRef.current?.replaceItems([]);
+ setCurrentLimitResult([]);
+
+ const sourceSegments = isModification
+ ? (editDataModificationCase?.[FieldConstants.LINE_SEGMENTS] ?? [])
+ : (editDataCreationCase ?? []);
+ const applyLimits = isModification ? (editDataModificationCase?.applySegmentsLimits ?? true) : true;
+ setValue(APPLY_SEGMENTS_LIMITS, applyLimits);
+
+ if (!sourceSegments.length) {
+ setValue(FINAL_CURRENT_LIMITS, []);
+ updateTotals();
+ return;
+ }
+
const updateSegmentsLimits = async () => {
- let promises;
- if (!isModification && editDataCreationCase) {
- promises = editDataCreationCase.map((segment) => getSegmentLimits(segment));
- }
- if (isModification && editDataModificationCase) {
- promises = editDataModificationCase[FieldConstants.LINE_SEGMENTS]?.map((segment) =>
- getSegmentLimits(segment)
- );
- }
+ const promises = sourceSegments.map((segment) => getSegmentLimits(segment));
try {
if (promises) {
@@
updateSegmentsLimits().then(() => {
updateTotals();
keepMostConstrainingLimits();
- const applyLimits = isModification ? (editDataModificationCase?.applySegmentsLimits ?? true) : true;
- setValue(APPLY_SEGMENTS_LIMITS, applyLimits);
});Also applies to: 272-277
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/dialogs/line-types-catalog/line-type-segment-form.tsx` around
lines 241 - 247, The early-return guards in the segment reset flow are
preventing stale state from being cleared when the dialog is reopened with no
segments. Update the reset logic in line-type-segment-form.tsx so the path that
handles empty edit/create data still calls arrayRef.current?.replaceItems([])
and resets APPLY_SEGMENTS_LIMITS, rather than returning before those cleanup
steps. Make sure the same fix is applied in both affected reset blocks so
reopening the mounted dialog always clears old rows, totals, and merged limits.
| import { | ||
| AreaTemperatureShapeFactorInfo, | ||
| CATEGORIES_TABS, | ||
| CurrentLimitsInfo, | ||
| CustomFormProvider, | ||
| DeepNullable, | ||
| LineTypeInfo, | ||
| Option, | ||
| snackWithFallback, | ||
| useSnackMessage, | ||
| } from '@gridsuite/commons-ui'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cd "$tmpdir"
tarball="$(npm pack `@gridsuite/commons-ui`@0.238.0 --silent)"
tar -xzf "$tarball"
rg -n --glob '*.{d.ts,ts,tsx,js,mjs,cjs}' '\bAreaTemperatureShapeFactorInfo\b' packageRepository: gridsuite/gridstudy-app
Length of output: 161
Move AreaTemperatureShapeFactorInfo to the module that exports it. @gridsuite/commons-ui does not expose this symbol, so this import will fail type-check until it comes from the package that actually defines it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/components/dialogs/line-types-catalog/line-types-catalog-selector-dialog.tsx`
around lines 9 - 19, `AreaTemperatureShapeFactorInfo` is being imported from the
wrong module in `line-types-catalog-selector-dialog.tsx`. Update the import to
come from the package/module that actually exports
`AreaTemperatureShapeFactorInfo`, while keeping the other
`@gridsuite/commons-ui` imports unchanged. Verify the symbol is referenced
consistently in `LineTypesCatalogSelectorDialog` and related types so the file
type-checks again.
Source: Linters/SAST tools
| [LIMITS]: ((formValues?.limits as any)?.[ENABLE_OLG_MODIFICATION] | ||
| ? { | ||
| [ENABLE_OLG_MODIFICATION]: formValues.limits[ENABLE_OLG_MODIFICATION], | ||
| [ENABLE_OLG_MODIFICATION]: (formValues.limits as any)[ | ||
| ENABLE_OLG_MODIFICATION | ||
| ], | ||
| [OPERATIONAL_LIMITS_GROUPS]: | ||
| getOpLimitsGroupInfosFromBranchModification( | ||
| formValues as LineModificationFormSchema | ||
| ), | ||
| formValues.limits?.operationalLimitsGroups ?? [], | ||
| } | ||
| : { | ||
| [ENABLE_OLG_MODIFICATION]: false, | ||
| [OPERATIONAL_LIMITS_GROUPS]: | ||
| convertToOperationalLimitsGroupFormSchema( | ||
| (twt?.currentLimits ?? []) as CurrentLimitsData[] | ||
| ), | ||
| }) as LimitsFormSchema, | ||
| }) as LimitsSchemaType, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep the selected OLG IDs in the reset payload.
Lines 745-759 rebuild LIMITS without SELECTED_OPERATIONAL_LIMITS_GROUP_ID1/2. After the equipment fetch, the form loses those selections and the submit path emits cleared values instead of the existing 2WT choices.
Proposed fix
[LIMITS]: ((formValues?.limits as any)?.[ENABLE_OLG_MODIFICATION]
? {
[ENABLE_OLG_MODIFICATION]: (formValues.limits as any)[
ENABLE_OLG_MODIFICATION
],
[OPERATIONAL_LIMITS_GROUPS]:
formValues.limits?.operationalLimitsGroups ?? [],
+ [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]:
+ formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ??
+ null,
+ [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]:
+ formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ??
+ null,
}
: {
[ENABLE_OLG_MODIFICATION]: false,
[OPERATIONAL_LIMITS_GROUPS]:
convertToOperationalLimitsGroupFormSchema(
(twt?.currentLimits ?? []) as CurrentLimitsData[]
),
+ [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]:
+ formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ??
+ null,
+ [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]:
+ formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ??
+ null,
}) as LimitsSchemaType,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [LIMITS]: ((formValues?.limits as any)?.[ENABLE_OLG_MODIFICATION] | |
| ? { | |
| [ENABLE_OLG_MODIFICATION]: formValues.limits[ENABLE_OLG_MODIFICATION], | |
| [ENABLE_OLG_MODIFICATION]: (formValues.limits as any)[ | |
| ENABLE_OLG_MODIFICATION | |
| ], | |
| [OPERATIONAL_LIMITS_GROUPS]: | |
| getOpLimitsGroupInfosFromBranchModification( | |
| formValues as LineModificationFormSchema | |
| ), | |
| formValues.limits?.operationalLimitsGroups ?? [], | |
| } | |
| : { | |
| [ENABLE_OLG_MODIFICATION]: false, | |
| [OPERATIONAL_LIMITS_GROUPS]: | |
| convertToOperationalLimitsGroupFormSchema( | |
| (twt?.currentLimits ?? []) as CurrentLimitsData[] | |
| ), | |
| }) as LimitsFormSchema, | |
| }) as LimitsSchemaType, | |
| [LIMITS]: ((formValues?.limits as any)?.[ENABLE_OLG_MODIFICATION] | |
| ? { | |
| [ENABLE_OLG_MODIFICATION]: (formValues.limits as any)[ | |
| ENABLE_OLG_MODIFICATION | |
| ], | |
| [OPERATIONAL_LIMITS_GROUPS]: | |
| formValues.limits?.operationalLimitsGroups ?? [], | |
| [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]: | |
| formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ?? | |
| null, | |
| [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]: | |
| formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ?? | |
| null, | |
| } | |
| : { | |
| [ENABLE_OLG_MODIFICATION]: false, | |
| [OPERATIONAL_LIMITS_GROUPS]: | |
| convertToOperationalLimitsGroupFormSchema( | |
| (twt?.currentLimits ?? []) as CurrentLimitsData[] | |
| ), | |
| [SELECTED_OPERATIONAL_LIMITS_GROUP_ID1]: | |
| formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID1] ?? | |
| null, | |
| [SELECTED_OPERATIONAL_LIMITS_GROUP_ID2]: | |
| formValues.limits?.[SELECTED_OPERATIONAL_LIMITS_GROUP_ID2] ?? | |
| null, | |
| }) as LimitsSchemaType, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/components/dialogs/network-modifications/two-windings-transformer/modification/two-windings-transformer-modification-dialog.tsx`
around lines 745 - 759, The LIMITS reset logic in
two-windings-transformer-modification-dialog.tsx is dropping the selected OLG
IDs, so the existing 2WT selections are lost after equipment fetch. Update the
LIMITS rebuild in the reset payload to carry through
SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 and SELECTED_OPERATIONAL_LIMITS_GROUP_ID2
alongside ENABLE_OLG_MODIFICATION and OPERATIONAL_LIMITS_GROUPS, using the
existing LIMITS/convertToOperationalLimitsGroupFormSchema flow so the form
preserves the chosen operational limits groups.
| "PermanentCurrentLimitText1": "IST 1", | ||
| "PermanentCurrentLimitText2": "IST 2", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
These labels now disagree with fr.json.
PermanentCurrentLimitText1/2 are IST 1/2 here, but PATL 1/2 in src/translations/fr.json. The same keys should not point to different limit types across locales.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/translations/en.json` around lines 709 - 710, The translation values for
PermanentCurrentLimitText1 and PermanentCurrentLimitText2 in en.json are
inconsistent with fr.json, so update the en.json entries to match the same limit
type labels used across locales. Use the PermanentCurrentLimitText1/2 keys in
the translation files to align the wording with fr.json and keep the locale
mappings consistent.
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx (1)
188-190: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winKeep the selected limit-group IDs in sync with regenerated limits. Lines 188-190 replace
limits.operationalLimitsGroupsbut leaveselectedOperationalLimitsGroupId1/2untouched; after a search-copy/edit, those IDs can still point to groups that no longer exist in the payload. Reset them or recompute them from the new groups when rebuilding limits.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx` around lines 188 - 190, The limit-group selection state in the line creation flow is getting out of sync when limits are regenerated. In line-creation-dialog.tsx, update the logic around setValue and convertLimitsToOperationalLimitsGroupFormSchema so that selectedOperationalLimitsGroupId1 and selectedOperationalLimitsGroupId2 are reset or recomputed whenever FieldConstants.OPERATIONAL_LIMITS_GROUPS is replaced. Make sure the selected IDs always match the newly built operational limit groups after a search-copy/edit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx`:
- Around line 188-190: The limit-group selection state in the line creation flow
is getting out of sync when limits are regenerated. In line-creation-dialog.tsx,
update the logic around setValue and
convertLimitsToOperationalLimitsGroupFormSchema so that
selectedOperationalLimitsGroupId1 and selectedOperationalLimitsGroupId2 are
reset or recomputed whenever FieldConstants.OPERATIONAL_LIMITS_GROUPS is
replaced. Make sure the selected IDs always match the newly built operational
limit groups after a search-copy/edit.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c2f3732d-fb1d-4e5b-b310-51d450695640
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsxsrc/components/utils/utils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/utils/utils.ts
…eation-form-from-commons-UI # Conflicts: # src/components/dialogs/limits/limits-pane.tsx # src/components/dialogs/limits/limits-side-pane.tsx # src/components/dialogs/limits/operational-limits-groups-tabs.tsx # src/components/dialogs/limits/temporary-limits-table.tsx # src/components/dialogs/line-types-catalog/line-type-segment-form.tsx # src/components/dialogs/line-types-catalog/line-types-catalog-selector-form.tsx # src/components/dialogs/network-modifications/line/characteristics-pane/line-characteristics-pane.tsx # src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx # src/components/dialogs/network-modifications/line/line-dialog-tabs.tsx # src/components/dialogs/network-modifications/line/modification/line-modification-dialog-header.tsx
…eation-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modifications/line/creation/line-creation-dialog.tsx
PR Summary
We remove from grid-study what has been moved to commons-ui by gridsuite/commons-ui#1213.