@gridsuite/commons-ui 0.191.0 → 0.192.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/components/network-modifications/by-filter/deletion/ByFilterDeletionForm.d.ts +0 -6
  2. package/dist/components/network-modifications/by-filter/deletion/ByFilterDeletionForm.js +6 -10
  3. package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.js +35 -39
  4. package/dist/components/network-modifications/common/measurements/BranchActiveReactivePowerMeasurementsForm.js +1 -7
  5. package/dist/components/network-modifications/common/measurements/PowerMeasurementsForm.js +3 -4
  6. package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.js +19 -22
  7. package/dist/components/network-modifications/common/properties/PropertiesForm.js +14 -15
  8. package/dist/components/network-modifications/common/properties/PropertyForm.d.ts +1 -1
  9. package/dist/components/network-modifications/common/properties/PropertyForm.js +42 -50
  10. package/dist/components/network-modifications/common/setpoints/SetPointsForm.js +21 -24
  11. package/dist/components/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +35 -38
  12. package/dist/components/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +1 -1
  13. package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/HvdcLccDeletionSpecificForm.js +5 -6
  14. package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.d.ts +0 -6
  15. package/dist/components/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +6 -5
  16. package/dist/components/network-modifications/load/common/LoadDialogHeader.js +6 -17
  17. package/dist/components/network-modifications/load/common/LoadDialogTabs.js +4 -4
  18. package/dist/components/network-modifications/load/common/LoadDialogTabsContent.js +21 -18
  19. package/dist/components/network-modifications/load/modification/loadModification.utils.js +1 -1
  20. package/dist/components/network-modifications/substation/creation/SubstationCreationForm.js +16 -12
  21. package/dist/components/network-modifications/substation/modification/SubstationModificationForm.js +40 -44
  22. package/dist/components/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +22 -14
  23. package/dist/components/network-modifications/voltageLevel/creation/tabs/characteristicsTab/CharacteristicsTab.js +5 -6
  24. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +3 -4
  25. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/couplingOmnibus/CouplingOmnibusCreation.js +3 -3
  26. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +2 -3
  27. package/dist/components/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/creation/CreateSwitchesForm.js +10 -21
  28. package/dist/components/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +3 -3
  29. package/dist/components/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +2 -2
  30. package/dist/components/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +103 -110
  31. package/dist/components/node/build-status-chip.d.ts +2 -1
  32. package/dist/components/node/build-status-chip.js +13 -3
  33. package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +1 -0
  34. package/dist/components/parameters/sensi/constants.d.ts +2 -2
  35. package/dist/components/parameters/sensi/constants.js +1 -1
  36. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.d.ts +1 -1
  37. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +5 -1
  38. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-factor-count.d.ts +1 -1
  39. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-factor-count.js +4 -0
  40. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.d.ts +2 -1
  41. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -0
  42. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.d.ts +2 -1
  43. package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +5 -2
  44. package/dist/components/parameters/sensi/sensitivity-parameters-selector.d.ts +2 -1
  45. package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +10 -2
  46. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +6 -1
  47. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +36 -9
  48. package/dist/translations/en/parameters.d.ts +1 -0
  49. package/dist/translations/en/parameters.js +4 -3
  50. package/dist/translations/fr/parameters.d.ts +1 -0
  51. package/dist/translations/fr/parameters.js +4 -3
  52. package/dist/utils/types/sensitivity-analysis.type.d.ts +2 -2
  53. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { TextField, Grid } from "@mui/material";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Grid, TextField } from "@mui/material";
3
3
  import { useWatch } from "react-hook-form";
4
- import GridItem from "../../../grid/grid-item.js";
5
4
  import GridSection from "../../../grid/grid-section.js";
6
5
  import "react-intl";
7
6
  import "../../../overflowableText/OverflowableText.js";
