Improve lf parameters layout#1237
Conversation
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.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 (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughLoad-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. ChangesLoad-flow parameter organization
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
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 |
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier.pro@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/features/results/securityanalysis/security-analysis.type.ts (1)
104-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRestore 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 winKeep 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
📒 Files selected for processing (16)
src/features/parameters/common/constants.tssrc/features/parameters/common/parameter-field.tsxsrc/features/parameters/loadflow/load-flow-advanced-parameters.tsxsrc/features/parameters/loadflow/load-flow-general-parameters.tsxsrc/features/parameters/loadflow/load-flow-parameters-content.tsxsrc/features/parameters/loadflow/load-flow-parameters-form.tsxsrc/features/parameters/loadflow/load-flow-parameters-header.tsxsrc/features/parameters/loadflow/load-flow-parameters-type.tssrc/features/parameters/loadflow/load-flow-parameters-utils.tssrc/features/parameters/loadflow/load-flow-provider-specific-parameters.tsxsrc/features/parameters/loadflow/use-load-flow-parameters-form.tssrc/features/parameters/short-circuit/short-circuit-parameters-utils.tssrc/features/results/securityanalysis/security-analysis.type.tssrc/translations/en/parameters.tssrc/translations/fr/parameters.tssrc/utils/types/parameters.type.ts
| const onValidationError = useCallback( | ||
| (errors: FieldErrors) => { | ||
| const tabsInError = []; | ||
| console.log('ERRORS', errors); |
There was a problem hiding this comment.
📐 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.
| 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.
|
LGTM , just need to fix the eslint errors. |
| handleTabChange={handleTabChange} | ||
| tabIndexesWithError={tabIndexesWithError} | ||
| formattedProviders={formattedProviders} | ||
| disableSpecificProviderParams={!watchProvider || !specificParametersDescriptionForProvider} |
There was a problem hiding this comment.
not sure why we need that?
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
not sure why we need this disabled?
|



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