Skip to content

add computation quotas per study#189

Open
EtienneLt wants to merge 6 commits into
mainfrom
add-computation-quotas
Open

add computation quotas per study#189
EtienneLt wants to merge 6 commits into
mainfrom
add-computation-quotas

Conversation

@EtienneLt

Copy link
Copy Markdown
Contributor

PR Summary

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@EtienneLt EtienneLt self-assigned this Jun 17, 2026
@coderabbitai

coderabbitai Bot commented Jun 17, 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: 32ee09f4-d277-42ca-a25b-6a9cd511d0f0

📥 Commits

Reviewing files that changed from the base of the PR and between 251fcfe and bcc36c2.

📒 Files selected for processing (1)
  • src/pages/profiles/modification/profile-modification-form.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/profiles/modification/profile-modification-form.tsx

📝 Walkthrough

Walkthrough

Profile modification now stores quotas in maxAllowValuesMap, expands the form to show the additional quota fields, and updates dialog validation, submit, and reset logic to use the new map. English and French translations were extended for the added quota labels.

Changes

User Quota Expansion

Layer / File(s) Summary
UserProfile type and form field constants
src/services/user-admin.ts, src/pages/profiles/modification/profile-modification-form.tsx, src/translations/en.json, src/translations/fr.json
UserProfile now exposes maxAllowValuesMap instead of the two direct max-allowed numeric fields. profile-modification-form.tsx exports the new USER_QUOTA_* and MAX_ALLOWED_* identifiers, and both translation files add the expanded quota labels.
ProfileModificationForm quota input fields
src/pages/profiles/modification/profile-modification-form.tsx
The user quota section is expanded to render the new IntegerInput fields for the additional quota categories.
Dialog schema, submit handler, and form reset
src/pages/profiles/modification/profile-modification-dialog.tsx
The dialog imports the new quota keys, extends validation for the extra fields, builds maxAllowValues on submit, sends it as maxAllowValuesMap, and repopulates the form from response.maxAllowValuesMap.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is only a placeholder and does not describe the changeset. Replace the placeholder with a brief summary of what changed, what it replaced, and any reviewer notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding computation quotas per study.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

<FormattedMessage id={'profiles.form.modification.userQuotas'} />
</h3>
</Grid>
<Grid item xs={12} style={{ paddingTop: 0 }}>

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.

Grid2

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.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: 1

🧹 Nitpick comments (1)
src/pages/profiles/modification/profile-modification-dialog.tsx (1)

110-124: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Use MAX_ALLOWED_* constants when building maxAllowValues.

This object duplicates literal key strings already exported as constants, which makes submit/reset contracts easier to drift.

♻️ Suggested refactor
                 const maxAllowValues = {
-                    maxAllowedCases: profileFormData[USER_QUOTA_CASE_NB],
-                    maxAllowedBuilds: profileFormData[USER_QUOTA_BUILD_NB],
-                    maxAllowedLoadflow: profileFormData[USER_QUOTA_LOADFLOW_NB],
-                    maxAllowedSecurity: profileFormData[USER_QUOTA_SECURITY_NB],
-                    maxAllowedSensitivity: profileFormData[USER_QUOTA_SENSITIVITY_NB],
-                    maxAllowedShortCircuit: profileFormData[USER_QUOTA_SHORTCIRCUIT_NB],
-                    maxAllowedVoltageInit: profileFormData[USER_QUOTA_VOLTAGE_INIT_NB],
-                    maxAllowedPccMin: profileFormData[USER_QUOTA_PCC_MIN_NB],
-                    maxAllowedStateEstimation: profileFormData[USER_QUOTA_STATE_ESTIMATION_NB],
-                    maxAllowedBalanceAdjustement: profileFormData[USER_QUOTA_BALANCE_ADJUSTEMENT_NB],
-                    maxAllowedDynamicSimulation: profileFormData[USER_QUOTA_DYNAMIC_SIMULATION_INIT_NB],
-                    maxAllowedDynamicSecurity: profileFormData[USER_QUOTA_DYNAMIC_SECURITY_INIT_NB],
-                    maxAllowedDynamicMargin: profileFormData[USER_QUOTA_DYNAMIC_MARGIN_INIT_NB],
+                    [MAX_ALLOWED_CASES]: profileFormData[USER_QUOTA_CASE_NB],
+                    [MAX_ALLOWED_BUILD]: profileFormData[USER_QUOTA_BUILD_NB],
+                    [MAX_ALLOWED_LOADFLOW]: profileFormData[USER_QUOTA_LOADFLOW_NB],
+                    [MAX_ALLOWED_SECURITY]: profileFormData[USER_QUOTA_SECURITY_NB],
+                    [MAX_ALLOWED_SENSITIVITY]: profileFormData[USER_QUOTA_SENSITIVITY_NB],
+                    [MAX_ALLOWED_SHORT_CIRCUIT]: profileFormData[USER_QUOTA_SHORTCIRCUIT_NB],
+                    [MAX_ALLOWED_VOLTAGE_INIT]: profileFormData[USER_QUOTA_VOLTAGE_INIT_NB],
+                    [MAX_ALLOWED_PCC_MIN]: profileFormData[USER_QUOTA_PCC_MIN_NB],
+                    [MAX_ALLOWED_STATE_ESTIMATION]: profileFormData[USER_QUOTA_STATE_ESTIMATION_NB],
+                    [MAX_ALLOWED_BALANCE_ADJUSTEMENT]: profileFormData[USER_QUOTA_BALANCE_ADJUSTEMENT_NB],
+                    [MAX_ALLOWED_DYNAMIC_SIMULATION]: profileFormData[USER_QUOTA_DYNAMIC_SIMULATION_INIT_NB],
+                    [MAX_ALLOWED_DYNAMIC_SECURITY]: profileFormData[USER_QUOTA_DYNAMIC_SECURITY_INIT_NB],
+                    [MAX_ALLOWED_DYNAMIC_MARGIN]: profileFormData[USER_QUOTA_DYNAMIC_MARGIN_INIT_NB],
                 };
