Skip to content

Nmk power cut off view#3951

Open
ghazwarhili wants to merge 3 commits into
mainfrom
nmk-power-cut-off-view
Open

Nmk power cut off view#3951
ghazwarhili wants to merge 3 commits into
mainfrom
nmk-power-cut-off-view

Conversation

@ghazwarhili
Copy link
Copy Markdown
Contributor

PR Summary

create new view for nmk power cut off

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

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: 44db6fb1-f2dd-4def-8563-d542f6574d75

📥 Commits

Reviewing files that changed from the base of the PR and between 6e73cb5 and 50a5dfb.

📒 Files selected for processing (4)
  • src/components/results/securityanalysis/security-analysis-result-tab.tsx
  • src/components/results/securityanalysis/security-analysis-result-utils.ts
  • src/components/results/securityanalysis/security-analysis.type.ts
  • src/components/results/securityanalysis/use-security-analysis-column-defs.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/components/results/securityanalysis/security-analysis-result-utils.ts
  • src/components/results/securityanalysis/use-security-analysis-column-defs.tsx
  • src/components/results/securityanalysis/security-analysis-result-tab.tsx

📝 Walkthrough

Walkthrough

Adds a new NMK "power cut-off" view: new connectivity types, a flattening helper and column definitions for disconnected power values, hook and component wiring to select and render the view, and English/French translations.

Changes

NMK Power Cut-Off View

Layer / File(s) Summary
Type contracts for connectivity and view mode
src/components/results/securityanalysis/security-analysis.type.ts
ConnectivityResult defines disconnected active power fields; ContingencyItem gains optional connectivityResult; SecurityAnalysisQueryParams and SecurityAnalysisResultNmkProps include isPowerCutOffView.
Data transformation and column definitions
src/components/results/securityanalysis/security-analysis-result-utils.ts
mappingColumnToField supports power-cut mapping; flattenNmKPowerCutOff converts contingency connectivity results into table rows; securityAnalysisTableNmKPowerCutOffColumnsDefinition adds columns for contingency id/status and disconnected load/generation active power.
Hook: conditional column definitions
src/components/results/securityanalysis/use-security-analysis-column-defs.tsx
Hook accepts isPowerCutOffView, returns power-cut NMK columns for RESULT_TYPE.NMK_CONTINGENCIES when enabled, and updates memo dependency list.
NMK result component
src/components/results/securityanalysis/security-analysis-result-nmk.tsx
Component reads isPowerCutOffView, builds rows with flattenNmKPowerCutOff when true, disables custom row background styling in that mode, and updates hook deps.
Tab component: view mode management
src/components/results/securityanalysis/security-analysis-result-tab.tsx
Introduces POWER_CUT_OFF_VIEW and NmkView, stores nmkView state and derives nmkType/isPowerCutOffView, appends isPowerCutOffView to query params, computes hasPowerCutOffData, wraps NMK selector in a Badge, adds a third menu item, and passes isPowerCutOffView downstream.
UI translations
src/translations/en.json, src/translations/fr.json
Adds disconnectedLoadActivePower, disconnectedGenerationActivePower, and ConstraintsFromPowerCutOff translation keys.

Suggested reviewers

  • EtienneLt
  • AbdelHedhili
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new NMK power cut-off view mode across multiple components.
Description check ✅ Passed The description is directly related to the changeset, indicating the creation of a new NMK power cut-off view, which aligns with the actual code changes.
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.

✏️ 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
Copy Markdown

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/results/securityanalysis/security-analysis-result-utils.ts`:
- Around line 829-845: The new columns created via makeAgGridFloatColumn within
makeAgGridCustomHeaderColumn for 'disconnectedLoadActivePower' and
'disconnectedGenerationActivePower' are missing entries in the query field
mapping used for server-side sort/filter; add mapping entries for these colId
keys in the same mapping object/function that translates AG Grid colIds to
backend field names (the same place other power/energy colIds are mapped) so
sortParams/filterParams send the correct backend field names when
makeAgGridFloatColumn('disconnectedLoadActivePower', ...) and
makeAgGridFloatColumn('disconnectedGenerationActivePower', ...) are used.

In
`@src/components/results/securityanalysis/use-security-analysis-column-defs.tsx`:
- Around line 138-140: The current early return uses only isPowerCutOffView and
can return NMK power-cutoff columns even when resultType is RESULT_TYPE.N;
update the guard to check the result type as well (e.g., require resultType !==
RESULT_TYPE.N or explicitly require resultType === RESULT_TYPE.K/M) before
calling securityAnalysisTableNmKPowerCutOffColumnsDefinition(intl,
filterEnums.nmk, getEnumLabel, tabIndex), so the NMK-specific columns are only
returned for NMK result types while preserving the existing call and arguments.
🪄 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: 93d9bab2-9659-449d-9d6a-5c70550c8011

📥 Commits

Reviewing files that changed from the base of the PR and between ed0662f and 6e73cb5.

📒 Files selected for processing (7)
  • src/components/results/securityanalysis/security-analysis-result-nmk.tsx
  • src/components/results/securityanalysis/security-analysis-result-tab.tsx
  • src/components/results/securityanalysis/security-analysis-result-utils.ts
  • src/components/results/securityanalysis/security-analysis.type.ts
  • src/components/results/securityanalysis/use-security-analysis-column-defs.tsx
  • src/translations/en.json
  • src/translations/fr.json

Comment thread src/components/results/securityanalysis/use-security-analysis-column-defs.tsx Outdated
@sonarqubecloud
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.

1 participant