@gridsuite/commons-ui 0.76.2 → 0.77.1
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/checkBoxList/DraggableClickableRowItem.js +1 -0
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +14 -27
- package/dist/components/filter/FilterCreationDialog.js +2 -1
- package/dist/components/filter/HeaderFilterForm.d.ts +7 -0
- package/dist/components/filter/HeaderFilterForm.js +14 -4
- package/dist/components/filter/constants/FilterConstants.d.ts +2 -2
- package/dist/components/filter/constants/FilterConstants.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.d.ts +2 -20
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +7 -7
- package/dist/components/filter/expert/ExpertFilterForm.d.ts +1 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +1 -1
- package/dist/components/filter/expert/expertFilter.type.d.ts +1 -136
- package/dist/components/filter/expert/expertFilter.type.js +0 -138
- package/dist/components/filter/expert/expertFilterConstants.d.ts +2 -1
- package/dist/components/filter/expert/expertFilterConstants.js +10 -9
- package/dist/components/filter/expert/expertFilterUtils.js +7 -40
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.d.ts +2 -18
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +7 -7
- package/dist/components/filter/filter.type.d.ts +18 -0
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +2 -0
- package/dist/components/index.js +1 -2
- package/dist/components/inputs/reactHookForm/text/DescriptionField.js +4 -3
- package/dist/components/inputs/reactHookForm/text/UniqueNameInput.js +3 -1
- package/dist/components/inputs/reactQueryBuilder/RemoveButton.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +4 -3
- package/dist/components/notifications/NotificationsProvider.d.ts +1 -1
- package/dist/components/notifications/NotificationsProvider.js +6 -5
- package/dist/components/notifications/hooks/useListenerManager.d.ts +1 -1
- package/dist/index.js +7 -2
- package/dist/services/appsMetadata.d.ts +2 -1
- package/dist/services/explore.d.ts +1 -1
- package/dist/services/explore.js +2 -1
- package/dist/utils/constants/index.d.ts +1 -0
- package/dist/utils/constants/index.js +3 -1
- package/dist/utils/constants/uiConstants.d.ts +1 -0
- package/dist/utils/constants/uiConstants.js +4 -0
- package/dist/utils/conversionUtils.d.ts +8 -10
- package/dist/utils/conversionUtils.js +58 -4
- package/dist/utils/index.js +7 -1
- package/dist/utils/types/fieldType.d.ts +168 -0
- package/dist/utils/types/fieldType.js +166 -0
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OperatorType, CombinatorType,
|
|
1
|
+
import { OperatorType, CombinatorType, DataType } from "./expertFilter.type.js";
|
|
2
|
+
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
2
3
|
var RULES = /* @__PURE__ */ ((RULES2) => {
|
|
3
4
|
RULES2["EMPTY_RULE"] = "emptyRule";
|
|
4
5
|
RULES2["EMPTY_GROUP"] = "emptyGroup";
|
|
@@ -803,56 +804,56 @@ const FIELDS_OPTIONS = {
|
|
|
803
804
|
inputType: "number"
|
|
804
805
|
},
|
|
805
806
|
PROPERTY: {
|
|
806
|
-
name: FieldType.
|
|
807
|
+
name: FieldType.FREE_PROPERTIES,
|
|
807
808
|
label: "property",
|
|
808
809
|
dataType: DataType.PROPERTY,
|
|
809
810
|
valueEditorType: "select",
|
|
810
811
|
defaultValue: ""
|
|
811
812
|
},
|
|
812
813
|
SUBSTATION_PROPERTY: {
|
|
813
|
-
name: FieldType.
|
|
814
|
+
name: FieldType.SUBSTATION_PROPERTIES,
|
|
814
815
|
label: "substationProperty",
|
|
815
816
|
dataType: DataType.PROPERTY,
|
|
816
817
|
valueEditorType: "select",
|
|
817
818
|
defaultValue: ""
|
|
818
819
|
},
|
|
819
820
|
SUBSTATION_PROPERTY_1: {
|
|
820
|
-
name: FieldType.
|
|
821
|
+
name: FieldType.SUBSTATION_PROPERTIES_1,
|
|
821
822
|
label: "substationProperty1",
|
|
822
823
|
dataType: DataType.PROPERTY,
|
|
823
824
|
valueEditorType: "select",
|
|
824
825
|
defaultValue: ""
|
|
825
826
|
},
|
|
826
827
|
SUBSTATION_PROPERTY_2: {
|
|
827
|
-
name: FieldType.
|
|
828
|
+
name: FieldType.SUBSTATION_PROPERTIES_2,
|
|
828
829
|
label: "substationProperty2",
|
|
829
830
|
dataType: DataType.PROPERTY,
|
|
830
831
|
valueEditorType: "select",
|
|
831
832
|
defaultValue: ""
|
|
832
833
|
},
|
|
833
834
|
VOLTAGE_LEVEL_PROPERTY: {
|
|
834
|
-
name: FieldType.
|
|
835
|
+
name: FieldType.VOLTAGE_LEVEL_PROPERTIES,
|
|
835
836
|
label: "voltageLevelProperty",
|
|
836
837
|
dataType: DataType.PROPERTY,
|
|
837
838
|
valueEditorType: "select",
|
|
838
839
|
defaultValue: ""
|
|
839
840
|
},
|
|
840
841
|
VOLTAGE_LEVEL_PROPERTY_1: {
|
|
841
|
-
name: FieldType.
|
|
842
|
+
name: FieldType.VOLTAGE_LEVEL_PROPERTIES_1,
|
|
842
843
|
label: "voltageLevelProperty1",
|
|
843
844
|
dataType: DataType.PROPERTY,
|
|
844
845
|
valueEditorType: "select",
|
|
845
846
|
defaultValue: ""
|
|
846
847
|
},
|
|
847
848
|
VOLTAGE_LEVEL_PROPERTY_2: {
|
|
848
|
-
name: FieldType.
|
|
849
|
+
name: FieldType.VOLTAGE_LEVEL_PROPERTIES_2,
|
|
849
850
|
label: "voltageLevelProperty2",
|
|
850
851
|
dataType: DataType.PROPERTY,
|
|
851
852
|
valueEditorType: "select",
|
|
852
853
|
defaultValue: ""
|
|
853
854
|
},
|
|
854
855
|
VOLTAGE_LEVEL_PROPERTY_3: {
|
|
855
|
-
name: FieldType.
|
|
856
|
+
name: FieldType.VOLTAGE_LEVEL_PROPERTIES_3,
|
|
856
857
|
label: "voltageLevelProperty3Twt",
|
|
857
858
|
dataType: DataType.PROPERTY,
|
|
858
859
|
valueEditorType: "select",
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { defaultOperators, getParentPath, findPath, remove } from "react-querybuilder";
|
|
2
2
|
import { validate } from "uuid";
|
|
3
|
-
import {
|
|
3
|
+
import { DataType } from "./expertFilter.type.js";
|
|
4
4
|
import { FIELDS_OPTIONS, OPERATOR_OPTIONS, RULES } from "./expertFilterConstants.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
FieldType.SHUNT_CONDUCTANCE_1,
|
|
8
|
-
FieldType.SHUNT_CONDUCTANCE_2,
|
|
9
|
-
FieldType.SHUNT_SUSCEPTANCE_1,
|
|
10
|
-
FieldType.SHUNT_SUSCEPTANCE_2
|
|
11
|
-
];
|
|
12
|
-
const kiloUnits = [FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT, FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT];
|
|
5
|
+
import { convertOutputValue, isBlankOrEmpty, convertInputValue } from "../../../utils/conversionUtils.js";
|
|
6
|
+
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
13
7
|
const searchTree = (tree, key, value) => {
|
|
14
8
|
const stack = Object.values(tree);
|
|
15
9
|
while (stack.length) {
|
|
@@ -125,21 +119,6 @@ const getOperators = (fieldName, intl) => {
|
|
|
125
119
|
return defaultOperators;
|
|
126
120
|
}
|
|
127
121
|
};
|
|
128
|
-
function changeValueUnit(value, field) {
|
|
129
|
-
if (microUnits.includes(field)) {
|
|
130
|
-
if (!Array.isArray(value)) {
|
|
131
|
-
return microUnitToUnit(value);
|
|
132
|
-
}
|
|
133
|
-
return value.map((a) => microUnitToUnit(a));
|
|
134
|
-
}
|
|
135
|
-
if (kiloUnits.includes(field)) {
|
|
136
|
-
if (!Array.isArray(value)) {
|
|
137
|
-
return kiloUnitToUnit(value);
|
|
138
|
-
}
|
|
139
|
-
return value.map((a) => kiloUnitToUnit(a));
|
|
140
|
-
}
|
|
141
|
-
return value;
|
|
142
|
-
}
|
|
143
122
|
function exportExpertRules(query) {
|
|
144
123
|
function transformRule(rule) {
|
|
145
124
|
var _a;
|
|
@@ -152,8 +131,8 @@ function exportExpertRules(query) {
|
|
|
152
131
|
id: rule.id,
|
|
153
132
|
field: rule.field,
|
|
154
133
|
operator: dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find((operator) => operator.name === rule.operator)) == null ? void 0 : _a.customName : rule.value.propertyOperator,
|
|
155
|
-
value: !isValueAnArray && rule.operator !== OPERATOR_OPTIONS.EXISTS.name && rule.operator !== OPERATOR_OPTIONS.NOT_EXISTS.name && dataType !== DataType.PROPERTY ?
|
|
156
|
-
values: isValueAnArray && dataType !== DataType.PROPERTY ?
|
|
134
|
+
value: !isValueAnArray && rule.operator !== OPERATOR_OPTIONS.EXISTS.name && rule.operator !== OPERATOR_OPTIONS.NOT_EXISTS.name && dataType !== DataType.PROPERTY ? convertOutputValue(rule.field, rule.value) : void 0,
|
|
135
|
+
values: isValueAnArray && dataType !== DataType.PROPERTY ? convertOutputValue(rule.field, rule.value) : void 0,
|
|
157
136
|
dataType,
|
|
158
137
|
propertyName: dataType === DataType.PROPERTY ? rule.value.propertyName : void 0,
|
|
159
138
|
propertyValues: dataType === DataType.PROPERTY ? rule.value.propertyValues : void 0
|
|
@@ -207,20 +186,11 @@ function importExpertRules(query) {
|
|
|
207
186
|
}
|
|
208
187
|
if (rule.values) {
|
|
209
188
|
if (rule.dataType === DataType.NUMBER) {
|
|
210
|
-
return rule.values.map((value) => parseFloat(value)).map((numberValue) =>
|
|
211
|
-
return microUnits.includes(rule.field) ? unitToMicroUnit(numberValue) : numberValue;
|
|
212
|
-
}).map((numberValue) => {
|
|
213
|
-
return kiloUnits.includes(rule.field) ? unitToKiloUnit(numberValue) : numberValue;
|
|
214
|
-
}).sort((a, b) => a - b);
|
|
189
|
+
return rule.values.map((value) => parseFloat(value)).map((numberValue) => convertInputValue(rule.field, numberValue)).sort((a, b) => a - b);
|
|
215
190
|
}
|
|
216
191
|
return rule.values.sort();
|
|
217
192
|
}
|
|
218
|
-
|
|
219
|
-
return unitToMicroUnit(parseFloat(rule.value));
|
|
220
|
-
}
|
|
221
|
-
if (kiloUnits.includes(rule.field)) {
|
|
222
|
-
return unitToKiloUnit(parseFloat(rule.value));
|
|
223
|
-
}
|
|
193
|
+
convertInputValue(rule.field, parseFloat(rule.value));
|
|
224
194
|
return rule.value;
|
|
225
195
|
}
|
|
226
196
|
function transformRule(rule) {
|
|
@@ -356,9 +326,6 @@ const queryValidator = (query) => {
|
|
|
356
326
|
};
|
|
357
327
|
const validateGroup = (ruleGroup) => {
|
|
358
328
|
const reasons = [];
|
|
359
|
-
if (ruleGroup.rules.length === 0) {
|
|
360
|
-
reasons.push(RULES.EMPTY_GROUP);
|
|
361
|
-
}
|
|
362
329
|
if (ruleGroup.id) {
|
|
363
330
|
if (reasons.length) {
|
|
364
331
|
result[ruleGroup.id] = { valid: false, reasons };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExpertFilterEditionDialog } from "./ExpertFilterEditionDialog.js";
|
|
2
2
|
import { EXPERT_FILTER_QUERY, ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData, rqbQuerySchemaValidator } from "./ExpertFilterForm.js";
|
|
3
|
-
import { CombinatorType, DataType,
|
|
3
|
+
import { CombinatorType, DataType, OperatorType } from "./expertFilter.type.js";
|
|
4
4
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./expertFilterConstants.js";
|
|
5
5
|
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expertFilterUtils.js";
|
|
6
6
|
export {
|
|
@@ -15,7 +15,6 @@ export {
|
|
|
15
15
|
ExpertFilterEditionDialog,
|
|
16
16
|
ExpertFilterForm,
|
|
17
17
|
FIELDS_OPTIONS,
|
|
18
|
-
FieldType,
|
|
19
18
|
LOAD_TYPE_OPTIONS,
|
|
20
19
|
OPERATOR_OPTIONS,
|
|
21
20
|
OperatorType,
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ElementExistsType } from '../../../utils/types/elementType';
|
|
3
|
-
import { UUID } from 'crypto';
|
|
1
|
+
import { FilterEditionProps } from '../filter.type';
|
|
4
2
|
|
|
5
|
-
export
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
titleId: string;
|
|
9
|
-
open: boolean;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
broadcastChannel: BroadcastChannel;
|
|
12
|
-
itemSelectionForCopy: ItemSelectionForCopy;
|
|
13
|
-
setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
|
|
14
|
-
getFilterById: (id: string) => Promise<any>;
|
|
15
|
-
activeDirectory?: UUID;
|
|
16
|
-
elementExists?: ElementExistsType;
|
|
17
|
-
language?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function ExplicitNamingFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, itemSelectionForCopy, setItemSelectionForCopy, getFilterById, activeDirectory, elementExists, language, }: Readonly<ExplicitNamingFilterEditionDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ExplicitNamingFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, itemSelectionForCopy, setItemSelectionForCopy, getFilterById, activeDirectory, elementExists, language, description, }: Readonly<FilterEditionProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,11 +13,10 @@ import { explicitNamingFilterSchema, FILTER_EQUIPMENTS_ATTRIBUTES } from "./Expl
|
|
|
13
13
|
import { FetchStatus } from "../../../utils/constants/fetchStatus.js";
|
|
14
14
|
import { FilterForm } from "../FilterForm.js";
|
|
15
15
|
import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from "../constants/FilterConstants.js";
|
|
16
|
+
import { HeaderFilterSchema } from "../HeaderFilterForm.js";
|
|
16
17
|
import * as yup from "yup";
|
|
17
18
|
const formSchema = yup.object().shape({
|
|
18
|
-
|
|
19
|
-
[FieldConstants.FILTER_TYPE]: yup.string().required(),
|
|
20
|
-
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
19
|
+
...HeaderFilterSchema,
|
|
21
20
|
...explicitNamingFilterSchema
|
|
22
21
|
}).required();
|
|
23
22
|
function ExplicitNamingFilterEditionDialog({
|
|
@@ -32,7 +31,8 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
32
31
|
getFilterById,
|
|
33
32
|
activeDirectory,
|
|
34
33
|
elementExists,
|
|
35
|
-
language
|
|
34
|
+
language,
|
|
35
|
+
description
|
|
36
36
|
}) {
|
|
37
37
|
var _a;
|
|
38
38
|
const { snackError } = useSnackMessage();
|
|
@@ -53,6 +53,7 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
53
53
|
setDataFetchStatus(FetchStatus.FETCH_SUCCESS);
|
|
54
54
|
reset({
|
|
55
55
|
[FieldConstants.NAME]: name,
|
|
56
|
+
[FieldConstants.DESCRIPTION]: description,
|
|
56
57
|
[FieldConstants.FILTER_TYPE]: FilterType.EXPLICIT_NAMING.id,
|
|
57
58
|
[FieldConstants.EQUIPMENT_TYPE]: response[FieldConstants.EQUIPMENT_TYPE],
|
|
58
59
|
[FILTER_EQUIPMENTS_ATTRIBUTES]: response[FILTER_EQUIPMENTS_ATTRIBUTES].map((row) => ({
|
|
@@ -68,7 +69,7 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
}, [id, name, open, reset, snackError, getFilterById]);
|
|
72
|
+
}, [id, name, open, reset, snackError, getFilterById, description]);
|
|
72
73
|
const onSubmit = useCallback(
|
|
73
74
|
(filterForm) => {
|
|
74
75
|
saveExplicitNamingFilter(
|
|
@@ -76,8 +77,7 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
76
77
|
false,
|
|
77
78
|
filterForm[FieldConstants.EQUIPMENT_TYPE],
|
|
78
79
|
filterForm[FieldConstants.NAME],
|
|
79
|
-
"",
|
|
80
|
-
// The description can not be edited from this dialog
|
|
80
|
+
filterForm[FieldConstants.DESCRIPTION] ?? "",
|
|
81
81
|
id,
|
|
82
82
|
(error) => {
|
|
83
83
|
snackError({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElementExistsType } from '../../utils';
|
|
1
2
|
import { UUID } from 'crypto';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,3 +12,20 @@ export type ItemSelectionForCopy = {
|
|
|
11
12
|
parentDirectoryUuid: UUID | null;
|
|
12
13
|
specificTypeItem: string | null;
|
|
13
14
|
};
|
|
15
|
+
export interface FilterEditionProps {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
titleId: string;
|
|
19
|
+
open: boolean;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
broadcastChannel: BroadcastChannel;
|
|
22
|
+
itemSelectionForCopy: ItemSelectionForCopy;
|
|
23
|
+
setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void;
|
|
24
|
+
getFilterById: (id: string) => Promise<{
|
|
25
|
+
[prop: string]: any;
|
|
26
|
+
}>;
|
|
27
|
+
activeDirectory?: UUID;
|
|
28
|
+
elementExists?: ElementExistsType;
|
|
29
|
+
language?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
@@ -5,7 +5,7 @@ import { CriteriaBasedForm } from "../contingencyList/criteriaBased/CriteriaBase
|
|
|
5
5
|
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "../contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
6
6
|
import { ExpertFilterEditionDialog } from "./expert/ExpertFilterEditionDialog.js";
|
|
7
7
|
import { EXPERT_FILTER_QUERY, ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData, rqbQuerySchemaValidator } from "./expert/ExpertFilterForm.js";
|
|
8
|
-
import { CombinatorType, DataType,
|
|
8
|
+
import { CombinatorType, DataType, OperatorType } from "./expert/expertFilter.type.js";
|
|
9
9
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./expert/expertFilterConstants.js";
|
|
10
10
|
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expert/expertFilterUtils.js";
|
|
11
11
|
import { ExplicitNamingFilterEditionDialog } from "./explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
@@ -31,7 +31,6 @@ export {
|
|
|
31
31
|
FIELDS_OPTIONS,
|
|
32
32
|
FILTER_EQUIPMENTS,
|
|
33
33
|
FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
34
|
-
FieldType,
|
|
35
34
|
FilterCreationDialog,
|
|
36
35
|
FilterForm,
|
|
37
36
|
FilterType,
|
|
@@ -41,6 +41,7 @@ const saveExplicitNamingFilter = (tableValues, isFilterCreation, equipmentType,
|
|
|
41
41
|
filterEquipmentsAttributes: cleanedTableValues
|
|
42
42
|
},
|
|
43
43
|
name,
|
|
44
|
+
description,
|
|
44
45
|
token
|
|
45
46
|
).then(() => {
|
|
46
47
|
handleClose();
|
|
@@ -75,6 +76,7 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
|
|
|
75
76
|
rules: exportExpertRules(query)
|
|
76
77
|
},
|
|
77
78
|
name,
|
|
79
|
+
description,
|
|
78
80
|
token
|
|
79
81
|
).then(() => {
|
|
80
82
|
onClose();
|
package/dist/components/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import { CriteriaBasedForm } from "./contingencyList/criteriaBased/CriteriaBased
|
|
|
30
30
|
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "./contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
31
31
|
import { ExpertFilterEditionDialog } from "./filter/expert/ExpertFilterEditionDialog.js";
|
|
32
32
|
import { EXPERT_FILTER_QUERY, ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData, rqbQuerySchemaValidator } from "./filter/expert/ExpertFilterForm.js";
|
|
33
|
-
import { CombinatorType, DataType,
|
|
33
|
+
import { CombinatorType, DataType, OperatorType } from "./filter/expert/expertFilter.type.js";
|
|
34
34
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./filter/expert/expertFilterConstants.js";
|
|
35
35
|
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./filter/expert/expertFilterUtils.js";
|
|
36
36
|
import { ExplicitNamingFilterEditionDialog } from "./filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
@@ -164,7 +164,6 @@ export {
|
|
|
164
164
|
FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
165
165
|
FieldErrorAlert,
|
|
166
166
|
FieldLabel,
|
|
167
|
-
FieldType,
|
|
168
167
|
FilterCreationDialog,
|
|
169
168
|
FilterForm,
|
|
170
169
|
FilterType,
|
|
@@ -8,14 +8,15 @@ import { useFormContext } from "react-hook-form";
|
|
|
8
8
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
9
9
|
import { ExpandingTextField } from "./ExpandingTextField.js";
|
|
10
10
|
function DescriptionField() {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const { setValue, getValues } = useFormContext();
|
|
12
|
+
const description = getValues(FieldConstants.DESCRIPTION);
|
|
13
|
+
const [isDescriptionFieldVisible, setIsDescriptionFieldVisible] = useState(!!description);
|
|
13
14
|
const handleOpenDescription = () => {
|
|
14
15
|
setIsDescriptionFieldVisible(true);
|
|
15
16
|
};
|
|
16
17
|
const handleCloseDescription = () => {
|
|
17
18
|
setIsDescriptionFieldVisible(false);
|
|
18
|
-
setValue(FieldConstants.DESCRIPTION, "");
|
|
19
|
+
setValue(FieldConstants.DESCRIPTION, "", { shouldDirty: true });
|
|
19
20
|
};
|
|
20
21
|
return /* @__PURE__ */ jsx(Box, { children: !isDescriptionFieldVisible ? /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleOpenDescription, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "AddDescription" }) }) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "flex-start" }, children: [
|
|
21
22
|
/* @__PURE__ */ jsx(
|
|
@@ -33,6 +33,7 @@ function UniqueNameInput({
|
|
|
33
33
|
const {
|
|
34
34
|
setError,
|
|
35
35
|
clearErrors,
|
|
36
|
+
trigger,
|
|
36
37
|
formState: { errors }
|
|
37
38
|
} = useFormContext();
|
|
38
39
|
const isValidating = (_a = errors.root) == null ? void 0 : _a.isValidating;
|
|
@@ -55,10 +56,11 @@ function UniqueNameInput({
|
|
|
55
56
|
console.error(e == null ? void 0 : e.message);
|
|
56
57
|
}).finally(() => {
|
|
57
58
|
clearErrors("root.isValidating");
|
|
59
|
+
trigger("root.isValidating");
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
},
|
|
61
|
-
[setError, clearErrors, name, elementType, elementExists, directory]
|
|
63
|
+
[setError, clearErrors, name, elementType, elementExists, directory, trigger]
|
|
62
64
|
);
|
|
63
65
|
const debouncedHandleCheckName = useDebounce(handleCheckName, 700);
|
|
64
66
|
useEffect(() => {
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import IconButton from "@mui/material/IconButton";
|
|
3
3
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
|
-
import {
|
|
5
|
+
import { recursiveRemove } from "../../filter/expert/expertFilterUtils.js";
|
|
6
6
|
const EXPERT_FILTER_QUERY = "rules";
|
|
7
7
|
function RemoveButton(props) {
|
|
8
8
|
const { path, className, title } = props;
|
|
@@ -12,8 +12,7 @@ function RemoveButton(props) {
|
|
|
12
12
|
function handleDelete() {
|
|
13
13
|
onChange(recursiveRemove(query, path));
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, title, children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {}) });
|
|
15
|
+
return /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => handleDelete(), className, title, children: /* @__PURE__ */ jsx(DeleteIcon, {}) });
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
18
|
RemoveButton
|
|
@@ -6,7 +6,7 @@ import { useFormContext } from "react-hook-form";
|
|
|
6
6
|
import { CountryValueEditor } from "./CountryValueEditor.js";
|
|
7
7
|
import { TranslatedValueEditor } from "./TranslatedValueEditor.js";
|
|
8
8
|
import { TextValueEditor } from "./TextValueEditor.js";
|
|
9
|
-
import {
|
|
9
|
+
import { DataType } from "../../filter/expert/expertFilter.type.js";
|
|
10
10
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
11
11
|
import { VoltageLevel, Substation } from "../../../utils/types/equipmentTypes.js";
|
|
12
12
|
import { ElementValueEditor } from "./ElementValueEditor.js";
|
|
@@ -15,6 +15,7 @@ import { PropertyValueEditor } from "./PropertyValueEditor.js";
|
|
|
15
15
|
import { FilterType } from "../../filter/constants/FilterConstants.js";
|
|
16
16
|
import { GroupValueEditor } from "./compositeRuleEditor/GroupValueEditor.js";
|
|
17
17
|
import { OPERATOR_OPTIONS } from "../../filter/expert/expertFilterConstants.js";
|
|
18
|
+
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
18
19
|
const styles = {
|
|
19
20
|
noArrows: {
|
|
20
21
|
"& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button": {
|
|
@@ -80,9 +81,9 @@ function ValueEditor(props) {
|
|
|
80
81
|
}
|
|
81
82
|
if (fieldData.dataType === DataType.PROPERTY) {
|
|
82
83
|
let equipmentType;
|
|
83
|
-
if (field === FieldType.
|
|
84
|
+
if (field === FieldType.SUBSTATION_PROPERTIES || field === FieldType.SUBSTATION_PROPERTIES_1 || field === FieldType.SUBSTATION_PROPERTIES_2) {
|
|
84
85
|
equipmentType = Substation.type;
|
|
85
|
-
} else if (field === FieldType.
|
|
86
|
+
} else if (field === FieldType.VOLTAGE_LEVEL_PROPERTIES || field === FieldType.VOLTAGE_LEVEL_PROPERTIES_1 || field === FieldType.VOLTAGE_LEVEL_PROPERTIES_2 || field === FieldType.VOLTAGE_LEVEL_PROPERTIES_3) {
|
|
86
87
|
equipmentType = VoltageLevel.type;
|
|
87
88
|
} else {
|
|
88
89
|
equipmentType = getValues(FieldConstants.EQUIPMENT_TYPE);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
export type NotificationsProviderProps = {
|
|
4
|
-
urls: Record<string, string>;
|
|
4
|
+
urls: Record<string, string | undefined>;
|
|
5
5
|
};
|
|
6
6
|
export declare function NotificationsProvider({ urls, children }: PropsWithChildren<NotificationsProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,9 @@ import ReconnectingWebSocket from "reconnecting-websocket";
|
|
|
4
4
|
import { NotificationsContext } from "./contexts/NotificationsContext.js";
|
|
5
5
|
import { useListenerManager } from "./hooks/useListenerManager.js";
|
|
6
6
|
const DELAY_BEFORE_WEBSOCKET_CONNECTED = 12e3;
|
|
7
|
+
function isUrlDefined(tuple) {
|
|
8
|
+
return tuple[1] !== void 0;
|
|
9
|
+
}
|
|
7
10
|
function NotificationsProvider({ urls, children }) {
|
|
8
11
|
const {
|
|
9
12
|
broadcast: broadcastMessage,
|
|
@@ -16,8 +19,8 @@ function NotificationsProvider({ urls, children }) {
|
|
|
16
19
|
removeListener: removeListenerOnReopen
|
|
17
20
|
} = useListenerManager(urls);
|
|
18
21
|
useEffect(() => {
|
|
19
|
-
const connections = Object.
|
|
20
|
-
const rws = new ReconnectingWebSocket(() =>
|
|
22
|
+
const connections = Object.entries(urls).filter(isUrlDefined).map(([urlKey, url]) => {
|
|
23
|
+
const rws = new ReconnectingWebSocket(() => url, [], {
|
|
21
24
|
// this option set the minimum duration being connected before reset the retry count to 0
|
|
22
25
|
minUptime: DELAY_BEFORE_WEBSOCKET_CONNECTED
|
|
23
26
|
});
|
|
@@ -34,9 +37,7 @@ function NotificationsProvider({ urls, children }) {
|
|
|
34
37
|
};
|
|
35
38
|
return rws;
|
|
36
39
|
});
|
|
37
|
-
return () =>
|
|
38
|
-
connections.forEach((c) => c.close());
|
|
39
|
-
};
|
|
40
|
+
return () => connections.forEach((c) => c.close());
|
|
40
41
|
}, [broadcastMessage, broadcastOnReopen, urls]);
|
|
41
42
|
const contextValue = useMemo(
|
|
42
43
|
() => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ListenerEventWS, ListenerOnReopen } from '../contexts/NotificationsContext';
|
|
2
2
|
|
|
3
|
-
export declare const useListenerManager: <TListener extends ListenerEventWS | ListenerOnReopen, TMessage extends MessageEvent<any>>(urls: Record<string, string>) => {
|
|
3
|
+
export declare const useListenerManager: <TListener extends ListenerEventWS | ListenerOnReopen, TMessage extends MessageEvent<any>>(urls: Record<string, string | undefined>) => {
|
|
4
4
|
addListener: (urlKey: string, listener: TListener) => void;
|
|
5
5
|
removeListener: (urlKey: string, id: string) => void;
|
|
6
6
|
broadcast: (urlKey: string) => (event: TMessage) => void;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { CriteriaBasedForm } from "./components/contingencyList/criteriaBased/Cr
|
|
|
31
31
|
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "./components/contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
32
32
|
import { ExpertFilterEditionDialog } from "./components/filter/expert/ExpertFilterEditionDialog.js";
|
|
33
33
|
import { EXPERT_FILTER_QUERY, ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData, rqbQuerySchemaValidator } from "./components/filter/expert/ExpertFilterForm.js";
|
|
34
|
-
import { CombinatorType, DataType,
|
|
34
|
+
import { CombinatorType, DataType, OperatorType } from "./components/filter/expert/expertFilter.type.js";
|
|
35
35
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./components/filter/expert/expertFilterConstants.js";
|
|
36
36
|
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./components/filter/expert/expertFilterUtils.js";
|
|
37
37
|
import { ExplicitNamingFilterEditionDialog } from "./components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
@@ -125,7 +125,8 @@ import { equalsArray } from "./utils/algos.js";
|
|
|
125
125
|
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./utils/constants/browserConstants.js";
|
|
126
126
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
127
127
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
128
|
-
import {
|
|
128
|
+
import { MAX_CHAR_DESCRIPTION } from "./utils/constants/uiConstants.js";
|
|
129
|
+
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
129
130
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
130
131
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
131
132
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
@@ -134,6 +135,7 @@ import { ElementType } from "./utils/types/elementType.js";
|
|
|
134
135
|
import { EQUIPMENT_TYPE, EquipmentType, OperatingStatus, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
|
|
135
136
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
|
|
136
137
|
import { MODIFICATION_TYPES, ModificationType } from "./utils/types/modificationType.js";
|
|
138
|
+
import { FieldType } from "./utils/types/fieldType.js";
|
|
137
139
|
import "./utils/yupConfig.js";
|
|
138
140
|
import { cardErrorBoundaryEn } from "./translations/en/cardErrorBoundaryEn.js";
|
|
139
141
|
import { commonButtonEn } from "./translations/en/commonButtonEn.js";
|
|
@@ -274,6 +276,7 @@ export {
|
|
|
274
276
|
Login,
|
|
275
277
|
LogoText,
|
|
276
278
|
Logout,
|
|
279
|
+
MAX_CHAR_DESCRIPTION,
|
|
277
280
|
MODIFICATION_TYPES,
|
|
278
281
|
MidFormError,
|
|
279
282
|
ModificationType,
|
|
@@ -350,6 +353,8 @@ export {
|
|
|
350
353
|
collectibleHelper,
|
|
351
354
|
commonButtonEn,
|
|
352
355
|
commonButtonFr,
|
|
356
|
+
convertInputValue,
|
|
357
|
+
convertOutputValue,
|
|
353
358
|
countRules,
|
|
354
359
|
createFilter,
|
|
355
360
|
csvEn,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Metadata, StudyMetadata } from '../utils';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type UrlString = `${string}://${string}` | `/${string}` | `./${string}`;
|
|
4
|
+
export type Url = UrlString | URL;
|
|
4
5
|
export type Env = {
|
|
5
6
|
appsMetadataServerUrl?: Url;
|
|
6
7
|
mapBoxToken?: string;
|
|
@@ -2,5 +2,5 @@ import { ElementAttributes } from '../utils/types/types';
|
|
|
2
2
|
import { UUID } from 'crypto';
|
|
3
3
|
|
|
4
4
|
export declare function createFilter(newFilter: any, name: string, description: string, parentDirectoryUuid?: UUID, token?: string): Promise<any>;
|
|
5
|
-
export declare function saveFilter(filter: any, name: string, token?: string): Promise<any>;
|
|
5
|
+
export declare function saveFilter(filter: any, name: string, description: string, token?: string): Promise<any>;
|
|
6
6
|
export declare function fetchElementsInfos(ids: UUID[], elementTypes?: string[], equipmentTypes?: string[]): Promise<ElementAttributes[]>;
|
package/dist/services/explore.js
CHANGED
|
@@ -17,9 +17,10 @@ function createFilter(newFilter, name, description, parentDirectoryUuid, token)
|
|
|
17
17
|
token
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
function saveFilter(filter, name, token) {
|
|
20
|
+
function saveFilter(filter, name, description, token) {
|
|
21
21
|
const urlSearchParams = new URLSearchParams();
|
|
22
22
|
urlSearchParams.append("name", name);
|
|
23
|
+
urlSearchParams.append("description", description);
|
|
23
24
|
return backendFetch(
|
|
24
25
|
`${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/filters/${filter.id}?${urlSearchParams.toString()}`,
|
|
25
26
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./browserConstants.js";
|
|
2
2
|
import { FetchStatus } from "./fetchStatus.js";
|
|
3
3
|
import { FieldConstants } from "./fieldConstants.js";
|
|
4
|
+
import { MAX_CHAR_DESCRIPTION } from "./uiConstants.js";
|
|
4
5
|
export {
|
|
5
6
|
DARK_THEME,
|
|
6
7
|
FetchStatus,
|
|
@@ -8,5 +9,6 @@ export {
|
|
|
8
9
|
LANG_ENGLISH,
|
|
9
10
|
LANG_FRENCH,
|
|
10
11
|
LANG_SYSTEM,
|
|
11
|
-
LIGHT_THEME
|
|
12
|
+
LIGHT_THEME,
|
|
13
|
+
MAX_CHAR_DESCRIPTION
|
|
12
14
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MAX_CHAR_DESCRIPTION = 500;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
1
|
+
import { FieldType } from './types/fieldType';
|
|
2
|
+
|
|
7
3
|
export declare const GRIDSUITE_DEFAULT_PRECISION: number;
|
|
8
4
|
export declare const roundToPrecision: (num: number, precision: number) => number;
|
|
9
5
|
export declare const roundToDefaultPrecision: (num: number) => number;
|
|
10
6
|
export declare function isBlankOrEmpty(value: unknown): boolean;
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
14
|
-
export declare
|
|
7
|
+
export declare function unitToMicroUnit(num: number): number | undefined;
|
|
8
|
+
export declare function microUnitToUnit(num: number): number | undefined;
|
|
9
|
+
export declare function unitToKiloUnit(num: number): number | undefined;
|
|
10
|
+
export declare function kiloUnitToUnit(num: number): number | undefined;
|
|
11
|
+
export declare function convertInputValue(field: FieldType, value: any): any;
|
|
12
|
+
export declare function convertOutputValue(field: FieldType, value: any): any;
|