@gridsuite/commons-ui 0.178.0 → 0.179.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/index.js +6 -0
- package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +3 -0
- package/dist/components/parameters/common/utils.d.ts +25 -2
- package/dist/components/parameters/common/utils.js +40 -1
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.d.ts +2 -18
- package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +2 -38
- package/dist/components/parameters/dynamic-security-analysis/constants.d.ts +9 -0
- package/dist/components/parameters/dynamic-security-analysis/constants.js +8 -0
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +65 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +130 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +9 -0
- package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +103 -0
- package/dist/components/parameters/dynamic-security-analysis/index.d.ts +8 -0
- package/dist/components/parameters/dynamic-security-analysis/index.js +8 -0
- package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.d.ts +10 -0
- package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.js +16 -0
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.d.ts +51 -0
- package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +181 -0
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +6 -0
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +24 -4
- package/dist/components/parameters/util/make-component-utils.d.ts +17 -0
- package/dist/components/parameters/util/make-component-utils.js +96 -0
- package/dist/components/parameters/util/styles.d.ts +38 -0
- package/dist/components/parameters/util/styles.js +41 -0
- package/dist/index.js +12 -1
- package/dist/services/dynamic-security-analysis.d.ts +4 -0
- package/dist/services/dynamic-security-analysis.js +29 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +6 -1
- package/dist/services/sensitivity-analysis.d.ts +1 -1
- package/dist/services/sensitivity-analysis.js +3 -2
- package/dist/services/utils.d.ts +2 -0
- package/dist/services/utils.js +3 -0
- package/dist/utils/types/elementType.d.ts +1 -0
- package/dist/utils/types/elementType.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { default as yup } from '../../../utils/yupConfig';
|
|
3
|
+
import { DynamicSecurityAnalysisParametersFetchReturn, DynamicSecurityAnalysisParametersInfos } from '../../../utils';
|
|
4
|
+
import { UseComputationParametersFormReturn } from '../common/utils';
|
|
5
|
+
export declare enum TabValues {
|
|
6
|
+
SCENARIO = "scenario",
|
|
7
|
+
CONTINGENCY = "contingency"
|
|
8
|
+
}
|
|
9
|
+
export declare const formSchema: yup.ObjectSchema<{
|
|
10
|
+
provider: string;
|
|
11
|
+
scenario: {
|
|
12
|
+
scenarioDuration: number;
|
|
13
|
+
};
|
|
14
|
+
contingency: {
|
|
15
|
+
contingenciesStartTime: number;
|
|
16
|
+
contingencyListInfos: {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
}, yup.AnyObject, {
|
|
22
|
+
provider: undefined;
|
|
23
|
+
scenario: {
|
|
24
|
+
scenarioDuration: undefined;
|
|
25
|
+
};
|
|
26
|
+
contingency: {
|
|
27
|
+
contingenciesStartTime: undefined;
|
|
28
|
+
contingencyListInfos: "";
|
|
29
|
+
};
|
|
30
|
+
}, "">;
|
|
31
|
+
export declare const emptyFormData: {
|
|
32
|
+
provider: string;
|
|
33
|
+
scenario: {
|
|
34
|
+
scenarioDuration: number;
|
|
35
|
+
};
|
|
36
|
+
contingency: {
|
|
37
|
+
contingenciesStartTime: number;
|
|
38
|
+
contingencyListInfos: never[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare const toFormValues: (_params: DynamicSecurityAnalysisParametersFetchReturn) => FieldValues;
|
|
42
|
+
export declare const toParamsInfos: (_formData: FieldValues) => DynamicSecurityAnalysisParametersFetchReturn;
|
|
43
|
+
export type UseDynamicSecurityAnalysisParametersFormReturn = UseComputationParametersFormReturn<TabValues>;
|
|
44
|
+
type UseDynamicSecurityAnalysisParametersFormProps = {
|
|
45
|
+
providers: Record<string, string>;
|
|
46
|
+
params: DynamicSecurityAnalysisParametersInfos | null;
|
|
47
|
+
name: string | null;
|
|
48
|
+
description: string | null;
|
|
49
|
+
};
|
|
50
|
+
export declare function useDynamicSecurityAnalysisParametersForm({ providers, params, name: initialName, description: initialDescription, }: Readonly<UseDynamicSecurityAnalysisParametersFormProps>): UseDynamicSecurityAnalysisParametersFormReturn;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import { useMemo, useEffect } from "react";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import "../../../utils/yupConfig.js";
|
|
5
|
+
import { ID } from "../../../utils/constants/filterConstant.js";
|
|
6
|
+
import "../../../utils/conversionUtils.js";
|
|
7
|
+
import "../../../utils/types/equipmentType.js";
|
|
8
|
+
import "react/jsx-runtime";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import { PROVIDER } from "../common/constants.js";
|
|
11
|
+
import "@mui/material";
|
|
12
|
+
import "react-intl";
|
|
13
|
+
import "localized-countries";
|
|
14
|
+
import "localized-countries/data/fr";
|
|
15
|
+
import "localized-countries/data/en";
|
|
16
|
+
import "notistack";
|
|
17
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
18
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
19
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
20
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
21
|
+
import "../../overflowableText/OverflowableText.js";
|
|
22
|
+
import * as yup from "yup";
|
|
23
|
+
import { NAME } from "../../inputs/reactHookForm/constants.js";
|
|
24
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
25
|
+
import "../../customAGGrid/customAggrid.js";
|
|
26
|
+
import "ag-grid-community";
|
|
27
|
+
import "react-papaparse";
|
|
28
|
+
import "react-csv-downloader";
|
|
29
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
30
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
31
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
32
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
34
|
+
import "@react-querybuilder/material";
|
|
35
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
36
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
37
|
+
import "uuid";
|
|
38
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
39
|
+
import "react-querybuilder";
|
|
40
|
+
import "../common/widget/parameter-line-slider.js";
|
|
41
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
42
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
43
|
+
import "../../filter/HeaderFilterForm.js";
|
|
44
|
+
import { getNameElementEditorSchema, getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
|
|
45
|
+
import { SCENARIO_DURATION, CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME } from "./constants.js";
|
|
46
|
+
import { useTabs } from "../common/utils.js";
|
|
47
|
+
var TabValues = /* @__PURE__ */ ((TabValues2) => {
|
|
48
|
+
TabValues2["SCENARIO"] = "scenario";
|
|
49
|
+
TabValues2["CONTINGENCY"] = "contingency";
|
|
50
|
+
return TabValues2;
|
|
51
|
+
})(TabValues || {});
|
|
52
|
+
const scenarioFormSchema = yup.object().shape({
|
|
53
|
+
[SCENARIO_DURATION]: yup.number().required()
|
|
54
|
+
}).required();
|
|
55
|
+
const contingencyFormSchema = yup.object().shape({
|
|
56
|
+
[CONTINGENCIES_START_TIME]: yup.number().required(),
|
|
57
|
+
[CONTINGENCIES_LIST_INFOS]: yup.array().of(
|
|
58
|
+
yup.object().shape({
|
|
59
|
+
[ID]: yup.string().required(),
|
|
60
|
+
[NAME]: yup.string().required()
|
|
61
|
+
})
|
|
62
|
+
).required()
|
|
63
|
+
});
|
|
64
|
+
const formSchema = yup.object().shape({
|
|
65
|
+
[PROVIDER]: yup.string().required(),
|
|
66
|
+
[
|
|
67
|
+
"scenario"
|
|
68
|
+
/* SCENARIO */
|
|
69
|
+
]: scenarioFormSchema,
|
|
70
|
+
[
|
|
71
|
+
"contingency"
|
|
72
|
+
/* CONTINGENCY */
|
|
73
|
+
]: contingencyFormSchema
|
|
74
|
+
});
|
|
75
|
+
const scenarioEmptyFormData = {
|
|
76
|
+
[SCENARIO_DURATION]: 0
|
|
77
|
+
};
|
|
78
|
+
const contingencyEmptyFormData = {
|
|
79
|
+
[CONTINGENCIES_START_TIME]: 0,
|
|
80
|
+
[CONTINGENCIES_LIST_INFOS]: []
|
|
81
|
+
};
|
|
82
|
+
const emptyFormData = {
|
|
83
|
+
[PROVIDER]: "",
|
|
84
|
+
[
|
|
85
|
+
"scenario"
|
|
86
|
+
/* SCENARIO */
|
|
87
|
+
]: { ...scenarioEmptyFormData },
|
|
88
|
+
[
|
|
89
|
+
"contingency"
|
|
90
|
+
/* CONTINGENCY */
|
|
91
|
+
]: { ...contingencyEmptyFormData }
|
|
92
|
+
};
|
|
93
|
+
const toFormValues = (_params) => ({
|
|
94
|
+
[PROVIDER]: _params.provider,
|
|
95
|
+
[
|
|
96
|
+
"scenario"
|
|
97
|
+
/* SCENARIO */
|
|
98
|
+
]: {
|
|
99
|
+
[SCENARIO_DURATION]: _params.scenarioDuration
|
|
100
|
+
},
|
|
101
|
+
[
|
|
102
|
+
"contingency"
|
|
103
|
+
/* CONTINGENCY */
|
|
104
|
+
]: {
|
|
105
|
+
[CONTINGENCIES_START_TIME]: _params.contingenciesStartTime,
|
|
106
|
+
[CONTINGENCIES_LIST_INFOS]: _params.contingencyListInfos
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const toParamsInfos = (_formData) => ({
|
|
110
|
+
provider: _formData[PROVIDER],
|
|
111
|
+
scenarioDuration: _formData[
|
|
112
|
+
"scenario"
|
|
113
|
+
/* SCENARIO */
|
|
114
|
+
][SCENARIO_DURATION],
|
|
115
|
+
contingenciesStartTime: _formData[
|
|
116
|
+
"contingency"
|
|
117
|
+
/* CONTINGENCY */
|
|
118
|
+
][CONTINGENCIES_START_TIME],
|
|
119
|
+
contingencyListInfos: _formData[
|
|
120
|
+
"contingency"
|
|
121
|
+
/* CONTINGENCY */
|
|
122
|
+
][CONTINGENCIES_LIST_INFOS]
|
|
123
|
+
});
|
|
124
|
+
function useDynamicSecurityAnalysisParametersForm({
|
|
125
|
+
providers,
|
|
126
|
+
params,
|
|
127
|
+
name: initialName,
|
|
128
|
+
description: initialDescription
|
|
129
|
+
}) {
|
|
130
|
+
const paramsLoaded = useMemo(() => !!params, [params]);
|
|
131
|
+
const formattedProviders = useMemo(
|
|
132
|
+
() => Object.entries(providers).map(([key, value]) => ({
|
|
133
|
+
id: key,
|
|
134
|
+
label: value
|
|
135
|
+
})),
|
|
136
|
+
[providers]
|
|
137
|
+
);
|
|
138
|
+
const returnFormSchema = useMemo(() => {
|
|
139
|
+
return initialName === null ? formSchema : formSchema.concat(getNameElementEditorSchema(initialName));
|
|
140
|
+
}, [initialName]);
|
|
141
|
+
const newEmptyFormData = useMemo(() => {
|
|
142
|
+
return {
|
|
143
|
+
...initialName === null ? {} : getNameElementEditorEmptyFormData(initialName, initialDescription),
|
|
144
|
+
...emptyFormData
|
|
145
|
+
};
|
|
146
|
+
}, [initialName, initialDescription]);
|
|
147
|
+
const returnFormMethods = useForm({
|
|
148
|
+
defaultValues: newEmptyFormData,
|
|
149
|
+
resolver: yupResolver(returnFormSchema)
|
|
150
|
+
});
|
|
151
|
+
const { reset } = returnFormMethods;
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (params) {
|
|
154
|
+
console.log("xxx Resetting form with params:", params);
|
|
155
|
+
reset(toFormValues(params));
|
|
156
|
+
}
|
|
157
|
+
}, [params, paramsLoaded, reset]);
|
|
158
|
+
const { selectedTab, tabsWithError, onTabChange, onError } = useTabs({
|
|
159
|
+
defaultTab: "scenario",
|
|
160
|
+
tabEnum: TabValues
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
formMethods: returnFormMethods,
|
|
164
|
+
formSchema: returnFormSchema,
|
|
165
|
+
paramsLoaded,
|
|
166
|
+
formattedProviders,
|
|
167
|
+
/* tab-related handling */
|
|
168
|
+
selectedTab,
|
|
169
|
+
tabsWithError,
|
|
170
|
+
onTabChange,
|
|
171
|
+
onError
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
TabValues,
|
|
176
|
+
emptyFormData,
|
|
177
|
+
formSchema,
|
|
178
|
+
toFormValues,
|
|
179
|
+
toParamsInfos,
|
|
180
|
+
useDynamicSecurityAnalysisParametersForm
|
|
181
|
+
};
|
|
@@ -41,6 +41,8 @@ import { SensitivityAnalysisParametersDialog } from "./sensi/sensitivity-analysi
|
|
|
41
41
|
import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./sensi/columns-definitions.js";
|
|
42
42
|
import { ACCURACY, ACTIVE, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./dynamic-margin-calculation/constants.js";
|
|
43
43
|
import { DynamicMarginCalculationInline } from "./dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
44
|
+
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./dynamic-security-analysis/constants.js";
|
|
45
|
+
import { DynamicSecurityAnalysisInline } from "./dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
44
46
|
export {
|
|
45
47
|
ACCURACY,
|
|
46
48
|
ACTIVE,
|
|
@@ -58,6 +60,8 @@ export {
|
|
|
58
60
|
COMPONENT_LIBRARY,
|
|
59
61
|
CONNECTED_MODE,
|
|
60
62
|
CONTINGENCIES,
|
|
63
|
+
CONTINGENCIES_LIST_INFOS,
|
|
64
|
+
CONTINGENCIES_START_TIME,
|
|
61
65
|
CONTINGENCY_LISTS,
|
|
62
66
|
CONTINGENCY_LISTS_INFOS,
|
|
63
67
|
COUNTRIES_TO_BALANCE,
|
|
@@ -78,6 +82,7 @@ export {
|
|
|
78
82
|
DIAGONAL_LABEL,
|
|
79
83
|
DISTRIBUTED_SLACK,
|
|
80
84
|
DynamicMarginCalculationInline,
|
|
85
|
+
DynamicSecurityAnalysisInline,
|
|
81
86
|
EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES,
|
|
82
87
|
EquipmentsSelectionType,
|
|
83
88
|
GENERAL,
|
|
@@ -165,6 +170,7 @@ export {
|
|
|
165
170
|
RATIO_TAP_CHANGER_TARGET_V,
|
|
166
171
|
REACTIVE_SLACKS_THRESHOLD,
|
|
167
172
|
READ_SLACK_BUS,
|
|
173
|
+
SCENARIO_DURATION,
|
|
168
174
|
SELECTION_TYPE,
|
|
169
175
|
SENSITIVITY_TYPES,
|
|
170
176
|
SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
|
|
@@ -12,6 +12,7 @@ import { ElementType } from "../../../utils/types/elementType.js";
|
|
|
12
12
|
import "../../../utils/types/equipmentType.js";
|
|
13
13
|
import "@mui/icons-material";
|
|
14
14
|
import "../../../utils/yupConfig.js";
|
|
15
|
+
import { DEFAULT_TIMEOUT_MS, IGNORE_SIGNAL } from "../../../services/utils.js";
|
|
15
16
|
import { updateParameter } from "../../../services/explore.js";
|
|
16
17
|
import "localized-countries";
|
|
17
18
|
import "localized-countries/data/fr";
|
|
@@ -63,6 +64,7 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
63
64
|
const [factorsCount, setFactorsCount] = useState(DEFAULT_FACTOR_COUNT);
|
|
64
65
|
const [isLoading, setIsLoading] = useState(false);
|
|
65
66
|
const [isSubmitAction, setIsSubmitAction] = useState(false);
|
|
67
|
+
const [factorCountParams, setFactorCountParams] = useState(null);
|
|
66
68
|
const emptyFormData = useMemo(() => {
|
|
67
69
|
return {
|
|
68
70
|
...getNameElementEditorEmptyFormData(name, description),
|
|
@@ -108,6 +110,7 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
108
110
|
const resetFactorsCount = useCallback(() => {
|
|
109
111
|
setIsLoading(false);
|
|
110
112
|
setFactorsCount(DEFAULT_FACTOR_COUNT);
|
|
113
|
+
setFactorCountParams(null);
|
|
111
114
|
}, []);
|
|
112
115
|
const updateFactorCount = useCallback(() => {
|
|
113
116
|
if (!currentNodeUuid || !currentRootNetworkUuid) {
|
|
@@ -132,23 +135,40 @@ const useSensitivityAnalysisParametersForm = ({
|
|
|
132
135
|
[PARAMETER_SENSI_PST]: filteredPst,
|
|
133
136
|
[PARAMETER_SENSI_NODES]: filteredNodes
|
|
134
137
|
};
|
|
138
|
+
setFactorCountParams(formatNewParams(filteredFormValues));
|
|
139
|
+
}, [currentNodeUuid, currentRootNetworkUuid, formatNewParams, getValues, resetFactorsCount]);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!factorCountParams || !currentNodeUuid || !currentRootNetworkUuid) {
|
|
142
|
+
return () => {
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
let loadingTimeoutId;
|
|
146
|
+
const controller = new AbortController();
|
|
147
|
+
const abortSignal = AbortSignal.any([controller.signal, AbortSignal.timeout(DEFAULT_TIMEOUT_MS)]);
|
|
135
148
|
setIsLoading(true);
|
|
136
149
|
getSensitivityAnalysisFactorsCount(
|
|
137
150
|
studyUuid,
|
|
138
151
|
currentNodeUuid,
|
|
139
152
|
currentRootNetworkUuid,
|
|
140
|
-
|
|
153
|
+
factorCountParams,
|
|
154
|
+
abortSignal
|
|
141
155
|
).then((factorsCountResponse) => {
|
|
142
156
|
setFactorsCount(factorsCountResponse);
|
|
143
|
-
|
|
157
|
+
loadingTimeoutId = setTimeout(() => {
|
|
144
158
|
setIsLoading(false);
|
|
145
159
|
}, 500);
|
|
146
|
-
return () => clearTimeout(timeoutId);
|
|
147
160
|
}).catch((error) => {
|
|
161
|
+
if (abortSignal.aborted && abortSignal.reason?.message === IGNORE_SIGNAL) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
148
164
|
setIsLoading(false);
|
|
149
165
|
snackWithFallback(snackError, error, { headerId: "getSensitivityAnalysisFactorsCountError" });
|
|
150
166
|
});
|
|
151
|
-
|
|
167
|
+
return () => {
|
|
168
|
+
controller?.abort(new Error(IGNORE_SIGNAL));
|
|
169
|
+
clearTimeout(loadingTimeoutId);
|
|
170
|
+
};
|
|
171
|
+
}, [snackError, studyUuid, currentRootNetworkUuid, currentNodeUuid, factorCountParams]);
|
|
152
172
|
const onFormChanged = useCallback(() => {
|
|
153
173
|
updateFactorCount();
|
|
154
174
|
}, [updateFactorCount]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Option } from '../../../utils';
|
|
3
|
+
export declare enum TYPES {
|
|
4
|
+
ENUM = "ENUM",
|
|
5
|
+
BOOL = "BOOL",
|
|
6
|
+
INTEGER = "INTEGER",
|
|
7
|
+
FLOAT = "FLOAT",
|
|
8
|
+
STRING = "STRING"
|
|
9
|
+
}
|
|
10
|
+
export type DefParam = {
|
|
11
|
+
type: TYPES;
|
|
12
|
+
label: string;
|
|
13
|
+
options?: Option[];
|
|
14
|
+
render?: (defParam: DefParam, path: string, key: string) => ReactElement;
|
|
15
|
+
};
|
|
16
|
+
export declare const makeComponent: (defParam: DefParam, path: string, key: string) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const makeComponents: (defParams: Record<string, DefParam>, path: string) => import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "@mui/material";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { parametersStyles } from "./styles.js";
|
|
5
|
+
import { LineSeparator } from "../common/line-separator.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "../../../utils/conversionUtils.js";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import "@mui/icons-material";
|
|
10
|
+
import "../../../utils/yupConfig.js";
|
|
11
|
+
import "localized-countries";
|
|
12
|
+
import "localized-countries/data/fr";
|
|
13
|
+
import "localized-countries/data/en";
|
|
14
|
+
import "notistack";
|
|
15
|
+
import "react-hook-form";
|
|
16
|
+
import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
17
|
+
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
18
|
+
import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
19
|
+
import "../../treeViewFinder/TreeViewFinder.js";
|
|
20
|
+
import "../../overflowableText/OverflowableText.js";
|
|
21
|
+
import "yup";
|
|
22
|
+
import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
23
|
+
import "../../customAGGrid/customAggrid.js";
|
|
24
|
+
import "ag-grid-community";
|
|
25
|
+
import "react-papaparse";
|
|
26
|
+
import "react-csv-downloader";
|
|
27
|
+
import { SwitchInput } from "../../inputs/reactHookForm/booleans/SwitchInput.js";
|
|
28
|
+
import { FloatInput } from "../../inputs/reactHookForm/numbers/FloatInput.js";
|
|
29
|
+
import { IntegerInput } from "../../inputs/reactHookForm/numbers/IntegerInput.js";
|
|
30
|
+
import "../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
31
|
+
import { SelectInput } from "../../inputs/reactHookForm/selectInputs/SelectInput.js";
|
|
32
|
+
import { TextInput } from "../../inputs/reactHookForm/text/TextInput.js";
|
|
33
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
34
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
35
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
36
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
37
|
+
import "@react-querybuilder/material";
|
|
38
|
+
import "../../filter/expert/expertFilterConstants.js";
|
|
39
|
+
import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
40
|
+
import "uuid";
|
|
41
|
+
import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
|
|
42
|
+
import "react-querybuilder";
|
|
43
|
+
import "../common/widget/parameter-line-slider.js";
|
|
44
|
+
import "../common/limitreductions/columns-definitions.js";
|
|
45
|
+
import "../common/contingency-table/columns-definitions.js";
|
|
46
|
+
var TYPES = /* @__PURE__ */ ((TYPES2) => {
|
|
47
|
+
TYPES2["ENUM"] = "ENUM";
|
|
48
|
+
TYPES2["BOOL"] = "BOOL";
|
|
49
|
+
TYPES2["INTEGER"] = "INTEGER";
|
|
50
|
+
TYPES2["FLOAT"] = "FLOAT";
|
|
51
|
+
TYPES2["STRING"] = "STRING";
|
|
52
|
+
return TYPES2;
|
|
53
|
+
})(TYPES || {});
|
|
54
|
+
const defaultParamRender = (defParam, path, key) => {
|
|
55
|
+
switch (defParam.type) {
|
|
56
|
+
case "ENUM":
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
SelectInput,
|
|
59
|
+
{
|
|
60
|
+
name: `${path}.${key}`,
|
|
61
|
+
label: "",
|
|
62
|
+
options: defParam?.options ?? [],
|
|
63
|
+
fullWidth: true,
|
|
64
|
+
size: "small"
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
case "BOOL":
|
|
68
|
+
return /* @__PURE__ */ jsx(SwitchInput, { name: `${path}.${key}`, label: "" });
|
|
69
|
+
case "INTEGER":
|
|
70
|
+
return /* @__PURE__ */ jsx(IntegerInput, { name: `${path}.${key}`, label: "" });
|
|
71
|
+
case "FLOAT":
|
|
72
|
+
return /* @__PURE__ */ jsx(FloatInput, { name: `${path}.${key}`, label: "" });
|
|
73
|
+
case "STRING":
|
|
74
|
+
return /* @__PURE__ */ jsx(TextInput, { name: `${path}.${key}`, label: "" });
|
|
75
|
+
default:
|
|
76
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const makeComponent = (defParam, path, key) => {
|
|
80
|
+
const render = defParam?.render ?? defaultParamRender;
|
|
81
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 8, sx: parametersStyles.parameterName, children: /* @__PURE__ */ jsx(FormattedMessage, { id: defParam.label }) }),
|
|
83
|
+
/* @__PURE__ */ jsx(Grid, { item: true, container: true, xs: 4, sx: parametersStyles.controlItem, children: render(defParam, path, key) })
|
|
84
|
+
] });
|
|
85
|
+
};
|
|
86
|
+
const makeComponents = (defParams, path) => {
|
|
87
|
+
return Object.keys(defParams).map((key) => /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, paddingTop: 1, children: [
|
|
88
|
+
makeComponent(defParams[key], path, key),
|
|
89
|
+
/* @__PURE__ */ jsx(LineSeparator, {})
|
|
90
|
+
] }, key));
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
TYPES,
|
|
94
|
+
makeComponent,
|
|
95
|
+
makeComponents
|
|
96
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const parametersStyles: {
|
|
3
|
+
readonly parameterName: (theme: Theme) => {
|
|
4
|
+
fontWeight: string;
|
|
5
|
+
marginTop: string;
|
|
6
|
+
};
|
|
7
|
+
readonly scrollableGrid: (theme: Theme) => {
|
|
8
|
+
overflowY: "auto";
|
|
9
|
+
overflowX: "hidden";
|
|
10
|
+
maxHeight: string;
|
|
11
|
+
paddingRight: string;
|
|
12
|
+
paddingTop: string;
|
|
13
|
+
paddingBottom: string;
|
|
14
|
+
flexGrow: number;
|
|
15
|
+
};
|
|
16
|
+
readonly controlItem: {
|
|
17
|
+
readonly justifyContent: "flex-end";
|
|
18
|
+
readonly flexGrow: 1;
|
|
19
|
+
};
|
|
20
|
+
readonly controlParametersItem: {
|
|
21
|
+
readonly justifyContent: "flex-start";
|
|
22
|
+
readonly flexGrow: 1;
|
|
23
|
+
readonly height: "fit-content";
|
|
24
|
+
readonly paddingBottom: 4;
|
|
25
|
+
};
|
|
26
|
+
readonly marginTopButton: {
|
|
27
|
+
readonly marginTop: "10px";
|
|
28
|
+
readonly position: "sticky";
|
|
29
|
+
readonly bottom: 0;
|
|
30
|
+
};
|
|
31
|
+
readonly panel: (theme: Theme) => {
|
|
32
|
+
marginTop: string;
|
|
33
|
+
marginBottom: string;
|
|
34
|
+
};
|
|
35
|
+
readonly title: (theme: Theme) => {
|
|
36
|
+
padding: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const parametersStyles = {
|
|
2
|
+
parameterName: (theme) => ({
|
|
3
|
+
fontWeight: "bold",
|
|
4
|
+
marginTop: theme.spacing(1)
|
|
5
|
+
}),
|
|
6
|
+
scrollableGrid: (theme) => ({
|
|
7
|
+
overflowY: "auto",
|
|
8
|
+
overflowX: "hidden",
|
|
9
|
+
maxHeight: "85%",
|
|
10
|
+
// TODO This needs to be refactored
|
|
11
|
+
paddingRight: theme.spacing(2),
|
|
12
|
+
paddingTop: theme.spacing(2),
|
|
13
|
+
paddingBottom: theme.spacing(1),
|
|
14
|
+
flexGrow: 1
|
|
15
|
+
}),
|
|
16
|
+
controlItem: {
|
|
17
|
+
justifyContent: "flex-end",
|
|
18
|
+
flexGrow: 1
|
|
19
|
+
},
|
|
20
|
+
controlParametersItem: {
|
|
21
|
+
justifyContent: "flex-start",
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
height: "fit-content",
|
|
24
|
+
paddingBottom: 4
|
|
25
|
+
},
|
|
26
|
+
marginTopButton: {
|
|
27
|
+
marginTop: "10px",
|
|
28
|
+
position: "sticky",
|
|
29
|
+
bottom: 0
|
|
30
|
+
},
|
|
31
|
+
panel: (theme) => ({
|
|
32
|
+
marginTop: theme.spacing(2),
|
|
33
|
+
marginBottom: theme.spacing(1)
|
|
34
|
+
}),
|
|
35
|
+
title: (theme) => ({
|
|
36
|
+
padding: theme.spacing(2)
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
parametersStyles
|
|
41
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,8 @@ import { SensitivityAnalysisParametersDialog } from "./components/parameters/sen
|
|
|
180
180
|
import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./components/parameters/sensi/columns-definitions.js";
|
|
181
181
|
import { ACCURACY, ACTIVE, CALCULATION_TYPE, LOADS_VARIATIONS, LOAD_FILTERS, LOAD_INCREASE_START_TIME, LOAD_INCREASE_STOP_TIME, LOAD_MODELS_RULE, MARGIN_CALCULATION_START_TIME, START_TIME, STOP_TIME, VARIATION } from "./components/parameters/dynamic-margin-calculation/constants.js";
|
|
182
182
|
import { DynamicMarginCalculationInline } from "./components/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js";
|
|
183
|
+
import { CONTINGENCIES_LIST_INFOS, CONTINGENCIES_START_TIME, SCENARIO_DURATION } from "./components/parameters/dynamic-security-analysis/constants.js";
|
|
184
|
+
import { DynamicSecurityAnalysisInline } from "./components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js";
|
|
183
185
|
import { CustomMenuItem, CustomNestedMenuItem } from "./components/menus/custom-nested-menu.js";
|
|
184
186
|
import { OverflowableTableCell } from "./components/muiTable/OverflowableTableCell.js";
|
|
185
187
|
import { OverflowableTableCellWithCheckbox } from "./components/muiTable/OverflowableTableCellWithCheckbox.js";
|
|
@@ -225,11 +227,12 @@ import { fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSec
|
|
|
225
227
|
import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, setStudyNetworkVisualizationParameters, updateVoltageInitParameters } from "./services/study.js";
|
|
226
228
|
import { getNetworkVisualizationsParameters } from "./services/study-config.js";
|
|
227
229
|
import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
|
|
228
|
-
import { backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList, handleNotOkResponse, parseError, safeEncodeURIComponent } from "./services/utils.js";
|
|
230
|
+
import { DEFAULT_TIMEOUT_MS, IGNORE_SIGNAL, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList, handleNotOkResponse, parseError, safeEncodeURIComponent } from "./services/utils.js";
|
|
229
231
|
import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
|
|
230
232
|
import { fetchShortCircuitParameters, getShortCircuitSpecificParametersDescription, updateShortCircuitParameters } from "./services/short-circuit-analysis.js";
|
|
231
233
|
import { fetchBusBarSectionsForNewCoupler, fetchNetworkModification, updateModification } from "./services/networkModification.js";
|
|
232
234
|
import { fetchDynamicMarginCalculationParameters, fetchDynamicMarginCalculationProviders, updateDynamicMarginCalculationParameters } from "./services/dynamic-margin-calculation.js";
|
|
235
|
+
import { fetchContingencyAndFiltersLists, fetchDynamicSecurityAnalysisProviders } from "./services/dynamic-security-analysis.js";
|
|
233
236
|
import { equalsArray } from "./utils/algos.js";
|
|
234
237
|
import { ActivePowerAdornment, AmpereAdornment, KiloAmpereAdornment, KilometerAdornment, MVAPowerAdornment, MicroSusceptanceAdornment, OhmAdornment, PercentageAdornment, ReactivePowerAdornment, SusceptanceAdornment, VoltageAdornment } from "./utils/constants/adornments.js";
|
|
235
238
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
@@ -368,6 +371,8 @@ export {
|
|
|
368
371
|
COMPONENT_LIBRARY,
|
|
369
372
|
CONNECTED_MODE,
|
|
370
373
|
CONTINGENCIES,
|
|
374
|
+
CONTINGENCIES_LIST_INFOS,
|
|
375
|
+
CONTINGENCIES_START_TIME,
|
|
371
376
|
CONTINGENCY_LISTS,
|
|
372
377
|
CONTINGENCY_LISTS_INFOS,
|
|
373
378
|
CONTINGENCY_LIST_EQUIPMENTS,
|
|
@@ -415,6 +420,7 @@ export {
|
|
|
415
420
|
DEFAULT_RANGE_VALUE,
|
|
416
421
|
DEFAULT_REACTIVE_SLACKS_THRESHOLD,
|
|
417
422
|
DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
423
|
+
DEFAULT_TIMEOUT_MS,
|
|
418
424
|
DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
419
425
|
DEGREE,
|
|
420
426
|
DESCRIPTION,
|
|
@@ -438,6 +444,7 @@ export {
|
|
|
438
444
|
DndTableBottomLeftButtons,
|
|
439
445
|
DndTableBottomRightButtons,
|
|
440
446
|
DynamicMarginCalculationInline,
|
|
447
|
+
DynamicSecurityAnalysisInline,
|
|
441
448
|
ENERGY_SOURCE_OPTIONS,
|
|
442
449
|
EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES,
|
|
443
450
|
EXPERT_FILTER_EQUIPMENTS,
|
|
@@ -495,6 +502,7 @@ export {
|
|
|
495
502
|
Hvdc,
|
|
496
503
|
HvdcType,
|
|
497
504
|
ID,
|
|
505
|
+
IGNORE_SIGNAL,
|
|
498
506
|
INJECTIONS_EQUIPMENT_TYPES,
|
|
499
507
|
INJECTION_DISTRIBUTION_TYPES,
|
|
500
508
|
INTL_LINE_FLOW_MODE_OPTIONS,
|
|
@@ -663,6 +671,7 @@ export {
|
|
|
663
671
|
RemoveButton,
|
|
664
672
|
ResizeHandle,
|
|
665
673
|
RuleValueEditor,
|
|
674
|
+
SCENARIO_DURATION,
|
|
666
675
|
SEARCH_EQUIPMENTS,
|
|
667
676
|
SELECTED,
|
|
668
677
|
SELECTION_TYPE,
|
|
@@ -842,6 +851,7 @@ export {
|
|
|
842
851
|
fetchBusBarSectionsForNewCoupler,
|
|
843
852
|
fetchConfigParameter,
|
|
844
853
|
fetchConfigParameters,
|
|
854
|
+
fetchContingencyAndFiltersLists,
|
|
845
855
|
fetchCsvSeparator,
|
|
846
856
|
fetchCurrentAnnouncement,
|
|
847
857
|
fetchDefaultCountry,
|
|
@@ -849,6 +859,7 @@ export {
|
|
|
849
859
|
fetchDirectoryElementPath,
|
|
850
860
|
fetchDynamicMarginCalculationParameters,
|
|
851
861
|
fetchDynamicMarginCalculationProviders,
|
|
862
|
+
fetchDynamicSecurityAnalysisProviders,
|
|
852
863
|
fetchElementsInfos,
|
|
853
864
|
fetchEnv,
|
|
854
865
|
fetchFavoriteAndDefaultCountries,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getRequestParamFromList, backendFetchJson } from "./utils.js";
|
|
2
|
+
const PREFIX_DYNAMIC_SECURITY_ANALYSIS_SERVER_QUERIES = `${"api/gateway"}/dynamic-security-analysis`;
|
|
3
|
+
const PREFIX_DIRECTORY_SERVER_QUERIES = `${"api/gateway"}/directory`;
|
|
4
|
+
function fetchContingencyAndFiltersLists(listIds) {
|
|
5
|
+
console.info("Fetching contingency and filters lists");
|
|
6
|
+
const idsParams = getRequestParamFromList(
|
|
7
|
+
"ids",
|
|
8
|
+
listIds.filter((id) => id)
|
|
9
|
+
// filter falsy elements
|
|
10
|
+
);
|
|
11
|
+
const urlSearchParams = new URLSearchParams(idsParams);
|
|
12
|
+
urlSearchParams.append("strictMode", "false");
|
|
13
|
+
const url = `${PREFIX_DIRECTORY_SERVER_QUERIES}/v1/elements?${urlSearchParams}`;
|
|
14
|
+
console.debug(url);
|
|
15
|
+
return backendFetchJson(url);
|
|
16
|
+
}
|
|
17
|
+
function getDynamicSecurityAnalysisUrl() {
|
|
18
|
+
return `${PREFIX_DYNAMIC_SECURITY_ANALYSIS_SERVER_QUERIES}/v1/`;
|
|
19
|
+
}
|
|
20
|
+
function fetchDynamicSecurityAnalysisProviders() {
|
|
21
|
+
console.info("fetch dynamic security analysis providers");
|
|
22
|
+
const url = `${getDynamicSecurityAnalysisUrl()}providers`;
|
|
23
|
+
console.debug(url);
|
|
24
|
+
return backendFetchJson(url);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
fetchContingencyAndFiltersLists,
|
|
28
|
+
fetchDynamicSecurityAnalysisProviders
|
|
29
|
+
};
|
package/dist/services/index.d.ts
CHANGED