@gridsuite/commons-ui 0.132.0 → 0.134.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/authentication/utils/authService.js +6 -9
- package/dist/components/checkBoxList/CheckBoxList.js +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItems.js +4 -4
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +5 -5
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +1 -1
- package/dist/components/contingencyList/criteriaBased/criteriaBasedUtils.js +7 -7
- package/dist/components/csvDownloader/use-csv-export.js +1 -4
- package/dist/components/customAGGrid/customAggrid.js +2 -2
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +1 -2
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +6 -6
- package/dist/components/dialogs/elementSaveDialog/utils.js +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +1 -1
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +3 -4
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +2 -3
- package/dist/components/dnd-table/dnd-table.js +7 -7
- package/dist/components/elementSearch/elementItem/EquipmentItem.js +6 -7
- package/dist/components/elementSearch/elementSearchDialog/ElementSearchDialog.js +1 -1
- package/dist/components/elementSearch/tagRenderer/TagRenderer.js +3 -4
- package/dist/components/filter/FilterCreationDialog.js +23 -13
- package/dist/components/filter/FilterForm.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +13 -6
- package/dist/components/filter/expert/ExpertFilterForm.d.ts +0 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +11 -21
- package/dist/components/filter/expert/expertFilterConstants.d.ts +13 -12
- package/dist/components/filter/expert/expertFilterConstants.js +17 -48
- package/dist/components/filter/expert/expertFilterUtils.js +21 -25
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -4
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +11 -18
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +14 -6
- package/dist/components/flatParameters/FlatParameters.js +2 -2
- package/dist/components/index.js +1 -4
- package/dist/components/inputs/SelectClearable.js +1 -1
- package/dist/components/inputs/index.js +0 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -48
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +3 -4
- package/dist/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js +1 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +4 -4
- package/dist/components/inputs/reactHookForm/chip-items-input.js +3 -3
- package/dist/components/inputs/reactHookForm/errorManagement/ErrorInput.js +1 -2
- package/dist/components/inputs/reactHookForm/index.js +0 -2
- package/dist/components/inputs/reactHookForm/numbers/FloatInput.js +1 -1
- package/dist/components/inputs/reactHookForm/numbers/SliderInput.js +1 -1
- package/dist/components/inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js +2 -2
- package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -3
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +4 -4
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +3 -3
- package/dist/components/inputs/reactHookForm/text/ExpandingTextField.js +2 -2
- package/dist/components/inputs/reactHookForm/text/TextInput.js +5 -5
- package/dist/components/inputs/reactHookForm/text/UniqueNameInput.js +2 -2
- package/dist/components/inputs/reactHookForm/utils/SubmitButton.js +1 -1
- package/dist/components/inputs/reactHookForm/utils/functions.js +2 -3
- package/dist/components/inputs/reactHookForm/utils/index.d.ts +0 -1
- package/dist/components/inputs/reactHookForm/utils/index.js +0 -2
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +8 -9
- package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/TranslatedValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/GroupValueEditor.js +12 -15
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js +3 -4
- package/dist/components/notifications/hooks/useListenerManager.js +2 -4
- package/dist/components/overflowableText/OverflowableText.js +4 -5
- package/dist/components/parameters/common/computing-type.d.ts +2 -1
- package/dist/components/parameters/common/computing-type.js +3 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +1 -1
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +3 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +15 -16
- package/dist/components/parameters/network-visualizations/map-parameters.js +13 -17
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +1 -2
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +5 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/sensitivity-table.js +2 -3
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +42 -54
- package/dist/components/parameters/sensi/utils.js +16 -27
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +47 -56
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/components/snackbarProvider/SnackbarProvider.js +1 -4
- package/dist/components/topBar/TopBar.js +33 -36
- package/dist/components/topBar/UserInformationDialog.js +7 -8
- package/dist/components/topBar/UserSettingsDialog.js +1 -1
- package/dist/components/treeViewFinder/TreeViewFinder.js +13 -13
- package/dist/hooks/use-parameters-backend.js +5 -5
- package/dist/hooks/use-unique-name-validation.js +2 -3
- package/dist/hooks/useConfidentialityWarning.js +1 -1
- package/dist/hooks/usePredefinedProperties.js +1 -2
- package/dist/index.js +9 -5
- package/dist/redux/commonStore.js +1 -2
- package/dist/services/businessErrorCode.d.ts +11 -0
- package/dist/services/businessErrorCode.js +10 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/utils.js +13 -7
- package/dist/translations/en/businessErrorsEn.d.ts +28 -0
- package/dist/translations/en/businessErrorsEn.js +25 -0
- package/dist/translations/en/equipmentsEn.d.ts +1 -0
- package/dist/translations/en/equipmentsEn.js +2 -1
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/fr/businessErrorsFr.d.ts +28 -0
- package/dist/translations/fr/businessErrorsFr.js +25 -0
- package/dist/translations/fr/equipmentsFr.d.ts +1 -0
- package/dist/translations/fr/equipmentsFr.js +2 -1
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/types/equipmentType.d.ts +162 -8
- package/dist/utils/types/equipmentType.js +126 -22
- package/dist/utils/types/index.js +2 -1
- package/package.json +6 -6
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.d.ts +0 -2
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.js +0 -9
|
@@ -17,6 +17,7 @@ import { catchErrorHandler } from "../../../services/utils.js";
|
|
|
17
17
|
import "../../../utils/conversionUtils.js";
|
|
18
18
|
import "@mui/icons-material";
|
|
19
19
|
import "../../../utils/types/equipmentType.js";
|
|
20
|
+
import { CustomError } from "../../../services/businessErrorCode.js";
|
|
20
21
|
import { EXPERT_FILTER_QUERY } from "./expertFilterConstants.js";
|
|
21
22
|
import * as yup from "yup";
|
|
22
23
|
const formSchema = yup.object().shape({
|
|
@@ -37,7 +38,6 @@ function ExpertFilterEditionDialog({
|
|
|
37
38
|
language,
|
|
38
39
|
description
|
|
39
40
|
}) {
|
|
40
|
-
var _a;
|
|
41
41
|
const { snackError } = useSnackMessage();
|
|
42
42
|
const [dataFetchStatus, setDataFetchStatus] = useState(FetchStatus.IDLE);
|
|
43
43
|
const formMethods = useForm({
|
|
@@ -48,7 +48,7 @@ function ExpertFilterEditionDialog({
|
|
|
48
48
|
formState: { errors }
|
|
49
49
|
} = formMethods;
|
|
50
50
|
const nameError = errors[FieldConstants.NAME];
|
|
51
|
-
const isValidating =
|
|
51
|
+
const isValidating = errors.root?.isValidating;
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (id && open) {
|
|
54
54
|
setDataFetchStatus(FetchStatus.FETCHING);
|
|
@@ -83,10 +83,17 @@ function ExpertFilterEditionDialog({
|
|
|
83
83
|
null,
|
|
84
84
|
onClose,
|
|
85
85
|
(error) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
if (error instanceof CustomError && error.businessErrorCode != null) {
|
|
87
|
+
snackError({
|
|
88
|
+
messageId: error.businessErrorCode,
|
|
89
|
+
headerId: "cannotSaveFilter"
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
snackError({
|
|
93
|
+
messageTxt: error.message,
|
|
94
|
+
headerId: "cannotSaveFilter"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
90
97
|
}
|
|
91
98
|
);
|
|
92
99
|
if (itemSelectionForCopy.sourceItemUuid === id) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FieldType } from '../../../utils/types/fieldType';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
|
-
export declare const rqbQuerySchemaValidator: (schema: yup.Schema) => yup.Schema<any, any, any, "">;
|
|
4
3
|
export declare const expertFilterSchema: {
|
|
5
4
|
rules: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
|
|
6
5
|
};
|
|
@@ -6,11 +6,10 @@ import * as yup from "yup";
|
|
|
6
6
|
import { v4 } from "uuid";
|
|
7
7
|
import { Box } from "@mui/material";
|
|
8
8
|
import { testQuery } from "./expertFilterUtils.js";
|
|
9
|
-
import { EXPERT_FILTER_QUERY,
|
|
9
|
+
import { EXPERT_FILTER_QUERY, RULES, OPERATOR_OPTIONS, COMBINATOR_OPTIONS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_EQUIPMENTS } from "./expertFilterConstants.js";
|
|
10
10
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
11
11
|
import { InputWithPopupConfirmation } from "../../inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
12
12
|
import { SelectInput } from "../../inputs/reactHookForm/selectInputs/SelectInput.js";
|
|
13
|
-
import { FilterType } from "../constants/FilterConstants.js";
|
|
14
13
|
import { CustomReactQueryBuilder } from "../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
|
|
15
14
|
import { unscrollableDialogStyles } from "../../dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
16
15
|
import "../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
@@ -39,22 +38,15 @@ yup.setLocale({
|
|
|
39
38
|
import '../../../assets/ExpertFilterForm.css';function isSupportedEquipmentType(equipmentType) {
|
|
40
39
|
return Object.values(EXPERT_FILTER_EQUIPMENTS).map((equipments) => equipments.id).includes(equipmentType);
|
|
41
40
|
}
|
|
42
|
-
const rqbQuerySchemaValidator = (schema) => schema.test(RULES.EMPTY_GROUP, RULES.EMPTY_GROUP, (query) => {
|
|
43
|
-
return testQuery(RULES.EMPTY_GROUP, query);
|
|
44
|
-
}).test(RULES.EMPTY_RULE, RULES.EMPTY_RULE, (query) => {
|
|
45
|
-
return testQuery(RULES.EMPTY_RULE, query);
|
|
46
|
-
}).test(RULES.INCORRECT_RULE, RULES.INCORRECT_RULE, (query) => {
|
|
47
|
-
return testQuery(RULES.INCORRECT_RULE, query);
|
|
48
|
-
}).test(RULES.BETWEEN_RULE, RULES.BETWEEN_RULE, (query) => {
|
|
49
|
-
return testQuery(RULES.BETWEEN_RULE, query);
|
|
50
|
-
});
|
|
51
41
|
const expertFilterSchema = {
|
|
52
|
-
[EXPERT_FILTER_QUERY]: yup.object().
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
[EXPERT_FILTER_QUERY]: yup.object().test(RULES.EMPTY_GROUP, RULES.EMPTY_GROUP, (query) => {
|
|
43
|
+
return testQuery(RULES.EMPTY_GROUP, query);
|
|
44
|
+
}).test(RULES.EMPTY_RULE, RULES.EMPTY_RULE, (query) => {
|
|
45
|
+
return testQuery(RULES.EMPTY_RULE, query);
|
|
46
|
+
}).test(RULES.INCORRECT_RULE, RULES.INCORRECT_RULE, (query) => {
|
|
47
|
+
return testQuery(RULES.INCORRECT_RULE, query);
|
|
48
|
+
}).test(RULES.BETWEEN_RULE, RULES.BETWEEN_RULE, (query) => {
|
|
49
|
+
return testQuery(RULES.BETWEEN_RULE, query);
|
|
58
50
|
})
|
|
59
51
|
};
|
|
60
52
|
const defaultQuery = {
|
|
@@ -86,8 +78,7 @@ function ExpertFilterForm() {
|
|
|
86
78
|
});
|
|
87
79
|
const formatLabelWithUnit = useFormatLabelWithUnit();
|
|
88
80
|
const translatedFields = useMemo(() => {
|
|
89
|
-
|
|
90
|
-
return (_a = EXPERT_FILTER_FIELDS[watchEquipmentType]) == null ? void 0 : _a.map((field) => {
|
|
81
|
+
return EXPERT_FILTER_FIELDS[watchEquipmentType]?.map((field) => {
|
|
91
82
|
return {
|
|
92
83
|
...field,
|
|
93
84
|
label: formatLabelWithUnit(field)
|
|
@@ -116,6 +107,5 @@ function ExpertFilterForm() {
|
|
|
116
107
|
export {
|
|
117
108
|
ExpertFilterForm,
|
|
118
109
|
expertFilterSchema,
|
|
119
|
-
getExpertFilterEmptyFormData
|
|
120
|
-
rqbQuerySchemaValidator
|
|
110
|
+
getExpertFilterEmptyFormData
|
|
121
111
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Field } from 'react-querybuilder';
|
|
2
2
|
import { CombinatorType, DataType, OperatorType } from './expertFilter.type';
|
|
3
3
|
import { FieldType } from '../../../utils/types/fieldType';
|
|
4
|
+
import { EquipmentType } from '../../../utils';
|
|
4
5
|
export declare enum RULES {
|
|
5
6
|
EMPTY_RULE = "emptyRule",
|
|
6
7
|
EMPTY_GROUP = "emptyGroup",
|
|
@@ -10,51 +11,51 @@ export declare enum RULES {
|
|
|
10
11
|
export declare const EXPERT_FILTER_QUERY = "rules";
|
|
11
12
|
export declare const EXPERT_FILTER_EQUIPMENTS: {
|
|
12
13
|
SUBSTATION: {
|
|
13
|
-
id:
|
|
14
|
+
id: EquipmentType;
|
|
14
15
|
label: string;
|
|
15
16
|
};
|
|
16
17
|
VOLTAGE_LEVEL: {
|
|
17
|
-
id:
|
|
18
|
+
id: EquipmentType;
|
|
18
19
|
label: string;
|
|
19
20
|
};
|
|
20
21
|
LINE: {
|
|
21
|
-
id:
|
|
22
|
+
id: EquipmentType;
|
|
22
23
|
label: string;
|
|
23
24
|
};
|
|
24
25
|
TWO_WINDINGS_TRANSFORMER: {
|
|
25
|
-
id:
|
|
26
|
+
id: EquipmentType;
|
|
26
27
|
label: string;
|
|
27
28
|
};
|
|
28
29
|
THREE_WINDINGS_TRANSFORMER: {
|
|
29
|
-
id:
|
|
30
|
+
id: EquipmentType;
|
|
30
31
|
label: string;
|
|
31
32
|
};
|
|
32
33
|
GENERATOR: {
|
|
33
|
-
id:
|
|
34
|
+
id: EquipmentType;
|
|
34
35
|
label: string;
|
|
35
36
|
};
|
|
36
37
|
BATTERY: {
|
|
37
|
-
id:
|
|
38
|
+
id: EquipmentType;
|
|
38
39
|
label: string;
|
|
39
40
|
};
|
|
40
41
|
LOAD: {
|
|
41
|
-
id:
|
|
42
|
+
id: EquipmentType;
|
|
42
43
|
label: string;
|
|
43
44
|
};
|
|
44
45
|
SHUNT_COMPENSATOR: {
|
|
45
|
-
id:
|
|
46
|
+
id: EquipmentType;
|
|
46
47
|
label: string;
|
|
47
48
|
};
|
|
48
49
|
STATIC_VAR_COMPENSATOR: {
|
|
49
|
-
id:
|
|
50
|
+
id: EquipmentType;
|
|
50
51
|
label: string;
|
|
51
52
|
};
|
|
52
53
|
HVDC_LINE: {
|
|
53
|
-
id:
|
|
54
|
+
id: EquipmentType;
|
|
54
55
|
label: string;
|
|
55
56
|
};
|
|
56
57
|
DANGLING_LINE: {
|
|
57
|
-
id:
|
|
58
|
+
id: EquipmentType;
|
|
58
59
|
label: string;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { OperatorType, CombinatorType, DataType } from "./expertFilter.type.js";
|
|
2
2
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
3
3
|
import { KILO_AMPERE, KILO_VOLT, MICRO_SIEMENS, SIEMENS, MEGA_VAR, MEGA_WATT, OHM, MEGA_VOLT_AMPERE } from "../../../utils/constants/unitsConstants.js";
|
|
4
|
+
import "../../../utils/conversionUtils.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "@mui/icons-material";
|
|
7
|
+
import { EquipmentType, ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
|
|
8
|
+
import "../../../utils/yupConfig.js";
|
|
4
9
|
var RULES = /* @__PURE__ */ ((RULES2) => {
|
|
5
10
|
RULES2["EMPTY_RULE"] = "emptyRule";
|
|
6
11
|
RULES2["EMPTY_GROUP"] = "emptyGroup";
|
|
@@ -10,54 +15,18 @@ var RULES = /* @__PURE__ */ ((RULES2) => {
|
|
|
10
15
|
})(RULES || {});
|
|
11
16
|
const EXPERT_FILTER_QUERY = "rules";
|
|
12
17
|
const EXPERT_FILTER_EQUIPMENTS = {
|
|
13
|
-
SUBSTATION:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
TWO_WINDINGS_TRANSFORMER: {
|
|
26
|
-
id: "TWO_WINDINGS_TRANSFORMER",
|
|
27
|
-
label: "TwoWindingsTransformers"
|
|
28
|
-
},
|
|
29
|
-
THREE_WINDINGS_TRANSFORMER: {
|
|
30
|
-
id: "THREE_WINDINGS_TRANSFORMER",
|
|
31
|
-
label: "ThreeWindingsTransformers"
|
|
32
|
-
},
|
|
33
|
-
GENERATOR: {
|
|
34
|
-
id: "GENERATOR",
|
|
35
|
-
label: "Generators"
|
|
36
|
-
},
|
|
37
|
-
BATTERY: {
|
|
38
|
-
id: "BATTERY",
|
|
39
|
-
label: "Batteries"
|
|
40
|
-
},
|
|
41
|
-
LOAD: {
|
|
42
|
-
id: "LOAD",
|
|
43
|
-
label: "Loads"
|
|
44
|
-
},
|
|
45
|
-
SHUNT_COMPENSATOR: {
|
|
46
|
-
id: "SHUNT_COMPENSATOR",
|
|
47
|
-
label: "ShuntCompensators"
|
|
48
|
-
},
|
|
49
|
-
STATIC_VAR_COMPENSATOR: {
|
|
50
|
-
id: "STATIC_VAR_COMPENSATOR",
|
|
51
|
-
label: "StaticVarCompensators"
|
|
52
|
-
},
|
|
53
|
-
HVDC_LINE: {
|
|
54
|
-
id: "HVDC_LINE",
|
|
55
|
-
label: "Hvdc"
|
|
56
|
-
},
|
|
57
|
-
DANGLING_LINE: {
|
|
58
|
-
id: "DANGLING_LINE",
|
|
59
|
-
label: "DanglingLines"
|
|
60
|
-
}
|
|
18
|
+
[EquipmentType.SUBSTATION]: ALL_EQUIPMENTS[EquipmentType.SUBSTATION],
|
|
19
|
+
[EquipmentType.VOLTAGE_LEVEL]: ALL_EQUIPMENTS[EquipmentType.VOLTAGE_LEVEL],
|
|
20
|
+
[EquipmentType.LINE]: ALL_EQUIPMENTS[EquipmentType.LINE],
|
|
21
|
+
[EquipmentType.TWO_WINDINGS_TRANSFORMER]: ALL_EQUIPMENTS[EquipmentType.TWO_WINDINGS_TRANSFORMER],
|
|
22
|
+
[EquipmentType.THREE_WINDINGS_TRANSFORMER]: ALL_EQUIPMENTS[EquipmentType.THREE_WINDINGS_TRANSFORMER],
|
|
23
|
+
[EquipmentType.GENERATOR]: ALL_EQUIPMENTS[EquipmentType.GENERATOR],
|
|
24
|
+
[EquipmentType.BATTERY]: ALL_EQUIPMENTS[EquipmentType.BATTERY],
|
|
25
|
+
[EquipmentType.LOAD]: ALL_EQUIPMENTS[EquipmentType.LOAD],
|
|
26
|
+
[EquipmentType.SHUNT_COMPENSATOR]: ALL_EQUIPMENTS[EquipmentType.SHUNT_COMPENSATOR],
|
|
27
|
+
[EquipmentType.STATIC_VAR_COMPENSATOR]: ALL_EQUIPMENTS[EquipmentType.STATIC_VAR_COMPENSATOR],
|
|
28
|
+
[EquipmentType.HVDC_LINE]: ALL_EQUIPMENTS[EquipmentType.HVDC_LINE],
|
|
29
|
+
[EquipmentType.DANGLING_LINE]: ALL_EQUIPMENTS[EquipmentType.DANGLING_LINE]
|
|
61
30
|
};
|
|
62
31
|
const ENERGY_SOURCE_OPTIONS = [
|
|
63
32
|
{ name: "HYDRO", label: "Hydro" },
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { defaultOperators, getParentPath, findPath, remove } from "react-querybuilder";
|
|
2
2
|
import { validate } from "uuid";
|
|
3
3
|
import { DataType } from "./expertFilter.type.js";
|
|
4
|
-
import { OPERATOR_OPTIONS, RULES, FIELDS_OPTIONS
|
|
4
|
+
import { OPERATOR_OPTIONS, RULES, FIELDS_OPTIONS } from "./expertFilterConstants.js";
|
|
5
5
|
import { isBlankOrEmpty, convertOutputValue, convertInputValue } from "../../../utils/conversionUtils.js";
|
|
6
6
|
import { FieldType } from "../../../utils/types/fieldType.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "@mui/icons-material";
|
|
9
|
+
import { ALL_EQUIPMENTS } from "../../../utils/types/equipmentType.js";
|
|
10
|
+
import "../../../utils/yupConfig.js";
|
|
7
11
|
const searchTree = (tree, key, value) => {
|
|
8
12
|
const stack = Object.values(tree);
|
|
9
13
|
while (stack.length) {
|
|
10
14
|
const node = stack.shift();
|
|
11
|
-
if (
|
|
15
|
+
if (node?.[key] === value) {
|
|
12
16
|
return node;
|
|
13
17
|
}
|
|
14
|
-
if (node
|
|
18
|
+
if (node?.children) {
|
|
15
19
|
stack.push(...Object.values(node.children));
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -28,11 +32,11 @@ const getDataType = (fieldName, operator) => {
|
|
|
28
32
|
return DataType.BOOLEAN;
|
|
29
33
|
}
|
|
30
34
|
const fieldData = getFieldData(fieldName);
|
|
31
|
-
return fieldData
|
|
35
|
+
return fieldData?.dataType;
|
|
32
36
|
};
|
|
33
37
|
const getOperators = (fieldName, intl) => {
|
|
34
38
|
const field = Object.values(FIELDS_OPTIONS).find((fieldOption) => fieldOption.name === fieldName);
|
|
35
|
-
switch (field
|
|
39
|
+
switch (field?.dataType) {
|
|
36
40
|
case DataType.STRING: {
|
|
37
41
|
let stringOperators = [
|
|
38
42
|
OPERATOR_OPTIONS.CONTAINS,
|
|
@@ -117,7 +121,6 @@ const getOperators = (fieldName, intl) => {
|
|
|
117
121
|
};
|
|
118
122
|
function exportExpertRules(query) {
|
|
119
123
|
function transformRule(rule) {
|
|
120
|
-
var _a;
|
|
121
124
|
const isValueAnArray = Array.isArray(rule.value);
|
|
122
125
|
const dataType = getDataType(rule.field, rule.operator);
|
|
123
126
|
if (dataType === DataType.COMBINATOR) {
|
|
@@ -126,7 +129,7 @@ function exportExpertRules(query) {
|
|
|
126
129
|
return {
|
|
127
130
|
id: rule.id,
|
|
128
131
|
field: rule.field,
|
|
129
|
-
operator: dataType !== DataType.PROPERTY ?
|
|
132
|
+
operator: dataType !== DataType.PROPERTY ? Object.values(OPERATOR_OPTIONS).find((operator) => operator.name === rule.operator)?.customName : rule.value.propertyOperator,
|
|
130
133
|
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,
|
|
131
134
|
values: isValueAnArray && dataType !== DataType.PROPERTY ? convertOutputValue(rule.field, rule.value) : void 0,
|
|
132
135
|
dataType,
|
|
@@ -135,7 +138,6 @@ function exportExpertRules(query) {
|
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
140
|
function transformCompositeRule(compositeRule) {
|
|
138
|
-
var _a;
|
|
139
141
|
const compositeGroup = compositeRule.value;
|
|
140
142
|
const transformedRules = Object.entries(compositeGroup.rules).map(
|
|
141
143
|
([field, rule]) => transformRule({
|
|
@@ -151,7 +153,7 @@ function exportExpertRules(query) {
|
|
|
151
153
|
dataType: DataType.COMBINATOR,
|
|
152
154
|
rules: transformedRules,
|
|
153
155
|
// two additional attributes to distinct a composite rule from a normal rule group
|
|
154
|
-
operator:
|
|
156
|
+
operator: Object.values(OPERATOR_OPTIONS).find((operator) => operator.name === compositeRule.operator)?.customName,
|
|
155
157
|
field: compositeRule.field
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -190,16 +192,14 @@ function importExpertRules(query) {
|
|
|
190
192
|
return rule.value;
|
|
191
193
|
}
|
|
192
194
|
function transformRule(rule) {
|
|
193
|
-
var _a;
|
|
194
195
|
return {
|
|
195
196
|
id: rule.id,
|
|
196
197
|
field: rule.field,
|
|
197
|
-
operator: rule.dataType !== DataType.PROPERTY ?
|
|
198
|
+
operator: rule.dataType !== DataType.PROPERTY ? Object.values(OPERATOR_OPTIONS).find((operator) => operator.customName === rule.operator)?.name : OPERATOR_OPTIONS.IS.name,
|
|
198
199
|
value: parseValue(rule)
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
202
|
function transformCompositeGroup(group) {
|
|
202
|
-
var _a;
|
|
203
203
|
const transformedRules = group.rules.map((rule) => transformRule(rule)).reduce(
|
|
204
204
|
(obj, transformedRule) => ({
|
|
205
205
|
...obj,
|
|
@@ -213,7 +213,7 @@ function importExpertRules(query) {
|
|
|
213
213
|
return {
|
|
214
214
|
id: group.id,
|
|
215
215
|
field: group.field,
|
|
216
|
-
operator:
|
|
216
|
+
operator: Object.values(OPERATOR_OPTIONS).find((operator) => operator.customName === group.operator)?.name,
|
|
217
217
|
value: {
|
|
218
218
|
combinator: group.combinator,
|
|
219
219
|
rules: transformedRules
|
|
@@ -254,7 +254,6 @@ const queryValidator = (query) => {
|
|
|
254
254
|
return result;
|
|
255
255
|
}
|
|
256
256
|
const validateRule = (rule) => {
|
|
257
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
258
257
|
const isValueAnArray = Array.isArray(rule.value);
|
|
259
258
|
const dataType = getDataType(rule.field, rule.operator);
|
|
260
259
|
const isNumberInput = dataType === DataType.NUMBER && !isValueAnArray;
|
|
@@ -265,7 +264,7 @@ const queryValidator = (query) => {
|
|
|
265
264
|
reasons: void 0
|
|
266
265
|
};
|
|
267
266
|
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.BETWEEN.name) {
|
|
268
|
-
if (!
|
|
267
|
+
if (!rule.value?.[0] || !rule.value?.[1]) {
|
|
269
268
|
result[rule.id] = {
|
|
270
269
|
valid: false,
|
|
271
270
|
reasons: [RULES.EMPTY_RULE]
|
|
@@ -281,7 +280,7 @@ const queryValidator = (query) => {
|
|
|
281
280
|
reasons: [RULES.BETWEEN_RULE]
|
|
282
281
|
};
|
|
283
282
|
}
|
|
284
|
-
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.IN.name && !
|
|
283
|
+
} else if (rule.id && rule.operator === OPERATOR_OPTIONS.IN.name && !rule.value?.length) {
|
|
285
284
|
result[rule.id] = {
|
|
286
285
|
valid: false,
|
|
287
286
|
reasons: [RULES.EMPTY_RULE]
|
|
@@ -296,12 +295,12 @@ const queryValidator = (query) => {
|
|
|
296
295
|
valid: false,
|
|
297
296
|
reasons: [RULES.INCORRECT_RULE]
|
|
298
297
|
};
|
|
299
|
-
} else if (rule.id && dataType === DataType.FILTER_UUID && (!
|
|
298
|
+
} else if (rule.id && dataType === DataType.FILTER_UUID && (!rule.value?.length || !validate(rule.value[0]))) {
|
|
300
299
|
result[rule.id] = {
|
|
301
300
|
valid: false,
|
|
302
301
|
reasons: [RULES.EMPTY_RULE]
|
|
303
302
|
};
|
|
304
|
-
} else if (rule.id && dataType === DataType.PROPERTY && (isBlankOrEmpty(
|
|
303
|
+
} else if (rule.id && dataType === DataType.PROPERTY && (isBlankOrEmpty(rule.value?.propertyName) || isBlankOrEmpty(rule.value?.propertyOperator) || isBlankOrEmpty(rule.value?.propertyValues) || !rule.value?.propertyValues?.length)) {
|
|
305
304
|
result[rule.id] = {
|
|
306
305
|
valid: false,
|
|
307
306
|
reasons: [RULES.EMPTY_RULE]
|
|
@@ -310,12 +309,11 @@ const queryValidator = (query) => {
|
|
|
310
309
|
const childrenFields = Object.keys(getFieldData(rule.field).children ?? {});
|
|
311
310
|
const compositeGroup = rule.value;
|
|
312
311
|
childrenFields.forEach((field) => {
|
|
313
|
-
var _a2, _b2, _c2, _d2;
|
|
314
312
|
validateRule({
|
|
315
313
|
...rule,
|
|
316
314
|
field,
|
|
317
|
-
operator:
|
|
318
|
-
value:
|
|
315
|
+
operator: compositeGroup?.rules?.[field]?.operator,
|
|
316
|
+
value: compositeGroup?.rules?.[field]?.value
|
|
319
317
|
});
|
|
320
318
|
});
|
|
321
319
|
}
|
|
@@ -351,10 +349,9 @@ const testQuery = (check, query) => {
|
|
|
351
349
|
});
|
|
352
350
|
};
|
|
353
351
|
function getNumberOfSiblings(path, query) {
|
|
354
|
-
var _a;
|
|
355
352
|
const parentPath = getParentPath(path);
|
|
356
353
|
const parentGroup = findPath(parentPath, query);
|
|
357
|
-
return
|
|
354
|
+
return parentGroup?.rules?.length;
|
|
358
355
|
}
|
|
359
356
|
function recursiveRemove(query, path) {
|
|
360
357
|
if (getNumberOfSiblings(path, query) === 1 && path.toString() !== [0].toString()) {
|
|
@@ -363,11 +360,10 @@ function recursiveRemove(query, path) {
|
|
|
363
360
|
return remove(query, path);
|
|
364
361
|
}
|
|
365
362
|
function getFilterEquipmentTypeLabel(equipmentType) {
|
|
366
|
-
var _a;
|
|
367
363
|
if (!equipmentType) {
|
|
368
364
|
return "";
|
|
369
365
|
}
|
|
370
|
-
return
|
|
366
|
+
return ALL_EQUIPMENTS[equipmentType]?.label ?? "";
|
|
371
367
|
}
|
|
372
368
|
export {
|
|
373
369
|
countRules,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExpertFilterEditionDialog } from "./ExpertFilterEditionDialog.js";
|
|
2
|
-
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData
|
|
2
|
+
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./ExpertFilterForm.js";
|
|
3
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, EXPERT_FILTER_QUERY, 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, getFilterEquipmentTypeLabel, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expertFilterUtils.js";
|
|
@@ -34,6 +34,5 @@ export {
|
|
|
34
34
|
importExpertRules,
|
|
35
35
|
queryValidator,
|
|
36
36
|
recursiveRemove,
|
|
37
|
-
rqbQuerySchemaValidator,
|
|
38
37
|
testQuery
|
|
39
38
|
};
|
|
@@ -34,7 +34,6 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
34
34
|
language,
|
|
35
35
|
description
|
|
36
36
|
}) {
|
|
37
|
-
var _a;
|
|
38
37
|
const { snackError } = useSnackMessage();
|
|
39
38
|
const [dataFetchStatus, setDataFetchStatus] = useState(FetchStatus.IDLE);
|
|
40
39
|
const formMethods = useForm({
|
|
@@ -45,18 +44,17 @@ function ExplicitNamingFilterEditionDialog({
|
|
|
45
44
|
formState: { errors }
|
|
46
45
|
} = formMethods;
|
|
47
46
|
const nameError = errors[FieldConstants.NAME];
|
|
48
|
-
const isValidating =
|
|
47
|
+
const isValidating = errors.root?.isValidating;
|
|
49
48
|
useEffect(() => {
|
|
50
49
|
if (id && open) {
|
|
51
50
|
setDataFetchStatus(FetchStatus.FETCHING);
|
|
52
51
|
getFilterById(id).then((response) => {
|
|
53
|
-
var _a2;
|
|
54
52
|
setDataFetchStatus(FetchStatus.FETCH_SUCCESS);
|
|
55
53
|
reset({
|
|
56
54
|
[FieldConstants.NAME]: name,
|
|
57
55
|
[FieldConstants.DESCRIPTION]: description,
|
|
58
56
|
[FieldConstants.EQUIPMENT_TYPE]: response[FieldConstants.EQUIPMENT_TYPE],
|
|
59
|
-
[FILTER_EQUIPMENTS_ATTRIBUTES]:
|
|
57
|
+
[FILTER_EQUIPMENTS_ATTRIBUTES]: response[FILTER_EQUIPMENTS_ATTRIBUTES]?.map((row) => ({
|
|
60
58
|
[FieldConstants.AG_GRID_ROW_UUID]: v4(),
|
|
61
59
|
...row
|
|
62
60
|
}))
|
|
@@ -12,7 +12,7 @@ import { Generator, Load } from "../../../utils/types/equipmentTypes.js";
|
|
|
12
12
|
import { NumericEditor } from "../../inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
|
|
13
13
|
import { InputWithPopupConfirmation } from "../../inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
14
14
|
import { toFloatOrNullValue } from "../../inputs/reactHookForm/utils/functions.js";
|
|
15
|
-
import { DISTRIBUTION_KEY
|
|
15
|
+
import { DISTRIBUTION_KEY } from "../constants/FilterConstants.js";
|
|
16
16
|
import { FILTER_EQUIPMENTS } from "../utils/filterFormUtils.js";
|
|
17
17
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
18
18
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
@@ -33,15 +33,12 @@ const explicitNamingFilterSchema = {
|
|
|
33
33
|
[FieldConstants.EQUIPMENT_ID]: yup.string().nullable(),
|
|
34
34
|
[DISTRIBUTION_KEY]: yup.number().nullable()
|
|
35
35
|
})
|
|
36
|
-
).compact((row) => !row[DISTRIBUTION_KEY] && !row[FieldConstants.EQUIPMENT_ID]).when([FieldConstants.
|
|
37
|
-
is:
|
|
38
|
-
then: (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}).test("ifOneKeyThenKeyEverywhere", "missingDistributionKeyError", (array) => {
|
|
43
|
-
return !(array.some((row) => row[DISTRIBUTION_KEY]) && array.some((row) => !row[DISTRIBUTION_KEY]));
|
|
44
|
-
})
|
|
36
|
+
).compact((row) => !row[DISTRIBUTION_KEY] && !row[FieldConstants.EQUIPMENT_ID]).min(1, "emptyFilterError").when([FieldConstants.EQUIPMENT_TYPE], {
|
|
37
|
+
is: (equipmentType) => isGeneratorOrLoad(equipmentType),
|
|
38
|
+
then: (innerSchema) => innerSchema.test("noKeyWithoutId", "distributionKeyWithMissingIdError", (array) => {
|
|
39
|
+
return !array.some((row) => !row[FieldConstants.EQUIPMENT_ID]);
|
|
40
|
+
}).test("ifOneKeyThenKeyEverywhere", "missingDistributionKeyError", (array) => {
|
|
41
|
+
return !(array.some((row) => row[DISTRIBUTION_KEY]) && array.some((row) => !row[DISTRIBUTION_KEY]));
|
|
45
42
|
})
|
|
46
43
|
})
|
|
47
44
|
};
|
|
@@ -91,10 +88,7 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
91
88
|
editable: true,
|
|
92
89
|
singleClickEdit: true,
|
|
93
90
|
flex: 1,
|
|
94
|
-
valueParser: (params) =>
|
|
95
|
-
var _a;
|
|
96
|
-
return ((_a = params.newValue) == null ? void 0 : _a.trim()) ?? null;
|
|
97
|
-
}
|
|
91
|
+
valueParser: (params) => params.newValue?.trim() ?? null
|
|
98
92
|
}
|
|
99
93
|
];
|
|
100
94
|
if (forGeneratorOrLoad) {
|
|
@@ -125,11 +119,10 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
125
119
|
const getDataFromCsvFile = useCallback((csvData) => {
|
|
126
120
|
if (csvData) {
|
|
127
121
|
return csvData.map((value) => {
|
|
128
|
-
var _a, _b;
|
|
129
122
|
return {
|
|
130
123
|
[FieldConstants.AG_GRID_ROW_UUID]: v4(),
|
|
131
|
-
[FieldConstants.EQUIPMENT_ID]:
|
|
132
|
-
[DISTRIBUTION_KEY]: toFloatOrNullValue(
|
|
124
|
+
[FieldConstants.EQUIPMENT_ID]: value[0]?.trim(),
|
|
125
|
+
[DISTRIBUTION_KEY]: toFloatOrNullValue(value[1]?.trim())
|
|
133
126
|
};
|
|
134
127
|
});
|
|
135
128
|
}
|
|
@@ -144,7 +137,7 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
|
|
|
144
137
|
setValue(FILTER_EQUIPMENTS_ATTRIBUTES, makeDefaultTableRows());
|
|
145
138
|
};
|
|
146
139
|
const onStudySelected = (studyUuid) => {
|
|
147
|
-
exportFilter(studyUuid, sourceFilterForExplicitNamingConversion
|
|
140
|
+
exportFilter(studyUuid, sourceFilterForExplicitNamingConversion?.id).then((matchingEquipments) => {
|
|
148
141
|
setValue(
|
|
149
142
|
FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
150
143
|
matchingEquipments.length === 0 ? makeDefaultTableRows() : matchingEquipments.map((equipment) => ({
|
|
@@ -4,7 +4,7 @@ import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./cons
|
|
|
4
4
|
import { CriteriaBasedForm } from "../contingencyList/criteriaBased/CriteriaBasedForm.js";
|
|
5
5
|
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "../contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
6
6
|
import { ExpertFilterEditionDialog } from "./expert/ExpertFilterEditionDialog.js";
|
|
7
|
-
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData
|
|
7
|
+
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./expert/ExpertFilterForm.js";
|
|
8
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, EXPERT_FILTER_QUERY, 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, getFilterEquipmentTypeLabel, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./expert/expertFilterUtils.js";
|
|
@@ -59,7 +59,6 @@ export {
|
|
|
59
59
|
importExpertRules,
|
|
60
60
|
queryValidator,
|
|
61
61
|
recursiveRemove,
|
|
62
|
-
rqbQuerySchemaValidator,
|
|
63
62
|
saveExpertFilter,
|
|
64
63
|
saveExplicitNamingFilter,
|
|
65
64
|
testQuery
|
|
@@ -73,9 +73,13 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
|
|
|
73
73
|
).then(() => {
|
|
74
74
|
onClose();
|
|
75
75
|
}).catch((error) => {
|
|
76
|
-
|
|
77
|
-
onError(
|
|
78
|
-
}
|
|
76
|
+
if (error instanceof Error) {
|
|
77
|
+
onError(error);
|
|
78
|
+
} else {
|
|
79
|
+
catchErrorHandler(error, (message) => {
|
|
80
|
+
onError(new Error(message));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
79
83
|
});
|
|
80
84
|
} else {
|
|
81
85
|
saveFilter(
|
|
@@ -91,9 +95,13 @@ const saveExpertFilter = (id, query, equipmentType, name, description, isFilterC
|
|
|
91
95
|
).then(() => {
|
|
92
96
|
onClose();
|
|
93
97
|
}).catch((error) => {
|
|
94
|
-
|
|
95
|
-
onError(
|
|
96
|
-
}
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
onError(error);
|
|
100
|
+
} else {
|
|
101
|
+
catchErrorHandler(error, (message) => {
|
|
102
|
+
onError(new Error(message));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
};
|
|
@@ -50,7 +50,7 @@ function extractDefault(paramDescription) {
|
|
|
50
50
|
return d ?? null;
|
|
51
51
|
}
|
|
52
52
|
function longestCommonPrefix(stringList) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!stringList?.length) {
|
|
54
54
|
return "";
|
|
55
55
|
}
|
|
56
56
|
let prefix = stringList.reduce((acc, str) => str.length < acc.length ? str : acc);
|
|
@@ -169,7 +169,7 @@ function FlatParameters({
|
|
|
169
169
|
return extractDefault(param);
|
|
170
170
|
}
|
|
171
171
|
const outputTransformFloatString = (value) => {
|
|
172
|
-
return
|
|
172
|
+
return value?.replace(",", ".") || "";
|
|
173
173
|
};
|
|
174
174
|
const getStringListValue = (allValues, selectValues) => {
|
|
175
175
|
if (!selectValues || !selectValues.length) {
|