Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default function CreateVoltageLevelSectionDialog({
: POSITION_NEW_SECTION_SIDE.BEFORE.id,
[SWITCHES_BEFORE_SECTIONS]: editData?.leftSwitchKind ?? null,
[SWITCHES_AFTER_SECTIONS]: editData?.rightSwitchKind ?? null,
[NEW_SWITCH_STATES]: editData?.switchOpen ?? false,
[NEW_SWITCH_STATES]: !(editData?.switchOpen ?? false),
});
},
[reset]
Expand Down Expand Up @@ -243,7 +243,7 @@ export default function CreateVoltageLevelSectionDialog({
voltageLevelSection?.isAfterBusBarSectionId === POSITION_NEW_SECTION_SIDE.AFTER.id,
leftSwitchKind: voltageLevelSection?.switchesBeforeSections || null,
rightSwitchKind: voltageLevelSection?.switchesAfterSections || null,
switchOpen: voltageLevelSection?.newSwitchStates || false,
switchOpen: !voltageLevelSection?.newSwitchStates || false,
} satisfies CreateVoltageLevelSectionInfos;
createVoltageLevelSection({
voltageLevelSectionInfos: voltageLevelSectionInfos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
BUS_BAR_INDEX,
BUSBAR_SECTION_ID,
IS_AFTER_BUSBAR_SECTION_ID,
NEW_SWITCH_STATES,
SWITCH_AFTER_NOT_REQUIRED,
SWITCH_BEFORE_NOT_REQUIRED,
SWITCHES_AFTER_SECTIONS,
Expand All @@ -19,7 +20,7 @@
import { filledTextField } from '../../../dialog-utils';
import { FormattedMessage, useIntl } from 'react-intl';
import { CurrentTreeNode } from 'components/graph/tree-node.type';
import { AutocompleteInput, Option, SelectInput } from '@gridsuite/commons-ui';
import { AutocompleteInput, Option, SelectInput, SwitchInput } from '@gridsuite/commons-ui';
import GridSection from '../../../commons/grid-section';
import { isNodeBuilt } from 'components/graph/util/model-functions';
import { InfoOutlined } from '@mui/icons-material';
Expand Down Expand Up @@ -93,6 +94,7 @@
{...filledTextField}
/>
);
const isNewSwitchOpen = useWatch({ name: NEW_SWITCH_STATES });

useEffect(() => {
if (busBarSectionInfos && busbarIndex) {
Expand Down Expand Up @@ -280,6 +282,12 @@
disabled={!busbarIndex || isNotRequiredSwitchAfter || isNotFoundOrNotSupported}
/>
);
const newSwitchState = (
<SwitchInput

Check warning on line 286 in src/components/dialogs/network-modifications/voltage-level/section/create-voltage-level-section-form.tsx

View workflow job for this annotation

GitHub Actions / build / build

Replace `⏎············name={NEW_SWITCH_STATES}⏎············label={isNewSwitchOpen·?·'areSwitchesClosed'·:·'areSwitchesOpen'}⏎·······` with `·name={NEW_SWITCH_STATES}·label={isNewSwitchOpen·?·'areSwitchesClosed'·:·'areSwitchesOpen'}`
name={NEW_SWITCH_STATES}
label={isNewSwitchOpen ? 'areSwitchesClosed' : 'areSwitchesOpen'}
/>
);
const getLabelDescription = useCallback(() => {
return intl.formatMessage({ id: 'newSection' });
}, [intl]);
Expand Down Expand Up @@ -372,6 +380,9 @@
<Grid item xs={12} sm={4}>
{switchAfterField}
</Grid>
<Grid item xs={12}>
{newSwitchState}
</Grid>
</Grid>
<PositionDiagramPane
studyUuid={studyUuid}
Expand Down
2 changes: 2 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,8 @@
"previousStatus": "Previous status",
"currentStatus": "Modified status",
"Open": "Open",
"areSwitchesOpen": "Open",
"areSwitchesClosed": "Closed",
"Closed": "Closed",
"GridLayoutPanel": "Grid layout panel",
"GridLayoutPanelAndTree": "Grid layout panel and tree",
Expand Down
2 changes: 2 additions & 0 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,8 @@
"previousStatus": "État précédent",
"currentStatus": "État modifié",
"Open": "Ouvert",
"areSwitchesOpen": "Ouverts",
"areSwitchesClosed": "Fermés",
"Closed": "Fermé",
"GridLayoutPanel": "Grille des images",
"GridLayoutPanelAndTree": "Grille des images et arbre décisionnel",
Expand Down
Loading