Skip to content
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

Fix sjb not found in creation form #2345

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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 @@ -179,7 +179,7 @@ export const getConnectivityFormData = (
[CONNECTION_DIRECTION]: connectionDirection ?? null,
[CONNECTION_NAME]: connectionName ?? '',
[CONNECTION_POSITION]: connectionPosition ?? null,
[CONNECTED]: isEquipmentModification ? terminalConnected : true,
[CONNECTED]: terminalConnected ?? true,
},
};
};
Expand Down
9 changes: 2 additions & 7 deletions src/components/dialogs/connectivity/connectivity-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,8 @@ export const ConnectivityForm = ({
return;
}
const currentBusOrBusbarSection = getValues(`${id}.${BUS_OR_BUSBAR_SECTION}`);
if (
busOrBusbarSectionOptions?.length > 0 &&
!busOrBusbarSectionOptions.find(
(busOrBusbarSection) => busOrBusbarSection.id === currentBusOrBusbarSection?.id
)
) {
setValue(`${id}.${BUS_OR_BUSBAR_SECTION}`, busOrBusbarSectionOptions[0]);
if (busOrBusbarSectionOptions?.length > 0 && currentBusOrBusbarSection?.id !== null) {
setValue(`${id}.${BUS_OR_BUSBAR_SECTION}`, currentBusOrBusbarSection);
}
}, [busOrBusbarSectionOptions, setValue, id, getValues, isEquipmentModification]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const LineCreationDialog = ({
connectionName: line.connectionName1,
connectionPosition: line.connectionPosition1,
voltageLevelId: line.voltageLevelId1,
connected: line.connected1,
terminalConnected: line.connected1,
},
CONNECTIVITY_1
),
Expand All @@ -221,7 +221,7 @@ const LineCreationDialog = ({
connectionName: line.connectionName2,
connectionPosition: line.connectionPosition2,
voltageLevelId: line.voltageLevelId2,
connected: line.connected2,
terminalConnected: line.connected2,
},
CONNECTIVITY_2
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const TwoWindingsTransformerCreationDialog = ({
connectionName: twt.connectionName1,
connectionPosition: twt.connectionPosition1,
voltageLevelId: twt.voltageLevelId1,
connected: twt.connected1,
terminalConnected: twt.connected1,
},
CONNECTIVITY_1
),
Expand All @@ -243,7 +243,7 @@ const TwoWindingsTransformerCreationDialog = ({
connectionName: twt.connectionName2,
connectionPosition: twt.connectionPosition2,
voltageLevelId: twt.voltageLevelId2,
connected: twt.connected2,
terminalConnected: twt.connected2,
},
CONNECTIVITY_2
),
Expand Down
Loading