From dc4f22a489139004ed42fff57f73e84e71fefd6b Mon Sep 17 00:00:00 2001 From: Abdelsalem Date: Mon, 9 Feb 2026 12:01:35 +0100 Subject: [PATCH 1/3] fix create svc by copy Signed-off-by: Abdelsalem --- .../creation/static-var-compensator-creation-dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx index b368cee421..782cab7b8b 100644 --- a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx +++ b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx @@ -220,7 +220,7 @@ const StaticVarCompensatorCreationDialog: FC = ({ addStandbyAutomaton: !!staticCompensator.standbyAutomatonInfos, standby: staticCompensator.standbyAutomatonInfos?.standby, b0: staticCompensator.standbyAutomatonInfos?.b0, - q0: null, + q0: staticCompensator.standbyAutomatonInfos ? null : undefined, nominalV: staticCompensator.nominalV, lVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.lowVoltageSetpoint, hVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.highVoltageSetpoint, From 3a351619c89403e894fa4ea2216807961508ff28 Mon Sep 17 00:00:00 2001 From: Abdelsalem Date: Tue, 10 Feb 2026 10:23:00 +0100 Subject: [PATCH 2/3] refacto Signed-off-by: Abdelsalem --- .../creation/standby-automaton-form-utils.ts | 8 +++++--- .../creation/static-var-compensator-creation-dialog.tsx | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts b/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts index f28b429cc0..dd1306a549 100644 --- a/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts +++ b/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts @@ -91,12 +91,15 @@ export const getStandbyAutomatonFormValidationSchema = () => [Q0]: requiredWhenQatNominalVChoice(yup.number().nullable()), }); +export const computeQ0 = (b0: number | null, nominalV: number | null): number | null => { + return b0 !== null && nominalV !== null ? b0 * Math.pow(nominalV, 2) : null; +}; + export const getStandbyAutomatonFormData = ({ addStandbyAutomaton, standby, b0, q0, - nominalV, lVoltageSetpoint, hVoltageSetpoint, lVoltageThreshold, @@ -106,7 +109,6 @@ export const getStandbyAutomatonFormData = ({ standby: any; b0: any; q0?: any; - nominalV?: any; lVoltageSetpoint: any; hVoltageSetpoint: any; lVoltageThreshold: any; @@ -120,6 +122,6 @@ export const getStandbyAutomatonFormData = ({ [LOW_VOLTAGE_THRESHOLD]: lVoltageThreshold, [HIGH_VOLTAGE_THRESHOLD]: hVoltageThreshold, [B0]: b0, - [Q0]: q0 === null && nominalV !== null && b0 !== null ? b0 * Math.pow(nominalV, 2) : q0, + [Q0]: q0, }, }); diff --git a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx index 782cab7b8b..cac060d206 100644 --- a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx +++ b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx @@ -78,6 +78,7 @@ import { getReactiveFormValidationSchema, } from './set-points-limits-form-utils'; import { + computeQ0, getStandbyAutomatonEmptyFormData, getStandbyAutomatonFormData, getStandbyAutomatonFormValidationSchema, @@ -220,8 +221,9 @@ const StaticVarCompensatorCreationDialog: FC = ({ addStandbyAutomaton: !!staticCompensator.standbyAutomatonInfos, standby: staticCompensator.standbyAutomatonInfos?.standby, b0: staticCompensator.standbyAutomatonInfos?.b0, - q0: staticCompensator.standbyAutomatonInfos ? null : undefined, - nominalV: staticCompensator.nominalV, + q0: staticCompensator.standbyAutomatonInfos + ? computeQ0(staticCompensator.standbyAutomatonInfos.b0, staticCompensator.nominalV) + : undefined, lVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.lowVoltageSetpoint, hVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.highVoltageSetpoint, lVoltageThreshold: staticCompensator.standbyAutomatonInfos?.lowVoltageThreshold, @@ -274,7 +276,6 @@ const StaticVarCompensatorCreationDialog: FC = ({ standby: staticCompensator.standby, b0: staticCompensator.b0 ?? null, q0: staticCompensator.q0 ?? null, - nominalV: null, lVoltageSetpoint: staticCompensator.lowVoltageSetpoint ?? null, hVoltageSetpoint: staticCompensator.highVoltageSetpoint ?? null, lVoltageThreshold: staticCompensator.lowVoltageThreshold ?? null, From a9d49a0cefc0a5b48c6b9e4175a094a12b170f7d Mon Sep 17 00:00:00 2001 From: Abdelsalem Date: Tue, 10 Feb 2026 10:53:22 +0100 Subject: [PATCH 3/3] refacto Signed-off-by: Abdelsalem --- .../creation/standby-automaton-form-utils.ts | 4 ++-- .../creation/static-var-compensator-creation-dialog.tsx | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts b/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts index dd1306a549..91f010a023 100644 --- a/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts +++ b/src/components/dialogs/network-modifications/static-var-compensator/creation/standby-automaton-form-utils.ts @@ -91,8 +91,8 @@ export const getStandbyAutomatonFormValidationSchema = () => [Q0]: requiredWhenQatNominalVChoice(yup.number().nullable()), }); -export const computeQ0 = (b0: number | null, nominalV: number | null): number | null => { - return b0 !== null && nominalV !== null ? b0 * Math.pow(nominalV, 2) : null; +export const computeQ0 = (b0?: number | null, nominalV?: number | null): number | undefined => { + return b0 != null && nominalV != null ? b0 * Math.pow(nominalV, 2) : undefined; }; export const getStandbyAutomatonFormData = ({ diff --git a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx index cac060d206..cfabee9557 100644 --- a/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx +++ b/src/components/dialogs/network-modifications/static-var-compensator/creation/static-var-compensator-creation-dialog.tsx @@ -221,9 +221,7 @@ const StaticVarCompensatorCreationDialog: FC = ({ addStandbyAutomaton: !!staticCompensator.standbyAutomatonInfos, standby: staticCompensator.standbyAutomatonInfos?.standby, b0: staticCompensator.standbyAutomatonInfos?.b0, - q0: staticCompensator.standbyAutomatonInfos - ? computeQ0(staticCompensator.standbyAutomatonInfos.b0, staticCompensator.nominalV) - : undefined, + q0: computeQ0(staticCompensator.standbyAutomatonInfos?.b0, staticCompensator.nominalV), lVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.lowVoltageSetpoint, hVoltageSetpoint: staticCompensator.standbyAutomatonInfos?.highVoltageSetpoint, lVoltageThreshold: staticCompensator.standbyAutomatonInfos?.lowVoltageThreshold,