Skip to content

Improve lf parameters layout#1237

Merged
khouadrired merged 9 commits into
mainfrom
improve-lf-parameters
Jul 16, 2026
Merged

Improve lf parameters layout#1237
khouadrired merged 9 commits into
mainfrom
improve-lf-parameters

Conversation

@klesaulnier

Copy link
Copy Markdown
Contributor

PR Summary

Separate advanced and specific provider params into different tabs
Fix select inputs and country inputs display

Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

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: 5634a259-f180-441d-84f7-147f32ecce01

📥 Commits

Reviewing files that changed from the base of the PR and between f85761a and 781ec5e.

📒 Files selected for processing (3)
  • src/features/parameters/common/parameter-field.tsx
  • src/translations/en/parameters.ts
  • src/translations/fr/parameters.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/translations/en/parameters.ts
  • src/translations/fr/parameters.ts
  • src/features/parameters/common/parameter-field.tsx

📝 Walkthrough

Walkthrough

Load-flow parameters now use separate General, Advanced, and Provider specific tabs. Advanced metadata, validation, persistence, parameter splitting, provider-specific rendering, input labels, translations, and tab error routing were updated accordingly.

Changes

Load-flow parameter organization

Layer / File(s) Summary
Parameter contracts and field rendering
src/features/parameters/common/*, src/features/parameters/loadflow/load-flow-parameters-type.ts, src/utils/types/parameters.type.ts, src/translations/*/parameters.ts
Adds the advanced-parameter key and reusable value type, extends parameter metadata with inputLabel, updates field rendering and layout behavior, and adds English and French labels.
Advanced and provider-specific parameter components
src/features/parameters/loadflow/load-flow-advanced-parameters.tsx, src/features/parameters/loadflow/load-flow-provider-specific-parameters.tsx
Defines advanced load-flow parameter metadata and renders advanced and provider-specific ParameterField instances.
Tab navigation and content wiring
src/features/parameters/loadflow/load-flow-parameters-header.tsx, src/features/parameters/loadflow/load-flow-parameters-content.tsx, src/features/parameters/loadflow/load-flow-parameters-form.tsx, src/features/parameters/loadflow/load-flow-general-parameters.tsx
Adds Advanced and Provider specific tabs, renders their panels, disables provider-specific controls when unavailable, and limits General parameters to basic fields.
Schema and form-value integration
src/features/parameters/loadflow/load-flow-parameters-utils.ts, src/features/parameters/loadflow/use-load-flow-parameters-form.ts
Nests advanced validation fields, splits loaded common parameters, persists advanced values, maps them into form state, and routes advanced validation errors to the Advanced tab.

Sequence Diagram(s)

sequenceDiagram
  participant Form
  participant Header
  participant Content
  participant AdvancedParameters
  participant ProviderSpecificParameters
  Form->>Header: provide provider-specific disabled state
  Header->>Content: select parameter tab
  Content->>AdvancedParameters: render advanced parameters
  Content->>ProviderSpecificParameters: render provider-specific parameters
Loading

Suggested reviewers: themaskedturtle, flomillot, ayolab

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main theme of the changes: improving the load-flow parameters layout.
Description check ✅ Passed The description accurately reflects the split into advanced/provider-specific tabs and the input display fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
src/features/results/securityanalysis/security-analysis.type.ts (1)

104-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Restore the formatter-preferred union layout.

The multiline formatting triggers the build/static-analysis warning. Keep the union members on one line as requested by the formatter.

Proposed fix
-        | ContingenciesFromConstraintItem[]
-        | ConstraintsFromContingencyItem[]
-        | CutOffPowerFromConstraintsItem[]
-        | null
+        ContingenciesFromConstraintItem[] | ConstraintsFromContingencyItem[] | CutOffPowerFromConstraintsItem[] | 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/features/results/securityanalysis/security-analysis.type.ts` around lines
104 - 107, Restore the formatter-preferred layout for the union type in the
relevant type declaration, keeping all union members, including null, on a
single line. Update the declaration containing ContingenciesFromConstraintItem
and ConstraintsFromContingencyItem rather than changing its semantics.

Source: Linters/SAST tools

src/features/parameters/short-circuit/short-circuit-parameters-utils.ts (1)

149-150: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the type assertion on one line.

This split formatting triggers the build/static-analysis warning; restore the formatter-preferred inline union.

Proposed fix
-        | yup.ObjectSchema<any>
-        | undefined;
+        yup.ObjectSchema<any> | undefined;
🤖 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/features/parameters/short-circuit/short-circuit-parameters-utils.ts`
around lines 149 - 150, In the type declaration for the short-circuit parameter
schema, restore the union type assertion to a single line by keeping
“yup.ObjectSchema<any> | undefined” inline, avoiding the
formatter/static-analysis warning.

Source: Linters/SAST tools

