-
Notifications
You must be signed in to change notification settings - Fork 4
enhance move feeder #3416
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
ghazwarhili
wants to merge
11
commits into
main
Choose a base branch
from
enhance-connection-position-move-feeder-modification
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.
+65
−54
Open
enhance move feeder #3416
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a9bf412
enhance move feeder
ghazwarhili 42022bc
fix type
ghazwarhili a421166
Merge branch 'main' into enhance-connection-position-move-feeder-modi…
ghazwarhili bef1f1a
code review remarks
ghazwarhili 4475f8c
fix sonar issues
ghazwarhili ecdb670
Merge branch 'main' into enhance-connection-position-move-feeder-modi…
ghazwarhili ff914b3
sonar issues
ghazwarhili 65b201c
Merge remote-tracking branch 'origin/enhance-connection-position-move…
ghazwarhili 4a8f854
Merge branch 'main' into enhance-connection-position-move-feeder-modi…
ghazwarhili 6105114
ass styles const
ghazwarhili dca3dd5
Merge branch 'main' into enhance-connection-position-move-feeder-modi…
ghazwarhili 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,12 +42,15 @@ import { moveVoltageLevelFeederBays } from '../../../../../services/study/networ | |
| import { AnyObject, TestFunction } from 'yup'; | ||
|
|
||
| const isActiveRow = (row: FeederBaysFormInfos) => row && !row.isRemoved; | ||
| const checkConnectionPositionField: TestFunction<string | undefined, AnyObject> = (currentPosition, context) => { | ||
| const checkConnectionPositionField: TestFunction<string | null | undefined, AnyObject> = (currentPosition, context) => { | ||
| // access to rows | ||
| const rows: FeederBaysFormInfos[] = context.from?.[1]?.value?.[MOVE_VOLTAGE_LEVEL_FEEDER_BAYS_TABLE]; | ||
| if (!Array.isArray(rows)) { | ||
| return true; | ||
| } | ||
| if (currentPosition === null || currentPosition === undefined) { | ||
| return true; | ||
| } | ||
| // take only active rows | ||
| const activeRows = rows.filter(isActiveRow); | ||
| // counting duplication | ||
|
|
@@ -74,13 +77,12 @@ const formSchema = yup.object().shape({ | |
| [BUSBAR_SECTION_ID]: requiredWhenActive(yup.string()), | ||
| [BUSBAR_SECTION_IDS]: requiredWhenActive(yup.array().of(yup.string())), | ||
| [CONNECTION_SIDE]: yup.string().nullable(), | ||
| [CONNECTION_NAME]: requiredWhenActive(yup.string()), | ||
| [CONNECTION_DIRECTION]: requiredWhenActive(yup.string()), | ||
| [CONNECTION_POSITION]: requiredWhenActive(yup.string()).test( | ||
| 'checkUniquePositions', | ||
| 'DuplicatedPositionsError', | ||
| checkConnectionPositionField | ||
| ), | ||
| [CONNECTION_NAME]: yup.string().nullable(), | ||
| [CONNECTION_DIRECTION]: yup.string().nullable(), | ||
| [CONNECTION_POSITION]: yup | ||
| .string() | ||
| .nullable() | ||
| .test('checkUniquePositions', 'DuplicatedPositionsError', checkConnectionPositionField), | ||
| [IS_REMOVED]: yup.boolean(), | ||
| [IS_SEPARATOR]: yup.boolean(), | ||
| }) | ||
|
|
@@ -96,7 +98,7 @@ const emptyFormData = { | |
| [CONNECTION_SIDE]: null, | ||
| [CONNECTION_NAME]: null, | ||
| [CONNECTION_DIRECTION]: null, | ||
| [CONNECTION_POSITION]: '0', | ||
| [CONNECTION_POSITION]: null, | ||
| [IS_REMOVED]: false, | ||
| [IS_SEPARATOR]: false, | ||
| }, | ||
|
|
@@ -152,14 +154,18 @@ export default function MoveVoltageLevelFeederBaysDialog({ | |
| (feederBaysInfos: FeederBaysInfos, busBarSectionInfos: string[]) => { | ||
| let mergedRowData: FeederBaysFormInfos[] = []; | ||
| if (!editData?.uuid && feederBaysInfos.length > 0) { | ||
| console.log('================feederBaysInfos', feederBaysInfos); | ||
|
||
| mergedRowData = feederBaysInfos.filter(Boolean).map((bay) => ({ | ||
| equipmentId: bay.equipmentId, | ||
| busbarSectionId: bay.busbarSectionId || null, | ||
| busbarSectionIds: busBarSectionInfos, | ||
| connectionSide: bay.connectionSide || null, | ||
| connectionName: bay.connectablePositionInfos.connectionName || null, | ||
| connectionDirection: bay.connectablePositionInfos.connectionDirection || null, | ||
| connectionPosition: bay.connectablePositionInfos.connectionPosition || null, | ||
| connectionPosition: | ||
| bay.connectablePositionInfos.connectionPosition !== undefined | ||
| ? String(bay.connectablePositionInfos.connectionPosition) | ||
| : null, | ||
| isRemoved: false, | ||
| rowId: null, | ||
| })); | ||
|
|
@@ -174,7 +180,10 @@ export default function MoveVoltageLevelFeederBaysDialog({ | |
| connectionSide: bay.connectionSide, | ||
| connectionName: bay.connectablePositionInfos.connectionName || null, | ||
| connectionDirection: bay.connectablePositionInfos.connectionDirection, | ||
| connectionPosition: bay.connectablePositionInfos.connectionPosition || '0', | ||
| connectionPosition: | ||
| bay.connectablePositionInfos.connectionPosition !== undefined | ||
| ? String(bay.connectablePositionInfos.connectionPosition) | ||
| : null, | ||
| isRemoved: false, | ||
| rowId: null, | ||
| }); | ||
|
|
@@ -294,7 +303,7 @@ export default function MoveVoltageLevelFeederBaysDialog({ | |
| equipmentId: row?.equipmentId!, | ||
| busbarSectionId: row?.busbarSectionId!, | ||
| connectionSide: row?.connectionSide!, | ||
| connectionPosition: row?.connectionPosition != null ? String(row.connectionPosition) : '0', | ||
| connectionPosition: row?.connectionPosition!, | ||
| connectionName: row?.connectionName!, | ||
| connectionDirection: row?.connectionDirection!, | ||
| })) | ||
|
|
||
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
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.
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.
add in a separated variable as it was before
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.
done