@gridsuite/commons-ui 0.109.1 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/components/index.js +9 -2
  2. package/dist/components/inputs/index.js +3 -2
  3. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +0 -2
  4. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -5
  5. package/dist/components/inputs/reactHookForm/constants.d.ts +8 -0
  6. package/dist/components/inputs/reactHookForm/constants.js +6 -0
  7. package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
  8. package/dist/components/inputs/reactHookForm/index.js +3 -2
  9. package/dist/components/parameters/common/index.js +2 -0
  10. package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +1 -1
  11. package/dist/components/parameters/common/limitreductions/columns-definitions.js +3 -1
  12. package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +4 -3
  13. package/dist/components/parameters/common/parameters-edition-dialog-props.d.ts +4 -0
  14. package/dist/components/parameters/common/parameters-edition-dialog-props.js +14 -1
  15. package/dist/components/parameters/index.d.ts +1 -0
  16. package/dist/components/parameters/index.js +6 -0
  17. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
  18. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +1 -1
  19. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -1
  20. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +34 -4
  21. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +4 -2
  22. package/dist/components/parameters/network-visualizations/map-parameters.js +1 -1
  23. package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +1 -1
  24. package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -3
  25. package/dist/components/parameters/security-analysis/index.d.ts +8 -0
  26. package/dist/components/parameters/security-analysis/index.js +6 -0
  27. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.d.ts +2 -0
  28. package/dist/components/parameters/security-analysis/security-analysis-parameters-dialog.js +107 -0
  29. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.d.ts +8 -0
  30. package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +139 -0
  31. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.d.ts +10 -0
  32. package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +197 -0
  33. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.d.ts +7 -0
  34. package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +84 -0
  35. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.d.ts +7 -0
  36. package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +138 -0
  37. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.d.ts +24 -0
  38. package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +162 -0
  39. package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -4
  40. package/dist/components/parameters/voltage-init/general-parameters.js +1 -1
  41. package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -3
  42. package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +2 -1
  43. package/dist/hooks/use-parameters-backend.d.ts +1 -1
  44. package/dist/index.js +20 -2
  45. package/dist/services/index.d.ts +1 -0
  46. package/dist/services/index.js +11 -0
  47. package/dist/services/security-analysis.d.ts +11 -0
  48. package/dist/services/security-analysis.js +91 -0
  49. package/dist/translations/en/parameters.d.ts +8 -0
  50. package/dist/translations/en/parameters.js +9 -1
  51. package/dist/translations/fr/parameters.d.ts +8 -0
  52. package/dist/translations/fr/parameters.js +9 -1
  53. package/package.json +1 -1