@@ -46,113 +45,107 @@ import "../../common/properties/propertyUtils.js";
46
45
  function VoltageLevelModificationForm({ voltageLevelToModify }) {
47
46
  const equipmentId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
48
47
  const watchHideSubstationField = useWatch({ name: FieldConstants.HIDE_SUBSTATION_FIELD, defaultValue: true });
49
- const voltageLevelIdField = /* @__PURE__ */ jsx(
50
- TextField,
51
- {
52
- size: "small",
53
- fullWidth: true,
54
- label: "ID",
55
- value: equipmentId ?? "",
56
- InputProps: {
57
- readOnly: true
58
- },
59
- disabled: true,
60
- ...filledTextField
61
- }
62
- );
63
- const voltageLevelNameField = /* @__PURE__ */ jsx(
64
- TextInput,
65
- {
66
- name: FieldConstants.EQUIPMENT_NAME,
67
- label: "Name",
68
- formProps: filledTextField,
69
- clearable: true,
70
- previousValue: voltageLevelToModify?.name ?? void 0
71
- }
72
- );
73
- const substationField = /* @__PURE__ */ jsx(
74
- AutocompleteInput,
75
- {
76
- allowNewValue: true,
77
- forcePopupIcon: true,
78
- name: FieldConstants.SUBSTATION_ID,
79
- label: "SUBSTATION",
80
- options: [voltageLevelToModify?.substationId ?? ""],
81
- inputTransform: (value) => value === null ? "" : value,
82
- outputTransform: (value) => value,
83
- size: "small",
84
- formProps: filledTextField,
85
- disabled: true
86
- }
87
- );
88
- const nominalVoltageField = /* @__PURE__ */ jsx(
89
- FloatInput,
90
- {
91
- name: FieldConstants.NOMINAL_V,
92
- label: "NominalVoltage",
93
- adornment: VoltageAdornment,
94
- clearable: true,
95
- previousValue: voltageLevelToModify?.nominalV
96
- }
97
- );
98
- const lowVoltageLimitField = /* @__PURE__ */ jsx(
99
- FloatInput,
100
- {
101
- name: FieldConstants.LOW_VOLTAGE_LIMIT,
102
- label: "LowVoltageLimit",
103
- adornment: VoltageAdornment,
104
- clearable: true,
105
- previousValue: voltageLevelToModify?.lowVoltageLimit ?? void 0
106
- }
107
- );
108
- const highVoltageLimitField = /* @__PURE__ */ jsx(
109
- FloatInput,
110
- {
111
- name: FieldConstants.HIGH_VOLTAGE_LIMIT,
112
- label: "HighVoltageLimit",
113
- adornment: VoltageAdornment,
114
- clearable: true,
115
- previousValue: voltageLevelToModify?.highVoltageLimit ?? void 0
116
- }
117
- );
118
- const lowShortCircuitCurrentLimitField = /* @__PURE__ */ jsx(
119
- FloatInput,
120
- {
121
- name: FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
122
- label: "LowShortCircuitCurrentLimit",
123
- adornment: KiloAmpereAdornment,
124
- clearable: true,
125
- previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMin ?? void 0
126
- }
127
- );
128
- const highShortCircuitCurrentLimitField = /* @__PURE__ */ jsx(
129
- FloatInput,
130
- {
131
- name: FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
132
- label: "HighShortCircuitCurrentLimit",
133
- adornment: KiloAmpereAdornment,
134
- clearable: true,
135
- previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMax ?? void 0
136
- }
137
- );
138
- return /* @__PURE__ */ jsxs(Fragment, { children: [
139
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
140
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: voltageLevelIdField }),
141
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: voltageLevelNameField }),
142
- !watchHideSubstationField && /* @__PURE__ */ jsx(GridItem, { size: 4, children: substationField })
143
- ] }),
144
- /* @__PURE__ */ jsx(GridSection, { title: "VoltageText" }),
145
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
146
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: nominalVoltageField }),
147
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: lowVoltageLimitField }),
148
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: highVoltageLimitField })
149
- ] }),
150
- /* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
151
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
152
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: lowShortCircuitCurrentLimitField }),
153
- /* @__PURE__ */ jsx(GridItem, { size: 4, children: highShortCircuitCurrentLimitField })
154
- ] }),
155
- /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel", isModification: true })
48
+ return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 2, children: [
49
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
50
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
51
+ TextField,
52
+ {
53
+ size: "small",
54
+ fullWidth: true,
55
+ label: "ID",
56
+ value: equipmentId ?? "",
57
+ InputProps: {
58
+ readOnly: true
59
+ },
60
+ disabled: true,
61
+ ...filledTextField
62
+ }
63
+ ) }),
64
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
65
+ TextInput,
66
+ {
67
+ name: FieldConstants.EQUIPMENT_NAME,
68
+ label: "Name",
69
+ formProps: filledTextField,
70
+ clearable: true,
71
+ previousValue: voltageLevelToModify?.name ?? void 0
72
+ }
73
+ ) }),
74
+ !watchHideSubstationField && /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
75
+ AutocompleteInput,
76
+ {
77
+ allowNewValue: true,
78
+ forcePopupIcon: true,
79
+ name: FieldConstants.SUBSTATION_ID,
80
+ label: "SUBSTATION",
81
+ options: [voltageLevelToModify?.substationId ?? ""],
82
+ inputTransform: (value) => value === null ? "" : value,
83
+ outputTransform: (value) => value,
84
+ size: "small",
85
+ formProps: filledTextField,
86
+ disabled: true
87
+ }
88
+ ) })
89
+ ] }) }),
90
+ /* @__PURE__ */ jsxs(Grid, { item: true, children: [
91
+ /* @__PURE__ */ jsx(GridSection, { title: "VoltageText" }),
92
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
93
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
94
+ FloatInput,
95
+ {
96
+ name: FieldConstants.NOMINAL_V,
97
+ label: "NominalVoltage",
98
+ adornment: VoltageAdornment,
99
+ clearable: true,
100
+ previousValue: voltageLevelToModify?.nominalV
101
+ }
102
+ ) }),
103
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
104
+ FloatInput,
105
+ {
106
+ name: FieldConstants.LOW_VOLTAGE_LIMIT,
107
+ label: "LowVoltageLimit",
108
+ adornment: VoltageAdornment,
109
+ clearable: true,
110
+ previousValue: voltageLevelToModify?.lowVoltageLimit ?? void 0
111
+ }
112
+ ) }),
113
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
114
+ FloatInput,
115
+ {
116
+ name: FieldConstants.HIGH_VOLTAGE_LIMIT,
117
+ label: "HighVoltageLimit",
118
+ adornment: VoltageAdornment,
119
+ clearable: true,
120
+ previousValue: voltageLevelToModify?.highVoltageLimit ?? void 0
121
+ }
122
+ ) })
123
+ ] }),
124
+ /* @__PURE__ */ jsx(GridSection, { title: "ShortCircuit" }),
125
+ /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
126
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
127
+ FloatInput,
128
+ {
129
+ name: FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
130
+ label: "LowShortCircuitCurrentLimit",
131
+ adornment: KiloAmpereAdornment,
132
+ clearable: true,
133
+ previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMin ?? void 0
134
+ }
135
+ ) }),
136
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(
137
+ FloatInput,
138
+ {
139
+ name: FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
140
+ label: "HighShortCircuitCurrentLimit",
141
+ adornment: KiloAmpereAdornment,
142
+ clearable: true,
143
+ previousValue: voltageLevelToModify?.identifiableShortCircuit?.ipMax ?? void 0
144
+ }
145
+ ) })
146
+ ] }),
147
+ /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "voltageLevel", isModification: true })
148
+ ] })
156
149
  ] });
