-
Notifications
You must be signed in to change notification settings - Fork 4
module ENR part 2, add powerElectronicsClusters parameters management
#999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sBouzols
wants to merge
21
commits into
main
Choose a base branch
from
feat_shortcircuit_ENR_params_part2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
69cf64a
feat(): module ENR part 2, add `powerElectronicsClusters` parameters …
sBouzols d22388e
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols 766d4c5
Merge remote-tracking branch 'origin/main' into feat_shortcircuit_ENR…
sBouzols 50d3a28
complete fix and refactor usage of SelectInput for cluster configura…
sBouzols 950b6d3
Merge remote-tracking branch 'origin/main' into feat_shortcircuit_ENR…
sBouzols 547ff25
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols d3af371
fix some sonar issues
sBouzols eea0b35
prettier
sBouzols 820cbeb
remove disable prettier line
sBouzols 93d5621
try som labels and alignments
sBouzols 2adc1d3
style(shortcircuit ENR params): style tables and all
sBouzols 5f5f602
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols a6c37f4
disable Select as well
sBouzols 4359312
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols 7d13d70
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols 7ca0daa
fixes from review
sBouzols 504fe0f
Merge branch 'feat_shortcircuit_ENR_params_part2' of https://github.c…
sBouzols 0c14b19
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols 67f83c2
remove unused import
sBouzols c4c8e13
Pass snackError to utility class to manage JSON parse error with a sn…
sBouzols f8c9edf
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
130 changes: 130 additions & 0 deletions
130
src/components/parameters/short-circuit/columns-definition.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| import { ElementType, EquipmentType } from '../../../utils'; | ||
|
|
||
| export const SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE = 'active'; | ||
| export const SHORT_CIRCUIT_ICC_MATERIAL_TYPE = 'type'; | ||
| export const SHORT_CIRCUIT_ICC_MATERIAL_ALPHA = 'alpha'; | ||
| export const SHORT_CIRCUIT_ICC_MATERIAL_USMIN = 'usMin'; | ||
| export const SHORT_CIRCUIT_ICC_MATERIAL_USMAX = 'usMax'; | ||
| export const SHORT_CIRCUIT_ICC_MATERIAL_U0 = 'u0'; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE = SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_FILTERS = 'filters'; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_TYPE = SHORT_CIRCUIT_ICC_MATERIAL_TYPE; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_ALPHA = SHORT_CIRCUIT_ICC_MATERIAL_ALPHA; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_USMIN = SHORT_CIRCUIT_ICC_MATERIAL_USMIN; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_USMAX = SHORT_CIRCUIT_ICC_MATERIAL_USMAX; | ||
| export const SHORT_CIRCUIT_ICC_CLUSTER_U0 = SHORT_CIRCUIT_ICC_MATERIAL_U0; | ||
|
|
||
| export interface IccCommonIColumnsDef { | ||
| label: React.ReactNode; | ||
| dataKey: string; | ||
| tooltip: React.ReactNode; | ||
| width?: string; | ||
| } | ||
|
|
||
| export interface IccMaterialIColumnsDef extends IccCommonIColumnsDef {} | ||
| export interface IccClusterIColumnsDef extends IccCommonIColumnsDef { | ||
| equipmentTypes?: EquipmentType[]; | ||
| elementType?: string; | ||
| titleId?: string; | ||
| initialValue?: any; | ||
| } | ||
|
|
||
| export const COLUMNS_DEFINITIONS_ICC_MATERIALS: IccMaterialIColumnsDef[] = [ | ||
| { | ||
| label: 'ShortCircuitIccActive', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE, | ||
| tooltip: 'ShortCircuitIccMaterialActiveTooltip', | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccMaterialType', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_TYPE, | ||
| tooltip: 'ShortCircuitIccMaterialTypeTooltip', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccAlpha', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_ALPHA, | ||
| tooltip: 'ShortCircuitIccAlphaTooltip', | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccUsmin', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_USMIN, | ||
| tooltip: 'ShortCircuitIccUsminTooltip', | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccUsmax', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_USMAX, | ||
| tooltip: 'ShortCircuitIccUsmaxTooltip', | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccU0', | ||
| dataKey: SHORT_CIRCUIT_ICC_MATERIAL_U0, | ||
| tooltip: 'ShortCircuitIccU0Tooltip', | ||
| width: '8%', | ||
| }, | ||
| ]; | ||
|
|
||
| export const COLUMNS_DEFINITIONS_ICC_CLUSTERS: IccClusterIColumnsDef[] = [ | ||
| { | ||
| label: 'ShortCircuitIccActive', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE, | ||
| tooltip: 'ShortCircuitIccClusterActiveTooltip', | ||
| initialValue: false, | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccClusterFilters', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_FILTERS, | ||
| tooltip: 'ShortCircuitIccClusterFiltersTooltip', | ||
| equipmentTypes: [EquipmentType.GENERATOR, EquipmentType.BATTERY], | ||
| elementType: ElementType.FILTER, | ||
| titleId: 'FiltersListsSelection', | ||
| initialValue: [], | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccClusterType', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_TYPE, | ||
| tooltip: 'ShortCircuitIccClusterTypeTooltip', | ||
| titleId: 'ShortCircuitIccClusterTypeListsSelection', | ||
| initialValue: [], | ||
| width: '15%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccAlpha', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_ALPHA, | ||
| tooltip: 'ShortCircuitIccAlphaTooltip', | ||
| initialValue: 1, | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccUsmin', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_USMIN, | ||
| tooltip: 'ShortCircuitIccUsminTooltip', | ||
| initialValue: 0, | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccUsmax', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_USMAX, | ||
| tooltip: 'ShortCircuitIccUsmaxTooltip', | ||
| initialValue: 100, | ||
| width: '8%', | ||
| }, | ||
| { | ||
| label: 'ShortCircuitIccU0', | ||
| dataKey: SHORT_CIRCUIT_ICC_CLUSTER_U0, | ||
| tooltip: 'ShortCircuitIccU0Tooltip', | ||
| initialValue: 100, | ||
| width: '8%', | ||
| }, | ||
| ]; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/components/parameters/short-circuit/short-circuit-icc-cluster-table-cell.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
| import { TableCell } from '@mui/material'; | ||
| import { DirectoryItemsInput, FloatInput, SelectInput, SwitchInput } from '../../inputs'; | ||
| import { | ||
| IccClusterIColumnsDef, | ||
| SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE, | ||
| SHORT_CIRCUIT_ICC_CLUSTER_FILTERS, | ||
| SHORT_CIRCUIT_ICC_CLUSTER_TYPE, | ||
| } from './columns-definition'; | ||
|
|
||
| export function ShortCircuitIccClusterTableCell({ | ||
| formName, | ||
| rowIndex, | ||
| column, | ||
| inputsDisabled, | ||
| }: Readonly<{ | ||
| formName: string; | ||
| rowIndex: number; | ||
| column: IccClusterIColumnsDef; | ||
| inputsDisabled?: boolean; | ||
| }>) { | ||
| return ( | ||
| <TableCell align="center" sx={{ fontWeight: 'bold' }}> | ||
| {column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE && ( | ||
| <SwitchInput size="small" name={`${formName}[${rowIndex}].${column.dataKey}`} /> | ||
| )} | ||
| {column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_FILTERS && ( | ||
| <DirectoryItemsInput | ||
| name={`${formName}[${rowIndex}].${column.dataKey}`} | ||
| equipmentTypes={column.equipmentTypes} | ||
| elementType={column.elementType ?? ''} | ||
| titleId={column.titleId} | ||
| hideErrorMessage | ||
| label={undefined} | ||
| itemFilter={undefined} | ||
| disable={inputsDisabled} | ||
| /> | ||
| )} | ||
| {column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_TYPE && ( | ||
| <SelectInput | ||
| size="small" | ||
| name={`${formName}[${rowIndex}].${column.dataKey}`} | ||
| label={column.titleId} | ||
| options={['WIND', 'SOLAR', 'HVDC']} | ||
| disabled={inputsDisabled} | ||
| /> | ||
| )} | ||
| {column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE && | ||
| column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_FILTERS && | ||
| column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_TYPE && ( | ||
| <FloatInput disabled={inputsDisabled} name={`${formName}[${rowIndex}].${column.dataKey}`} /> | ||
| )} | ||
| </TableCell> | ||
| ); | ||
| } | ||
55 changes: 55 additions & 0 deletions
55
src/components/parameters/short-circuit/short-circuit-icc-cluster-table-row.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
| import { IconButton, TableCell, TableRow, Tooltip } from '@mui/material'; | ||
| import { Delete as DeleteIcon } from '@mui/icons-material'; | ||
| import { useWatch } from 'react-hook-form'; | ||
| import { useState } from 'react'; | ||
| import { FormattedMessage } from 'react-intl'; | ||
| import { IccClusterIColumnsDef, SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE } from './columns-definition'; | ||
| import { ShortCircuitIccClusterTableCell } from './short-circuit-icc-cluster-table-cell'; | ||
|
|
||
| interface ShortCircuitIccClusterTableRowProps { | ||
| formName: string; | ||
| columnsDefinition: IccClusterIColumnsDef[]; | ||
| index: number; | ||
| onDeleteButton: (index: number) => void; | ||
| } | ||
|
|
||
| export function ShortCircuitIccClusterTableRow({ | ||
| formName, | ||
| columnsDefinition, | ||
| index, | ||
| onDeleteButton, | ||
| }: Readonly<ShortCircuitIccClusterTableRowProps>) { | ||
| const [isHover, setIsHover] = useState(false); | ||
| const watchRowActive = useWatch({ | ||
| name: `${formName}[${index}].${SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE}`, | ||
| }); | ||
|
|
||
| return ( | ||
| <TableRow onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)}> | ||
| {columnsDefinition.map((column: IccClusterIColumnsDef) => ( | ||
| <ShortCircuitIccClusterTableCell | ||
| key={`${column.dataKey}`} | ||
| formName={formName} | ||
| rowIndex={index} | ||
| column={column} | ||
| inputsDisabled={!watchRowActive} | ||
| /> | ||
| ))} | ||
| <TableCell align="center"> | ||
| {isHover && ( | ||
| <Tooltip title={<FormattedMessage id="DeleteRows" />}> | ||
| <IconButton size="small" onClick={() => onDeleteButton(index)}> | ||
| <DeleteIcon fontSize="small" /> | ||
| </IconButton> | ||
| </Tooltip> | ||
| )} | ||
| </TableCell> | ||
| </TableRow> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2026, for every new file