@@ -0,0 +1,162 @@
1
+ import { useForm } from "react-hook-form";
2
+ import { useState, useMemo, useCallback, useEffect } from "react";
3
+ import { yupResolver } from "@hookform/resolvers/yup";
4
+ import "../../../utils/conversionUtils.js";
5
+ import "react/jsx-runtime";
6
+ import "@mui/icons-material";
7
+ import { ElementType } from "../../../utils/types/elementType.js";
8
+ import "../../../utils/types/equipmentType.js";
9
+ import "../../../utils/yupConfig.js";
10
+ import { PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER } from "../common/constant.js";
11
+ import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
12
+ import "@mui/material";
13
+ import "react-intl";
14
+ import { updateParameter } from "../../../services/explore.js";
15
+ import "localized-countries";
16
+ import "localized-countries/data/fr";
17
+ import "localized-countries/data/en";
18
+ import "notistack";
19
+ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
20
+ import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
21
+ import "../../dialogs/elementSaveDialog/ElementSaveDialog.js";
22
+ import "../../treeViewFinder/TreeViewFinder.js";
23
+ import "yup";
24
+ import "../../overflowableText/OverflowableText.js";
25
+ import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
26
+ import "../../customAGGrid/customAggrid.js";
27
+ import "ag-grid-community";
28
+ import "react-papaparse";
29
+ import "react-csv-downloader";
30
+ import "../../inputs/reactHookForm/numbers/RangeInput.js";
31
+ import "@react-querybuilder/material";
32
+ import "../../filter/expert/expertFilterConstants.js";
33
+ import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
34
+ import "uuid";
35
+ import "../../inputs/reactQueryBuilder/PropertyValueEditor.js";
36
+ import "react-querybuilder";
37
+ import "../common/widget/parameter-line-slider.js";
38
+ import { getSAParametersFromSchema, LIMIT_REDUCTIONS_FORM, IST_FORM, LIMIT_DURATION_FORM } from "../common/limitreductions/columns-definitions.js";
39
+ import { toFormValuesLimitReductions, toFormValueSaParameters } from "../common/limitreductions/limit-reductions-form-util.js";
40
+ import "../../filter/HeaderFilterForm.js";
41
+ import { getNameElementEditorEmptyFormData } from "../common/name-element-editor/name-element-editor-utils.js";
42
+ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, name, description) => {
43
+ const [providers, provider, , , , params, , updateParameters, , , defaultLimitReductions] = parametersBackend;
44
+ const [currentProvider, setCurrentProvider] = useState(params == null ? void 0 : params.provider);
45
+ const formattedProviders = useMemo(() => {
46
+ return Object.entries(providers).filter(([key]) => !key.includes("DynaFlow")).map(([key, value]) => ({
47
+ id: key,
48
+ label: value
49
+ }));
50
+ }, [providers]);
51
+ const paramsLoaded = useMemo(() => !!params && !!currentProvider, [currentProvider, params]);
52
+ const formSchema = useMemo(() => {
53
+ return getSAParametersFromSchema(name, params == null ? void 0 : params.limitReductions);
54
+ }, [name, params == null ? void 0 : params.limitReductions]);
55
+ const formMethods = useForm({
56
+ defaultValues: {
57
+ ...getNameElementEditorEmptyFormData(name, description),
58
+ [PARAM_SA_PROVIDER]: provider,
59
+ [LIMIT_REDUCTIONS_FORM]: [],
60
+ [PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: null,
61
+ [PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: null,
62
+ [PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: null,
63
+ [PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: null,
64
+ [PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: null
65
+ },
66
+ resolver: yupResolver(formSchema)
67
+ });
68
+ const { reset, watch } = formMethods;
69
+ const watchProvider = watch("provider");
70
+ const toLimitReductions = useCallback(
71
+ (formLimits) => {
72
+ if (!(params == null ? void 0 : params.limitReductions)) {
73
+ return [];
74
+ }
75
+ return params.limitReductions.map((vlLimits, indexVl) => {
76
+ const vlLNewLimits = {
77
+ ...vlLimits,
78
+ permanentLimitReduction: formLimits[indexVl][IST_FORM]
79
+ };
80
+ vlLimits.temporaryLimitReductions.forEach((temporaryLimit, index) => {
81
+ vlLNewLimits.temporaryLimitReductions[index] = {
82
+ ...temporaryLimit,
83
+ reduction: formLimits[indexVl][LIMIT_DURATION_FORM + index]
84
+ };
85
+ });
86
+ return vlLNewLimits;
87
+ });
88
+ },
89
+ [params == null ? void 0 : params.limitReductions]
90
+ );
91
+ const formatNewParams = useCallback(
92
+ (formData) => {
93
+ return {
94
+ [PARAM_SA_PROVIDER]: formData[PARAM_SA_PROVIDER],
95
+ [PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] / 100,
96
+ [PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD] / 100,
97
+ [PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD]: formData[PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD],
98
+ [PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD]: formData[PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD] / 100,
99
+ [PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD]: formData[PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD],
100
+ limitReductions: toLimitReductions(formData[LIMIT_REDUCTIONS_FORM])
101
+ };
102
+ },
103
+ [toLimitReductions]
104
+ );
105
+ const onSaveInline = useCallback(
106
+ (formData) => {
107
+ updateParameters(formatNewParams(formData));
108
+ },
109
+ [updateParameters, formatNewParams]
110
+ );
111
+ const onSaveDialog = useCallback(
112
+ (formData) => {
113
+ if (parametersUuid) {
114
+ updateParameter(
115
+ parametersUuid,
116
+ formatNewParams(formData),
117
+ formData[NAME],
118
+ ElementType.SECURITY_ANALYSIS_PARAMETERS,
119
+ formData[DESCRIPTION] ?? ""
120
+ );
121
+ }
122
+ },
123
+ [parametersUuid, formatNewParams]
124
+ );
125
+ useEffect(() => {
126
+ if (watchProvider !== currentProvider) {
127
+ setCurrentProvider(watchProvider);
128
+ if (watchProvider !== void 0 && currentProvider !== void 0) {
129
+ if (params !== null) {
130
+ params.limitReductions = defaultLimitReductions;
131
+ }
132
+ formMethods.setValue(
133
+ LIMIT_REDUCTIONS_FORM,
134
+ toFormValuesLimitReductions(defaultLimitReductions)[LIMIT_REDUCTIONS_FORM]
135
+ );
136
+ }
137
+ }
138
+ }, [watchProvider, currentProvider, formMethods, setCurrentProvider, defaultLimitReductions, params]);
139
+ useEffect(() => {
140
+ if (!params) {
141
+ return;
142
+ }
143
+ reset(toFormValueSaParameters(params));
144
+ }, [paramsLoaded, params, reset]);
145
+ return {
146
+ formMethods,
147
+ formSchema,
148
+ formattedProviders,
149
+ defaultLimitReductions,
150
+ toFormValueSaParameters,
151
+ formatNewParams,
152
+ params,
153
+ currentProvider,
154
+ setCurrentProvider,
155
+ paramsLoaded,
156
+ onSaveInline,
157
+ onSaveDialog
158
+ };
159
+ };
160
+ export {
161
+ useSecurityAnalysisParametersForm
162
+ };
@@ -16,7 +16,9 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
16
16
  import "@mui/icons-material";
17
17
  import * as yup from "yup";
18
18
  import "../../overflowableText/OverflowableText.js";
19
- import { DESCRIPTION_INPUT, NAME } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
19
+ import { ElementType } from "../../../utils/types/elementType.js";
20
+ import "../../treeViewFinder/TreeViewFinder.js";
21
+ import { DESCRIPTION, NAME } from "../../inputs/reactHookForm/constants.js";
20
22
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
21
23
  import "../../customAGGrid/customAggrid.js";
22
24
  import "ag-grid-community";
@@ -24,7 +26,6 @@ import "react-papaparse";
24
26
  import "react-csv-downloader";
25
27
  import "../../inputs/reactHookForm/numbers/RangeInput.js";
26
28
  import "../../../utils/conversionUtils.js";
27
- import { ElementType } from "../../../utils/types/elementType.js";
28
29
  import "@react-querybuilder/material";
29
30
  import "../../filter/expert/expertFilterConstants.js";
30
31
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -96,7 +97,7 @@ const useShortCircuitParametersForm = ({
96
97
  const {
97
98
  predefinedParameters: omit,
98
99
  [NAME]: omit2,
99
- [DESCRIPTION_INPUT]: omit3,
100
+ [DESCRIPTION]: omit3,
100
101
  ...newParametersWithoutPredefinedParameters
101
102
  } = newParameters;
102
103
  let parameters = {
@@ -168,7 +169,7 @@ const useShortCircuitParametersForm = ({
168
169
  prepareDataToSend(shortCircuitParameters, formData),
169
170
  formData[NAME],
170
171
  ElementType.SHORT_CIRCUIT_PARAMETERS,
171
- formData[DESCRIPTION_INPUT] ?? ""
172
+ formData[DESCRIPTION] ?? ""
172
173
  ).catch((error) => {
173
174
  snackError({
174
175
  messageTxt: error.message,
@@ -5,6 +5,7 @@ import { FormattedMessage } from "react-intl";
5
5
  import { Grid, Alert, Box } from "@mui/material";
6
6
  import { GENERAL, GENERAL_APPLY_MODIFICATIONS, UPDATE_BUS_VOLTAGE, REACTIVE_SLACKS_THRESHOLD, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD } from "./constants.js";
7
7
  import { ReactivePowerAdornment } from "../common/constant.js";
8
+ import "../../../utils/yupConfig.js";
8
9
  import { LineSeparator } from "../common/line-separator.js";
9
10
  import { parametersStyles } from "../parameters-style.js";
10
11
  import "../../../utils/types/equipmentType.js";
@@ -26,7 +27,6 @@ import "react-papaparse";
26
27
  import "react-csv-downloader";
27
28
  import "../../inputs/reactHookForm/numbers/RangeInput.js";
28
29
  import "../../../utils/conversionUtils.js";
29
- import "../../../utils/yupConfig.js";
30
30
  import "@react-querybuilder/material";
31
31
  import "../../filter/expert/expertFilterConstants.js";
32
32
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -17,7 +17,9 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
17
17
  import "@mui/icons-material";
18
18
  import * as yup from "yup";
19
19
  import "../../overflowableText/OverflowableText.js";
20
- import { NAME, DESCRIPTION_INPUT } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
20
+ import { ElementType } from "../../../utils/types/elementType.js";
21
+ import "../../treeViewFinder/TreeViewFinder.js";
22
+ import { NAME, DESCRIPTION } from "../../inputs/reactHookForm/constants.js";
21
23
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
22
24
  import "../../customAGGrid/customAggrid.js";
23
25
  import "ag-grid-community";
@@ -25,7 +27,6 @@ import "react-papaparse";
25
27
  import "react-csv-downloader";
26
28
  import "../../inputs/reactHookForm/numbers/RangeInput.js";
27
29
  import { isBlankOrEmpty } from "../../../utils/conversionUtils.js";
28
- import { ElementType } from "../../../utils/types/elementType.js";
29
30
  import "@react-querybuilder/material";
30
31
  import "../../filter/expert/expertFilterConstants.js";
31
32
  import "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
@@ -167,7 +168,7 @@ const useVoltageInitParametersForm = ({
167
168
  fromVoltageInitParametersFormToParamValues(formData).computationParameters,
168
169
  formData[NAME],
169
170
  ElementType.VOLTAGE_INIT_PARAMETERS,
170
- formData[DESCRIPTION_INPUT] ?? ""
171
+ formData[DESCRIPTION] ?? ""
171
172
  ).catch((error) => {
172
173
  snackError({
173
174
  messageTxt: error.message,
@@ -14,7 +14,8 @@ import "../../inputs/reactHookForm/provider/CustomFormProvider.js";
14
14
  import "@mui/icons-material";
15
15
  import "yup";
16
16
  import "../../overflowableText/OverflowableText.js";
17
- import { NAME } from "../../inputs/reactHookForm/DirectoryItemsInput.js";
17
+ import "../../treeViewFinder/TreeViewFinder.js";
18
+ import { NAME } from "../../inputs/reactHookForm/constants.js";
18
19
  import "../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
19
20
  import "../../customAGGrid/customAggrid.js";
20
21
  import "ag-grid-community";
@@ -8,4 +8,4 @@ export declare enum OptionalServicesStatus {
8
8
  Down = "DOWN",
9
9
  Pending = "PENDING"
10
10
  }
11
- export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined, backendFetchProviders: () => Promise<string[]>, backendFetchProvider: ((studyUuid: UUID) => Promise<string>) | null, backendFetchDefaultProvider: () => Promise<string>, backendUpdateProvider: ((studyUuid: UUID, newProvider: string) => Promise<void>) | null, backendFetchParameters: (studyUuid: UUID) => Promise<ParametersInfos<T>>, backendUpdateParameters?: (studyUuid: UUID, newParam: ParametersInfos<T> | null) => Promise<any>, backendFetchSpecificParametersDescription?: () => Promise<SpecificParametersInfos>, backendFetchDefaultLimitReductions?: () => Promise<ILimitReductionsByVoltageLevel[]>) => UseParametersBackendReturnProps<T>;
11
+ export declare const useParametersBackend: <T extends ComputingType>(user: User | null, studyUuid: UUID | null, type: T, optionalServiceStatus: OptionalServicesStatus | undefined, backendFetchProviders: () => Promise<string[]>, backendFetchProvider: ((studyUuid: UUID) => Promise<string>) | null, backendFetchDefaultProvider: () => Promise<string>, backendUpdateProvider: ((studyUuid: UUID, newProvider: string) => Promise<any>) | null, backendFetchParameters: (studyUuid: UUID) => Promise<ParametersInfos<T>>, backendUpdateParameters?: (studyUuid: UUID, newParam: ParametersInfos<T> | null) => Promise<any>, backendFetchSpecificParametersDescription?: () => Promise<SpecificParametersInfos>, backendFetchDefaultLimitReductions?: () => Promise<ILimitReductionsByVoltageLevel[]>) => UseParametersBackendReturnProps<T>;
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import "@mui/material";
54
54
  import "react-intl";
55
55
  import { SelectClearable } from "./components/inputs/SelectClearable.js";
56
56
  import { ChipItemsInput } from "./components/inputs/reactHookForm/chip-items-input.js";
57
- import { DESCRIPTION_INPUT, DirectoryItemsInput, NAME } from "./components/inputs/reactHookForm/DirectoryItemsInput.js";
57
+ import { DirectoryItemsInput } from "./components/inputs/reactHookForm/DirectoryItemsInput.js";
58
58
  import { RawReadOnlyInput } from "./components/inputs/reactHookForm/RawReadOnlyInput.js";
59
59
  import { BottomRightButtons } from "./components/inputs/reactHookForm/agGridTable/BottomRightButtons.js";
60
60
  import { CustomAgGridTable } from "./components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
@@ -92,6 +92,7 @@ import { SubmitButton } from "./components/inputs/reactHookForm/utils/SubmitButt
92
92
  import { TextFieldWithAdornment } from "./components/inputs/reactHookForm/utils/TextFieldWithAdornment.js";
93
93
  import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./components/inputs/reactHookForm/utils/functions.js";
94
94
  import { HelperPreviousValue } from "./components/inputs/reactHookForm/utils/HelperPreviousValue.js";
95
+ import { DESCRIPTION, NAME } from "./components/inputs/reactHookForm/constants.js";
95
96
  import { AddButton } from "./components/inputs/reactQueryBuilder/AddButton.js";
96
97
  import { AutocompleteWithFavorites } from "./components/inputs/reactQueryBuilder/AutocompleteWithFavorites.js";
97
98
  import { CombinatorSelector } from "./components/inputs/reactQueryBuilder/CombinatorSelector.js";
@@ -126,6 +127,7 @@ import { LeftPanelCloseIcon } from "./components/icons/LeftPanelCloseIcon.js";
126
127
  import { DeviceHubIcon } from "./components/icons/DeviceHubIcon.js";
127
128
  import { ComputingType, formatComputingTypeLabel, isValidComputingType } from "./components/parameters/common/computing-type.js";
128
129
  import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, VOLTAGE_LEVEL, VoltageAdornment } from "./components/parameters/common/constant.js";
130
+ import { getDialogParametersFormSchema } from "./components/parameters/common/parameters-edition-dialog-props.js";
129
131
  import { LineSeparator } from "./components/parameters/common/line-separator.js";
130
132
  import { LabelledButton, SwitchWithLabel, TabPanel } from "./components/parameters/common/parameters.js";
131
133
  import { CreateParameterDialog } from "./components/parameters/common/parameters-creation-dialog.js";
@@ -158,6 +160,8 @@ import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD,
158
160
  import { EquipmentsSelectionType } from "./components/parameters/voltage-init/voltage-init.type.js";
159
161
  import { VoltageInitParametersEditionDialog } from "./components/parameters/voltage-init/voltage-init-parameters-dialog.js";
160
162
  import { VoltageInitParametersInLine } from "./components/parameters/voltage-init/voltage-init-parameters-inline.js";
163
+ import { SecurityAnalysisParametersInline } from "./components/parameters/security-analysis/security-analysis-parameters-inline.js";
164
+ import { SecurityAnalysisParametersDialog } from "./components/parameters/security-analysis/security-analysis-parameters-dialog.js";
161
165
  import { CustomMenuItem, CustomNestedMenuItem } from "./components/menus/custom-nested-menu.js";
162
166
  import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
163
167
  import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
@@ -183,6 +187,7 @@ import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizat
183
187
  import { getNetworkVisualizationsParameters } from "./services/study-config.js";
184
188
  import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
185
189
  import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
190
+ import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
186
191
  import { equalsArray } from "./utils/algos.js";
187
192
  import { FetchStatus } from "./utils/constants/fetchStatus.js";
188
193
  import { FieldConstants } from "./utils/constants/fieldConstants.js";
@@ -319,7 +324,7 @@ export {
319
324
  DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
320
325
  DEFAULT_UPDATE_BUS_VOLTAGE,
321
326
  DEGREE,
322
- DESCRIPTION_INPUT,
327
+ DESCRIPTION,
323
328
  DIAGONAL_LABEL,
324
329
  DISTRIBUTED_SLACK,
325
330
  DISTRIBUTION_KEY,
@@ -536,6 +541,8 @@ export {
536
541
  SUBSTATION_LAYOUT,
537
542
  SVAR_REGULATION_MODE_OPTIONS,
538
543
  SVC,
544
+ SecurityAnalysisParametersDialog,
545
+ SecurityAnalysisParametersInline,
539
546
  SelectClearable,
540
547
  SelectInput,
541
548
  SensitivityType,
@@ -641,6 +648,7 @@ export {
641
648
  fetchAppsMetadata,
642
649
  fetchCurrentAnnouncement,
643
650
  fetchDefaultCountry,
651
+ fetchDefaultSecurityAnalysisProvider,
644
652
  fetchDirectoryContent,
645
653
  fetchDirectoryElementPath,
646
654
  fetchElementsInfos,
@@ -648,6 +656,8 @@ export {
648
656
  fetchFavoriteAndDefaultCountries,
649
657
  fetchLoadFlowParameters,
650
658
  fetchRootFolders,
659
+ fetchSecurityAnalysisParameters,
660
+ fetchSecurityAnalysisProviders,
651
661
  fetchStudyMetadata,
652
662
  fetchUserDetails,
653
663
  filterEn,
@@ -664,6 +674,7 @@ export {
664
674
  getCriteriaBasedFormData,
665
675
  getCriteriaBasedSchema,
666
676
  getDefaultLoadFlowProvider,
677
+ getDialogParametersFormSchema,
667
678
  getEquipmentsInfosForSearchBar,
668
679
  getExpertFilterEmptyFormData,
669
680
  getExplicitNamingFilterEmptyFormData,
@@ -680,8 +691,11 @@ export {
680
691
  getRangeInputSchema,
681
692
  getRequestParamFromList,
682
693
  getSAParametersFromSchema,
694
+ getSecurityAnalysisDefaultLimitReductions,
695
+ getSecurityAnalysisParameters,
683
696
  getStudyNetworkVisualizationsParameters,
684
697
  getStudyShortCircuitParameters,
698
+ getStudyUrl,
685
699
  getSystemLanguage,
686
700
  getTabIndicatorStyle,
687
701
  getTabStyle,
@@ -733,6 +747,7 @@ export {
733
747
  roundToDefaultPrecision,
734
748
  roundToPrecision,
735
749
  rqbQuerySchemaValidator,
750
+ safeEncodeURIComponent,
736
751
  sanitizePercentageValue,
737
752
  saveExpertFilter,
738
753
  saveExplicitNamingFilter,
@@ -741,6 +756,7 @@ export {
741
756
  setLoadFlowParameters,
742
757
  setLoggedUser,
743
758
  setLogoutError,
759
+ setSecurityAnalysisParameters,
744
760
  setShowAuthenticationRouterLogin,
745
761
  setSignInCallbackError,
746
762
  setStudyNetworkVisualizationParameters,
@@ -765,6 +781,8 @@ export {
765
781
  unitToMicroUnit,
766
782
  unscrollableDialogStyles,
767
783
  updateParameter,
784
+ updateSecurityAnalysisParameters,
785
+ updateSecurityAnalysisProvider,
768
786
  updateVoltageInitParameters,
769
787
  useConfidentialityWarning,
770
788
  useConvertValue,
@@ -13,3 +13,4 @@ export * from './study';
13
13
  export * from './study-config';
14
14
  export * from './userAdmin';
15
15
  export * from './voltage-init';
16
+ export * from './security-analysis';
@@ -7,6 +7,7 @@ import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizat
7
7
  import { getNetworkVisualizationsParameters } from "./study-config.js";
8
8
  import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
9
9
  import { getVoltageInitParameters, getVoltageInitUrl } from "./voltage-init.js";
10
+ import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
10
11
  export {
11
12
  PREFIX_STUDY_QUERIES,
12
13
  backendFetch,
@@ -20,6 +21,7 @@ export {
20
21
  fetchAppsMetadata,
21
22
  fetchCurrentAnnouncement,
22
23
  fetchDefaultCountry,
24
+ fetchDefaultSecurityAnalysisProvider,
23
25
  fetchDirectoryContent,
24
26
  fetchDirectoryElementPath,
25
27
  fetchElementsInfos,
@@ -27,6 +29,8 @@ export {
27
29
  fetchFavoriteAndDefaultCountries,
28
30
  fetchLoadFlowParameters,
29
31
  fetchRootFolders,
32
+ fetchSecurityAnalysisParameters,
33
+ fetchSecurityAnalysisProviders,
30
34
  fetchStudyMetadata,
31
35
  fetchUserDetails,
32
36
  getAvailableComponentLibraries,
@@ -37,16 +41,23 @@ export {
37
41
  getLoadFlowUrl,
38
42
  getNetworkVisualizationsParameters,
39
43
  getRequestParamFromList,
44
+ getSecurityAnalysisDefaultLimitReductions,
45
+ getSecurityAnalysisParameters,
40
46
  getStudyNetworkVisualizationsParameters,
41
47
  getStudyShortCircuitParameters,
48
+ getStudyUrl,
42
49
  getVoltageInitParameters,
43
50
  getVoltageInitUrl,
44
51
  invalidateStudyShortCircuitStatus,
45
52
  isStudyMetadata,
53
+ safeEncodeURIComponent,
46
54
  saveFilter,
47
55
  setLoadFlowParameters,
56
+ setSecurityAnalysisParameters,
48
57
  setStudyNetworkVisualizationParameters,
49
58
  setStudyShortCircuitParameters,
50
59
  updateParameter,
60
+ updateSecurityAnalysisParameters,
61
+ updateSecurityAnalysisProvider,
51
62
  updateVoltageInitParameters
52
63
  };
@@ -0,0 +1,11 @@
1
+ import { UUID } from 'crypto';
2
+ export declare function safeEncodeURIComponent(value: string | null | undefined): string;
3
+ export declare const getStudyUrl: (studyUuid: UUID | null) => string;
4
+ export declare function fetchSecurityAnalysisProviders(): Promise<any>;
5
+ export declare function fetchSecurityAnalysisParameters(parameterUuid: string): Promise<any>;
6
+ export declare function getSecurityAnalysisDefaultLimitReductions(): Promise<any>;
7
+ export declare function updateSecurityAnalysisProvider(studyUuid: UUID, newProvider: string): Promise<Response>;
8
+ export declare function fetchDefaultSecurityAnalysisProvider(): Promise<string>;
9
+ export declare function getSecurityAnalysisParameters(studyUuid: UUID): Promise<any>;
10
+ export declare function setSecurityAnalysisParameters(studyUuid: UUID, newParams: any): Promise<Response>;
11
+ export declare function updateSecurityAnalysisParameters(parameterUuid: UUID, newParams: any): Promise<Response>;
@@ -0,0 +1,91 @@
1
+ import { backendFetchJson, backendFetch, backendFetchText } from "./utils.js";
2
+ import { PREFIX_STUDY_QUERIES } from "./loadflow.js";
3
+ function safeEncodeURIComponent(value) {
4
+ return value != null ? encodeURIComponent(value) : "";
5
+ }
6
+ const PREFIX_SECURITY_ANALYSIS_SERVER_QUERIES = `${"api/gateway"}/security-analysis`;
7
+ const getStudyUrl = (studyUuid) => `${PREFIX_STUDY_QUERIES}/v1/studies/${safeEncodeURIComponent(studyUuid)}`;
8
+ function getSecurityAnalysisUrl() {
9
+ return `${PREFIX_SECURITY_ANALYSIS_SERVER_QUERIES}/v1/`;
10
+ }
11
+ function fetchSecurityAnalysisProviders() {
12
+ console.info("fetch security analysis providers");
13
+ const url = `${getSecurityAnalysisUrl()}providers`;
14
+ console.debug(url);
15
+ return backendFetchJson(url);
16
+ }
17
+ function fetchSecurityAnalysisParameters(parameterUuid) {
18
+ console.info("fetch security analysis parameters");
19
+ const url = `${getSecurityAnalysisUrl()}parameters/${encodeURIComponent(parameterUuid)}`;
20
+ console.debug(url);
21
+ return backendFetchJson(url);
22
+ }
23
+ function getSecurityAnalysisDefaultLimitReductions() {
24
+ console.info("get security analysis default limit reductions");
25
+ const url = `${getSecurityAnalysisUrl()}parameters/default-limit-reductions`;
26
+ console.debug(url);
27
+ return backendFetchJson(url);
28
+ }
29
+ function updateSecurityAnalysisProvider(studyUuid, newProvider) {
30
+ console.info("update security analysis provider");
31
+ const url = `${getStudyUrl(studyUuid)}/security-analysis/provider`;
32
+ console.debug(url);
33
+ return backendFetch(url, {
34
+ method: "POST",
35
+ headers: {
36
+ Accept: "application/json",
37
+ "Content-Type": "application/json"
38
+ },
39
+ body: newProvider
40
+ });
41
+ }
42
+ function fetchDefaultSecurityAnalysisProvider() {
43
+ console.info("fetch default security analysis provider");
44
+ const url = `${PREFIX_STUDY_QUERIES}/v1/security-analysis-default-provider`;
45
+ console.debug(url);
46
+ return backendFetchText(url);
47
+ }
48
+ function getSecurityAnalysisParameters(studyUuid) {
49
+ console.info("get security analysis parameters");
50
+ const url = `${getStudyUrl(studyUuid)}/security-analysis/parameters`;
51
+ console.debug(url);
52
+ return backendFetchJson(url);
53
+ }
54
+ function setSecurityAnalysisParameters(studyUuid, newParams) {
55
+ console.info("set security analysis parameters");
56
+ const url = `${getStudyUrl(studyUuid)}/security-analysis/parameters`;
57
+ console.debug(url);
58
+ return backendFetch(url, {
59
+ method: "POST",
60
+ headers: {
61
+ Accept: "application/json",
62
+ "Content-Type": "application/json"
63
+ },
64
+ body: newParams ? JSON.stringify(newParams) : null
65
+ });
66
+ }
67
+ function updateSecurityAnalysisParameters(parameterUuid, newParams) {
68
+ console.info("set security analysis parameters");
69
+ const setSecurityAnalysisParametersUrl = `${getSecurityAnalysisUrl()}parameters/${parameterUuid}`;
70
+ console.debug(setSecurityAnalysisParametersUrl);
71
+ return backendFetch(setSecurityAnalysisParametersUrl, {
72
+ method: "PUT",
73
+ headers: {
74
+ Accept: "application/json",
75
+ "Content-Type": "application/json"
76
+ },
77
+ body: newParams ? JSON.stringify(newParams) : null
78
+ });
79
+ }
80
+ export {
81
+ fetchDefaultSecurityAnalysisProvider,
82
+ fetchSecurityAnalysisParameters,
83
+ fetchSecurityAnalysisProviders,
84
+ getSecurityAnalysisDefaultLimitReductions,
85
+ getSecurityAnalysisParameters,
86
+ getStudyUrl,
87
+ safeEncodeURIComponent,
88
+ setSecurityAnalysisParameters,
89
+ updateSecurityAnalysisParameters,
90
+ updateSecurityAnalysisProvider
91
+ };
@@ -147,4 +147,12 @@ export declare const parametersEn: {
147
147
  VariableGenerators: string;
148
148
  VariableTransformers: string;
149
149
  VariableShuntCompensators: string;
150
+ 'securityAnalysis.violationsHiding': string;
151
+ 'securityAnalysis.current': string;
152
+ 'securityAnalysis.lowVoltage': string;
153
+ 'securityAnalysis.highVoltage': string;
154
+ 'securityAnalysis.toolTip.violationsHiding': string;
155
+ 'securityAnalysis.toolTip.current': string;
156
+ 'securityAnalysis.toolTip.lowVoltage': string;
157
+ 'securityAnalysis.toolTip.highVoltage': string;
150
158
  };
@@ -140,7 +140,15 @@ const parametersEn = {
140
140
  FiltersListsSelection: "Filters lists selection",
141
141
  VariableGenerators: "Generators with variable reactive power",
142
142
  VariableTransformers: "Variable transformers",
143
- VariableShuntCompensators: "Variable shunt compensators"
143
+ VariableShuntCompensators: "Variable shunt compensators",
144
+ "securityAnalysis.violationsHiding": "Post-contingency violations hiding",
145
+ "securityAnalysis.current": "Current",
146
+ "securityAnalysis.lowVoltage": "Low voltage",
147
+ "securityAnalysis.highVoltage": "High voltage",
148
+ "securityAnalysis.toolTip.violationsHiding": "This section configures thresholds to determine which violations that already exist in the pre-contingency state are redisplayed in the post-contingency state as aggravated violations.",
149
+ "securityAnalysis.toolTip.current": "For current violations, the value can only be proportional. For example, if the proportional value corresponds to 10 A, a 1000 A current preexisting violation will be displayed in the post-contingency state only if the new value is above 1010 A.",
150
+ "securityAnalysis.toolTip.lowVoltage": "For low voltage violations, the value of the threshold can be either proportional or absolute. If both values are defined, the smallest value is used. For example, if the proportional value corresponds to 1 kV and the absolute value is 2 kV, a 200 kV low voltage preexisting violation will be displayed in the post-contingency state only if the new value is below 199 kV.",
151
+ "securityAnalysis.toolTip.highVoltage": "For high voltage violations, the value of the threshold can be either proportional or absolute. If both values are defined, the smallest value is used. For example, if the proportional value corresponds to 1 kV and the absolute value is 2 kV, a 250 kV high voltage preexisting violation will be displayed in the post-contingency state only if the new value is above 251 kV."
144
152
  };
145
153
  export {
146
154
  parametersEn
@@ -148,4 +148,12 @@ export declare const parametersFr: {
148
148
  VariableGenerators: string;
149
149
  VariableTransformers: string;
150
150
  VariableShuntCompensators: string;
151
+ 'securityAnalysis.violationsHiding': string;
152
+ 'securityAnalysis.current': string;
153
+ 'securityAnalysis.lowVoltage': string;
154
+ 'securityAnalysis.highVoltage': string;
155
+ 'securityAnalysis.toolTip.violationsHiding': string;
156
+ 'securityAnalysis.toolTip.current': string;
157
+ 'securityAnalysis.toolTip.lowVoltage': string;
158
+ 'securityAnalysis.toolTip.highVoltage': string;
151
159
  };
@@ -141,7 +141,15 @@ const parametersFr = {
141
141
  FiltersListsSelection: "Sélection des listes de filtres",
142
142
  VariableGenerators: "Groupes à puissance réactive variable",
143
143
  VariableTransformers: "Transformateurs variables",
144
- VariableShuntCompensators: "MCS variables"
144
+ VariableShuntCompensators: "MCS variables",
145
+ "securityAnalysis.violationsHiding": "Masquage des contraintes en N-k",
146
+ "securityAnalysis.current": "Intensité",
147
+ "securityAnalysis.lowVoltage": "Tension basse",
148
+ "securityAnalysis.highVoltage": "Tension haute",
149
+ "securityAnalysis.toolTip.violationsHiding": "Cette section permet de paramétrer le niveau d'aggravation à partir duquel les contraintes calculées en N réapparaissent en N-k.",
150
+ "securityAnalysis.toolTip.current": "L'aggravation de contrainte en intensité est déterminée uniquement en pourcentage de la valeur calculée en N pour les ouvrages en contrainte. Par exemple, si l'aggravation en pourcentage correspond à 10 A alors la contrainte en N réapparaitra en N-k pour une augmentation d'intensité de plus de 10 A par rapport à la valeur calculée en N.",
151
+ "securityAnalysis.toolTip.lowVoltage": "L'aggravation de contrainte en tension basse peut être calculée en pourcentage ou en définie en valeur absolue par rapport à la valeur calculée en N. La valeur prise en compte sera la plus conservative des deux. Par exemple, si l'aggravation en pourcentage correspond à 1 kV et celle renseignée en absolu est de 2 kV, alors la contrainte en tension basse réapparaitra en N-k pour une chute de tension de plus de 1 kV par rapport à la valeur calculée en N.",
152
+ "securityAnalysis.toolTip.highVoltage": "L'aggravation de contrainte en tension haute peut être calculée en pourcentage ou en définie en valeur absolue par rapport à la valeur calculée en N. La valeur prise en compte sera la plus conservative des deux. Par exemple, si l'aggravation en pourcentage correspond à 1 kV et celle renseignée en absolu est de 2 kV, alors la contrainte en tension haute réapparaitra en N-k pour une élévation de tension de plus de 1 kV par rapport à la valeur calculée en N."
145
153
  };
146
154
  export {
147
155
  parametersFr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.109.1",
3
+ "version": "0.110.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",