@gridsuite/commons-ui 0.169.0 → 0.170.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 +7 -0
- package/dist/components/network-modifications/common/properties/propertyUtils.d.ts +1 -1
- package/dist/components/network-modifications/common/properties/propertyUtils.js +2 -2
- package/dist/components/network-modifications/index.js +7 -0
- package/dist/components/network-modifications/substation/index.d.ts +1 -0
- package/dist/components/network-modifications/substation/index.js +8 -1
- package/dist/components/network-modifications/substation/modification/SubstationModificationForm.d.ts +6 -0
- package/dist/components/network-modifications/substation/modification/SubstationModificationForm.js +89 -0
- package/dist/components/network-modifications/substation/modification/index.d.ts +9 -0
- package/dist/components/network-modifications/substation/modification/index.js +9 -0
- package/dist/components/network-modifications/substation/modification/substationModification.types.d.ts +17 -0
- package/dist/components/network-modifications/substation/modification/substationModification.types.js +1 -0
- package/dist/components/network-modifications/substation/modification/substationModification.utils.d.ts +24 -0
- package/dist/components/network-modifications/substation/modification/substationModification.utils.js +42 -0
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -0
- package/dist/index.js +11 -1
- package/dist/translations/en/businessErrorsEn.d.ts +1 -0
- package/dist/translations/en/businessErrorsEn.js +1 -0
- package/dist/translations/en/networkModificationsEn.d.ts +2 -0
- package/dist/translations/en/networkModificationsEn.js +2 -0
- package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
- package/dist/translations/fr/businessErrorsFr.js +1 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +2 -0
- package/dist/translations/fr/networkModificationsFr.js +2 -0
- package/dist/utils/conversionUtils.d.ts +2 -0
- package/dist/utils/conversionUtils.js +6 -0
- package/dist/utils/index.js +4 -1
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +2 -0
- package/dist/utils/types/network-modification-types.d.ts +14 -0
- package/dist/utils/types/network-modification-types.js +8 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -186,6 +186,8 @@ import { copyEquipmentPropertiesForCreation, createPropertyModification, creatio
|
|
|
186
186
|
import { filledTextField, italicFontTextField, standardTextField } from "./network-modifications/common/form.utils.js";
|
|
187
187
|
import { SubstationCreationForm } from "./network-modifications/substation/creation/SubstationCreationForm.js";
|
|
188
188
|
import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./network-modifications/substation/creation/substationCreation.utils.js";
|
|
189
|
+
import { SubstationModificationForm } from "./network-modifications/substation/modification/SubstationModificationForm.js";
|
|
190
|
+
import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./network-modifications/substation/modification/substationModification.utils.js";
|
|
189
191
|
export {
|
|
190
192
|
ACCURACY,
|
|
191
193
|
ACTIVE,
|
|
@@ -485,6 +487,7 @@ export {
|
|
|
485
487
|
SubmitButton,
|
|
486
488
|
SubstationCreationForm,
|
|
487
489
|
SubstationLayout,
|
|
490
|
+
SubstationModificationForm,
|
|
488
491
|
SwitchInput,
|
|
489
492
|
SwitchWithLabel,
|
|
490
493
|
TAB_INFO,
|
|
@@ -583,6 +586,10 @@ export {
|
|
|
583
586
|
substationCreationEmptyFormData,
|
|
584
587
|
substationCreationFormSchema,
|
|
585
588
|
substationCreationFormToDto,
|
|
589
|
+
substationModificationDtoToForm,
|
|
590
|
+
substationModificationEmptyFormData,
|
|
591
|
+
substationModificationFormSchema,
|
|
592
|
+
substationModificationFormToDto,
|
|
586
593
|
testQuery,
|
|
587
594
|
toFloatOrNullValue,
|
|
588
595
|
toFormValuesLimitReductions,
|
|
@@ -8,7 +8,7 @@ export declare const emptyProperties: Properties;
|
|
|
8
8
|
export declare const createPropertyModification: (name: string, value: string | null) => Property;
|
|
9
9
|
export declare const initializedProperty: () => Property;
|
|
10
10
|
export declare const getFilledPropertiesFromModification: (properties: Property[] | undefined | null) => FilledProperty[];
|
|
11
|
-
export declare const getPropertiesFromModification: (properties: Property[] | undefined | null) => Properties;
|
|
11
|
+
export declare const getPropertiesFromModification: (properties: Property[] | undefined | null, includePreviousValue?: boolean) => Properties;
|
|
12
12
|
export declare const copyEquipmentPropertiesForCreation: (equipmentInfos: EquipmentWithProperties) => Properties;
|
|
13
13
|
export declare const mergeModificationAndEquipmentProperties: (modificationProperties: Property[], equipment: EquipmentWithProperties) => Property[];
|
|
14
14
|
export declare function getConcatenatedProperties(equipment: EquipmentWithProperties, getValues: (name: string) => any, id?: string): any;
|
|
@@ -41,13 +41,13 @@ const getFilledPropertiesFromModification = (properties) => {
|
|
|
41
41
|
};
|
|
42
42
|
}) ?? [];
|
|
43
43
|
};
|
|
44
|
-
const getPropertiesFromModification = (properties) => {
|
|
44
|
+
const getPropertiesFromModification = (properties, includePreviousValue = true) => {
|
|
45
45
|
return {
|
|
46
46
|
[FieldConstants.ADDITIONAL_PROPERTIES]: properties ? properties.map((p) => {
|
|
47
47
|
return {
|
|
48
48
|
[FieldConstants.NAME]: p[FieldConstants.NAME],
|
|
49
49
|
[FieldConstants.VALUE]: p[FieldConstants.VALUE],
|
|
50
|
-
[FieldConstants.PREVIOUS_VALUE]: p[FieldConstants.PREVIOUS_VALUE],
|
|
50
|
+
[FieldConstants.PREVIOUS_VALUE]: includePreviousValue ? p[FieldConstants.PREVIOUS_VALUE] : void 0,
|
|
51
51
|
[FieldConstants.ADDED]: p[FieldConstants.ADDED],
|
|
52
52
|
[FieldConstants.DELETION_MARK]: p[FieldConstants.DELETION_MARK]
|
|
53
53
|
};
|
|
@@ -4,10 +4,13 @@ import { copyEquipmentPropertiesForCreation, createPropertyModification, creatio
|
|
|
4
4
|
import { filledTextField, italicFontTextField, standardTextField } from "./common/form.utils.js";
|
|
5
5
|
import { SubstationCreationForm } from "./substation/creation/SubstationCreationForm.js";
|
|
6
6
|
import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./substation/creation/substationCreation.utils.js";
|
|
7
|
+
import { SubstationModificationForm } from "./substation/modification/SubstationModificationForm.js";
|
|
8
|
+
import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./substation/modification/substationModification.utils.js";
|
|
7
9
|
export {
|
|
8
10
|
PropertiesForm,
|
|
9
11
|
PropertyForm,
|
|
10
12
|
SubstationCreationForm,
|
|
13
|
+
SubstationModificationForm,
|
|
11
14
|
copyEquipmentPropertiesForCreation,
|
|
12
15
|
createPropertyModification,
|
|
13
16
|
creationPropertiesSchema,
|
|
@@ -27,5 +30,9 @@ export {
|
|
|
27
30
|
substationCreationEmptyFormData,
|
|
28
31
|
substationCreationFormSchema,
|
|
29
32
|
substationCreationFormToDto,
|
|
33
|
+
substationModificationDtoToForm,
|
|
34
|
+
substationModificationEmptyFormData,
|
|
35
|
+
substationModificationFormSchema,
|
|
36
|
+
substationModificationFormToDto,
|
|
30
37
|
toModificationProperties
|
|
31
38
|
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { SubstationCreationForm } from "./creation/SubstationCreationForm.js";
|
|
2
2
|
import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./creation/substationCreation.utils.js";
|
|
3
|
+
import { SubstationModificationForm } from "./modification/SubstationModificationForm.js";
|
|
4
|
+
import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./modification/substationModification.utils.js";
|
|
3
5
|
export {
|
|
4
6
|
SubstationCreationForm,
|
|
7
|
+
SubstationModificationForm,
|
|
5
8
|
substationCreationDtoToForm,
|
|
6
9
|
substationCreationEmptyFormData,
|
|
7
10
|
substationCreationFormSchema,
|
|
8
|
-
substationCreationFormToDto
|
|
11
|
+
substationCreationFormToDto,
|
|
12
|
+
substationModificationDtoToForm,
|
|
13
|
+
substationModificationEmptyFormData,
|
|
14
|
+
substationModificationFormSchema,
|
|
15
|
+
substationModificationFormToDto
|
|
9
16
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SubstationModificationInfos } from './substationModification.types';
|
|
2
|
+
interface SubstationModificationFormProps {
|
|
3
|
+
substationToModify?: SubstationModificationInfos | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function SubstationModificationForm({ substationToModify }: Readonly<SubstationModificationFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
package/dist/components/network-modifications/substation/modification/SubstationModificationForm.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TextField, Grid } from "@mui/material";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { useWatch } from "react-hook-form";
|
|
5
|
+
import GridItem from "../../../grid/grid-item.js";
|
|
6
|
+
import "../../../overflowableText/OverflowableText.js";
|
|
7
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
8
|
+
import "../../../../utils/conversionUtils.js";
|
|
9
|
+
import "../../../../utils/types/equipmentType.js";
|
|
10
|
+
import "@mui/icons-material";
|
|
11
|
+
import "../../../../utils/yupConfig.js";
|
|
12
|
+
import "react";
|
|
13
|
+
import { useLocalizedCountries } from "../../../../hooks/useLocalizedCountries.js";
|
|
14
|
+
import "notistack";
|
|
15
|
+
import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
|
|
16
|
+
import "yup";
|
|
17
|
+
import "../../../treeViewFinder/TreeViewFinder.js";
|
|
18
|
+
import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
19
|
+
import "../../../customAGGrid/customAggrid.js";
|
|
20
|
+
import "ag-grid-community";
|
|
21
|
+
import "react-papaparse";
|
|
22
|
+
import "react-csv-downloader";
|
|
23
|
+
import { TextInput } from "../../../inputs/reactHookForm/text/TextInput.js";
|
|
24
|
+
import "../../../inputs/reactHookForm/numbers/RangeInput.js";
|
|
25
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
26
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
27
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
28
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
29
|
+
import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
30
|
+
import { CountrySelectionInput } from "../../../inputs/reactHookForm/CountrySelectionInput.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 { PropertiesForm } from "../../common/properties/PropertiesForm.js";
|
|
38
|
+
import { filledTextField } from "../../common/form.utils.js";
|
|
39
|
+
import "../../common/properties/propertyUtils.js";
|
|
40
|
+
function SubstationModificationForm({ substationToModify }) {
|
|
41
|
+
const { locale } = useIntl();
|
|
42
|
+
const { translate } = useLocalizedCountries(locale);
|
|
43
|
+
const equipmentId = useWatch({ name: FieldConstants.EQUIPMENT_ID });
|
|
44
|
+
const substationIdField = /* @__PURE__ */ jsx(
|
|
45
|
+
TextField,
|
|
46
|
+
{
|
|
47
|
+
size: "small",
|
|
48
|
+
fullWidth: true,
|
|
49
|
+
label: "ID",
|
|
50
|
+
value: equipmentId ?? "",
|
|
51
|
+
InputProps: {
|
|
52
|
+
readOnly: true
|
|
53
|
+
},
|
|
54
|
+
disabled: true,
|
|
55
|
+
...filledTextField
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const substationNameField = /* @__PURE__ */ jsx(
|
|
59
|
+
TextInput,
|
|
60
|
+
{
|
|
61
|
+
name: FieldConstants.EQUIPMENT_NAME,
|
|
62
|
+
label: "Name",
|
|
63
|
+
formProps: filledTextField,
|
|
64
|
+
previousValue: substationToModify?.name,
|
|
65
|
+
clearable: true
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
const substationCountryField = /* @__PURE__ */ jsx(
|
|
69
|
+
CountrySelectionInput,
|
|
70
|
+
{
|
|
71
|
+
name: FieldConstants.COUNTRY,
|
|
72
|
+
label: "Country",
|
|
73
|
+
formProps: filledTextField,
|
|
74
|
+
size: "small",
|
|
75
|
+
previousValue: substationToModify?.country ? translate(substationToModify.country) : ""
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
80
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: substationIdField }),
|
|
81
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: substationNameField }),
|
|
82
|
+
/* @__PURE__ */ jsx(GridItem, { size: 4, children: substationCountryField })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "substation", isModification: true })
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
SubstationModificationForm
|
|
89
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './SubstationModificationForm';
|
|
8
|
+
export * from './substationModification.types';
|
|
9
|
+
export * from './substationModification.utils';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SubstationModificationForm } from "./SubstationModificationForm.js";
|
|
2
|
+
import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./substationModification.utils.js";
|
|
3
|
+
export {
|
|
4
|
+
SubstationModificationForm,
|
|
5
|
+
substationModificationDtoToForm,
|
|
6
|
+
substationModificationEmptyFormData,
|
|
7
|
+
substationModificationFormSchema,
|
|
8
|
+
substationModificationFormToDto
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UUID } from 'node:crypto';
|
|
2
|
+
import { AttributeModification, ModificationType } from '../../../../utils';
|
|
3
|
+
import { Property } from '../../common';
|
|
4
|
+
export interface SubstationModificationInfos {
|
|
5
|
+
id: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
country: string | null;
|
|
8
|
+
properties?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface SubstationModificationDto {
|
|
11
|
+
uuid?: UUID;
|
|
12
|
+
equipmentId: string;
|
|
13
|
+
equipmentName?: AttributeModification<string> | null;
|
|
14
|
+
country: AttributeModification<string> | null;
|
|
15
|
+
properties?: Property[] | null;
|
|
16
|
+
type?: ModificationType;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as yup } from '../../../../utils/yupConfig';
|
|
2
|
+
import { SubstationModificationDto } from './substationModification.types';
|
|
3
|
+
export declare const substationModificationFormSchema: yup.ObjectSchema<{
|
|
4
|
+
equipmentID: string;
|
|
5
|
+
equipmentName: string | null | undefined;
|
|
6
|
+
country: string | null | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
AdditionalProperties: {
|
|
9
|
+
previousValue?: string | null | undefined;
|
|
10
|
+
value?: string | null | undefined;
|
|
11
|
+
added: NonNullable<boolean | undefined>;
|
|
12
|
+
deletionMark: NonNullable<boolean | undefined>;
|
|
13
|
+
name: string;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
}, yup.AnyObject, {
|
|
16
|
+
equipmentID: undefined;
|
|
17
|
+
equipmentName: undefined;
|
|
18
|
+
country: undefined;
|
|
19
|
+
AdditionalProperties: "";
|
|
20
|
+
}, "">;
|
|
21
|
+
export type SubstationModificationFormData = yup.InferType<typeof substationModificationFormSchema>;
|
|
22
|
+
export declare const substationModificationEmptyFormData: SubstationModificationFormData;
|
|
23
|
+
export declare const substationModificationFormToDto: (formData: SubstationModificationFormData) => SubstationModificationDto;
|
|
24
|
+
export declare const substationModificationDtoToForm: (substationDto: SubstationModificationDto, includePreviousValues?: boolean) => SubstationModificationFormData;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "../../../../utils/yupConfig.js";
|
|
2
|
+
import { modificationPropertiesSchema, toModificationProperties, getPropertiesFromModification } from "../../common/properties/propertyUtils.js";
|
|
3
|
+
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
4
|
+
import { toModificationOperation } from "../../../../utils/conversionUtils.js";
|
|
5
|
+
import "../../../../utils/types/equipmentType.js";
|
|
6
|
+
import { ModificationType } from "../../../../utils/types/modificationType.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import { sanitizeString } from "../../../../utils/ts-utils.js";
|
|
10
|
+
import * as yup from "yup";
|
|
11
|
+
const substationModificationFormSchema = yup.object().shape({
|
|
12
|
+
[FieldConstants.EQUIPMENT_ID]: yup.string().required(),
|
|
13
|
+
[FieldConstants.EQUIPMENT_NAME]: yup.string().nullable(),
|
|
14
|
+
[FieldConstants.COUNTRY]: yup.string().nullable()
|
|
15
|
+
}).concat(modificationPropertiesSchema);
|
|
16
|
+
const substationModificationEmptyFormData = {
|
|
17
|
+
equipmentID: "",
|
|
18
|
+
equipmentName: "",
|
|
19
|
+
country: null,
|
|
20
|
+
AdditionalProperties: []
|
|
21
|
+
};
|
|
22
|
+
const substationModificationFormToDto = (formData) => ({
|
|
23
|
+
type: ModificationType.SUBSTATION_MODIFICATION,
|
|
24
|
+
equipmentId: formData.equipmentID,
|
|
25
|
+
equipmentName: toModificationOperation(sanitizeString(formData.equipmentName)),
|
|
26
|
+
country: toModificationOperation(formData.country ?? null),
|
|
27
|
+
properties: toModificationProperties(formData)
|
|
28
|
+
});
|
|
29
|
+
const substationModificationDtoToForm = (substationDto, includePreviousValues = true) => {
|
|
30
|
+
return {
|
|
31
|
+
equipmentID: substationDto.equipmentId,
|
|
32
|
+
equipmentName: substationDto.equipmentName?.value ?? "",
|
|
33
|
+
country: substationDto.country?.value ?? null,
|
|
34
|
+
...getPropertiesFromModification(substationDto?.properties, includePreviousValues)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
substationModificationDtoToForm,
|
|
39
|
+
substationModificationEmptyFormData,
|
|
40
|
+
substationModificationFormSchema,
|
|
41
|
+
substationModificationFormToDto
|
|
42
|
+
};
|
package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js
CHANGED
|
@@ -76,6 +76,9 @@ const useSecurityAnalysisParametersForm = (parametersBackend, parametersUuid, na
|
|
|
76
76
|
const watchProvider = watch(PARAM_SA_PROVIDER);
|
|
77
77
|
const toContingencyListsInfos = useCallback(
|
|
78
78
|
(formContingencyListsInfos) => {
|
|
79
|
+
if (!formContingencyListsInfos) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
79
82
|
return formContingencyListsInfos.map((contingencyListsInfos) => ({
|
|
80
83
|
[CONTINGENCY_LISTS]: contingencyListsInfos[CONTINGENCY_LISTS]?.map((c) => ({
|
|
81
84
|
[ID]: c[ID],
|
package/dist/index.js
CHANGED
|
@@ -187,6 +187,8 @@ import { copyEquipmentPropertiesForCreation, createPropertyModification, creatio
|
|
|
187
187
|
import { filledTextField, italicFontTextField, standardTextField } from "./components/network-modifications/common/form.utils.js";
|
|
188
188
|
import { SubstationCreationForm } from "./components/network-modifications/substation/creation/SubstationCreationForm.js";
|
|
189
189
|
import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./components/network-modifications/substation/creation/substationCreation.utils.js";
|
|
190
|
+
import { SubstationModificationForm } from "./components/network-modifications/substation/modification/SubstationModificationForm.js";
|
|
191
|
+
import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./components/network-modifications/substation/modification/substationModification.utils.js";
|
|
190
192
|
import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
|
|
191
193
|
import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
|
|
192
194
|
import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
|
|
@@ -227,7 +229,7 @@ import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT
|
|
|
227
229
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./utils/constants/configConstants.js";
|
|
228
230
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./utils/constants/filterConstant.js";
|
|
229
231
|
import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./utils/constants/translationKeys.js";
|
|
230
|
-
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
232
|
+
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, toModificationOperation, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
231
233
|
import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./utils/error.js";
|
|
232
234
|
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
233
235
|
import { getEquipmentTypeShortLabel } from "./utils/labelUtils.js";
|
|
@@ -250,6 +252,7 @@ import { ParameterType } from "./utils/types/parameters.type.js";
|
|
|
250
252
|
import { SolverTypeInfos } from "./utils/types/dynamic-simulation.type.js";
|
|
251
253
|
import { DistributionType, SensitivityType } from "./utils/types/sensitivity-analysis.type.js";
|
|
252
254
|
import { CalculationType, LoadModelsRule } from "./utils/types/dynamic-margin-calculation.type.js";
|
|
255
|
+
import { OperationType } from "./utils/types/network-modification-types.js";
|
|
253
256
|
import { getIdOrSelf, notNull, notUndefined, parseIntData, removeNullFields, sanitizeString } from "./utils/ts-utils.js";
|
|
254
257
|
import { toNumber, validateValueIsANumber } from "./utils/validation-functions.js";
|
|
255
258
|
import "./utils/yupConfig.js";
|
|
@@ -569,6 +572,7 @@ export {
|
|
|
569
572
|
OPERATOR_OPTIONS,
|
|
570
573
|
OhmAdornment,
|
|
571
574
|
OperatingStatus,
|
|
575
|
+
OperationType,
|
|
572
576
|
OperatorType,
|
|
573
577
|
OptionalServicesStatus,
|
|
574
578
|
OverflowableChip,
|
|
@@ -696,6 +700,7 @@ export {
|
|
|
696
700
|
Substation,
|
|
697
701
|
SubstationCreationForm,
|
|
698
702
|
SubstationLayout,
|
|
703
|
+
SubstationModificationForm,
|
|
699
704
|
SusceptanceAdornment,
|
|
700
705
|
SwitchInput,
|
|
701
706
|
SwitchWithLabel,
|
|
@@ -956,12 +961,17 @@ export {
|
|
|
956
961
|
substationCreationEmptyFormData,
|
|
957
962
|
substationCreationFormSchema,
|
|
958
963
|
substationCreationFormToDto,
|
|
964
|
+
substationModificationDtoToForm,
|
|
965
|
+
substationModificationEmptyFormData,
|
|
966
|
+
substationModificationFormSchema,
|
|
967
|
+
substationModificationFormToDto,
|
|
959
968
|
default2 as svg,
|
|
960
969
|
tableEn,
|
|
961
970
|
tableFr,
|
|
962
971
|
testQuery,
|
|
963
972
|
toFloatOrNullValue,
|
|
964
973
|
toFormValuesLimitReductions,
|
|
974
|
+
toModificationOperation,
|
|
965
975
|
toModificationProperties,
|
|
966
976
|
toNestedGlobalSelectors,
|
|
967
977
|
toNumber,
|
|
@@ -58,6 +58,7 @@ export declare const businessErrorsEn: {
|
|
|
58
58
|
'shortcircuit.busOutOfVoltage': string;
|
|
59
59
|
'shortcircuit.missingExtensionData': string;
|
|
60
60
|
'shortcircuit.inconsistentVoltageLevels': string;
|
|
61
|
+
'securityAnalysis.contingencyListConfigEmpty': string;
|
|
61
62
|
'dynamicMapping.mappingNameNotProvided': string;
|
|
62
63
|
'dynamicSecurityAnalysis.providerNotFound': string;
|
|
63
64
|
'dynamicSecurityAnalysis.contingenciesNotFound': string;
|
|
@@ -52,6 +52,7 @@ const businessErrorsEn = {
|
|
|
52
52
|
"shortcircuit.busOutOfVoltage": "Selected bus is out of voltage.",
|
|
53
53
|
"shortcircuit.missingExtensionData": "Missing short-circuit extension data.",
|
|
54
54
|
"shortcircuit.inconsistentVoltageLevels": "Some voltage levels have wrong isc values. Check out the logs to find which ones.",
|
|
55
|
+
"securityAnalysis.contingencyListConfigEmpty": "The configuration does not contain any contingency.",
|
|
55
56
|
"dynamicMapping.mappingNameNotProvided": "Mapping name not provided",
|
|
56
57
|
"dynamicSecurityAnalysis.providerNotFound": "Dynamic security analysis provider not found.",
|
|
57
58
|
"dynamicSecurityAnalysis.contingenciesNotFound": "No contingencies provided.",
|
|
@@ -68,6 +68,8 @@ export declare const networkModificationsEn: {
|
|
|
68
68
|
ModificationReadError: string;
|
|
69
69
|
CreateSubstation: string;
|
|
70
70
|
SubstationCreationError: string;
|
|
71
|
+
ModifySubstation: string;
|
|
72
|
+
SubstationModificationError: string;
|
|
71
73
|
AdditionalInformation: string;
|
|
72
74
|
AddProperty: string;
|
|
73
75
|
PropertyName: string;
|
|
@@ -74,6 +74,8 @@ const networkModificationsEn = {
|
|
|
74
74
|
ModificationReadError: "An error occurred while fetching the modification",
|
|
75
75
|
CreateSubstation: "Create substation",
|
|
76
76
|
SubstationCreationError: "Error while creating substation",
|
|
77
|
+
ModifySubstation: "Modify substation",
|
|
78
|
+
SubstationModificationError: "Error while modifying substation",
|
|
77
79
|
AdditionalInformation: "Additional information",
|
|
78
80
|
AddProperty: "Add property",
|
|
79
81
|
PropertyName: "Property name",
|
|
@@ -58,6 +58,7 @@ export declare const businessErrorsFr: {
|
|
|
58
58
|
'shortcircuit.busOutOfVoltage': string;
|
|
59
59
|
'shortcircuit.missingExtensionData': string;
|
|
60
60
|
'shortcircuit.inconsistentVoltageLevels': string;
|
|
61
|
+
'securityAnalysis.contingencyListConfigEmpty': string;
|
|
61
62
|
'dynamicMapping.mappingNameNotProvided': string;
|
|
62
63
|
'dynamicSecurityAnalysis.providerNotFound': string;
|
|
63
64
|
'dynamicSecurityAnalysis.contingenciesNotFound': string;
|
|
@@ -52,6 +52,7 @@ const businessErrorsFr = {
|
|
|
52
52
|
"shortcircuit.busOutOfVoltage": "Bus sélectionné en dehors des limites de tension.",
|
|
53
53
|
"shortcircuit.missingExtensionData": "Données de l'extension court-circuit manquantes.",
|
|
54
54
|
"shortcircuit.inconsistentVoltageLevels": "Des postes ont des données Icc incohérentes. Vérifiez les logs pour déterminer lesquels.",
|
|
55
|
+
"securityAnalysis.contingencyListConfigEmpty": "La configuration ne contient aucun aléas.",
|
|
55
56
|
"dynamicMapping.mappingNameNotProvided": "Nom du mapping non fourni",
|
|
56
57
|
"dynamicSecurityAnalysis.providerNotFound": "Simulateur d'analyse de sécurité dynamique non trouvé.",
|
|
57
58
|
"dynamicSecurityAnalysis.contingenciesNotFound": "Aucun aléa fourni.",
|
|
@@ -68,6 +68,8 @@ export declare const networkModificationsFr: {
|
|
|
68
68
|
ModificationReadError: string;
|
|
69
69
|
CreateSubstation: string;
|
|
70
70
|
SubstationCreationError: string;
|
|
71
|
+
ModifySubstation: string;
|
|
72
|
+
SubstationModificationError: string;
|
|
71
73
|
AdditionalInformation: string;
|
|
72
74
|
AddProperty: string;
|
|
73
75
|
PropertyName: string;
|
|
@@ -74,6 +74,8 @@ const networkModificationsFr = {
|
|
|
74
74
|
ModificationReadError: "Une erreur est survenue lors de la récupération de la modification",
|
|
75
75
|
CreateSubstation: "Créer un site",
|
|
76
76
|
SubstationCreationError: "Erreur lors de la création d'un site'",
|
|
77
|
+
ModifySubstation: "Modifier un site",
|
|
78
|
+
SubstationModificationError: "Erreur lors de la modification d'un site",
|
|
77
79
|
AdditionalInformation: "Informations complémentaires",
|
|
78
80
|
AddProperty: "Ajouter une propriété",
|
|
79
81
|
PropertyName: "Nom de la propriété",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AttributeModification } from './types';
|
|
1
2
|
import { FieldType } from './types/fieldType';
|
|
2
3
|
export declare const GRIDSUITE_DEFAULT_PRECISION: number;
|
|
3
4
|
export declare const roundToPrecision: (num: number, precision: number) => number;
|
|
@@ -9,3 +10,4 @@ export declare function unitToKiloUnit(num: number): number | undefined;
|
|
|
9
10
|
export declare function kiloUnitToUnit(num: number): number | undefined;
|
|
10
11
|
export declare function convertInputValue(field: FieldType, value: any): any;
|
|
11
12
|
export declare function convertOutputValue(field: FieldType, value: any): any;
|
|
13
|
+
export declare function toModificationOperation<T>(value: T): AttributeModification<Exclude<Exclude<T, null>, undefined>> | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import "./types/equipmentType.js";
|
|
1
2
|
import { FieldType } from "./types/fieldType.js";
|
|
3
|
+
import { OperationType } from "./types/network-modification-types.js";
|
|
2
4
|
const GRIDSUITE_DEFAULT_PRECISION = 13;
|
|
3
5
|
const roundToPrecision = (num, precision) => Number(num.toPrecision(precision));
|
|
4
6
|
const roundToDefaultPrecision = (num) => roundToPrecision(num, GRIDSUITE_DEFAULT_PRECISION);
|
|
@@ -66,6 +68,9 @@ function convertOutputValue(field, value) {
|
|
|
66
68
|
}
|
|
67
69
|
return value;
|
|
68
70
|
}
|
|
71
|
+
function toModificationOperation(value) {
|
|
72
|
+
return value === 0 || value === false || value ? { value, op: OperationType.SET } : null;
|
|
73
|
+
}
|
|
69
74
|
export {
|
|
70
75
|
GRIDSUITE_DEFAULT_PRECISION,
|
|
71
76
|
convertInputValue,
|
|
@@ -75,6 +80,7 @@ export {
|
|
|
75
80
|
microUnitToUnit,
|
|
76
81
|
roundToDefaultPrecision,
|
|
77
82
|
roundToPrecision,
|
|
83
|
+
toModificationOperation,
|
|
78
84
|
unitToKiloUnit,
|
|
79
85
|
unitToMicroUnit
|
|
80
86
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT
|
|
|
7
7
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./constants/configConstants.js";
|
|
8
8
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./constants/filterConstant.js";
|
|
9
9
|
import { DUPLICATED_PROPS_ERROR, YUP_REQUIRED } from "./constants/translationKeys.js";
|
|
10
|
-
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
10
|
+
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, toModificationOperation, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
11
11
|
import { catchErrorHandler, extractErrorMessageDescriptor, snackWithFallback } from "./error.js";
|
|
12
12
|
import { areArrayElementsUnique, arraysContainIdenticalStrings, isEmpty, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
13
13
|
import { getEquipmentTypeShortLabel } from "./labelUtils.js";
|
|
@@ -30,6 +30,7 @@ import { ParameterType } from "./types/parameters.type.js";
|
|
|
30
30
|
import { SolverTypeInfos } from "./types/dynamic-simulation.type.js";
|
|
31
31
|
import { DistributionType, SensitivityType } from "./types/sensitivity-analysis.type.js";
|
|
32
32
|
import { CalculationType, LoadModelsRule } from "./types/dynamic-margin-calculation.type.js";
|
|
33
|
+
import { OperationType } from "./types/network-modification-types.js";
|
|
33
34
|
import { getIdOrSelf, notNull, notUndefined, parseIntData, removeNullFields, sanitizeString } from "./ts-utils.js";
|
|
34
35
|
import { toNumber, validateValueIsANumber } from "./validation-functions.js";
|
|
35
36
|
import "./yupConfig.js";
|
|
@@ -95,6 +96,7 @@ export {
|
|
|
95
96
|
OHM,
|
|
96
97
|
OhmAdornment,
|
|
97
98
|
OperatingStatus,
|
|
99
|
+
OperationType,
|
|
98
100
|
PARAM_DEVELOPER_MODE,
|
|
99
101
|
PARAM_LANGUAGE,
|
|
100
102
|
PARAM_THEME,
|
|
@@ -152,6 +154,7 @@ export {
|
|
|
152
154
|
roundToPrecision,
|
|
153
155
|
sanitizeString,
|
|
154
156
|
snackWithFallback,
|
|
157
|
+
toModificationOperation,
|
|
155
158
|
toNestedGlobalSelectors,
|
|
156
159
|
toNumber,
|
|
157
160
|
unitToKiloUnit,
|
|
@@ -11,6 +11,7 @@ import { ParameterType } from "./parameters.type.js";
|
|
|
11
11
|
import { SolverTypeInfos } from "./dynamic-simulation.type.js";
|
|
12
12
|
import { DistributionType, SensitivityType } from "./sensitivity-analysis.type.js";
|
|
13
13
|
import { CalculationType, LoadModelsRule } from "./dynamic-margin-calculation.type.js";
|
|
14
|
+
import { OperationType } from "./network-modification-types.js";
|
|
14
15
|
export {
|
|
15
16
|
ALL_EQUIPMENTS,
|
|
16
17
|
AnnouncementSeverity,
|
|
@@ -37,6 +38,7 @@ export {
|
|
|
37
38
|
ModificationType,
|
|
38
39
|
NetworkTimeoutError,
|
|
39
40
|
OperatingStatus,
|
|
41
|
+
OperationType,
|
|
40
42
|
ParameterType,
|
|
41
43
|
ProblemDetailError,
|
|
42
44
|
SEARCH_EQUIPMENTS,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum OperationType {
|
|
8
|
+
SET = "SET",
|
|
9
|
+
UNSET = "UNSET"
|
|
10
|
+
}
|
|
11
|
+
export type AttributeModification<T> = {
|
|
12
|
+
value?: T;
|
|
13
|
+
op: OperationType;
|
|
14
|
+
};
|