🤖 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/pages/profiles/modification/profile-modification-dialog.tsx` around lines
110 - 124, The maxAllowValues object in profile-modification-dialog.tsx is using
hardcoded literal strings as keys (maxAllowedCases, maxAllowedBuilds, etc.)
which can drift from contracts used in submit and reset handlers. Replace each
literal key name with the corresponding MAX_ALLOWED_* constant that should
already be exported. For example, the key maxAllowedCases should be replaced
with the MAX_ALLOWED_CASES constant, maxAllowedBuilds with MAX_ALLOWED_BUILDS,
and so on for all keys in the maxAllowValues object definition.
🤖 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/pages/profiles/modification/profile-modification-dialog.tsx`:
- Around line 188-193: The form reset mapping has swapped quota keys where
USER_QUOTA_PCC_MIN_NB is incorrectly mapped from MAX_ALLOWED_VOLTAGE_INIT and
USER_QUOTA_VOLTAGE_INIT_NB is incorrectly mapped from MAX_ALLOWED_PCC_MIN. Fix
this by swapping the values so that USER_QUOTA_PCC_MIN_NB maps to
MAX_ALLOWED_PCC_MIN and USER_QUOTA_VOLTAGE_INIT_NB maps to
MAX_ALLOWED_VOLTAGE_INIT, ensuring the correct quota values are loaded and
persisted.

---

Nitpick comments:
In `@src/pages/profiles/modification/profile-modification-dialog.tsx`:
- Around line 110-124: The maxAllowValues object in
profile-modification-dialog.tsx is using hardcoded literal strings as keys
(maxAllowedCases, maxAllowedBuilds, etc.) which can drift from contracts used in
submit and reset handlers. Replace each literal key name with the corresponding
MAX_ALLOWED_* constant that should already be exported. For example, the key
maxAllowedCases should be replaced with the MAX_ALLOWED_CASES constant,
maxAllowedBuilds with MAX_ALLOWED_BUILDS, and so on for all keys in the
maxAllowValues object definition.
🪄 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: 2f13b447-6e65-41ed-a590-0f1373d11e01

📥 Commits

Reviewing files that changed from the base of the PR and between 3065ba5 and 0302357.

📒 Files selected for processing (5)
  • src/pages/profiles/modification/profile-modification-dialog.tsx
  • src/pages/profiles/modification/profile-modification-form.tsx
  • src/services/user-admin.ts
  • src/translations/en.json
  • src/translations/fr.json

Comment thread src/pages/profiles/modification/profile-modification-dialog.tsx Outdated
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@EtienneLt EtienneLt requested a review from GhilesA June 30, 2026 07:43
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

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