🤖 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/features/parameters/loadflow/use-load-flow-parameters-form.ts`:
- Line 236: Remove the debug console.log('ERRORS', errors) statement from the
form validation logic in the load-flow parameters form, leaving the surrounding
error handling unchanged.

In `@src/translations/en/parameters.ts`:
- Line 19: Add the missing Advanced translation entry to the parameter
translations object in parameters.ts, using the Advanced label value so
FormattedMessage with TabValues.ADVANCED resolves correctly.

In `@src/translations/fr/parameters.ts`:
- Line 20: The French translations are missing the Advanced tab label, causing
TabValues.ADVANCED to fall back to English. Add the Advanced key to the
translation object in parameters.ts with the French value “Avancé”, alongside
ProviderSpecific and inputLabelLfCountriesToBalance.

---

Nitpick comments:
In `@src/features/parameters/short-circuit/short-circuit-parameters-utils.ts`:
- Around line 149-150: In the type declaration for the short-circuit parameter
schema, restore the union type assertion to a single line by keeping
“yup.ObjectSchema<any> | undefined” inline, avoiding the
formatter/static-analysis warning.

In `@src/features/results/securityanalysis/security-analysis.type.ts`:
- Around line 104-107: Restore the formatter-preferred layout for the union type
in the relevant type declaration, keeping all union members, including null, on
a single line. Update the declaration containing ContingenciesFromConstraintItem
and ConstraintsFromContingencyItem rather than changing its semantics.
🪄 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: a7d37c84-ba66-433b-aa59-36dda0833305

📥 Commits

Reviewing files that changed from the base of the PR and between 24bc93d and f85761a.

📒 Files selected for processing (16)
  • src/features/parameters/common/constants.ts
  • src/features/parameters/common/parameter-field.tsx
  • src/features/parameters/loadflow/load-flow-advanced-parameters.tsx
  • src/features/parameters/loadflow/load-flow-general-parameters.tsx
  • src/features/parameters/loadflow/load-flow-parameters-content.tsx
  • src/features/parameters/loadflow/load-flow-parameters-form.tsx
  • src/features/parameters/loadflow/load-flow-parameters-header.tsx
  • src/features/parameters/loadflow/load-flow-parameters-type.ts
  • src/features/parameters/loadflow/load-flow-parameters-utils.ts
  • src/features/parameters/loadflow/load-flow-provider-specific-parameters.tsx
  • src/features/parameters/loadflow/use-load-flow-parameters-form.ts
  • src/features/parameters/short-circuit/short-circuit-parameters-utils.ts
  • src/features/results/securityanalysis/security-analysis.type.ts
  • src/translations/en/parameters.ts
  • src/translations/fr/parameters.ts
  • src/utils/types/parameters.type.ts

const onValidationError = useCallback(
(errors: FieldErrors) => {
const tabsInError = [];
console.log('ERRORS', errors);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove debug console.log before merge.

console.log('ERRORS', errors) logs raw form validation errors to the browser console in production. This is a debug artifact that should be removed.

🧹 Proposed fix
     (errors: FieldErrors) => {
         const tabsInError = [];
-        console.log('ERRORS', errors);
         if (errors?.[LIMIT_REDUCTIONS_FORM] && TabValues.LIMIT_REDUCTIONS !== selectedTab) {
📝 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.

Suggested change
console.log('ERRORS', errors);
🤖 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/features/parameters/loadflow/use-load-flow-parameters-form.ts` at line
236, Remove the debug console.log('ERRORS', errors) statement from the form
validation logic in the load-flow parameters form, leaving the surrounding error
handling unchanged.

Comment thread src/translations/en/parameters.ts
Comment thread src/translations/fr/parameters.ts
@khouadrired

Copy link
Copy Markdown
Contributor

LGTM , just need to fix the eslint errors.

Comment thread src/features/parameters/common/parameter-field.tsx Outdated
handleTabChange={handleTabChange}
tabIndexesWithError={tabIndexesWithError}
formattedProviders={formattedProviders}
disableSpecificProviderParams={!watchProvider || !specificParametersDescriptionForProvider}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure why we need that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

before, the specific provider params section was disabled when no provider value is set or a failure when fetching the provider params , so here we have the same bihaviour of disabling the Tab

value={TabValues.PROVIDER_SPECIFIC}
sx={getTabStyle(tabIndexesWithError, TabValues.PROVIDER_SPECIFIC)}
data-testid="LfProviderSpecificTab"
disabled={disableSpecificProviderParams}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure why we need this disabled?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

answered above

@antoinebhs antoinebhs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud

Copy link
Copy Markdown

@khouadrired khouadrired merged commit 6ea28d2 into main Jul 16, 2026
6 checks passed
@khouadrired khouadrired deleted the improve-lf-parameters branch July 16, 2026 12:14
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.

3 participants