@gridsuite/commons-ui 0.121.0 → 0.123.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/filter/FilterCreationDialog.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +2 -1
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +1 -1
- package/dist/components/filter/utils/filterApi.d.ts +2 -2
- package/dist/components/filter/utils/filterApi.js +4 -4
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +2 -7
- package/dist/components/notifications/hooks/useListenerManager.js +7 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/translations/en/filterExpertEn.d.ts +1 -0
- package/dist/translations/en/filterExpertEn.js +1 -0
- package/dist/translations/fr/filterExpertFr.d.ts +1 -0
- package/dist/translations/fr/filterExpertFr.js +1 -0
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ function FilterCreationDialog({
|
|
|
60
60
|
null,
|
|
61
61
|
(error) => {
|
|
62
62
|
snackError({
|
|
63
|
-
messageTxt: error
|
|
63
|
+
messageTxt: error.message
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
onClose,
|
|
@@ -78,7 +78,7 @@ function FilterCreationDialog({
|
|
|
78
78
|
onClose,
|
|
79
79
|
(error) => {
|
|
80
80
|
snackError({
|
|
81
|
-
messageTxt: error
|
|
81
|
+
messageTxt: error.message
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { UUID } from 'crypto';
|
|
2
|
-
export declare const saveExplicitNamingFilter: (tableValues: any[], isFilterCreation: boolean, equipmentType: string, name: string, description: string, id: string | null, setCreateFilterErr: (
|
|
3
|
-
export declare const saveExpertFilter: (id: string | null, query: any, equipmentType: string, name: string, description: string, isFilterCreation: boolean, activeDirectory: UUID | undefined | null, onClose: () => void, onError: (
|
|
2
|
+
export declare const saveExplicitNamingFilter: (tableValues: any[], isFilterCreation: boolean, equipmentType: string, name: string, description: string, id: string | null, setCreateFilterErr: (error: Error) => void, handleClose: () => void, activeDirectory?: UUID, token?: string) => void;
|
|
3
|
+
export declare const saveExpertFilter: (id: string | null, query: any, equipmentType: string, name: string, description: string, isFilterCreation: boolean, activeDirectory: UUID | undefined | null, onClose: () => void, onError: (error: Error) => void, token?: string) => void;
|
|
@@ -37,7 +37,7 @@ const saveExplicitNamingFilter = (tableValues, isFilterCreation, equipmentType,
|
|
|
37
37
|
).then(() => {
|
|
38
38
|
handleClose();
|
|
39
39
|
}).catch((error) => {
|
|
40
|
-
setCreateFilterErr(error
|
|
40
|
+
setCreateFilterErr(error instanceof Error ? error : new Error("unknown error"));
|
|
41
41
|
});
|
|
42
42
|
} else {
|
|
43
43
|
saveFilter(
|
|
@@ -53,7 +53,7 @@ const saveExplicitNamingFilter = (tableValues, isFilterCreation, equipmentType,
|
|
|
53
53
|
).then(() => {
|
|
54
54
|
handleClose();
|
|
55
55
|
}).catch((error) => {
|
|
56
|
-
setCreateFilterErr(error
|
|
56
|
+
setCreateFilterErr(error instanceof Error ? error : new Error("unknown error"));
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
};
|
|
@@ -74,7 +74,7 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
|
|
|
74
74
|
onClose();
|
|
75
75
|
}).catch((error) => {
|
|
76
76
|
catchErrorHandler(error, (message) => {
|
|
77
|
-
onError(message);
|
|
77
|
+
onError(new Error(message));
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
} else {
|
|
@@ -92,7 +92,7 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
|
|
|
92
92
|
onClose();
|
|
93
93
|
}).catch((error) => {
|
|
94
94
|
catchErrorHandler(error, (message) => {
|
|
95
|
-
onError(message);
|
|
95
|
+
onError(new Error(message));
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
}
|
|
@@ -12,7 +12,6 @@ import { VoltageLevel, Substation } from "../../../utils/types/equipmentTypes.js
|
|
|
12
12
|
import { ElementValueEditor } from "./ElementValueEditor.js";
|
|
13
13
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
14
14
|
import { PropertyValueEditor } from "./PropertyValueEditor.js";
|
|
15
|
-
import { FilterType } from "../../filter/constants/FilterConstants.js";
|
|
16
15
|
import { GroupValueEditor } from "./compositeRuleEditor/GroupValueEditor.js";
|
|
17
16
|
import { OPERATOR_OPTIONS } from "../../filter/expert/expertFilterConstants.js";
|
|
18
17
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
@@ -32,13 +31,9 @@ function ValueEditor(props) {
|
|
|
32
31
|
const { getValues } = formContext;
|
|
33
32
|
const itemFilter = useCallback(
|
|
34
33
|
(filterValue) => {
|
|
35
|
-
var _a, _b, _c
|
|
34
|
+
var _a, _b, _c;
|
|
36
35
|
if ((filterValue == null ? void 0 : filterValue.type) === ElementType.FILTER) {
|
|
37
|
-
return (
|
|
38
|
-
// we do not authorize to use an expert filter in the rules of
|
|
39
|
-
// another expert filter, to prevent potential cycle problems
|
|
40
|
-
((_a = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _a.type) !== FilterType.EXPERT.id && (field === FieldType.ID && ((_b = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _b.equipmentType) === getValues(FieldConstants.EQUIPMENT_TYPE) || (field === FieldType.VOLTAGE_LEVEL_ID || field === FieldType.VOLTAGE_LEVEL_ID_1 || field === FieldType.VOLTAGE_LEVEL_ID_2 || field === FieldType.VOLTAGE_LEVEL_ID_3) && ((_c = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _c.equipmentType) === VoltageLevel.type || (field === FieldType.SUBSTATION_ID || field === FieldType.SUBSTATION_ID_1 || field === FieldType.SUBSTATION_ID_2) && ((_d = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _d.equipmentType) === Substation.type)
|
|
41
|
-
);
|
|
36
|
+
return field === FieldType.ID && ((_a = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _a.equipmentType) === getValues(FieldConstants.EQUIPMENT_TYPE) || (field === FieldType.VOLTAGE_LEVEL_ID || field === FieldType.VOLTAGE_LEVEL_ID_1 || field === FieldType.VOLTAGE_LEVEL_ID_2 || field === FieldType.VOLTAGE_LEVEL_ID_3) && ((_b = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _b.equipmentType) === VoltageLevel.type || (field === FieldType.SUBSTATION_ID || field === FieldType.SUBSTATION_ID_1 || field === FieldType.SUBSTATION_ID_2) && ((_c = filterValue == null ? void 0 : filterValue.specificMetadata) == null ? void 0 : _c.equipmentType) === Substation.type;
|
|
42
37
|
}
|
|
43
38
|
return true;
|
|
44
39
|
},
|
|
@@ -13,7 +13,13 @@ const useListenerManager = (urls) => {
|
|
|
13
13
|
const addListenerEvent = useCallback((urlKey, listener) => {
|
|
14
14
|
const urlsListeners = urlsListenersRef.current;
|
|
15
15
|
if (urlKey in urlsListeners) {
|
|
16
|
-
urlsListeners[urlKey].
|
|
16
|
+
const existingIndex = urlsListeners[urlKey].findIndex((l) => l.id === listener.id);
|
|
17
|
+
if (existingIndex !== -1) {
|
|
18
|
+
console.warn(`🔄 Replacing existing listener ${listener.id} on ${urlKey}`);
|
|
19
|
+
urlsListeners[urlKey][existingIndex] = listener;
|
|
20
|
+
} else {
|
|
21
|
+
urlsListeners[urlKey].push(listener);
|
|
22
|
+
}
|
|
17
23
|
} else {
|
|
18
24
|
urlsListeners[urlKey] = [listener];
|
|
19
25
|
}
|
|
@@ -77,7 +77,7 @@ const useShortCircuitParametersForm = ({
|
|
|
77
77
|
const resetAll = useCallback(
|
|
78
78
|
(predefinedParameter) => {
|
|
79
79
|
const dirty = { shouldDirty: true };
|
|
80
|
-
setValue(SHORT_CIRCUIT_WITH_FEEDER_RESULT,
|
|
80
|
+
setValue(SHORT_CIRCUIT_WITH_FEEDER_RESULT, false, dirty);
|
|
81
81
|
setValue(SHORT_CIRCUIT_WITH_LOADS, false, dirty);
|
|
82
82
|
setValue(
|
|
83
83
|
SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS,
|
|
@@ -172,6 +172,7 @@ const filterExpertFr = {
|
|
|
172
172
|
pairingKey: "Xnode",
|
|
173
173
|
tieLineId: "ID de l'interconnexion",
|
|
174
174
|
cannotRetrieveFilter: "Erreur d'accès au filtre : ",
|
|
175
|
+
cannotSaveFilter: "Erreur lors de la mise à jour du filtre : ",
|
|
175
176
|
equality: "=",
|
|
176
177
|
notEquality: "!=",
|
|
177
178
|
greaterThan: ">",
|