157
150
  }
158
151
  export {
@@ -6,7 +6,8 @@ type BuildStatusChipProps = {
6
6
  sx?: SxStyle;
7
7
  icon?: ReactElement;
8
8
  onClick?: (e: React.MouseEvent) => void;
9
+ isRootNode?: boolean;
9
10
  overrideLabel?: boolean;
10
11
  };
11
- export declare function BuildStatusChip({ buildStatus, sx, icon, onClick, overrideLabel, }: Readonly<BuildStatusChipProps>): import("react/jsx-runtime").JSX.Element;
12
+ export declare function BuildStatusChip({ buildStatus, sx, icon, onClick, isRootNode, overrideLabel, }: Readonly<BuildStatusChipProps>): import("react/jsx-runtime").JSX.Element;
12
13
  export default BuildStatusChip;
@@ -7,7 +7,7 @@ import "@mui/icons-material";
7
7
  import { mergeSx } from "../../utils/styles.js";
8
8
  import "../../utils/yupConfig.js";
9
9
  import { BuildStatus } from "./constant.js";
10
- function getBuildStatusSx(buildStatus) {
10
+ function getBuildStatusSx(isRootNode, buildStatus) {
11
11
  return (theme) => {
12
12
  const bs = theme.node.buildStatus;
13
13
  let bg;
@@ -25,6 +25,9 @@ function getBuildStatusSx(buildStatus) {
25
25
  bg = bs.notBuilt;
26
26
  break;
27
27
  }
28
+ if (isRootNode) {
29
+ bg = bs.warning;
30
+ }
28
31
  return {
29
32
  background: bg,
30
33
  // only set explicit contrast color when it's the "notBuilt" background
@@ -46,15 +49,22 @@ function BuildStatusChip({
46
49
  sx,
47
50
  icon,
48
51
  onClick,
52
+ isRootNode = false,
49
53
  overrideLabel = false
50
54
  }) {
51
55
  const intl = useIntl();
52
56
  let labelId = buildStatus?.toString();
57
+ let localNodeStatus = buildStatus;
53
58
  if (overrideLabel) {
54
- if (labelId === BuildStatus.BUILT) {
59
+ if (isRootNode) {
60
+ labelId = "ROOT_NODE";
61
+ localNodeStatus = BuildStatus.NOT_BUILT;
62
+ } else if (labelId === BuildStatus.BUILT || labelId === BuildStatus.BUILT_WITH_WARNING || labelId === BuildStatus.BUILT_WITH_ERROR) {
55
63
  labelId = "NODE_BUILT";
64
+ localNodeStatus = BuildStatus.BUILT;
56
65
  } else if (labelId === BuildStatus.NOT_BUILT) {
57
66
  labelId = "NODE_NOT_BUILT";
67
+ localNodeStatus = BuildStatus.NOT_BUILT;
58
68
  }
59
69
  }
60
70
  const label = intl.formatMessage({ id: labelId });
@@ -65,7 +75,7 @@ function BuildStatusChip({
65
75
  size: "small",
66
76
  icon,
67
77
  onClick,
68
- sx: mergeSx(getBuildStatusSx(buildStatus), sx, baseStyle)
78
+ sx: mergeSx(getBuildStatusSx(isRootNode, localNodeStatus), sx, baseStyle)
69
79
  }
70
80
  );
71
81
  }
@@ -10,6 +10,7 @@ export interface ParametersEditionDialogProps {
10
10
  name: string;
11
11
  description: string | null;
12
12
  activeDirectory: UUID;
13
+ isRootNode: boolean;
13
14
  language?: GsLang;
14
15
  user: User | null;
15
16
  globalBuildStatus?: BuildStatus;
@@ -27,6 +27,6 @@ export declare const CONTAINER_NAME = "containerName";
27
27
  export declare const MAX_RESULTS_COUNT = 500000;
28
28
  export declare const MAX_VARIABLES_COUNT = 5000;
29
29
  export declare const DEFAULT_FACTOR_COUNT: {
30
- resultCount: number;
31
- variableCount: number;
30
+ resultCount: null;
31
+ variableCount: null;
32
32
  };
@@ -20,7 +20,7 @@ const CONTAINER_ID = "containerId";
20
20
  const CONTAINER_NAME = "containerName";
21
21
  const MAX_RESULTS_COUNT = 5e5;
22
22
  const MAX_VARIABLES_COUNT = 5e3;
23
- const DEFAULT_FACTOR_COUNT = { resultCount: 0, variableCount: 0 };
23
+ const DEFAULT_FACTOR_COUNT = { resultCount: null, variableCount: null };
24
24
  export {
25
25
  ANGLE_FLOW_SENSITIVITY_VALUE_THRESHOLD,
26
26
  CONTAINER_ID,
@@ -1,2 +1,2 @@
1
1
  import { ParametersEditionDialogProps } from '../common';
2
- export declare function SensitivityAnalysisParametersDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, user, globalBuildStatus, isDeveloperMode, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function SensitivityAnalysisParametersDialog({ id, open, onClose, titleId, name, description, activeDirectory, language, user, globalBuildStatus, isRootNode, isDeveloperMode, }: Readonly<ParametersEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
@@ -56,6 +56,7 @@ function SensitivityAnalysisParametersDialog({
56
56
  language,
57
57
  user,
58
58
  globalBuildStatus,
59
+ isRootNode = false,
59
60
  isDeveloperMode = false
60
61
  }) {
61
62
  const parametersBackend = useParametersBackend(
@@ -76,7 +77,9 @@ function SensitivityAnalysisParametersDialog({
76
77
  parametersBackend,
77
78
  parametersUuid: id,
78
79
  name,
79
- description
80
+ description,
81
+ globalBuildStatus,
82
+ isRootNode
80
83
  });
81
84
  const {
82
85
  formState: { errors, dirtyFields }
@@ -101,6 +104,7 @@ function SensitivityAnalysisParametersDialog({
101
104
  {
102
105
  sensitivityAnalysisMethods,
103
106
  isDeveloperMode,
107
+ isRootNode,
104
108
  globalBuildStatus,
105
109
  renderTitleFields: () => {
106
110
  return /* @__PURE__ */ jsx(
@@ -1,5 +1,5 @@
1
1
  interface SensitivityAnalysisParametersFactorCountProps {
2
- count: number;
2
+ count: number | null;
3
3
  maxCount: number;
4
4
  messageId: string;
5
5
  isLoading: boolean;
@@ -28,9 +28,13 @@ const styles = {
28
28
  const renderLoadingState = () => {
29
29
  return /* @__PURE__ */ jsx(Box, { sx: styles.textInfo, children: /* @__PURE__ */ jsx(CircularProgress, { size: "1em", sx: styles.circularProgress }) });
30
30
  };
31
+ const renderDefaultFactorCount = (messageId) => {
32
+ return /* @__PURE__ */ jsx(Box, { sx: styles.textInitial, children: /* @__PURE__ */ jsx(FormattedMessage, { id: messageId, values: { count: null, suffix: "" } }) });
33
+ };
31
34
  function SensitivityAnalysisParametersFactorCount(props) {
32
35
  const { count, maxCount, messageId, isLoading } = props;
33
36
  if (isLoading) return renderLoadingState();
37
+ if (count === null) return renderDefaultFactorCount(messageId);
34
38
  const isOverMillion = count > 999999;
35
39
  const isOverLimit = count > maxCount;
36
40
  const isZero = count === 0;
@@ -1,10 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { UseSensitivityAnalysisParametersReturn } from './use-sensitivity-analysis-parameters';
3
3
  import { BuildStatus } from '../../node/constant';
4
- export declare function SensitivityAnalysisParametersForm({ sensitivityAnalysisMethods, renderTitleFields, renderActions, isDeveloperMode, globalBuildStatus, }: Readonly<{
4
+ export declare function SensitivityAnalysisParametersForm({ sensitivityAnalysisMethods, renderTitleFields, renderActions, isDeveloperMode, isRootNode, globalBuildStatus, }: Readonly<{
5
5
  sensitivityAnalysisMethods: UseSensitivityAnalysisParametersReturn;
6
6
  renderTitleFields?: () => ReactNode;
7
7
  renderActions?: () => ReactNode;
8
8
  isDeveloperMode: boolean;
9
+ isRootNode: boolean;
9
10
  globalBuildStatus?: BuildStatus;
10
11
  }>): import("react/jsx-runtime").JSX.Element;
@@ -63,6 +63,7 @@ function SensitivityAnalysisParametersForm({
63
63
  renderTitleFields,
64
64
  renderActions,
65
65
  isDeveloperMode,
66
+ isRootNode,
66
67
  globalBuildStatus
67
68
  }) {
68
69
  return /* @__PURE__ */ jsx(
@@ -119,6 +120,7 @@ function SensitivityAnalysisParametersForm({
119
120
  factorsCount: sensitivityAnalysisMethods.factorsCount,
120
121
  isDeveloperMode,
121
122
  isStudyLinked: sensitivityAnalysisMethods.isStudyLinked,
123
+ isRootNode,
122
124
  globalBuildStatus
123
125
  }
124
126
  )
@@ -9,7 +9,8 @@ interface SensitivityAnalysisParametersProps {
9
9
  parametersBackend: UseParametersBackendReturnProps<ComputingType.SENSITIVITY_ANALYSIS>;
10
10
  setHaveDirtyFields: (isDirty: boolean) => void;
11
11
  globalBuildStatus?: BuildStatus;
12
+ isRootNode: boolean;
12
13
  isDeveloperMode: boolean;
13
14
  }
14
- export declare function SensitivityAnalysisParametersInline({ studyUuid, currentNodeUuid, currentRootNetworkUuid, parametersBackend, setHaveDirtyFields, globalBuildStatus, isDeveloperMode, }: Readonly<SensitivityAnalysisParametersProps>): import("react/jsx-runtime").JSX.Element;
15
+ export declare function SensitivityAnalysisParametersInline({ studyUuid, currentNodeUuid, currentRootNetworkUuid, parametersBackend, setHaveDirtyFields, globalBuildStatus, isRootNode, isDeveloperMode, }: Readonly<SensitivityAnalysisParametersProps>): import("react/jsx-runtime").JSX.Element;
15
16
  export {};
@@ -54,11 +54,11 @@ function SensitivityAnalysisParametersInline({
54
54
  parametersBackend,
55
55
  setHaveDirtyFields,
56
56
  globalBuildStatus,
57
+ isRootNode,
57
58
  isDeveloperMode
58
59
  }) {
59
60
  const intl = useIntl();
60
61
  const { snackError } = useSnackMessage();
61
- console.info(`globalBuildStatus : ${globalBuildStatus}`);
62
62
  const sensitivityAnalysisMethods = useSensitivityAnalysisParametersForm({
63
63
  studyUuid,
64
64
  currentNodeUuid,
@@ -66,7 +66,9 @@ function SensitivityAnalysisParametersInline({
66
66
  parametersBackend,
67
67
  name: null,
68
68
  description: null,
69
- parametersUuid: null
69
+ parametersUuid: null,
70
+ globalBuildStatus,
71
+ isRootNode
70
72
  });
71
73
  const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
72
74
  const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
@@ -115,6 +117,7 @@ function SensitivityAnalysisParametersInline({
115
117
  {
116
118
  sensitivityAnalysisMethods,
117
119
  isDeveloperMode,
120
+ isRootNode,
118
121
  globalBuildStatus,
119
122
  renderActions: () => {
120
123
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6,7 +6,8 @@ interface SensitivityParametersSelectorProps {
6
6
  factorsCount: FactorsCount;
7
7
  isDeveloperMode: boolean;
8
8
  isStudyLinked: boolean;
9
+ isRootNode: boolean;
9
10
  globalBuildStatus?: BuildStatus;
10
11
  }
11
- declare function SensitivityParametersSelector({ onFormChanged, isLoading, factorsCount, isDeveloperMode, isStudyLinked, globalBuildStatus, }: Readonly<SensitivityParametersSelectorProps>): import("react/jsx-runtime").JSX.Element;
12
+ declare function SensitivityParametersSelector({ onFormChanged, isLoading, factorsCount, isDeveloperMode, isStudyLinked, isRootNode, globalBuildStatus, }: Readonly<SensitivityParametersSelectorProps>): import("react/jsx-runtime").JSX.Element;
12
13
  export default SensitivityParametersSelector;
@@ -48,7 +48,7 @@ import { BuildStatusChip } from "../../node/build-status-chip.js";
48
48
  const styles = {
49
49
  boxContent: {
50
50
  display: "flex",
51
- alignItems: "end",
51
+ alignItems: "center",
52
52
  justifyContent: "right",
53
53
  gap: 0.5,
54
54
  flex: "auto",
@@ -62,6 +62,7 @@ function SensitivityParametersSelector({
62
62
  factorsCount,
63
63
  isDeveloperMode,
64
64
  isStudyLinked,
65
+ isRootNode,
65
66
  globalBuildStatus
66
67
  }) {
67
68
  const intl = useIntl();
@@ -123,7 +124,14 @@ function SensitivityParametersSelector({
123
124
  tab.label
124
125
  )) }),
125
126
  isStudyLinked && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 3 }, children: [
126
- /* @__PURE__ */ jsx(Box, { sx: { ...styles.boxContent }, children: /* @__PURE__ */ jsx(BuildStatusChip, { buildStatus: globalBuildStatus, overrideLabel: true }) }),
127
+ /* @__PURE__ */ jsx(Box, { sx: { ...styles.boxContent }, children: /* @__PURE__ */ jsx(
128
+ BuildStatusChip,
129
+ {
130
+ buildStatus: globalBuildStatus,
131
+ overrideLabel: true,
132
+ isRootNode
133
+ }
134
+ ) }),
127
135
  /* @__PURE__ */ jsxs(Box, { sx: { ...styles.boxContent }, children: [
128
136
  /* @__PURE__ */ jsx(
129
137
  SensitivityAnalysisParametersFactorCount,
@@ -3,6 +3,7 @@ import { ObjectSchema } from 'yup';
3
3
  import { UUID } from 'node:crypto';
4
4
  import { ComputingType } from '../common';
5
5
  import { FactorsCount, SensitivityAnalysisParametersInfos, UseParametersBackendReturnProps } from '../../../utils';
6
+ import { BuildStatus } from '../../node';
6
7
  export interface UseSensitivityAnalysisParametersReturn {
7
8
  formMethods: UseFormReturn<any>;
8
9
  formSchema: ObjectSchema<any>;
@@ -33,6 +34,8 @@ type UseSensitivityAnalysisParametersFormProps = {
33
34
  currentRootNetworkUuid: null;
34
35
  parametersBackend: UseParametersBackendReturnProps<ComputingType.SENSITIVITY_ANALYSIS>;
35
36
  parametersUuid: UUID;
37
+ globalBuildStatus: BuildStatus | undefined;
38
+ isRootNode: boolean;
36
39
  } | {
37
40
  name: null;
38
41
  description: null;
@@ -41,6 +44,8 @@ type UseSensitivityAnalysisParametersFormProps = {
41
44
  currentRootNetworkUuid: UUID | null;
42
45
  parametersBackend: UseParametersBackendReturnProps<ComputingType.SENSITIVITY_ANALYSIS>;
43
46
  parametersUuid: null;
47
+ globalBuildStatus: BuildStatus | undefined;
48
+ isRootNode: boolean;
44
49
  };
45
- export declare const useSensitivityAnalysisParametersForm: ({ studyUuid, currentNodeUuid, currentRootNetworkUuid, parametersBackend, parametersUuid, name, description, }: UseSensitivityAnalysisParametersFormProps) => UseSensitivityAnalysisParametersReturn;
50
+ export declare const useSensitivityAnalysisParametersForm: ({ studyUuid, currentNodeUuid, currentRootNetworkUuid, parametersBackend, parametersUuid, name, description, globalBuildStatus, isRootNode, }: UseSensitivityAnalysisParametersFormProps) => UseSensitivityAnalysisParametersReturn;
46
51
  export {};
@@ -50,6 +50,7 @@ import { DEFAULT_FACTOR_COUNT, PARAMETER_SENSI_NODES, PARAMETER_SENSI_PST, PARAM
50
50
  import { getSensitivityAnalysisFactorsCount, setSensitivityAnalysisParameters } from "../../../services/sensitivity-analysis.js";
51
51
  import "../../filter/HeaderFilterForm.js";
52
52
  import { getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
53
+ import { BuildStatus } from "../../node/constant.js";
53
54
  const useSensitivityAnalysisParametersForm = ({
54
55
  studyUuid,
55
56
  currentNodeUuid,
@@ -57,7 +58,9 @@ const useSensitivityAnalysisParametersForm = ({
57
58
  parametersBackend,
58
59
  parametersUuid,
59
60
  name,
60
- description
61
+ description,
62
+ globalBuildStatus,
63
+ isRootNode
61
64
  }) => {
62
65
  const { providers, params, updateParameters } = parametersBackend;
63
66
  const [sensitivityAnalysisParams, setSensitivityAnalysisParams] = useState(params);
@@ -139,10 +142,16 @@ const useSensitivityAnalysisParametersForm = ({
139
142
  setFactorCountParams(formatNewParams(filteredFormValues));
140
143
  }, [currentNodeUuid, currentRootNetworkUuid, formatNewParams, getValues, resetFactorsCount]);
141
144
  useEffect(() => {
145
+ let active = true;
142
146
  if (!factorCountParams || !currentNodeUuid || !currentRootNetworkUuid) {
143
147
  return () => {
144
148
  };
145
149
  }
150
+ if (globalBuildStatus === BuildStatus.NOT_BUILT || globalBuildStatus === BuildStatus.BUILDING || isRootNode) {
151
+ setFactorsCount(DEFAULT_FACTOR_COUNT);
152
+ return () => {
153
+ };
154
+ }
146
155
  let loadingTimeoutId;
147
156
  const controller = new AbortController();
148
157
  const abortSignal = AbortSignal.any([controller.signal, AbortSignal.timeout(DEFAULT_TIMEOUT_MS)]);
@@ -154,22 +163,34 @@ const useSensitivityAnalysisParametersForm = ({
154
163
  factorCountParams,
155
164
  abortSignal
156
165
  ).then((factorsCountResponse) => {
157
- setFactorsCount(factorsCountResponse);
158
- loadingTimeoutId = setTimeout(() => {
159
- setIsLoading(false);
160
- }, 500);
166
+ if (active) {
167
+ setFactorsCount(factorsCountResponse);
168
+ }
161
169
  }).catch((error) => {
162
170
  if (abortSignal.aborted && abortSignal.reason?.message === IGNORE_SIGNAL) {
163
171
  return;
164
172
  }
165
- setIsLoading(false);
166
173
  snackWithFallback(snackError, error, { headerId: "getSensitivityAnalysisFactorsCountError" });
174
+ }).finally(() => {
175
+ if (active) {
176
+ loadingTimeoutId = setTimeout(() => setIsLoading(false), 500);
177
+ }
167
178
  });
168
179
  return () => {
180
+ active = false;
169
181
  controller?.abort(new Error(IGNORE_SIGNAL));
170
182
  clearTimeout(loadingTimeoutId);
183
+ setIsLoading(false);
171
184
  };
172
- }, [snackError, studyUuid, currentRootNetworkUuid, currentNodeUuid, factorCountParams]);
185
+ }, [
186
+ snackError,
187
+ studyUuid,
188
+ currentRootNetworkUuid,
189
+ currentNodeUuid,
190
+ factorCountParams,
191
+ globalBuildStatus,
192
+ isRootNode
193
+ ]);
173
194
  const onFormChanged = useCallback(() => {
174
195
  updateFactorCount();
175
196
  }, [updateFactorCount]);
@@ -350,8 +371,14 @@ const useSensitivityAnalysisParametersForm = ({
350
371
  reset(fromSensitivityAnalysisParamsDataToFormValues(params));
351
372
  }
352
373
  }, [params, reset, fromSensitivityAnalysisParamsDataToFormValues]);
353
- const isMaxResultsReached = useMemo(() => factorsCount.resultCount > MAX_RESULTS_COUNT, [factorsCount]);
354
- const isMaxVariablesReached = useMemo(() => factorsCount.variableCount > MAX_VARIABLES_COUNT, [factorsCount]);
374
+ const isMaxResultsReached = useMemo(
375
+ () => factorsCount.resultCount !== null && factorsCount.resultCount > MAX_RESULTS_COUNT,
376
+ [factorsCount]
377
+ );
378
+ const isMaxVariablesReached = useMemo(
379
+ () => factorsCount.variableCount !== null && factorsCount.variableCount > MAX_VARIABLES_COUNT,
380
+ [factorsCount]
381
+ );
355
382
  const paramsLoaded = useMemo(() => !!params, [params]);
356
383
  return {
357
384
  formMethods,
@@ -284,4 +284,5 @@ export declare const parametersEn: {
284
284
  BUILDING: string;
285
285
  NODE_BUILT: string;
286
286
  NODE_NOT_BUILT: string;
287
+ ROOT_NODE: string;
287
288
  };
@@ -226,8 +226,8 @@ const parametersEn = {
226
226
  EquipmentsInVoltageRegulation: "Equipments in voltage regulation",
227
227
  PSTS: "PSTs",
228
228
  Active: "Active",
229
- "sensitivityAnalysis.simulatedResults": "{count, plural, =0 {0 result} =1 {1 result} other {#{suffix} results}}",
230
- "sensitivityAnalysis.simulatedVariables": "{count, plural, =0 {0 variable} =1 {1 variable} other {#{suffix} variables}}",
229
+ "sensitivityAnalysis.simulatedResults": "{count, select, null {- result} 0 {0 result} 1 {1 result} other {{count}{suffix} results}}",
230
+ "sensitivityAnalysis.simulatedVariables": "{count, select, null {- variable} 0 {0 variable} 1 {1 variable} other {{count}{suffix} variables}}",
231
231
  "sensitivityAnalysis.maximumFactorsCount": "{maxFactorsCount} max",
232
232
  "sensitivityAnalysis.separator": " | ",
233
233
  loadingComputing: "Calculation in progress...",
@@ -284,7 +284,8 @@ const parametersEn = {
284
284
  NOT_BUILT: "Not built",
285
285
  BUILDING: "Building",
286
286
  NODE_BUILT: "Node built",
287
- NODE_NOT_BUILT: "Node not built"
287
+ NODE_NOT_BUILT: "Node not built",
288
+ ROOT_NODE: "Root node"
288
289
  };
289
290
  export {
290
291
  parametersEn
@@ -284,4 +284,5 @@ export declare const parametersFr: {
284
284
  BUILDING: string;
285
285
  NODE_BUILT: string;
286
286
  NODE_NOT_BUILT: string;
287
+ ROOT_NODE: string;
287
288
  };