@gridsuite/commons-ui 0.170.0 → 0.171.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/inputs/reactHookForm/selectInputs/CountriesInput.js +13 -10
- package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +5 -5
- package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +8 -15
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +2 -2
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +2 -4
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.d.ts +2 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +33 -43
- package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +7 -9
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +1 -1
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -3
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +1 -3
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +10 -11
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-dialog.js +6 -7
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +6 -14
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.d.ts +0 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +6 -6
- package/dist/hooks/use-parameters-backend.d.ts +2 -3
- package/dist/hooks/use-parameters-backend.js +33 -110
- package/dist/index.js +2 -5
- package/dist/services/index.js +2 -5
- package/dist/services/loadflow.d.ts +0 -1
- package/dist/services/loadflow.js +1 -8
- package/dist/services/security-analysis.d.ts +0 -2
- package/dist/services/security-analysis.js +2 -23
- package/dist/services/sensitivity-analysis.d.ts +0 -1
- package/dist/services/sensitivity-analysis.js +1 -8
- package/dist/translations/en/parameters.d.ts +0 -7
- package/dist/translations/en/parameters.js +0 -7
- package/dist/translations/fr/parameters.d.ts +0 -8
- package/dist/translations/fr/parameters.js +0 -8
- package/dist/utils/types/parameters.type.d.ts +16 -13
- package/package.json +1 -1
|
@@ -26,16 +26,19 @@ function CountriesInput({ name, label, dataTestId }) {
|
|
|
26
26
|
getOptionLabel: translateOption,
|
|
27
27
|
fullWidth: true,
|
|
28
28
|
multiple: true,
|
|
29
|
-
renderTags: (val, getTagsProps) => val.map((code, index) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
renderTags: (val, getTagsProps) => val.map((code, index) => {
|
|
30
|
+
const { key, ...tagProps } = getTagsProps({ index });
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Chip,
|
|
33
|
+
{
|
|
34
|
+
"data-testid": `${dataTestId}.${code}`,
|
|
35
|
+
size: "small",
|
|
36
|
+
label: translate(code),
|
|
37
|
+
...tagProps
|
|
38
|
+
},
|
|
39
|
+
key ?? code
|
|
40
|
+
);
|
|
41
|
+
})
|
|
39
42
|
}
|
|
40
43
|
);
|
|
41
44
|
}
|
package/dist/components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js
CHANGED
|
@@ -50,7 +50,7 @@ function DynamicMarginCalculationInline({
|
|
|
50
50
|
parametersBackend,
|
|
51
51
|
setHaveDirtyFields
|
|
52
52
|
}) {
|
|
53
|
-
const
|
|
53
|
+
const { providers, params, updateParameters, resetParameters } = parametersBackend;
|
|
54
54
|
const dynamicMarginCalculationMethods = useDynamicMarginCalculationParametersForm({
|
|
55
55
|
providers,
|
|
56
56
|
params,
|
|
@@ -71,14 +71,14 @@ function DynamicMarginCalculationInline({
|
|
|
71
71
|
setOpenResetConfirmation(false);
|
|
72
72
|
}, []);
|
|
73
73
|
const handleReset = useCallback(() => {
|
|
74
|
-
|
|
74
|
+
resetParameters();
|
|
75
75
|
setOpenResetConfirmation(false);
|
|
76
|
-
}, [
|
|
76
|
+
}, [resetParameters]);
|
|
77
77
|
const onSubmit = useCallback(
|
|
78
78
|
(formData) => {
|
|
79
|
-
|
|
79
|
+
updateParameters(toParamsInfos(formData));
|
|
80
80
|
},
|
|
81
|
-
[
|
|
81
|
+
[updateParameters]
|
|
82
82
|
);
|
|
83
83
|
const handleLoadParameter = useCallback(
|
|
84
84
|
(newParams) => {
|
|
@@ -8,7 +8,7 @@ import "../../../utils/types/equipmentType.js";
|
|
|
8
8
|
import { LANG_ENGLISH } from "../../../utils/langs.js";
|
|
9
9
|
import "@mui/icons-material";
|
|
10
10
|
import "../../../utils/yupConfig.js";
|
|
11
|
-
import { getLoadFlowDefaultLimitReductions,
|
|
11
|
+
import { getLoadFlowDefaultLimitReductions, getLoadFlowProviders, fetchLoadFlowParameters, setLoadFlowParameters, getLoadFlowSpecificParametersDescription } from "../../../services/loadflow.js";
|
|
12
12
|
import "react";
|
|
13
13
|
import "@mui/material";
|
|
14
14
|
import "react-intl";
|
|
@@ -57,20 +57,13 @@ function LoadFlowParametersEditionDialog({
|
|
|
57
57
|
language = LANG_ENGLISH,
|
|
58
58
|
isDeveloperMode = false
|
|
59
59
|
}) {
|
|
60
|
-
const parametersBackend = useParametersBackend(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
getDefaultLoadFlowProvider,
|
|
68
|
-
null,
|
|
69
|
-
fetchLoadFlowParameters,
|
|
70
|
-
setLoadFlowParameters,
|
|
71
|
-
getLoadFlowSpecificParametersDescription,
|
|
72
|
-
getLoadFlowDefaultLimitReductions
|
|
73
|
-
);
|
|
60
|
+
const parametersBackend = useParametersBackend(user, id, ComputingType.LOAD_FLOW, OptionalServicesStatus.Up, {
|
|
61
|
+
backendFetchProviders: getLoadFlowProviders,
|
|
62
|
+
backendFetchParameters: fetchLoadFlowParameters,
|
|
63
|
+
backendUpdateParameters: setLoadFlowParameters,
|
|
64
|
+
backendFetchSpecificParametersDescription: getLoadFlowSpecificParametersDescription,
|
|
65
|
+
backendFetchDefaultLimitReductions: getLoadFlowDefaultLimitReductions
|
|
66
|
+
});
|
|
74
67
|
const loadflowMethods = useLoadFlowParametersForm(parametersBackend, isDeveloperMode, id, name, description);
|
|
75
68
|
const {
|
|
76
69
|
formState: { errors, dirtyFields }
|
|
@@ -74,7 +74,7 @@ function LoadFlowParametersForm({
|
|
|
74
74
|
formattedProviders,
|
|
75
75
|
specificParametersDescriptionForProvider,
|
|
76
76
|
params,
|
|
77
|
-
|
|
77
|
+
watchProvider,
|
|
78
78
|
defaultLimitReductions,
|
|
79
79
|
paramsLoaded
|
|
80
80
|
} = loadflowMethods;
|
|
@@ -94,7 +94,7 @@ function LoadFlowParametersForm({
|
|
|
94
94
|
LoadFlowParametersContent,
|
|
95
95
|
{
|
|
96
96
|
selectedTab,
|
|
97
|
-
currentProvider:
|
|
97
|
+
currentProvider: watchProvider ?? "",
|
|
98
98
|
specificParameters: specificParametersDescriptionForProvider,
|
|
99
99
|
params,
|
|
100
100
|
defaultLimitReductions
|
|
@@ -55,7 +55,7 @@ function LoadFlowParametersInline({
|
|
|
55
55
|
setHaveDirtyFields,
|
|
56
56
|
isDeveloperMode
|
|
57
57
|
}) {
|
|
58
|
-
const
|
|
58
|
+
const { resetParameters } = parametersBackend;
|
|
59
59
|
const loadflowMethods = useLoadFlowParametersForm(parametersBackend, isDeveloperMode, null, null, null);
|
|
60
60
|
const intl = useIntl();
|
|
61
61
|
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
@@ -64,9 +64,8 @@ function LoadFlowParametersInline({
|
|
|
64
64
|
const { snackError } = useSnackMessage();
|
|
65
65
|
const executeResetAction = useCallback(() => {
|
|
66
66
|
resetParameters();
|
|
67
|
-
resetProvider();
|
|
68
67
|
setOpenResetConfirmation(false);
|
|
69
|
-
}, [resetParameters
|
|
68
|
+
}, [resetParameters]);
|
|
70
69
|
const handleResetAllClick = useCallback(() => {
|
|
71
70
|
setOpenResetConfirmation(true);
|
|
72
71
|
}, []);
|
|
@@ -79,7 +78,6 @@ function LoadFlowParametersInline({
|
|
|
79
78
|
if (newParams && newParams.length > 0) {
|
|
80
79
|
setOpenSelectParameterDialog(false);
|
|
81
80
|
fetchLoadFlowParameters(newParams[0].id).then((parameters) => {
|
|
82
|
-
loadflowMethods.setCurrentProvider(parameters.provider);
|
|
83
81
|
console.info(`loading the following loadflow parameters : ${parameters.uuid}`);
|
|
84
82
|
reset(loadflowMethods.toLoadFlowFormValues(parameters), {
|
|
85
83
|
keepDefaultValues: true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
2
|
-
import {
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
3
|
import { ObjectSchema } from 'yup';
|
|
4
4
|
import { UUID } from 'node:crypto';
|
|
5
5
|
import { TabValues } from './load-flow-parameters-utils';
|
|
@@ -22,8 +22,7 @@ export interface UseLoadFlowParametersFormReturn {
|
|
|
22
22
|
toLoadFlowFormValues: (_params: LoadFlowParametersInfos) => any;
|
|
23
23
|
formatNewParams: (formData: Record<string, any>) => LoadFlowParametersInfos;
|
|
24
24
|
params: LoadFlowParametersInfos | null;
|
|
25
|
-
|
|
26
|
-
setCurrentProvider: Dispatch<SetStateAction<string | undefined>>;
|
|
25
|
+
watchProvider: string | undefined;
|
|
27
26
|
paramsLoaded: boolean;
|
|
28
27
|
onValidationError: (errors: FieldErrors) => void;
|
|
29
28
|
onSaveInline: (formData: Record<string, any>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useForm } from "react-hook-form";
|
|
2
2
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
|
-
import { useState, useCallback, useMemo,
|
|
3
|
+
import { useState, useRef, useCallback, useMemo, useEffect, useEffectEvent } from "react";
|
|
4
4
|
import { TabValues, getCommonLoadFlowParametersFormSchema, mapLimitReductions, setLimitReductions } from "./load-flow-parameters-utils.js";
|
|
5
5
|
import { PROVIDER, SPECIFIC_PARAMETERS, COMMON_PARAMETERS, VERSION_PARAMETER } from "../common/constants.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
@@ -47,30 +47,18 @@ import "../../filter/HeaderFilterForm.js";
|
|
|
47
47
|
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
48
48
|
import { getDefaultSpecificParamsValues, getSpecificParametersFormSchema, getAllSpecificParametersValues, formatSpecificParameters, setSpecificParameters } from "../common/utils.js";
|
|
49
49
|
const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parametersUuid, name, description) => {
|
|
50
|
-
const
|
|
51
|
-
providers,
|
|
52
|
-
provider,
|
|
53
|
-
,
|
|
54
|
-
,
|
|
55
|
-
,
|
|
56
|
-
params,
|
|
57
|
-
,
|
|
58
|
-
updateParameters,
|
|
59
|
-
,
|
|
60
|
-
specificParamsDescriptions,
|
|
61
|
-
defaultLimitReductions
|
|
62
|
-
] = parametersBackend;
|
|
63
|
-
const [currentProvider, setCurrentProvider] = useState(params?.provider);
|
|
50
|
+
const { providers, params, updateParameters, specificParamsDescription, defaultLimitReductions } = parametersBackend;
|
|
64
51
|
const [selectedTab, setSelectedTab] = useState(TabValues.GENERAL);
|
|
65
52
|
const [limitReductionNumber, setLimitReductionNumber] = useState(0);
|
|
66
53
|
const [tabIndexesWithError, setTabIndexesWithError] = useState([]);
|
|
54
|
+
const [specificParametersDescriptionForProvider, setSpecificParametersDescriptionForProvider] = useState(() => {
|
|
55
|
+
return params?.provider && specificParamsDescription ? specificParamsDescription[params.provider] : [];
|
|
56
|
+
});
|
|
67
57
|
const { snackError } = useSnackMessage();
|
|
58
|
+
const previousWatchProviderRef = useRef(void 0);
|
|
68
59
|
const handleTabChange = useCallback((event, newValue) => {
|
|
69
60
|
setSelectedTab(newValue);
|
|
70
61
|
}, []);
|
|
71
|
-
const specificParametersDescriptionForProvider = useMemo(() => {
|
|
72
|
-
return currentProvider && specificParamsDescriptions ? specificParamsDescriptions[currentProvider] : [];
|
|
73
|
-
}, [currentProvider, specificParamsDescriptions]);
|
|
74
62
|
const specificParametersDefaultValues = useMemo(() => {
|
|
75
63
|
return getDefaultSpecificParamsValues(specificParametersDescriptionForProvider);
|
|
76
64
|
}, [specificParametersDescriptionForProvider]);
|
|
@@ -86,7 +74,7 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
86
74
|
const formMethods = useForm({
|
|
87
75
|
defaultValues: {
|
|
88
76
|
...getNameElementEditorEmptyFormData(name, description),
|
|
89
|
-
[PROVIDER]: provider,
|
|
77
|
+
[PROVIDER]: params?.provider,
|
|
90
78
|
[PARAM_LIMIT_REDUCTION]: null,
|
|
91
79
|
[COMMON_PARAMETERS]: {
|
|
92
80
|
...params?.commonParameters
|
|
@@ -100,6 +88,14 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
100
88
|
});
|
|
101
89
|
const { watch, reset } = formMethods;
|
|
102
90
|
const watchProvider = watch(PROVIDER);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const provider = watchProvider ?? params?.provider;
|
|
93
|
+
if (!provider || !specificParamsDescription) {
|
|
94
|
+
setSpecificParametersDescriptionForProvider([]);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setSpecificParametersDescriptionForProvider(specificParamsDescription[provider] ?? []);
|
|
98
|
+
}, [watchProvider, params?.provider, specificParamsDescription]);
|
|
103
99
|
const toLimitReductions = useCallback(
|
|
104
100
|
(formLimits) => {
|
|
105
101
|
if (formLimits?.length === 0) {
|
|
@@ -143,6 +139,7 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
143
139
|
const toLoadFlowFormValues = useCallback(
|
|
144
140
|
(_params) => {
|
|
145
141
|
const specificParamsListForCurrentProvider = _params.specificParametersPerProvider[_params.provider];
|
|
142
|
+
const specificParametersForLoadedProvider = specificParamsDescription?.[_params.provider] ?? [];
|
|
146
143
|
return {
|
|
147
144
|
[PROVIDER]: _params.provider,
|
|
148
145
|
[PARAM_LIMIT_REDUCTION]: _params.limitReduction,
|
|
@@ -151,16 +148,16 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
151
148
|
},
|
|
152
149
|
[SPECIFIC_PARAMETERS]: {
|
|
153
150
|
...formatSpecificParameters(
|
|
154
|
-
|
|
151
|
+
specificParametersForLoadedProvider,
|
|
155
152
|
specificParamsListForCurrentProvider
|
|
156
153
|
)
|
|
157
154
|
},
|
|
158
155
|
...toFormValuesLimitReductions(_params.limitReductions)
|
|
159
156
|
};
|
|
160
157
|
},
|
|
161
|
-
[
|
|
158
|
+
[specificParamsDescription]
|
|
162
159
|
);
|
|
163
|
-
const paramsLoaded = useMemo(() => !!params && !!
|
|
160
|
+
const paramsLoaded = useMemo(() => !!params && !!watchProvider, [watchProvider, params]);
|
|
164
161
|
const formattedProviders = useMemo(() => {
|
|
165
162
|
return Object.entries(providers).filter(([key]) => !key.includes("DynaFlow") || isDeveloperMode).map(([key, value]) => ({
|
|
166
163
|
id: key,
|
|
@@ -214,28 +211,22 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
214
211
|
resetForm(params);
|
|
215
212
|
}, [paramsLoaded, params]);
|
|
216
213
|
useEffect(() => {
|
|
217
|
-
if (watchProvider
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
setLimitReductionNumber(params?.limitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
226
|
-
}
|
|
214
|
+
if (!watchProvider || watchProvider === previousWatchProviderRef.current) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
setSpecificParameters(watchProvider, specificParamsDescription, formMethods);
|
|
218
|
+
setLimitReductions(watchProvider, defaultLimitReductions, formMethods);
|
|
219
|
+
if (watchProvider === PARAM_PROVIDER_OPENLOADFLOW) {
|
|
220
|
+
if (previousWatchProviderRef.current) {
|
|
221
|
+
setLimitReductionNumber(defaultLimitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
227
222
|
} else {
|
|
228
|
-
setLimitReductionNumber(0);
|
|
223
|
+
setLimitReductionNumber(params?.limitReductions?.at(0)?.temporaryLimitReductions?.length ?? 0);
|
|
229
224
|
}
|
|
225
|
+
} else {
|
|
226
|
+
setLimitReductionNumber(0);
|
|
230
227
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
defaultLimitReductions,
|
|
234
|
-
formMethods,
|
|
235
|
-
params?.limitReductions,
|
|
236
|
-
specificParamsDescriptions,
|
|
237
|
-
watchProvider
|
|
238
|
-
]);
|
|
228
|
+
previousWatchProviderRef.current = watchProvider;
|
|
229
|
+
}, [defaultLimitReductions, formMethods, params?.limitReductions, specificParamsDescription, watchProvider]);
|
|
239
230
|
return {
|
|
240
231
|
formMethods,
|
|
241
232
|
formSchema,
|
|
@@ -248,8 +239,7 @@ const useLoadFlowParametersForm = (parametersBackend, isDeveloperMode, parameter
|
|
|
248
239
|
toLoadFlowFormValues,
|
|
249
240
|
formatNewParams,
|
|
250
241
|
params,
|
|
251
|
-
|
|
252
|
-
setCurrentProvider,
|
|
242
|
+
watchProvider,
|
|
253
243
|
paramsLoaded,
|
|
254
244
|
onValidationError,
|
|
255
245
|
onSaveInline,
|
|
@@ -6,7 +6,7 @@ import { ElementType } from "../../../utils/types/elementType.js";
|
|
|
6
6
|
import "../../../utils/types/equipmentType.js";
|
|
7
7
|
import "@mui/icons-material";
|
|
8
8
|
import "../../../utils/yupConfig.js";
|
|
9
|
-
import { getSecurityAnalysisDefaultLimitReductions,
|
|
9
|
+
import { getSecurityAnalysisDefaultLimitReductions, fetchSecurityAnalysisProviders, fetchSecurityAnalysisParameters, updateSecurityAnalysisParameters } from "../../../services/security-analysis.js";
|
|
10
10
|
import "@mui/material";
|
|
11
11
|
import "localized-countries";
|
|
12
12
|
import "localized-countries/data/fr";
|
|
@@ -60,14 +60,12 @@ function SecurityAnalysisParametersDialog({
|
|
|
60
60
|
id,
|
|
61
61
|
ComputingType.SECURITY_ANALYSIS,
|
|
62
62
|
OptionalServicesStatus.Up,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
void 0,
|
|
70
|
-
getSecurityAnalysisDefaultLimitReductions
|
|
63
|
+
{
|
|
64
|
+
backendFetchProviders: fetchSecurityAnalysisProviders,
|
|
65
|
+
backendFetchParameters: fetchSecurityAnalysisParameters,
|
|
66
|
+
backendUpdateParameters: updateSecurityAnalysisParameters,
|
|
67
|
+
backendFetchDefaultLimitReductions: getSecurityAnalysisDefaultLimitReductions
|
|
68
|
+
}
|
|
71
69
|
);
|
|
72
70
|
const securityAnalysisMethods = useSecurityAnalysisParametersForm(parametersBackend, id, name, description);
|
|
73
71
|
const {
|
|
@@ -134,7 +134,7 @@ function SecurityAnalysisParametersForm({
|
|
|
134
134
|
SecurityAnalysisParametersSelector,
|
|
135
135
|
{
|
|
136
136
|
params: securityAnalysisMethods.params,
|
|
137
|
-
currentProvider: securityAnalysisMethods.
|
|
137
|
+
currentProvider: securityAnalysisMethods.watchProvider?.trim(),
|
|
138
138
|
isDeveloperMode,
|
|
139
139
|
defaultLimitReductions: securityAnalysisMethods.defaultLimitReductions
|
|
140
140
|
}
|
|
@@ -56,7 +56,7 @@ function SecurityAnalysisParametersInline({
|
|
|
56
56
|
isDeveloperMode
|
|
57
57
|
}) {
|
|
58
58
|
const securityAnalysisMethods = useSecurityAnalysisParametersForm(parametersBackend, null, null, null);
|
|
59
|
-
const
|
|
59
|
+
const { resetParameters } = parametersBackend;
|
|
60
60
|
const intl = useIntl();
|
|
61
61
|
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
62
62
|
const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
|
|
@@ -65,9 +65,8 @@ function SecurityAnalysisParametersInline({
|
|
|
65
65
|
const { handleSubmit, formState, reset, getValues } = securityAnalysisMethods.formMethods;
|
|
66
66
|
const executeResetAction = useCallback(() => {
|
|
67
67
|
resetParameters();
|
|
68
|
-
resetProvider();
|
|
69
68
|
setOpenResetConfirmation(false);
|
|
70
|
-
}, [resetParameters
|
|
69
|
+
}, [resetParameters]);
|
|
71
70
|
const handleResetAllClick = useCallback(() => {
|
|
72
71
|
setOpenResetConfirmation(true);
|
|
73
72
|
}, []);
|
package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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 { UseParametersBackendReturnProps } from '../../../utils';
|
|
6
5
|
import { ComputingType, ILimitReductionsByVoltageLevel } from '../common';
|
|
@@ -16,8 +15,7 @@ export interface UseSecurityAnalysisParametersFormReturn {
|
|
|
16
15
|
toFormValueSaParameters: (_params: SAParameters) => any;
|
|
17
16
|
formatNewParams: (formData: Record<string, any>) => SAParameters;
|
|
18
17
|
params: SAParameters | null;
|
|
19
|
-
|
|
20
|
-
setCurrentProvider: Dispatch<SetStateAction<string | undefined>>;
|
|
18
|
+
watchProvider: string | undefined;
|
|
21
19
|
paramsLoaded: boolean;
|
|
22
20
|
onSaveInline: (formData: Record<string, any>) => void;
|
|
23
21
|
onSaveDialog: (formData: Record<string, any>) => void;
|
package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useForm } from "react-hook-form";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useMemo, useCallback, useEffect } from "react";
|
|
3
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
4
|
import "../../../utils/conversionUtils.js";
|
|
5
5
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
@@ -45,8 +45,8 @@ import { getNameElementEditorEmptyFormData } from "../common/name-element-editor
|
|
|
45
45
|
import { getSAParametersFormSchema, toFormValueSaParameters } from "./columns-definitions.js";
|
|
46
46
|
import { ACTIVATED, DESCRIPTION, NAME, ID } from "../common/parameter-table/constants.js";
|
|
47
47
|
const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, name, description) => {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
48
|
+
const { providers, params, updateParameters, defaultLimitReductions } = parametersBackend;
|
|
49
|
+
const previousWatchProviderRef = useRef(void 0);
|
|
50
50
|
const { snackError } = useSnackMessage();
|
|
51
51
|
const formattedProviders = useMemo(() => {
|
|
52
52
|
return Object.entries(providers).filter(([key]) => !key.includes("DynaFlow")).map(([key, value]) => ({
|
|
@@ -54,14 +54,13 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
54
54
|
label: value
|
|
55
55
|
}));
|
|
56
56
|
}, [providers]);
|
|
57
|
-
const paramsLoaded = useMemo(() => !!params && !!currentProvider, [currentProvider, params]);
|
|
58
57
|
const formSchema = useMemo(() => {
|
|
59
58
|
return getSAParametersFormSchema(name, params?.limitReductions);
|
|
60
59
|
}, [name, params?.limitReductions]);
|
|
61
60
|
const formMethods = useForm({
|
|
62
61
|
defaultValues: {
|
|
63
62
|
...getNameElementEditorEmptyFormData(name, description),
|
|
64
|
-
[PARAM_SA_PROVIDER]: provider,
|
|
63
|
+
[PARAM_SA_PROVIDER]: params?.provider,
|
|
65
64
|
[CONTINGENCY_LISTS_INFOS]: [],
|
|
66
65
|
[LIMIT_REDUCTIONS_FORM]: [],
|
|
67
66
|
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: null,
|
|
@@ -74,6 +73,7 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
74
73
|
});
|
|
75
74
|
const { reset, watch } = formMethods;
|
|
76
75
|
const watchProvider = watch(PARAM_SA_PROVIDER);
|
|
76
|
+
const paramsLoaded = useMemo(() => !!params && !!watchProvider, [watchProvider, params]);
|
|
77
77
|
const toContingencyListsInfos = useCallback(
|
|
78
78
|
(formContingencyListsInfos) => {
|
|
79
79
|
if (!formContingencyListsInfos) {
|
|
@@ -149,9 +149,8 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
149
149
|
[parametersUuid, formatNewParams, snackError]
|
|
150
150
|
);
|
|
151
151
|
useEffect(() => {
|
|
152
|
-
if (watchProvider !==
|
|
153
|
-
|
|
154
|
-
if (watchProvider !== void 0 && currentProvider !== void 0) {
|
|
152
|
+
if (watchProvider !== void 0 && watchProvider !== previousWatchProviderRef.current) {
|
|
153
|
+
if (previousWatchProviderRef.current !== void 0) {
|
|
155
154
|
if (params !== null) {
|
|
156
155
|
params.limitReductions = defaultLimitReductions;
|
|
157
156
|
}
|
|
@@ -160,8 +159,9 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
160
159
|
toFormValuesLimitReductions(defaultLimitReductions)[LIMIT_REDUCTIONS_FORM]
|
|
161
160
|
);
|
|
162
161
|
}
|
|
162
|
+
previousWatchProviderRef.current = watchProvider;
|
|
163
163
|
}
|
|
164
|
-
}, [watchProvider,
|
|
164
|
+
}, [watchProvider, formMethods, defaultLimitReductions, params]);
|
|
165
165
|
useEffect(() => {
|
|
166
166
|
if (!params) {
|
|
167
167
|
return;
|
|
@@ -176,8 +176,7 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
176
176
|
toFormValueSaParameters,
|
|
177
177
|
formatNewParams,
|
|
178
178
|
params,
|
|
179
|
-
|
|
180
|
-
setCurrentProvider,
|
|
179
|
+
watchProvider,
|
|
181
180
|
paramsLoaded,
|
|
182
181
|
onSaveInline,
|
|
183
182
|
onSaveDialog
|
|
@@ -39,7 +39,7 @@ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
|
39
39
|
import "react-querybuilder";
|
|
40
40
|
import "../common/widget/parameter-line-slider.js";
|
|
41
41
|
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
-
import {
|
|
42
|
+
import { fetchSensitivityAnalysisProviders, fetchSensitivityAnalysisParameters, updateSensitivityAnalysisParameters } from "../../../services/sensitivity-analysis.js";
|
|
43
43
|
import { NameElementEditorForm } from "../common/name-element-editor/name-element-editor-form.js";
|
|
44
44
|
import { useSensitivityAnalysisParametersForm } from "./use-sensitivity-analysis-parameters.js";
|
|
45
45
|
import { SensitivityAnalysisParametersForm } from "./sensitivity-analysis-parameters-form.js";
|
|
@@ -60,12 +60,11 @@ function SensitivityAnalysisParametersDialog({
|
|
|
60
60
|
id,
|
|
61
61
|
ComputingType.SENSITIVITY_ANALYSIS,
|
|
62
62
|
OptionalServicesStatus.Up,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
updateSensitivityAnalysisParameters
|
|
63
|
+
{
|
|
64
|
+
backendFetchProviders: fetchSensitivityAnalysisProviders,
|
|
65
|
+
backendFetchParameters: fetchSensitivityAnalysisParameters,
|
|
66
|
+
backendUpdateParameters: updateSensitivityAnalysisParameters
|
|
67
|
+
}
|
|
69
68
|
);
|
|
70
69
|
const sensitivityAnalysisMethods = useSensitivityAnalysisParametersForm({
|
|
71
70
|
studyUuid: null,
|
|
@@ -56,7 +56,7 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
56
56
|
name,
|
|
57
57
|
description
|
|
58
58
|
}) => {
|
|
59
|
-
const
|
|
59
|
+
const { providers, params, updateParameters } = parametersBackend;
|
|
60
60
|
const [sensitivityAnalysisParams, setSensitivityAnalysisParams] = useState(params);
|
|
61
61
|
const { snackError } = useSnackMessage();
|
|
62
62
|
const [factorsCount, setFactorsCount] = useState(DEFAULT_FACTOR_COUNT);
|
|
@@ -7,7 +7,7 @@ import { ElementType } from "../../../utils/types/elementType.js";
|
|
|
7
7
|
import "../../../utils/types/equipmentType.js";
|
|
8
8
|
import "@mui/icons-material";
|
|
9
9
|
import "../../../utils/yupConfig.js";
|
|
10
|
-
import {
|
|
10
|
+
import { fetchShortCircuitParameters, updateShortCircuitParameters, getShortCircuitSpecificParametersDescription } from "../../../services/short-circuit-analysis.js";
|
|
11
11
|
import "react";
|
|
12
12
|
import "@mui/material";
|
|
13
13
|
import "react-intl";
|
|
@@ -55,19 +55,11 @@ function ShortCircuitParametersEditionDialog({
|
|
|
55
55
|
language,
|
|
56
56
|
isDeveloperMode
|
|
57
57
|
}) {
|
|
58
|
-
const parametersBackend = useParametersBackend(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
null,
|
|
64
|
-
null,
|
|
65
|
-
null,
|
|
66
|
-
null,
|
|
67
|
-
fetchShortCircuitParameters,
|
|
68
|
-
updateShortCircuitParameters,
|
|
69
|
-
getShortCircuitSpecificParametersDescription
|
|
70
|
-
);
|
|
58
|
+
const parametersBackend = useParametersBackend(user, id, ComputingType.SHORT_CIRCUIT, OptionalServicesStatus.Up, {
|
|
59
|
+
backendFetchParameters: fetchShortCircuitParameters,
|
|
60
|
+
backendUpdateParameters: updateShortCircuitParameters,
|
|
61
|
+
backendFetchSpecificParametersDescription: getShortCircuitSpecificParametersDescription
|
|
62
|
+
});
|
|
71
63
|
const shortCircuitMethods = useShortCircuitParametersForm({
|
|
72
64
|
parametersBackend,
|
|
73
65
|
parametersUuid: id,
|
|
@@ -59,7 +59,7 @@ function ShortCircuitParametersInLine({
|
|
|
59
59
|
const intl = useIntl();
|
|
60
60
|
const [openCreateParameterDialog, setOpenCreateParameterDialog] = useState(false);
|
|
61
61
|
const [openSelectParameterDialog, setOpenSelectParameterDialog] = useState(false);
|
|
62
|
-
const
|
|
62
|
+
const { resetParameters } = parametersBackend;
|
|
63
63
|
const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
|
|
64
64
|
const [pendingResetAction, setPendingResetAction] = useState(null);
|
|
65
65
|
const { snackError } = useSnackMessage();
|
|
@@ -13,7 +13,6 @@ export interface UseShortCircuitParametersFormReturn {
|
|
|
13
13
|
toShortCircuitFormValues: (_params: ShortCircuitParametersInfos) => any;
|
|
14
14
|
formatNewParams: (formData: Record<string, any>) => ShortCircuitParametersInfos;
|
|
15
15
|
params: ShortCircuitParametersInfos | null;
|
|
16
|
-
provider: string | undefined;
|
|
17
16
|
paramsLoaded: boolean;
|
|
18
17
|
onValidationError: (errors: FieldErrors) => void;
|
|
19
18
|
onSaveInline: (formData: Record<string, any>) => void;
|
|
@@ -51,12 +51,13 @@ const useShortCircuitParametersForm = ({
|
|
|
51
51
|
name,
|
|
52
52
|
description
|
|
53
53
|
}) => {
|
|
54
|
-
const
|
|
54
|
+
const { params, updateParameters, specificParamsDescription } = parametersBackend;
|
|
55
|
+
const provider = params?.provider;
|
|
55
56
|
const [paramsLoaded, setParamsLoaded] = useState(false);
|
|
56
57
|
const { snackError } = useSnackMessage();
|
|
57
58
|
const specificParametersDescriptionForProvider = useMemo(() => {
|
|
58
|
-
return provider &&
|
|
59
|
-
}, [provider,
|
|
59
|
+
return provider && specificParamsDescription?.[provider] ? specificParamsDescription[provider] : [];
|
|
60
|
+
}, [provider, specificParamsDescription]);
|
|
60
61
|
const specificParametersDefaultValues = useMemo(() => {
|
|
61
62
|
return {
|
|
62
63
|
...getDefaultShortCircuitSpecificParamsValues(specificParametersDescriptionForProvider, snackError)
|
|
@@ -192,12 +193,12 @@ const useShortCircuitParametersForm = ({
|
|
|
192
193
|
[formatNewParams, parametersUuid, snackError]
|
|
193
194
|
);
|
|
194
195
|
useEffect(() => {
|
|
195
|
-
if (!params || !provider || !
|
|
196
|
+
if (!params || !provider || !specificParamsDescription) {
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
198
199
|
reset(toShortCircuitFormValues(params));
|
|
199
200
|
setParamsLoaded(true);
|
|
200
|
-
}, [provider, params, reset,
|
|
201
|
+
}, [provider, params, reset, specificParamsDescription, toShortCircuitFormValues]);
|
|
201
202
|
return {
|
|
202
203
|
formMethods,
|
|
203
204
|
formSchema,
|
|
@@ -205,7 +206,6 @@ const useShortCircuitParametersForm = ({
|
|
|
205
206
|
toShortCircuitFormValues,
|
|
206
207
|
formatNewParams,
|
|
207
208
|
params,
|
|
208
|
-
provider,
|
|
209
209
|
paramsLoaded,
|
|
210
210
|
onValidationError,
|
|
211
211
|
onSaveInline,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { UUID } from 'node:crypto';
|
|
2
2
|
import { User } from 'oidc-client';
|
|
3
3
|
import { ComputingType } from '../components/parameters/common/computing-type';
|
|
4
|
-
import {
|
|
5
|
-
import { ParametersInfos, SpecificParametersDescription, UseParametersBackendReturnProps } from '../utils/types/parameters.type';
|
|
4
|
+
import { BackendFunctions, UseParametersBackendReturnProps } from '../utils/types/parameters.type';
|
|
6
5
|
export declare enum OptionalServicesStatus {
|
|
7
6
|
Up = "UP",
|
|
8
7
|
Down = "DOWN",
|
|
9
8
|
Pending = "PENDING"
|
|
10
9
|
}
|
|
11
|
-
export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined,
|
|
10
|
+
export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined, backendFunctions: BackendFunctions<T>) => UseParametersBackendReturnProps<T>;
|
|
@@ -1,101 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState, useCallback, useEffect } from "react";
|
|
2
2
|
import { useSnackMessage } from "./useSnackMessage.js";
|
|
3
|
-
import { useDebounce } from "./useDebounce.js";
|
|
4
3
|
import { formatComputingTypeLabel } from "../components/parameters/common/computing-type.js";
|
|
5
4
|
import { snackWithFallback } from "../utils/error.js";
|
|
6
|
-
const INITIAL_PROVIDERS = {};
|
|
7
5
|
var OptionalServicesStatus = /* @__PURE__ */ ((OptionalServicesStatus2) => {
|
|
8
6
|
OptionalServicesStatus2["Up"] = "UP";
|
|
9
7
|
OptionalServicesStatus2["Down"] = "DOWN";
|
|
10
8
|
OptionalServicesStatus2["Pending"] = "PENDING";
|
|
11
9
|
return OptionalServicesStatus2;
|
|
12
10
|
})(OptionalServicesStatus || {});
|
|
13
|
-
const useParametersBackend = (user, studyUuid, type, optionalServiceStatus,
|
|
11
|
+
const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, backendFunctions) => {
|
|
14
12
|
const { snackError, snackWarning } = useSnackMessage();
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const {
|
|
14
|
+
backendFetchProviders,
|
|
15
|
+
backendFetchParameters,
|
|
16
|
+
backendUpdateParameters,
|
|
17
|
+
backendFetchSpecificParametersDescription,
|
|
18
|
+
backendFetchDefaultLimitReductions
|
|
19
|
+
} = backendFunctions;
|
|
20
|
+
const [providers, setProviders] = useState({});
|
|
19
21
|
const [params, setParams] = useState(null);
|
|
20
22
|
const [specificParamsDescription, setSpecificParamsDescription] = useState(
|
|
21
23
|
null
|
|
22
24
|
);
|
|
23
25
|
const [defaultLimitReductions, setDefaultLimitReductions] = useState([]);
|
|
24
|
-
const optionalServiceStatusRef = useRef(optionalServiceStatus);
|
|
25
|
-
optionalServiceStatusRef.current = optionalServiceStatus;
|
|
26
|
-
const currentParams = useMemo(() => {
|
|
27
|
-
if (params && "provider" in params && provider) {
|
|
28
|
-
return { ...params, provider };
|
|
29
|
-
}
|
|
30
|
-
return params;
|
|
31
|
-
}, [params, provider]);
|
|
32
|
-
const updateProvider = useCallback(
|
|
33
|
-
(newProvider) => {
|
|
34
|
-
if (!studyUuid) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const oldProvider = providerRef.current;
|
|
38
|
-
setProvider(newProvider);
|
|
39
|
-
backendUpdateProvider?.(studyUuid, newProvider).catch((error) => {
|
|
40
|
-
setProvider(oldProvider);
|
|
41
|
-
snackWithFallback(snackError, error, {
|
|
42
|
-
headerId: `update${formatComputingTypeLabel(type)}ProviderError`
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
[backendUpdateProvider, studyUuid, snackError, type]
|
|
47
|
-
);
|
|
48
|
-
const resetProvider = useCallback(() => {
|
|
49
|
-
backendFetchDefaultProvider?.().then((defaultProvider) => {
|
|
50
|
-
const providerNames = Object.keys(providersRef.current);
|
|
51
|
-
if (providerNames.length > 0) {
|
|
52
|
-
const newProvider = defaultProvider in providersRef.current ? defaultProvider : providerNames[0];
|
|
53
|
-
if (newProvider !== providerRef.current) {
|
|
54
|
-
updateProvider(newProvider);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}).catch((error) => {
|
|
58
|
-
snackWithFallback(snackError, error, {
|
|
59
|
-
headerId: `fetchDefault${formatComputingTypeLabel(type)}ProviderError`
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}, [backendFetchDefaultProvider, updateProvider, snackError, type]);
|
|
63
26
|
const fetchAvailableProviders = useCallback(() => {
|
|
64
|
-
return backendFetchProviders?.().then((
|
|
65
|
-
const providersObj =
|
|
27
|
+
return backendFetchProviders?.().then((response) => {
|
|
28
|
+
const providersObj = response.reduce((acc, v) => {
|
|
66
29
|
return {
|
|
67
30
|
...acc,
|
|
68
31
|
[v]: v
|
|
69
32
|
};
|
|
70
33
|
}, {});
|
|
71
|
-
|
|
34
|
+
setProviders(providersObj);
|
|
72
35
|
}).catch((error) => {
|
|
73
36
|
snackWithFallback(snackError, error, {
|
|
74
37
|
headerId: `fetch${formatComputingTypeLabel(type)}ProvidersError`
|
|
75
38
|
});
|
|
76
39
|
});
|
|
77
40
|
}, [backendFetchProviders, snackError, type]);
|
|
78
|
-
const fetchProvider = useCallback(
|
|
79
|
-
(_studyUuid) => {
|
|
80
|
-
backendFetchProvider?.(_studyUuid).then((newProvider) => {
|
|
81
|
-
if (newProvider in providersRef.current) {
|
|
82
|
-
setProvider(newProvider);
|
|
83
|
-
} else {
|
|
84
|
-
resetProvider();
|
|
85
|
-
}
|
|
86
|
-
}).catch((error) => {
|
|
87
|
-
snackWithFallback(snackError, error, {
|
|
88
|
-
headerId: `fetch${formatComputingTypeLabel(type)}ProviderError`
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
[backendFetchProvider, resetProvider, snackError, type]
|
|
93
|
-
);
|
|
94
41
|
useEffect(() => {
|
|
95
|
-
if (user !== null &&
|
|
96
|
-
fetchAvailableProviders()
|
|
42
|
+
if (user !== null && optionalServiceStatus === "UP") {
|
|
43
|
+
fetchAvailableProviders();
|
|
97
44
|
}
|
|
98
|
-
}, [fetchAvailableProviders,
|
|
45
|
+
}, [fetchAvailableProviders, optionalServiceStatus, user]);
|
|
99
46
|
const fetchSpecificParametersDescription = useCallback(() => {
|
|
100
47
|
backendFetchSpecificParametersDescription?.().then((specificParams) => {
|
|
101
48
|
setSpecificParamsDescription(specificParams);
|
|
@@ -109,7 +56,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
109
56
|
if (optionalServiceStatus === "UP") {
|
|
110
57
|
fetchSpecificParametersDescription();
|
|
111
58
|
}
|
|
112
|
-
}, [optionalServiceStatus,
|
|
59
|
+
}, [optionalServiceStatus, fetchSpecificParametersDescription]);
|
|
113
60
|
const fetchDefaultLimitReductions = useCallback(() => {
|
|
114
61
|
backendFetchDefaultLimitReductions?.().then((defaultLimits) => {
|
|
115
62
|
setDefaultLimitReductions(defaultLimits);
|
|
@@ -122,44 +69,27 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
122
69
|
fetchDefaultLimitReductions();
|
|
123
70
|
}
|
|
124
71
|
}, [optionalServiceStatus, fetchDefaultLimitReductions]);
|
|
125
|
-
const
|
|
126
|
-
(_studyUuid, newParams, oldParams) => {
|
|
127
|
-
backendUpdateParameters?.(_studyUuid, newParams).catch((error) => {
|
|
128
|
-
setParams(oldParams);
|
|
129
|
-
if (oldParams && "provider" in oldParams) {
|
|
130
|
-
setProvider(oldParams.provider);
|
|
131
|
-
} else {
|
|
132
|
-
setProvider(void 0);
|
|
133
|
-
}
|
|
134
|
-
snackWithFallback(snackError, error, {
|
|
135
|
-
headerId: `update${formatComputingTypeLabel(type)}ParametersError`
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
[backendUpdateParameters, snackError, type]
|
|
140
|
-
);
|
|
141
|
-
const debouncedBackendUpdateParameters = useDebounce(backendUpdateParametersCb, 1e3);
|
|
142
|
-
const updateParameter = useCallback(
|
|
72
|
+
const updateParameters = useCallback(
|
|
143
73
|
(newParams) => {
|
|
144
74
|
if (!studyUuid) {
|
|
145
75
|
return;
|
|
146
76
|
}
|
|
147
|
-
const oldParams =
|
|
77
|
+
const oldParams = params ? { ...params } : null;
|
|
148
78
|
setParams(newParams);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
79
|
+
backendUpdateParameters?.(studyUuid, newParams).catch((error) => {
|
|
80
|
+
setParams(oldParams);
|
|
81
|
+
snackWithFallback(snackError, error, {
|
|
82
|
+
headerId: `update${formatComputingTypeLabel(type)}ParametersError`
|
|
83
|
+
});
|
|
84
|
+
});
|
|
155
85
|
},
|
|
156
|
-
[
|
|
86
|
+
[backendUpdateParameters, params, snackError, studyUuid, type]
|
|
157
87
|
);
|
|
158
88
|
const resetParameters = useCallback(() => {
|
|
159
89
|
if (!studyUuid || !backendUpdateParameters) {
|
|
160
|
-
return
|
|
90
|
+
return;
|
|
161
91
|
}
|
|
162
|
-
|
|
92
|
+
backendUpdateParameters(studyUuid, null).then((response) => {
|
|
163
93
|
if (response.status === 204) {
|
|
164
94
|
snackWarning({
|
|
165
95
|
headerId: `reset${formatComputingTypeLabel(type)}ParametersWarning`
|
|
@@ -175,9 +105,6 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
175
105
|
(_studyUuid) => {
|
|
176
106
|
backendFetchParameters(_studyUuid).then((_params) => {
|
|
177
107
|
setParams(_params);
|
|
178
|
-
if ("provider" in _params) {
|
|
179
|
-
setProvider(_params.provider);
|
|
180
|
-
}
|
|
181
108
|
}).catch((error) => {
|
|
182
109
|
snackWithFallback(snackError, error, {
|
|
183
110
|
headerId: `fetch${formatComputingTypeLabel(type)}ParametersError`
|
|
@@ -191,19 +118,15 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
191
118
|
fetchParameters(studyUuid);
|
|
192
119
|
}
|
|
193
120
|
}, [optionalServiceStatus, studyUuid, fetchParameters]);
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
fetchProvider,
|
|
198
|
-
updateProvider,
|
|
199
|
-
resetProvider,
|
|
200
|
-
currentParams,
|
|
121
|
+
return {
|
|
122
|
+
providers,
|
|
123
|
+
params,
|
|
201
124
|
fetchParameters,
|
|
202
|
-
|
|
125
|
+
updateParameters,
|
|
203
126
|
resetParameters,
|
|
204
127
|
specificParamsDescription,
|
|
205
128
|
defaultLimitReductions
|
|
206
|
-
|
|
129
|
+
};
|
|
207
130
|
};
|
|
208
131
|
export {
|
|
209
132
|
OptionalServicesStatus,
|
package/dist/index.js
CHANGED
|
@@ -209,9 +209,9 @@ import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fe
|
|
|
209
209
|
import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./services/config.js";
|
|
210
210
|
import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./services/directory.js";
|
|
211
211
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
|
|
212
|
-
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters,
|
|
212
|
+
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./services/loadflow.js";
|
|
213
213
|
import { fetchPccMinParameters, getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
|
|
214
|
-
import {
|
|
214
|
+
import { fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, setSecurityAnalysisParameters, updateSecurityAnalysisParameters } from "./services/security-analysis.js";
|
|
215
215
|
import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, setStudyNetworkVisualizationParameters, updateVoltageInitParameters } from "./services/study.js";
|
|
216
216
|
import { getNetworkVisualizationsParameters } from "./services/study-config.js";
|
|
217
217
|
import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
|
|
@@ -817,7 +817,6 @@ export {
|
|
|
817
817
|
fetchCsvSeparator,
|
|
818
818
|
fetchCurrentAnnouncement,
|
|
819
819
|
fetchDefaultCountry,
|
|
820
|
-
fetchDefaultSecurityAnalysisProvider,
|
|
821
820
|
fetchDirectoryContent,
|
|
822
821
|
fetchDirectoryElementPath,
|
|
823
822
|
fetchDynamicMarginCalculationParameters,
|
|
@@ -849,7 +848,6 @@ export {
|
|
|
849
848
|
getAvailableComponentLibraries,
|
|
850
849
|
getComputedLanguage,
|
|
851
850
|
getConcatenatedProperties,
|
|
852
|
-
getDefaultLoadFlowProvider,
|
|
853
851
|
getEquipmentTypeShortLabel,
|
|
854
852
|
getEquipmentsInfosForSearchBar,
|
|
855
853
|
getExpertFilterEmptyFormData,
|
|
@@ -988,7 +986,6 @@ export {
|
|
|
988
986
|
updateParameter,
|
|
989
987
|
updatePccMinParameters,
|
|
990
988
|
updateSecurityAnalysisParameters,
|
|
991
|
-
updateSecurityAnalysisProvider,
|
|
992
989
|
updateShortCircuitParameters,
|
|
993
990
|
updateVoltageInitParameters,
|
|
994
991
|
useConfidentialityWarning,
|
package/dist/services/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fe
|
|
|
2
2
|
import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./config.js";
|
|
3
3
|
import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./directory.js";
|
|
4
4
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
|
|
5
|
-
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters,
|
|
5
|
+
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./loadflow.js";
|
|
6
6
|
import { fetchPccMinParameters, getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
|
|
7
|
-
import {
|
|
7
|
+
import { fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, setSecurityAnalysisParameters, updateSecurityAnalysisParameters } from "./security-analysis.js";
|
|
8
8
|
import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, setStudyNetworkVisualizationParameters, updateVoltageInitParameters } from "./study.js";
|
|
9
9
|
import { getNetworkVisualizationsParameters } from "./study-config.js";
|
|
10
10
|
import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
|
|
@@ -30,7 +30,6 @@ export {
|
|
|
30
30
|
fetchConfigParameters,
|
|
31
31
|
fetchCurrentAnnouncement,
|
|
32
32
|
fetchDefaultCountry,
|
|
33
|
-
fetchDefaultSecurityAnalysisProvider,
|
|
34
33
|
fetchDirectoryContent,
|
|
35
34
|
fetchDirectoryElementPath,
|
|
36
35
|
fetchDynamicMarginCalculationParameters,
|
|
@@ -49,7 +48,6 @@ export {
|
|
|
49
48
|
fetchUserDetails,
|
|
50
49
|
getAppName,
|
|
51
50
|
getAvailableComponentLibraries,
|
|
52
|
-
getDefaultLoadFlowProvider,
|
|
53
51
|
getLoadFlowDefaultLimitReductions,
|
|
54
52
|
getLoadFlowProviders,
|
|
55
53
|
getLoadFlowSpecificParametersDescription,
|
|
@@ -81,7 +79,6 @@ export {
|
|
|
81
79
|
updateParameter,
|
|
82
80
|
updatePccMinParameters,
|
|
83
81
|
updateSecurityAnalysisParameters,
|
|
84
|
-
updateSecurityAnalysisProvider,
|
|
85
82
|
updateShortCircuitParameters,
|
|
86
83
|
updateVoltageInitParameters
|
|
87
84
|
};
|
|
@@ -4,6 +4,5 @@ export declare function getLoadFlowUrl(): string;
|
|
|
4
4
|
export declare function getLoadFlowProviders(): Promise<any>;
|
|
5
5
|
export declare function getLoadFlowSpecificParametersDescription(): Promise<any>;
|
|
6
6
|
export declare function getLoadFlowDefaultLimitReductions(): Promise<any>;
|
|
7
|
-
export declare function getDefaultLoadFlowProvider(): Promise<string>;
|
|
8
7
|
export declare function fetchLoadFlowParameters(parameterUuid: string): Promise<any>;
|
|
9
8
|
export declare function setLoadFlowParameters(parameterUuid: UUID, newParams: any): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { backendFetchJson,
|
|
1
|
+
import { backendFetchJson, backendFetch } from "./utils.js";
|
|
2
2
|
const PREFIX_LOADFLOW_SERVER_QUERIES = `${"api/gateway"}/loadflow`;
|
|
3
3
|
const PREFIX_STUDY_QUERIES = `${"api/gateway"}/study`;
|
|
4
4
|
function getLoadFlowUrl() {
|
|
@@ -22,12 +22,6 @@ function getLoadFlowDefaultLimitReductions() {
|
|
|
22
22
|
console.debug(getLoadFlowDefaultLimitReductionsUrl);
|
|
23
23
|
return backendFetchJson(getLoadFlowDefaultLimitReductionsUrl);
|
|
24
24
|
}
|
|
25
|
-
function getDefaultLoadFlowProvider() {
|
|
26
|
-
console.info("get default load flow provier");
|
|
27
|
-
const getDefaultLoadFlowProviderUrl = `${PREFIX_STUDY_QUERIES}/v1/loadflow-default-provider`;
|
|
28
|
-
console.debug(getDefaultLoadFlowProviderUrl);
|
|
29
|
-
return backendFetchText(getDefaultLoadFlowProviderUrl);
|
|
30
|
-
}
|
|
31
25
|
function fetchLoadFlowParameters(parameterUuid) {
|
|
32
26
|
console.info("fetch load flow parameters");
|
|
33
27
|
const url = `${getLoadFlowUrl()}parameters/${encodeURIComponent(parameterUuid)}`;
|
|
@@ -50,7 +44,6 @@ function setLoadFlowParameters(parameterUuid, newParams) {
|
|
|
50
44
|
export {
|
|
51
45
|
PREFIX_STUDY_QUERIES,
|
|
52
46
|
fetchLoadFlowParameters,
|
|
53
|
-
getDefaultLoadFlowProvider,
|
|
54
47
|
getLoadFlowDefaultLimitReductions,
|
|
55
48
|
getLoadFlowProviders,
|
|
56
49
|
getLoadFlowSpecificParametersDescription,
|
|
@@ -3,8 +3,6 @@ export declare const getStudyUrl: (studyUuid: UUID | null) => string;
|
|
|
3
3
|
export declare function fetchSecurityAnalysisProviders(): Promise<any>;
|
|
4
4
|
export declare function fetchSecurityAnalysisParameters(parameterUuid: string): Promise<any>;
|
|
5
5
|
export declare function getSecurityAnalysisDefaultLimitReductions(): Promise<any>;
|
|
6
|
-
export declare function updateSecurityAnalysisProvider(studyUuid: UUID, newProvider: string): Promise<Response>;
|
|
7
|
-
export declare function fetchDefaultSecurityAnalysisProvider(): Promise<string>;
|
|
8
6
|
export declare function getSecurityAnalysisParameters(studyUuid: UUID): Promise<any>;
|
|
9
7
|
export declare function setSecurityAnalysisParameters(studyUuid: UUID, newParams: any): Promise<Response>;
|
|
10
8
|
export declare function updateSecurityAnalysisParameters(parameterUuid: UUID, newParams: any): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safeEncodeURIComponent, backendFetchJson, backendFetch
|
|
1
|
+
import { safeEncodeURIComponent, backendFetchJson, backendFetch } from "./utils.js";
|
|
2
2
|
import { PREFIX_STUDY_QUERIES } from "./loadflow.js";
|
|
3
3
|
const PREFIX_SECURITY_ANALYSIS_SERVER_QUERIES = `${"api/gateway"}/security-analysis`;
|
|
4
4
|
const getStudyUrl = (studyUuid) => `${PREFIX_STUDY_QUERIES}/v1/studies/${safeEncodeURIComponent(studyUuid)}`;
|
|
@@ -23,25 +23,6 @@ function getSecurityAnalysisDefaultLimitReductions() {
|
|
|
23
23
|
console.debug(url);
|
|
24
24
|
return backendFetchJson(url);
|
|
25
25
|
}
|
|
26
|
-
function updateSecurityAnalysisProvider(studyUuid, newProvider) {
|
|
27
|
-
console.info("update security analysis provider");
|
|
28
|
-
const url = `${getStudyUrl(studyUuid)}/security-analysis/provider`;
|
|
29
|
-
console.debug(url);
|
|
30
|
-
return backendFetch(url, {
|
|
31
|
-
method: "POST",
|
|
32
|
-
headers: {
|
|
33
|
-
Accept: "application/json",
|
|
34
|
-
"Content-Type": "application/json"
|
|
35
|
-
},
|
|
36
|
-
body: newProvider
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function fetchDefaultSecurityAnalysisProvider() {
|
|
40
|
-
console.info("fetch default security analysis provider");
|
|
41
|
-
const url = `${PREFIX_STUDY_QUERIES}/v1/security-analysis-default-provider`;
|
|
42
|
-
console.debug(url);
|
|
43
|
-
return backendFetchText(url);
|
|
44
|
-
}
|
|
45
26
|
function getSecurityAnalysisParameters(studyUuid) {
|
|
46
27
|
console.info("get security analysis parameters");
|
|
47
28
|
const url = `${getStudyUrl(studyUuid)}/security-analysis/parameters`;
|
|
@@ -75,13 +56,11 @@ function updateSecurityAnalysisParameters(parameterUuid, newParams) {
|
|
|
75
56
|
});
|
|
76
57
|
}
|
|
77
58
|
export {
|
|
78
|
-
fetchDefaultSecurityAnalysisProvider,
|
|
79
59
|
fetchSecurityAnalysisParameters,
|
|
80
60
|
fetchSecurityAnalysisProviders,
|
|
81
61
|
getSecurityAnalysisDefaultLimitReductions,
|
|
82
62
|
getSecurityAnalysisParameters,
|
|
83
63
|
getStudyUrl,
|
|
84
64
|
setSecurityAnalysisParameters,
|
|
85
|
-
updateSecurityAnalysisParameters
|
|
86
|
-
updateSecurityAnalysisProvider
|
|
65
|
+
updateSecurityAnalysisParameters
|
|
87
66
|
};
|
|
@@ -8,5 +8,4 @@ export declare function getSensitivityAnalysisParameters(studyUuid: UUID): Promi
|
|
|
8
8
|
export declare function fetchSensitivityAnalysisParameters(parameterUuid: string): Promise<any>;
|
|
9
9
|
export declare function setSensitivityAnalysisParameters(studyUuid: UUID | null, newParams: SensitivityAnalysisParametersInfos | null): Promise<Response>;
|
|
10
10
|
export declare function getSensitivityAnalysisFactorsCount(studyUuid: UUID | null, currentNodeUuid: UUID, currentRootNetworkUuid: UUID, newParams: SensitivityAnalysisParametersInfos): Promise<FactorsCount>;
|
|
11
|
-
export declare function fetchDefaultSensitivityAnalysisProvider(): Promise<string>;
|
|
12
11
|
export declare function updateSensitivityAnalysisParameters(parameterUuid: UUID, newParams: any): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safeEncodeURIComponent, backendFetchJson, backendFetch
|
|
1
|
+
import { safeEncodeURIComponent, backendFetchJson, backendFetch } from "./utils.js";
|
|
2
2
|
import { PREFIX_STUDY_QUERIES } from "./loadflow.js";
|
|
3
3
|
const GET_PARAMETERS_PREFIX = `${"api/gateway"}/sensitivity-analysis/v1/parameters`;
|
|
4
4
|
const PREFIX_SENSITIVITY_ANALYSIS_SERVER_QUERIES = `${"api/gateway"}/sensitivity-analysis`;
|
|
@@ -52,12 +52,6 @@ function getSensitivityAnalysisFactorsCount(studyUuid, currentNodeUuid, currentR
|
|
|
52
52
|
body: JSON.stringify(newParams)
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
function fetchDefaultSensitivityAnalysisProvider() {
|
|
56
|
-
console.info("fetch default sensitivity analysis provider");
|
|
57
|
-
const url = `${PREFIX_STUDY_QUERIES}/v1/sensitivity-analysis-default-provider`;
|
|
58
|
-
console.debug(url);
|
|
59
|
-
return backendFetchText(url);
|
|
60
|
-
}
|
|
61
55
|
function updateSensitivityAnalysisParameters(parameterUuid, newParams) {
|
|
62
56
|
console.info("set security analysis parameters");
|
|
63
57
|
const setSecurityAnalysisParametersUrl = `${getSensiUrl()}parameters/${parameterUuid}`;
|
|
@@ -72,7 +66,6 @@ function updateSensitivityAnalysisParameters(parameterUuid, newParams) {
|
|
|
72
66
|
});
|
|
73
67
|
}
|
|
74
68
|
export {
|
|
75
|
-
fetchDefaultSensitivityAnalysisProvider,
|
|
76
69
|
fetchSensitivityAnalysisParameters,
|
|
77
70
|
fetchSensitivityAnalysisProviders,
|
|
78
71
|
getSensiUrl,
|
|
@@ -236,19 +236,12 @@ export declare const parametersEn: {
|
|
|
236
236
|
fetchLoadFlowProvidersError: string;
|
|
237
237
|
fetchLoadFlowSpecificParametersError: string;
|
|
238
238
|
updateLoadFlowParametersError: string;
|
|
239
|
-
updateLoadFlowProviderError: string;
|
|
240
|
-
fetchDefaultSecurityAnalysisProviderError: string;
|
|
241
239
|
fetchSecurityAnalysisParametersError: string;
|
|
242
|
-
fetchSecurityAnalysisProviderError: string;
|
|
243
240
|
fetchSecurityAnalysisProvidersError: string;
|
|
244
241
|
updateSecurityAnalysisParametersError: string;
|
|
245
|
-
updateSecurityAnalysisProviderError: string;
|
|
246
|
-
fetchDefaultSensitivityAnalysisProviderError: string;
|
|
247
242
|
fetchSensitivityAnalysisParametersError: string;
|
|
248
|
-
fetchSensitivityAnalysisProviderError: string;
|
|
249
243
|
fetchSensitivityAnalysisProvidersError: string;
|
|
250
244
|
updateSensitivityAnalysisParametersError: string;
|
|
251
|
-
updateSensitivityAnalysisProviderError: string;
|
|
252
245
|
getSensitivityAnalysisFactorsCountError: string;
|
|
253
246
|
resetLoadFlowParametersWarning: string;
|
|
254
247
|
PccMinParametersError: string;
|
|
@@ -232,21 +232,14 @@ const parametersEn = {
|
|
|
232
232
|
fetchLoadFlowProvidersError: "An error occurred while fetching the load flow providers",
|
|
233
233
|
fetchLoadFlowSpecificParametersError: "An error occured when fetching the load flow specific parameters",
|
|
234
234
|
updateLoadFlowParametersError: "An error occurred while updating the load flow parameters",
|
|
235
|
-
updateLoadFlowProviderError: "An error occurred while updating the load flow provider",
|
|
236
235
|
// SecurityAnalysis
|
|
237
|
-
fetchDefaultSecurityAnalysisProviderError: "An error occured when fetching default security analysis provider",
|
|
238
236
|
fetchSecurityAnalysisParametersError: "An error occured when fetching the security analysis parameters",
|
|
239
|
-
fetchSecurityAnalysisProviderError: "An error occured when fetching security analysis provider",
|
|
240
237
|
fetchSecurityAnalysisProvidersError: "An error occured when fetching security analysis provider list",
|
|
241
238
|
updateSecurityAnalysisParametersError: "An error occurred while updating the security analysis parameters",
|
|
242
|
-
updateSecurityAnalysisProviderError: "An error occured when updating security analysis provider",
|
|
243
239
|
// SensitivityAnalysis
|
|
244
|
-
fetchDefaultSensitivityAnalysisProviderError: "An error occured when fetching default sensitivity analysis provider",
|
|
245
240
|
fetchSensitivityAnalysisParametersError: "An error occured when fetching the sensitivity analysis parameters",
|
|
246
|
-
fetchSensitivityAnalysisProviderError: "An error occured when fetching sensitivity analysis provider",
|
|
247
241
|
fetchSensitivityAnalysisProvidersError: "An error occured when fetching sensitivity analysis provider list",
|
|
248
242
|
updateSensitivityAnalysisParametersError: "An error occurred while updating the sensitivity analysis parameters",
|
|
249
|
-
updateSensitivityAnalysisProviderError: "An error occured when updating sensitivity analysis provider",
|
|
250
243
|
getSensitivityAnalysisFactorsCountError: "An error occured while estimating sensitivity analysis computations",
|
|
251
244
|
// Other
|
|
252
245
|
resetLoadFlowParametersWarning: "Impossible to retrieve the load flow parameters defined in the user profile (default values are used)",
|
|
@@ -231,25 +231,17 @@ export declare const parametersFr: {
|
|
|
231
231
|
loadingComputing: string;
|
|
232
232
|
AddRows: string;
|
|
233
233
|
Optional: string;
|
|
234
|
-
fetchDefaultLoadFlowProviderError: string;
|
|
235
234
|
fetchLoadFlowParametersError: string;
|
|
236
235
|
fetchLoadFlowProviderError: string;
|
|
237
236
|
fetchLoadFlowProvidersError: string;
|
|
238
237
|
fetchLoadFlowSpecificParametersError: string;
|
|
239
238
|
updateLoadFlowParametersError: string;
|
|
240
|
-
updateLoadFlowProviderError: string;
|
|
241
|
-
fetchDefaultSecurityAnalysisProviderError: string;
|
|
242
239
|
fetchSecurityAnalysisParametersError: string;
|
|
243
|
-
fetchSecurityAnalysisProviderError: string;
|
|
244
240
|
fetchSecurityAnalysisProvidersError: string;
|
|
245
241
|
updateSecurityAnalysisParametersError: string;
|
|
246
|
-
updateSecurityAnalysisProviderError: string;
|
|
247
|
-
fetchDefaultSensitivityAnalysisProviderError: string;
|
|
248
242
|
fetchSensitivityAnalysisParametersError: string;
|
|
249
|
-
fetchSensitivityAnalysisProviderError: string;
|
|
250
243
|
fetchSensitivityAnalysisProvidersError: string;
|
|
251
244
|
updateSensitivityAnalysisParametersError: string;
|
|
252
|
-
updateSensitivityAnalysisProviderError: string;
|
|
253
245
|
getSensitivityAnalysisFactorsCountError: string;
|
|
254
246
|
resetLoadFlowParametersWarning: string;
|
|
255
247
|
PccMinParametersError: string;
|
|
@@ -227,27 +227,19 @@ const parametersFr = {
|
|
|
227
227
|
Optional: " (optionnel)",
|
|
228
228
|
// Computed translations used in the snackbars
|
|
229
229
|
// LoadFlow
|
|
230
|
-
fetchDefaultLoadFlowProviderError: "Une erreur est survenue lors de la récupération du fournisseur de calcul de répartition par défaut",
|
|
231
230
|
fetchLoadFlowParametersError: "Une erreur est survenue lors de la récupération des paramètres de calcul de répartition",
|
|
232
231
|
fetchLoadFlowProviderError: "Une erreur est survenue lors de la récupération du fournisseur de calcul de répartition",
|
|
233
232
|
fetchLoadFlowProvidersError: "Une erreur est survenue lors de la récupération des fournisseurs de calcul de répartition",
|
|
234
233
|
fetchLoadFlowSpecificParametersError: "Une erreur est survenue lors de la récupération des paramètres spécifiques de calcul de répartition",
|
|
235
234
|
updateLoadFlowParametersError: "Une erreur est survenue lors de la mise à jour des paramètres de calcul de répartition",
|
|
236
|
-
updateLoadFlowProviderError: "Une erreur est survenue lors de la mise à jour du fournisseur courant de calcul de répartition",
|
|
237
235
|
// SecurityAnalysis
|
|
238
|
-
fetchDefaultSecurityAnalysisProviderError: "Une erreur est survenue lors de la récupération du fournisseur d'analyse de sécurité par défaut",
|
|
239
236
|
fetchSecurityAnalysisParametersError: "Une erreur est survenue lors de la récupération des paramètres de l'analyse de sécurité",
|
|
240
|
-
fetchSecurityAnalysisProviderError: "Une erreur est survenue lors de la récupération du fournisseur courant d'analyse de sécurité",
|
|
241
237
|
fetchSecurityAnalysisProvidersError: "Une erreur est survenue lors de la récupération des fournisseurs d'analyse de sécurité",
|
|
242
238
|
updateSecurityAnalysisParametersError: "Une erreur est survenue lors de la mise a jour des paramètres de l'analyse de sécurité",
|
|
243
|
-
updateSecurityAnalysisProviderError: "Une erreur est survenue lors de la mise a jour du fournisseur courant d'analyse de sécurité",
|
|
244
239
|
// SensitivityAnalysis
|
|
245
|
-
fetchDefaultSensitivityAnalysisProviderError: "Une erreur est survenue lors de la récupération du fournisseur d'analyse de sensibilité par défaut",
|
|
246
240
|
fetchSensitivityAnalysisParametersError: "Une erreur est survenue lors de la récupération des paramètres de l'analyse de sensibilité",
|
|
247
|
-
fetchSensitivityAnalysisProviderError: "Une erreur est survenue lors de la récupération du fournisseur courant d'analyse de sensibilité",
|
|
248
241
|
fetchSensitivityAnalysisProvidersError: "Une erreur est survenue lors de la récupération des fournisseurs d'analyse de sensibilité",
|
|
249
242
|
updateSensitivityAnalysisParametersError: "Une erreur est survenue lors de la mise a jour des paramètres de l'analyse de sensibilité",
|
|
250
|
-
updateSensitivityAnalysisProviderError: "Une erreur est survenue lors de la mise a jour du fournisseur courant d'analyse de sensibilité",
|
|
251
243
|
getSensitivityAnalysisFactorsCountError: "Une erreur est survenue lors de l'estimation du nombre de calculs",
|
|
252
244
|
// Other
|
|
253
245
|
resetLoadFlowParametersWarning: "Impossible de récupérer les paramètres de calcul de répartition définis dans le profil utilisateur (les valeurs par défaut sont appliquées)",
|
|
@@ -30,16 +30,19 @@ export type SpecificParametersDescription = Record<string, SpecificParameterInfo
|
|
|
30
30
|
export type SpecificParametersValues = Record<string, any>;
|
|
31
31
|
export type SpecificParametersPerProvider = Record<string, SpecificParametersValues>;
|
|
32
32
|
export type ParametersInfos<T extends ComputingType> = T extends ComputingType.SENSITIVITY_ANALYSIS ? SensitivityAnalysisParametersInfos : T extends ComputingType.SECURITY_ANALYSIS ? SAParameters : T extends ComputingType.LOAD_FLOW ? LoadFlowParametersInfos : T extends ComputingType.DYNAMIC_SIMULATION ? DynamicSimulationParametersFetchReturn : T extends ComputingType.DYNAMIC_SECURITY_ANALYSIS ? DynamicSecurityAnalysisParametersFetchReturn : T extends ComputingType.DYNAMIC_MARGIN_CALCULATION ? DynamicMarginCalculationParametersInfos : T extends ComputingType.SHORT_CIRCUIT ? ShortCircuitParametersInfos : Record<string, any>;
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(
|
|
37
|
-
(
|
|
38
|
-
() =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
export type BackendFunctions<T extends ComputingType> = {
|
|
34
|
+
backendFetchProviders?: (() => Promise<string[]>) | null;
|
|
35
|
+
backendFetchParameters: (paramsUuidOrStudyUuid: UUID) => Promise<ParametersInfos<T>>;
|
|
36
|
+
backendUpdateParameters?: (paramsUuidOrStudyUuid: UUID, newParam: ParametersInfos<T> | null) => Promise<any>;
|
|
37
|
+
backendFetchSpecificParametersDescription?: () => Promise<SpecificParametersDescription>;
|
|
38
|
+
backendFetchDefaultLimitReductions?: () => Promise<ILimitReductionsByVoltageLevel[]>;
|
|
39
|
+
};
|
|
40
|
+
export type UseParametersBackendReturnProps<T extends ComputingType> = {
|
|
41
|
+
providers: Record<string, string>;
|
|
42
|
+
params: ParametersInfos<T> | null;
|
|
43
|
+
fetchParameters: (paramsUuidOrStudyUuid: UUID) => void;
|
|
44
|
+
updateParameters: (newParams: ParametersInfos<T>) => void;
|
|
45
|
+
resetParameters: () => void;
|
|
46
|
+
specificParamsDescription: SpecificParametersDescription | null;
|
|
47
|
+
defaultLimitReductions: ILimitReductionsByVoltageLevel[];
|
|
48
|
+
};
|