@gridsuite/commons-ui 0.150.0 → 0.151.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.
- package/dist/components/parameters/sensi/constants.d.ts +6 -1
- package/dist/components/parameters/sensi/constants.js +6 -2
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-factor-count.d.ts +8 -0
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-factor-count.js +53 -0
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -3
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +3 -3
- package/dist/components/parameters/sensi/sensitivity-parameters-selector.d.ts +5 -11
- package/dist/components/parameters/sensi/sensitivity-parameters-selector.js +64 -99
- package/dist/components/parameters/sensi/sensitivity-table.d.ts +2 -3
- package/dist/components/parameters/sensi/sensitivity-table.js +27 -37
- package/dist/components/parameters/sensi/table-cell.d.ts +1 -1
- package/dist/components/parameters/sensi/table-cell.js +2 -8
- package/dist/components/parameters/sensi/table-row.d.ts +2 -2
- package/dist/components/parameters/sensi/table-row.js +4 -6
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +7 -10
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +67 -114
- package/dist/components/parameters/sensi/utils.d.ts +6 -15
- package/dist/components/parameters/sensi/utils.js +21 -4
- package/dist/hooks/use-create-row-data-sensi.js +1 -2
- package/dist/services/sensitivity-analysis.d.ts +2 -2
- package/dist/services/sensitivity-analysis.js +8 -9
- package/dist/translations/en/businessErrorsEn.d.ts +1 -0
- package/dist/translations/en/businessErrorsEn.js +2 -1
- package/dist/translations/en/parameters.d.ts +3 -3
- package/dist/translations/en/parameters.js +3 -3
- package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
- package/dist/translations/fr/businessErrorsFr.js +2 -1
- package/dist/translations/fr/parameters.d.ts +3 -3
- package/dist/translations/fr/parameters.js +3 -3
- package/dist/utils/types/sensitivity-analysis.type.d.ts +4 -7
- package/package.json +1 -1
|
@@ -26,4 +26,9 @@ export declare const PARAMETER_SENSI_PST = "sensitivityPST";
|
|
|
26
26
|
export declare const PARAMETER_SENSI_NODES = "sensitivityNodes";
|
|
27
27
|
export declare const CONTAINER_ID = "containerId";
|
|
28
28
|
export declare const CONTAINER_NAME = "containerName";
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const MAX_RESULTS_COUNT = 500000;
|
|
30
|
+
export declare const MAX_VARIABLES_COUNT = 5000;
|
|
31
|
+
export declare const DEFAULT_FACTOR_COUNT: {
|
|
32
|
+
resultCount: number;
|
|
33
|
+
variableCount: number;
|
|
34
|
+
};
|
|
@@ -20,20 +20,24 @@ const PARAMETER_SENSI_PST = "sensitivityPST";
|
|
|
20
20
|
const PARAMETER_SENSI_NODES = "sensitivityNodes";
|
|
21
21
|
const CONTAINER_ID = "containerId";
|
|
22
22
|
const CONTAINER_NAME = "containerName";
|
|
23
|
-
const
|
|
23
|
+
const MAX_RESULTS_COUNT = 5e5;
|
|
24
|
+
const MAX_VARIABLES_COUNT = 5e3;
|
|
25
|
+
const DEFAULT_FACTOR_COUNT = { resultCount: 0, variableCount: 0 };
|
|
24
26
|
export {
|
|
25
27
|
ACTIVATED,
|
|
26
28
|
ANGLE_FLOW_SENSITIVITY_VALUE_THRESHOLD,
|
|
27
29
|
CONTAINER_ID,
|
|
28
30
|
CONTAINER_NAME,
|
|
29
31
|
CONTINGENCIES,
|
|
30
|
-
|
|
32
|
+
DEFAULT_FACTOR_COUNT,
|
|
31
33
|
DISTRIBUTION_TYPE,
|
|
32
34
|
EQUIPMENTS_IN_VOLTAGE_REGULATION,
|
|
33
35
|
FLOW_FLOW_SENSITIVITY_VALUE_THRESHOLD,
|
|
34
36
|
FLOW_VOLTAGE_SENSITIVITY_VALUE_THRESHOLD,
|
|
35
37
|
HVDC_LINES,
|
|
36
38
|
INJECTIONS,
|
|
39
|
+
MAX_RESULTS_COUNT,
|
|
40
|
+
MAX_VARIABLES_COUNT,
|
|
37
41
|
MONITORED_BRANCHES,
|
|
38
42
|
PARAMETER_SENSI_HVDC,
|
|
39
43
|
PARAMETER_SENSI_INJECTION,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SensitivityAnalysisParametersFactorCountProps {
|
|
2
|
+
count: number;
|
|
3
|
+
maxCount: number;
|
|
4
|
+
messageId: string;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function SensitivityAnalysisParametersFactorCount(props: SensitivityAnalysisParametersFactorCountProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, CircularProgress } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { ErrorOutline } from "@mui/icons-material";
|
|
5
|
+
const styles = {
|
|
6
|
+
circularProgress: (theme) => ({
|
|
7
|
+
display: "flex",
|
|
8
|
+
marginRight: theme.spacing(1),
|
|
9
|
+
color: theme.palette.primary.main
|
|
10
|
+
}),
|
|
11
|
+
errorOutlineIcon: (theme) => ({
|
|
12
|
+
marginRight: theme.spacing(1),
|
|
13
|
+
color: theme.palette.error.main,
|
|
14
|
+
display: "flex"
|
|
15
|
+
}),
|
|
16
|
+
textInfo: (theme) => ({
|
|
17
|
+
color: theme.palette.primary.main,
|
|
18
|
+
display: "flex"
|
|
19
|
+
}),
|
|
20
|
+
textInitial: {
|
|
21
|
+
color: "grey"
|
|
22
|
+
},
|
|
23
|
+
textAlert: (theme) => ({
|
|
24
|
+
color: theme.palette.error.main,
|
|
25
|
+
display: "flex"
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
const renderLoadingState = () => {
|
|
29
|
+
return /* @__PURE__ */ jsx(Box, { sx: styles.textInfo, children: /* @__PURE__ */ jsx(CircularProgress, { size: "1em", sx: styles.circularProgress }) });
|
|
30
|
+
};
|
|
31
|
+
function SensitivityAnalysisParametersFactorCount(props) {
|
|
32
|
+
const { count, maxCount, messageId, isLoading } = props;
|
|
33
|
+
if (isLoading) return renderLoadingState();
|
|
34
|
+
const isOverMillion = count > 999999;
|
|
35
|
+
const isOverLimit = count > maxCount;
|
|
36
|
+
const isZero = count === 0;
|
|
37
|
+
const isAlert = isOverMillion || isOverLimit;
|
|
38
|
+
let sx = styles.textInfo;
|
|
39
|
+
if (isAlert) {
|
|
40
|
+
sx = styles.textAlert;
|
|
41
|
+
} else if (isZero) {
|
|
42
|
+
sx = styles.textInitial;
|
|
43
|
+
}
|
|
44
|
+
const displayCount = isOverMillion ? "999999" : count.toString();
|
|
45
|
+
const suffix = isOverMillion ? "+" : "";
|
|
46
|
+
return /* @__PURE__ */ jsxs(Box, { sx, children: [
|
|
47
|
+
isAlert && /* @__PURE__ */ jsx(ErrorOutline, { sx: styles.errorOutlineIcon }),
|
|
48
|
+
/* @__PURE__ */ jsx(FormattedMessage, { id: messageId, values: { count: displayCount, suffix } })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
SensitivityAnalysisParametersFactorCount
|
|
53
|
+
};
|
|
@@ -108,9 +108,8 @@ function SensitivityAnalysisParametersForm({
|
|
|
108
108
|
SensitivityParametersSelector,
|
|
109
109
|
{
|
|
110
110
|
onFormChanged: sensitivityAnalysisMethods.onFormChanged,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
analysisComputeComplexity: sensitivityAnalysisMethods.analysisComputeComplexity,
|
|
111
|
+
isLoading: sensitivityAnalysisMethods.isLoading,
|
|
112
|
+
factorsCount: sensitivityAnalysisMethods.factorsCount,
|
|
114
113
|
isDeveloperMode,
|
|
115
114
|
isStudyLinked: sensitivityAnalysisMethods.isStudyLinked
|
|
116
115
|
}
|
|
@@ -73,7 +73,7 @@ function SensitivityAnalysisParametersInline({
|
|
|
73
73
|
reset(sensitivityAnalysisMethods.fromSensitivityAnalysisParamsDataToFormValues(parameters), {
|
|
74
74
|
keepDefaultValues: true
|
|
75
75
|
});
|
|
76
|
-
sensitivityAnalysisMethods.
|
|
76
|
+
sensitivityAnalysisMethods.onFormChanged();
|
|
77
77
|
}).catch((error) => {
|
|
78
78
|
snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
|
|
79
79
|
});
|
|
@@ -90,7 +90,7 @@ function SensitivityAnalysisParametersInline({
|
|
|
90
90
|
const clear = useCallback(() => {
|
|
91
91
|
reset(sensitivityAnalysisMethods.emptyFormData);
|
|
92
92
|
resetSensitivityAnalysisParameters();
|
|
93
|
-
sensitivityAnalysisMethods.
|
|
93
|
+
sensitivityAnalysisMethods.resetFactorsCount();
|
|
94
94
|
setOpenResetConfirmation(false);
|
|
95
95
|
}, [reset, sensitivityAnalysisMethods, resetSensitivityAnalysisParameters]);
|
|
96
96
|
const handleResetClick = useCallback(() => {
|
|
@@ -125,7 +125,7 @@ function SensitivityAnalysisParametersInline({
|
|
|
125
125
|
{
|
|
126
126
|
onClick: handleSubmit(sensitivityAnalysisMethods.onSaveInline),
|
|
127
127
|
variant: "outlined",
|
|
128
|
-
disabled: sensitivityAnalysisMethods.
|
|
128
|
+
disabled: sensitivityAnalysisMethods.isLoading || sensitivityAnalysisMethods.isMaxResultsReached || sensitivityAnalysisMethods.isMaxVariablesReached,
|
|
129
129
|
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" })
|
|
130
130
|
}
|
|
131
131
|
)
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
1
|
+
import { FactorsCount } from '../../../utils';
|
|
7
2
|
interface SensitivityParametersSelectorProps {
|
|
8
|
-
onFormChanged: (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
analysisComputeComplexity: number;
|
|
3
|
+
onFormChanged: () => void;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
factorsCount: FactorsCount;
|
|
12
6
|
isDeveloperMode: boolean;
|
|
13
7
|
isStudyLinked: boolean;
|
|
14
8
|
}
|
|
15
|
-
declare function SensitivityParametersSelector({ onFormChanged,
|
|
9
|
+
declare function SensitivityParametersSelector({ onFormChanged, isLoading, factorsCount, isDeveloperMode, isStudyLinked, }: Readonly<SensitivityParametersSelectorProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
10
|
export default SensitivityParametersSelector;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useEffect
|
|
2
|
+
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
4
|
-
import { Grid, Tabs, Tab
|
|
5
|
-
import { ErrorOutline } from "@mui/icons-material";
|
|
4
|
+
import { Grid, Box, Tabs, Tab } from "@mui/material";
|
|
6
5
|
import { SensiTabValues, SensiBranchesTabValues, SensiInjectionsSet, SensiInjection, SensiHvdcs, SensiPsts, SensiNodes, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_PSTS, COLUMNS_DEFINITIONS_NODES } from "./columns-definitions.js";
|
|
7
6
|
import { SensitivityTable } from "./sensitivity-table.js";
|
|
8
7
|
import { TabPanel } from "../common/parameters.js";
|
|
9
8
|
import "../../../utils/conversionUtils.js";
|
|
10
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
11
|
import "../../../utils/yupConfig.js";
|
|
12
12
|
import "localized-countries";
|
|
13
13
|
import "localized-countries/data/fr";
|
|
@@ -35,28 +35,9 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
35
35
|
import "react-querybuilder";
|
|
36
36
|
import "../common/widget/parameter-line-slider.js";
|
|
37
37
|
import "../common/limitreductions/columns-definitions.js";
|
|
38
|
+
import { SensitivityAnalysisParametersFactorCount } from "./sensitivity-analysis-parameters-factor-count.js";
|
|
39
|
+
import { MAX_VARIABLES_COUNT, MAX_RESULTS_COUNT } from "./constants.js";
|
|
38
40
|
const styles = {
|
|
39
|
-
circularProgress: (theme) => ({
|
|
40
|
-
display: "flex",
|
|
41
|
-
marginRight: theme.spacing(1),
|
|
42
|
-
color: theme.palette.primary.main
|
|
43
|
-
}),
|
|
44
|
-
errorOutlineIcon: (theme) => ({
|
|
45
|
-
marginRight: theme.spacing(1),
|
|
46
|
-
color: theme.palette.error.main,
|
|
47
|
-
display: "flex"
|
|
48
|
-
}),
|
|
49
|
-
textInfo: (theme) => ({
|
|
50
|
-
color: theme.palette.primary.main,
|
|
51
|
-
display: "flex"
|
|
52
|
-
}),
|
|
53
|
-
textInitial: {
|
|
54
|
-
color: "grey"
|
|
55
|
-
},
|
|
56
|
-
textAlert: (theme) => ({
|
|
57
|
-
color: theme.palette.error.main,
|
|
58
|
-
display: "flex"
|
|
59
|
-
}),
|
|
60
41
|
boxContent: {
|
|
61
42
|
display: "flex",
|
|
62
43
|
alignItems: "end",
|
|
@@ -68,9 +49,8 @@ const styles = {
|
|
|
68
49
|
};
|
|
69
50
|
function SensitivityParametersSelector({
|
|
70
51
|
onFormChanged,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
analysisComputeComplexity,
|
|
52
|
+
isLoading,
|
|
53
|
+
factorsCount,
|
|
74
54
|
isDeveloperMode,
|
|
75
55
|
isStudyLinked
|
|
76
56
|
}) {
|
|
@@ -114,76 +94,71 @@ function SensitivityParametersSelector({
|
|
|
114
94
|
},
|
|
115
95
|
[intl]
|
|
116
96
|
);
|
|
117
|
-
const renderComputingEventLoading = () => {
|
|
118
|
-
return /* @__PURE__ */ jsxs(Box, { sx: styles.textInfo, children: [
|
|
119
|
-
/* @__PURE__ */ jsx(CircularProgress, { size: "1em", sx: styles.circularProgress }),
|
|
120
|
-
/* @__PURE__ */ jsx(FormattedMessage, { id: "loadingComputing" })
|
|
121
|
-
] });
|
|
122
|
-
};
|
|
123
97
|
useEffect(() => {
|
|
124
98
|
if (!isDeveloperMode) {
|
|
125
99
|
setTabValue(SensiTabValues.SensitivityBranches);
|
|
126
100
|
}
|
|
127
101
|
}, [isDeveloperMode]);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
102
|
+
return /* @__PURE__ */ jsxs(Grid, { sx: { width: "100%" }, children: [
|
|
103
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%" }, children: [
|
|
104
|
+
/* @__PURE__ */ jsx(Tabs, { value: tabValue, onChange: handleTabChange, children: tabInfo.map((tab, index) => /* @__PURE__ */ jsx(
|
|
105
|
+
Tab,
|
|
106
|
+
{
|
|
107
|
+
label: /* @__PURE__ */ jsx(FormattedMessage, { id: tab.label }),
|
|
108
|
+
value: index,
|
|
109
|
+
sx: {
|
|
110
|
+
fontSize: 17,
|
|
111
|
+
fontWeight: "bold",
|
|
112
|
+
textTransform: "capitalize"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
tab.label
|
|
116
|
+
)) }),
|
|
117
|
+
isStudyLinked && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
118
|
+
/* @__PURE__ */ jsxs(Box, { sx: { ...styles.boxContent, minWidth: 300 }, children: [
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
SensitivityAnalysisParametersFactorCount,
|
|
121
|
+
{
|
|
122
|
+
count: factorsCount.variableCount,
|
|
123
|
+
maxCount: MAX_VARIABLES_COUNT,
|
|
124
|
+
messageId: "sensitivityAnalysis.simulatedVariables",
|
|
125
|
+
isLoading
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ jsx(FormattedMessage, { id: "sensitivityAnalysis.separator" }),
|
|
133
129
|
/* @__PURE__ */ jsx(
|
|
134
130
|
FormattedMessage,
|
|
135
131
|
{
|
|
136
|
-
id: "sensitivityAnalysis.
|
|
132
|
+
id: "sensitivityAnalysis.maximumFactorsCount",
|
|
137
133
|
values: {
|
|
138
|
-
|
|
134
|
+
maxFactorsCount: MAX_VARIABLES_COUNT.toLocaleString()
|
|
139
135
|
}
|
|
140
136
|
}
|
|
141
137
|
)
|
|
142
|
-
] })
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return /* @__PURE__ */ jsx(Box, { sx: styles.textInitial, children: /* @__PURE__ */ jsx(
|
|
152
|
-
FormattedMessage,
|
|
153
|
-
{
|
|
154
|
-
id: "sensitivityAnalysis.simulatedComputations",
|
|
155
|
-
values: {
|
|
156
|
-
count: analysisComputeComplexity.toString()
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsxs(Box, { sx: { ...styles.boxContent, minWidth: 300 }, children: [
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
SensitivityAnalysisParametersFactorCount,
|
|
142
|
+
{
|
|
143
|
+
count: factorsCount.resultCount,
|
|
144
|
+
maxCount: MAX_RESULTS_COUNT,
|
|
145
|
+
messageId: "sensitivityAnalysis.simulatedResults",
|
|
146
|
+
isLoading
|
|
157
147
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}, [analysisComputeComplexity, launchLoader]);
|
|
173
|
-
return /* @__PURE__ */ jsxs(Grid, { sx: { width: "100%" }, children: [
|
|
174
|
-
/* @__PURE__ */ jsx(Tabs, { value: tabValue, onChange: handleTabChange, children: tabInfo.map((tab, index) => /* @__PURE__ */ jsx(
|
|
175
|
-
Tab,
|
|
176
|
-
{
|
|
177
|
-
label: /* @__PURE__ */ jsx(FormattedMessage, { id: tab.label }),
|
|
178
|
-
value: index,
|
|
179
|
-
sx: {
|
|
180
|
-
fontSize: 17,
|
|
181
|
-
fontWeight: "bold",
|
|
182
|
-
textTransform: "capitalize"
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
tab.label
|
|
186
|
-
)) }),
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsx(FormattedMessage, { id: "sensitivityAnalysis.separator" }),
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
FormattedMessage,
|
|
152
|
+
{
|
|
153
|
+
id: "sensitivityAnalysis.maximumFactorsCount",
|
|
154
|
+
values: {
|
|
155
|
+
maxFactorsCount: MAX_RESULTS_COUNT.toLocaleString()
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] })
|
|
160
|
+
] })
|
|
161
|
+
] }),
|
|
187
162
|
tabInfo.map((tab, index) => /* @__PURE__ */ jsxs(TabPanel, { value: tabValue, index, sx: { paddingTop: 1 }, children: [
|
|
188
163
|
tabValue === SensiTabValues.SensitivityBranches && tab.subTabs && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
189
164
|
/* @__PURE__ */ jsx(Tabs, { value: subTabValue, onChange: handleSubTabChange, children: tab.subTabs.map((subTab, subIndex) => /* @__PURE__ */ jsx(
|
|
@@ -198,11 +173,6 @@ function SensitivityParametersSelector({
|
|
|
198
173
|
},
|
|
199
174
|
subTab.label
|
|
200
175
|
)) }),
|
|
201
|
-
isStudyLinked && /* @__PURE__ */ jsxs(Box, { sx: styles.boxContent, children: [
|
|
202
|
-
ComputingEvent,
|
|
203
|
-
/* @__PURE__ */ jsx(FormattedMessage, { id: "sensitivityAnalysis.separator" }),
|
|
204
|
-
/* @__PURE__ */ jsx(FormattedMessage, { id: "sensitivityAnalysis.maximumSimulatedComputations" })
|
|
205
|
-
] }),
|
|
206
176
|
/* @__PURE__ */ jsx(TabPanel, { index: SensiBranchesTabValues.SensiInjectionsSet, value: subTabValue, children: /* @__PURE__ */ jsx(
|
|
207
177
|
SensitivityTable,
|
|
208
178
|
{
|
|
@@ -213,8 +183,7 @@ function SensitivityParametersSelector({
|
|
|
213
183
|
useFieldArrayOutput: useFieldArrayOutputInjectionsSet,
|
|
214
184
|
createRows: rowDataInjectionsSet,
|
|
215
185
|
tableHeight: 300,
|
|
216
|
-
onFormChanged
|
|
217
|
-
onChangeParams
|
|
186
|
+
onFormChanged
|
|
218
187
|
}
|
|
219
188
|
) }),
|
|
220
189
|
/* @__PURE__ */ jsx(TabPanel, { index: SensiBranchesTabValues.SensiInjection, value: subTabValue, children: /* @__PURE__ */ jsx(
|
|
@@ -225,8 +194,7 @@ function SensitivityParametersSelector({
|
|
|
225
194
|
useFieldArrayOutput: useFieldArrayOutputInjections,
|
|
226
195
|
createRows: rowDataInjections,
|
|
227
196
|
tableHeight: 300,
|
|
228
|
-
onFormChanged
|
|
229
|
-
onChangeParams
|
|
197
|
+
onFormChanged
|
|
230
198
|
}
|
|
231
199
|
) }),
|
|
232
200
|
/* @__PURE__ */ jsx(TabPanel, { index: SensiBranchesTabValues.SensiHVDC, value: subTabValue, children: /* @__PURE__ */ jsx(
|
|
@@ -237,8 +205,7 @@ function SensitivityParametersSelector({
|
|
|
237
205
|
useFieldArrayOutput: useFieldArrayOutputHvdc,
|
|
238
206
|
createRows: rowDataHvdc,
|
|
239
207
|
tableHeight: 300,
|
|
240
|
-
onFormChanged
|
|
241
|
-
onChangeParams
|
|
208
|
+
onFormChanged
|
|
242
209
|
}
|
|
243
210
|
) }),
|
|
244
211
|
/* @__PURE__ */ jsx(TabPanel, { index: SensiBranchesTabValues.SensiPST, value: subTabValue, children: /* @__PURE__ */ jsx(
|
|
@@ -249,8 +216,7 @@ function SensitivityParametersSelector({
|
|
|
249
216
|
useFieldArrayOutput: useFieldArrayOutputPst,
|
|
250
217
|
createRows: rowDataPst,
|
|
251
218
|
tableHeight: 300,
|
|
252
|
-
onFormChanged
|
|
253
|
-
onChangeParams
|
|
219
|
+
onFormChanged
|
|
254
220
|
}
|
|
255
221
|
) })
|
|
256
222
|
] }),
|
|
@@ -262,8 +228,7 @@ function SensitivityParametersSelector({
|
|
|
262
228
|
useFieldArrayOutput: useFieldArrayOutputNodes,
|
|
263
229
|
createRows: rowDataNodes,
|
|
264
230
|
tableHeight: 367,
|
|
265
|
-
onFormChanged
|
|
266
|
-
onChangeParams
|
|
231
|
+
onFormChanged
|
|
267
232
|
}
|
|
268
233
|
)
|
|
269
234
|
] }, tab.label))
|
|
@@ -8,8 +8,7 @@ interface SensitivityTableProps {
|
|
|
8
8
|
createRows: (a: number) => void;
|
|
9
9
|
disableAdd?: boolean;
|
|
10
10
|
disableDelete?: boolean;
|
|
11
|
-
onFormChanged: (
|
|
12
|
-
onChangeParams: (a: Record<string, any>, b: string, c: number) => void;
|
|
11
|
+
onFormChanged: () => void;
|
|
13
12
|
}
|
|
14
|
-
export declare function SensitivityTable({ arrayFormName, useFieldArrayOutput, columnsDefinition, tableHeight, createRows, disableAdd, disableDelete, onFormChanged,
|
|
13
|
+
export declare function SensitivityTable({ arrayFormName, useFieldArrayOutput, columnsDefinition, tableHeight, createRows, disableAdd, disableDelete, onFormChanged, }: Readonly<SensitivityTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
15
14
|
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TableContainer, Table, TableHead, TableRow, TableCell, Box, Tooltip, IconButton, TableBody } from "@mui/material";
|
|
3
3
|
import { AddCircle } from "@mui/icons-material";
|
|
4
|
-
import { useCallback } from "react";
|
|
4
|
+
import { useRef, useCallback } from "react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { useFormContext } from "react-hook-form";
|
|
7
7
|
import { TableRowComponent } from "./table-row.js";
|
|
8
|
-
import { ACTIVATED, MONITORED_BRANCHES, INJECTIONS, HVDC_LINES, PSTS, COUNT } from "./constants.js";
|
|
9
8
|
import "@hello-pangea/dnd";
|
|
10
9
|
import { MAX_ROWS_NUMBER } from "../../dnd-table/dnd-table.type.js";
|
|
11
10
|
import "../../overflowableText/OverflowableText.js";
|
|
@@ -31,6 +30,7 @@ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
|
31
30
|
import "uuid";
|
|
32
31
|
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
33
32
|
import "react-querybuilder";
|
|
33
|
+
import { isValidSensiParameterRow } from "./utils.js";
|
|
34
34
|
function SensitivityTable({
|
|
35
35
|
arrayFormName,
|
|
36
36
|
useFieldArrayOutput,
|
|
@@ -39,55 +39,45 @@ function SensitivityTable({
|
|
|
39
39
|
createRows,
|
|
40
40
|
disableAdd,
|
|
41
41
|
disableDelete = false,
|
|
42
|
-
onFormChanged
|
|
43
|
-
onChangeParams
|
|
42
|
+
onFormChanged
|
|
44
43
|
}) {
|
|
45
44
|
const intl = useIntl();
|
|
46
45
|
const { getValues } = useFormContext();
|
|
47
46
|
const { fields: currentRows, append, remove } = useFieldArrayOutput;
|
|
47
|
+
const validRowCountRef = useRef(
|
|
48
|
+
(getValues(arrayFormName) || []).filter((row) => isValidSensiParameterRow(row)).length
|
|
49
|
+
);
|
|
50
|
+
const handleRowChanged = useCallback(
|
|
51
|
+
(index) => {
|
|
52
|
+
const currentRowValues = getValues(arrayFormName);
|
|
53
|
+
const row = currentRowValues[index];
|
|
54
|
+
const currentValidRowCount = currentRowValues.filter(
|
|
55
|
+
(r) => isValidSensiParameterRow(r)
|
|
56
|
+
).length;
|
|
57
|
+
const previousValidRowCount = validRowCountRef.current;
|
|
58
|
+
validRowCountRef.current = currentValidRowCount;
|
|
59
|
+
if (currentValidRowCount !== previousValidRowCount || isValidSensiParameterRow(row)) {
|
|
60
|
+
onFormChanged();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
[getValues, arrayFormName, onFormChanged]
|
|
64
|
+
);
|
|
48
65
|
const handleAddRowsButton = useCallback(() => {
|
|
49
66
|
if (currentRows.length >= MAX_ROWS_NUMBER) {
|
|
50
67
|
return;
|
|
51
68
|
}
|
|
52
69
|
append(createRows(1));
|
|
53
70
|
}, [append, createRows, currentRows.length]);
|
|
54
|
-
const fetchCount = useCallback(
|
|
55
|
-
(providedArrayFormName, index, source) => {
|
|
56
|
-
const row = getValues(providedArrayFormName)[index];
|
|
57
|
-
const isActivated = row[ACTIVATED];
|
|
58
|
-
const hasMonitoredBranches = row[MONITORED_BRANCHES]?.length > 0;
|
|
59
|
-
const hasInjections = row[INJECTIONS]?.length > 0 || row[HVDC_LINES]?.length > 0 || row[PSTS]?.length > 0;
|
|
60
|
-
if (source === "switch" && hasMonitoredBranches && hasInjections) {
|
|
61
|
-
if (isActivated) {
|
|
62
|
-
onChangeParams(row, providedArrayFormName, index);
|
|
63
|
-
} else {
|
|
64
|
-
onFormChanged(true);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (source === "directory" && isActivated) {
|
|
68
|
-
if (hasMonitoredBranches && hasInjections) {
|
|
69
|
-
onChangeParams(row, providedArrayFormName, index);
|
|
70
|
-
} else if ((!hasMonitoredBranches || !hasInjections) && row.count === 0) {
|
|
71
|
-
onFormChanged(false);
|
|
72
|
-
} else if (!hasMonitoredBranches || !hasInjections) {
|
|
73
|
-
onFormChanged(true);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
[onChangeParams, onFormChanged, getValues]
|
|
78
|
-
);
|
|
79
71
|
const handleDeleteButton = useCallback(
|
|
80
72
|
(index) => {
|
|
81
73
|
const currentRowsValues = getValues(arrayFormName);
|
|
82
|
-
let isFormChanged = false;
|
|
83
74
|
if (index >= 0 && index < currentRowsValues.length) {
|
|
84
|
-
|
|
85
|
-
isFormChanged = true;
|
|
86
|
-
}
|
|
75
|
+
const wasValid = isValidSensiParameterRow(currentRowsValues[index]);
|
|
87
76
|
remove(index);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
if (wasValid) {
|
|
78
|
+
validRowCountRef.current -= 1;
|
|
79
|
+
onFormChanged();
|
|
80
|
+
}
|
|
91
81
|
}
|
|
92
82
|
},
|
|
93
83
|
[arrayFormName, getValues, onFormChanged, remove]
|
|
@@ -120,7 +110,7 @@ function SensitivityTable({
|
|
|
120
110
|
index,
|
|
121
111
|
handleDeleteButton,
|
|
122
112
|
disableDelete,
|
|
123
|
-
|
|
113
|
+
handleRowChanged
|
|
124
114
|
},
|
|
125
115
|
row.id
|
|
126
116
|
)) })
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
-
declare function EditableTableCell(arrayFormName: string, rowIndex: number, column: any, onRowChanged: (
|
|
7
|
+
declare function EditableTableCell(arrayFormName: string, rowIndex: number, column: any, onRowChanged: () => void): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default EditableTableCell;
|
|
@@ -32,12 +32,6 @@ import "uuid";
|
|
|
32
32
|
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
33
33
|
import "react-querybuilder";
|
|
34
34
|
function EditableTableCell(arrayFormName, rowIndex, column, onRowChanged) {
|
|
35
|
-
const handleDirectoryItemsChange = () => {
|
|
36
|
-
onRowChanged(true, "directory");
|
|
37
|
-
};
|
|
38
|
-
const handleSwitchInputChange = () => {
|
|
39
|
-
onRowChanged(true, "switch");
|
|
40
|
-
};
|
|
41
35
|
return /* @__PURE__ */ jsxs(
|
|
42
36
|
TableCell,
|
|
43
37
|
{
|
|
@@ -55,7 +49,7 @@ function EditableTableCell(arrayFormName, rowIndex, column, onRowChanged) {
|
|
|
55
49
|
hideErrorMessage: true,
|
|
56
50
|
label: void 0,
|
|
57
51
|
itemFilter: void 0,
|
|
58
|
-
onRowChanged
|
|
52
|
+
onRowChanged
|
|
59
53
|
}
|
|
60
54
|
),
|
|
61
55
|
column.menuItems && /* @__PURE__ */ jsx(
|
|
@@ -67,7 +61,7 @@ function EditableTableCell(arrayFormName, rowIndex, column, onRowChanged) {
|
|
|
67
61
|
fullWidth: true
|
|
68
62
|
}
|
|
69
63
|
),
|
|
70
|
-
column.checkboxItems && /* @__PURE__ */ jsx("span", { onChange:
|
|
64
|
+
column.checkboxItems && /* @__PURE__ */ jsx("span", { onChange: onRowChanged, children: /* @__PURE__ */ jsx(SwitchInput, { name: `${arrayFormName}[${rowIndex}].${column.dataKey}` }) }),
|
|
71
65
|
column.floatItems && /* @__PURE__ */ jsx(FloatInput, { name: `${arrayFormName}[${rowIndex}].${column.dataKey}` }),
|
|
72
66
|
column.textItems && /* @__PURE__ */ jsx(
|
|
73
67
|
TextInput,
|
|
@@ -5,7 +5,7 @@ interface TableRowComponentProps {
|
|
|
5
5
|
index: number;
|
|
6
6
|
handleDeleteButton: (index: number) => void;
|
|
7
7
|
disableDelete: boolean;
|
|
8
|
-
|
|
8
|
+
handleRowChanged: (a: number) => void;
|
|
9
9
|
}
|
|
10
|
-
export declare function TableRowComponent({ arrayFormName, columnsDefinition, index, handleDeleteButton, disableDelete,
|
|
10
|
+
export declare function TableRowComponent({ arrayFormName, columnsDefinition, index, handleDeleteButton, disableDelete, handleRowChanged, }: Readonly<TableRowComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -10,21 +10,19 @@ function TableRowComponent({
|
|
|
10
10
|
index,
|
|
11
11
|
handleDeleteButton,
|
|
12
12
|
disableDelete = false,
|
|
13
|
-
|
|
13
|
+
handleRowChanged
|
|
14
14
|
}) {
|
|
15
15
|
const [isHover, setIsHover] = useState(false);
|
|
16
16
|
const intl = useIntl();
|
|
17
17
|
function handleHover(enter) {
|
|
18
18
|
return setIsHover(enter);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
fetchCount(arrayFormName, index, source);
|
|
23
|
-
}
|
|
20
|
+
const handleCellChanged = () => {
|
|
21
|
+
handleRowChanged(index);
|
|
24
22
|
};
|
|
25
23
|
return /* @__PURE__ */ jsxs(TableRow, { onMouseEnter: () => handleHover(true), onMouseLeave: () => handleHover(false), children: [
|
|
26
24
|
columnsDefinition.map(
|
|
27
|
-
(column) => EditableTableCell(arrayFormName, index, column,
|
|
25
|
+
(column) => EditableTableCell(arrayFormName, index, column, handleCellChanged)
|
|
28
26
|
),
|
|
29
27
|
!disableDelete && /* @__PURE__ */ jsx(TableCell, { sx: { width: "5rem", textAlign: "center" }, children: isHover && /* @__PURE__ */ jsx(
|
|
30
28
|
Tooltip,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { ObjectSchema } from 'yup';
|
|
3
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
4
3
|
import { UUID } from 'node:crypto';
|
|
5
4
|
import { ComputingType } from '../common';
|
|
6
|
-
import { SensitivityAnalysisParametersInfos, UseParametersBackendReturnProps } from '../../../utils';
|
|
7
|
-
type SubTabsValues = 'sensitivityInjectionsSet' | 'sensitivityInjection' | 'sensitivityHVDC' | 'sensitivityPST';
|
|
5
|
+
import { FactorsCount, SensitivityAnalysisParametersInfos, UseParametersBackendReturnProps } from '../../../utils';
|
|
8
6
|
export interface UseSensitivityAnalysisParametersReturn {
|
|
9
7
|
formMethods: UseFormReturn<any>;
|
|
10
8
|
formSchema: ObjectSchema<any>;
|
|
@@ -19,14 +17,13 @@ export interface UseSensitivityAnalysisParametersReturn {
|
|
|
19
17
|
isStudyLinked: boolean;
|
|
20
18
|
onSaveInline: (formData: Record<string, any>) => void;
|
|
21
19
|
onSaveDialog: (formData: Record<string, any>) => void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onFormChanged: (
|
|
26
|
-
onChangeParams: (row: any, arrayFormName: SubTabsValues, index: number) => void;
|
|
20
|
+
isMaxResultsReached: boolean;
|
|
21
|
+
isMaxVariablesReached: boolean;
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
onFormChanged: () => void;
|
|
27
24
|
emptyFormData: Record<string, unknown>;
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
factorsCount: FactorsCount;
|
|
26
|
+
resetFactorsCount: () => void;
|
|
30
27
|
}
|
|
31
28
|
type UseSensitivityAnalysisParametersFormProps = {
|
|
32
29
|
name: string;
|