@gridsuite/commons-ui 0.69.1 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/components/directoryItemSelector/DirectoryItemSelector.d.ts +2 -1
  2. package/dist/components/directoryItemSelector/DirectoryItemSelector.js +17 -7
  3. package/dist/components/filter/index.d.ts +1 -0
  4. package/dist/components/snackbarProvider/SnackbarProvider.js +30 -6
  5. package/dist/hooks/index.d.ts +1 -0
  6. package/dist/hooks/index.js +2 -0
  7. package/dist/hooks/useModificationLabelComputer.d.ts +24 -0
  8. package/dist/hooks/useModificationLabelComputer.js +74 -0
  9. package/dist/hooks/useSnackMessage.js +5 -2
  10. package/dist/index.js +15 -3
  11. package/dist/services/appsMetadata.d.ts +1 -0
  12. package/dist/services/appsMetadata.js +2 -1
  13. package/dist/services/index.js +4 -2
  14. package/dist/services/utils.d.ts +1 -0
  15. package/dist/services/utils.js +8 -0
  16. package/dist/translations/en/index.d.ts +1 -0
  17. package/dist/translations/en/index.js +2 -0
  18. package/dist/translations/en/networkModificationsEn.d.ts +60 -0
  19. package/dist/translations/en/networkModificationsEn.js +57 -0
  20. package/dist/translations/fr/index.d.ts +1 -0
  21. package/dist/translations/fr/index.js +2 -0
  22. package/dist/translations/fr/networkModificationsFr.d.ts +60 -0
  23. package/dist/translations/fr/networkModificationsFr.js +57 -0
  24. package/dist/utils/index.js +5 -1
  25. package/dist/utils/types/equipmentType.d.ts +16 -1
  26. package/dist/utils/types/equipmentType.js +25 -1
  27. package/dist/utils/types/index.d.ts +1 -0
  28. package/dist/utils/types/index.js +5 -1
  29. package/dist/utils/types/modificationType.d.ts +170 -0
  30. package/dist/utils/types/modificationType.js +208 -0
  31. package/package.json +8 -4
  32. package/dist/components/topBar/tests/TopBar.test.d.ts +0 -7
@@ -16,5 +16,6 @@ export interface DirectoryItemSelectorProps extends TreeViewFinderProps {
16
16
  onlyLeaves?: boolean;
17
17
  multiselect?: boolean;
18
18
  expanded?: UUID[];
19
+ selected?: UUID[];
19
20
  }
20
- export declare function DirectoryItemSelector({ open, types, equipmentTypes, itemFilter, expanded, ...otherTreeViewFinderProps }: Readonly<DirectoryItemSelectorProps>): import("react/jsx-runtime").JSX.Element;
21
+ export declare function DirectoryItemSelector({ open, types, equipmentTypes, itemFilter, expanded, selected, ...otherTreeViewFinderProps }: Readonly<DirectoryItemSelectorProps>): import("react/jsx-runtime").JSX.Element;
@@ -107,6 +107,7 @@ function DirectoryItemSelector({
107
107
  equipmentTypes,
108
108
  itemFilter,
109
109
  expanded,
110
+ selected,
110
111
  ...otherTreeViewFinderProps
111
112
  }) {
112
113
  const [data, setData] = useState([]);
@@ -166,7 +167,7 @@ function DirectoryItemSelector({
166
167
  });
167
168
  });
168
169
  }, [convertRoots, types, snackError]);
169
- const fetchDirectory = useCallback(
170
+ const fetchDirectoryChildren = useCallback(
170
171
  (nodeId) => {
171
172
  const typeList = types.includes(ElementType.DIRECTORY) ? [] : types;
172
173
  fetchDirectoryContent(nodeId, typeList).then((children) => {
@@ -195,24 +196,33 @@ function DirectoryItemSelector({
195
196
  [types, equipmentTypes, itemFilter, contentFilter, addToDirectory]
196
197
  );
197
198
  useEffect(() => {
198
- if (open) {
199
- updateRootDirectories();
200
- if (expanded) {
199
+ if (open && expanded && selected) {
200
+ const isSelectedItemFetched = selected.every((id) => nodeMap.current[id]);
201
+ if (!isSelectedItemFetched) {
201
202
  expanded.forEach((nodeId) => {
202
- fetchDirectory(nodeId);
203
+ const node = nodeMap.current[nodeId];
204
+ if ((node == null ? void 0 : node.children) && node.children.length === 0) {
205
+ fetchDirectoryChildren(nodeId);
206
+ }
203
207
  });
204
208
  }
205
209
  }
206
- }, [open, updateRootDirectories, expanded, fetchDirectory]);
210
+ }, [open, expanded, fetchDirectoryChildren, selected, data]);
211
+ useEffect(() => {
212
+ if (open) {
213
+ updateRootDirectories();
214
+ }
215
+ }, [open, updateRootDirectories]);
207
216
  return /* @__PURE__ */ jsx(
208
217
  TreeViewFinder,
209
218
  {
210
- onTreeBrowse: fetchDirectory,
219
+ onTreeBrowse: fetchDirectoryChildren,
211
220
  sortMethod: sortHandlingDirectories,
212
221
  multiSelect: true,
213
222
  open,
214
223
  expanded,
215
224
  onlyLeaves: true,
225
+ selected,
216
226
  ...otherTreeViewFinderProps,
217
227
  data
218
228
  }
@@ -4,6 +4,7 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
+ export * from './filter.type';
7
8
  export * from './FilterCreationDialog';
8
9
  export * from './FilterForm';
9
10
  export * from './constants/FilterConstants';
@@ -1,15 +1,39 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
- import { Button } from "@mui/material";
3
+ import { styled, IconButton } from "@mui/material";
4
+ import ClearIcon from "@mui/icons-material/Clear";
4
5
  import { SnackbarProvider as SnackbarProvider$1 } from "notistack";
6
+ const StyledOrigSnackbarProvider = styled(SnackbarProvider$1)(() => ({
7
+ "&.notistack-MuiContent": {
8
+ alignItems: "flex-start",
9
+ flexWrap: "nowrap"
10
+ },
11
+ "#notistack-snackbar": {
12
+ alignItems: "flex-start"
13
+ }
14
+ }));
15
+ const styles = {
16
+ buttonColor: (theme) => ({
17
+ color: theme.palette.common.white
18
+ })
19
+ };
5
20
  function SnackbarProvider(props) {
6
21
  const ref = useRef(null);
7
- const action = (key) => /* @__PURE__ */ jsx(Button, { onClick: () => {
8
- var _a;
9
- return (_a = ref.current) == null ? void 0 : _a.closeSnackbar(key);
10
- }, style: { color: "#fff", fontSize: "20px" }, children: "✖" });
22
+ const action = (key) => /* @__PURE__ */ jsx(
23
+ IconButton,
24
+ {
25
+ onClick: () => {
26
+ var _a;
27
+ return (_a = ref.current) == null ? void 0 : _a.closeSnackbar(key);
28
+ },
29
+ "aria-label": "clear-snack",
30
+ size: "small",
31
+ sx: styles.buttonColor,
32
+ children: /* @__PURE__ */ jsx(ClearIcon, { fontSize: "small" })
33
+ }
34
+ );
11
35
  return /* @__PURE__ */ jsx(
12
- SnackbarProvider$1,
36
+ StyledOrigSnackbarProvider,
13
37
  {
14
38
  ref,
15
39
  anchorOrigin: { horizontal: "center", vertical: "bottom" },
@@ -5,6 +5,7 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export * from './customStates';
8
+ export * from './useModificationLabelComputer';
8
9
  export * from './useConfidentialityWarning';
9
10
  export * from './useDebounce';
10
11
  export * from './useIntlRef';
@@ -1,5 +1,6 @@
1
1
  import { useStateBoolean } from "./customStates/useStateBoolean.js";
2
2
  import { useStateNumber } from "./customStates/useStateNumber.js";
3
+ import { useModificationLabelComputer } from "./useModificationLabelComputer.js";
3
4
  import { useConfidentialityWarning } from "./useConfidentialityWarning.js";
4
5
  import { useDebounce } from "./useDebounce.js";
5
6
  import { useIntlRef } from "./useIntlRef.js";
@@ -14,6 +15,7 @@ export {
14
15
  useDebounce,
15
16
  useIntlRef,
16
17
  useLocalizedCountries,
18
+ useModificationLabelComputer,
17
19
  usePredefinedProperties,
18
20
  usePrevious,
19
21
  useSnackMessage,
@@ -0,0 +1,24 @@
1
+ import { UUID } from 'crypto';
2
+
3
+ export interface NetworkModificationMetadata {
4
+ uuid: UUID;
5
+ type: string;
6
+ date: Date;
7
+ stashed: boolean;
8
+ activated: boolean;
9
+ messageType: string;
10
+ messageValues: string;
11
+ }
12
+ export declare const useModificationLabelComputer: () => {
13
+ computeLabel: (modif: NetworkModificationMetadata, withFormat?: boolean) => {
14
+ action: string;
15
+ energizedEnd: string;
16
+ computedLabel: string | import("react/jsx-runtime").JSX.Element;
17
+ } | {
18
+ equipmentAttributeName: string;
19
+ equipmentAttributeValue: string;
20
+ computedLabel: string | import("react/jsx-runtime").JSX.Element;
21
+ } | {
22
+ computedLabel: any;
23
+ };
24
+ };
@@ -0,0 +1,74 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useIntl } from "react-intl";
3
+ import { useCallback } from "react";
4
+ import { MODIFICATION_TYPES } from "../utils/types/modificationType.js";
5
+ import { EQUIPMENT_TYPE } from "../utils/types/equipmentType.js";
6
+ const getOperatingStatusModificationValues = (modification, withFormat) => {
7
+ return {
8
+ action: modification.action,
9
+ energizedEnd: modification.energizedVoltageLevelId,
10
+ computedLabel: withFormat ? /* @__PURE__ */ jsx("strong", { children: modification.equipmentId }) : modification.equipmentId
11
+ };
12
+ };
13
+ const getEquipmentAttributeModificationValues = (modification, withFormat) => {
14
+ return {
15
+ equipmentAttributeName: modification.equipmentAttributeName,
16
+ equipmentAttributeValue: modification.equipmentAttributeValue,
17
+ computedLabel: withFormat ? /* @__PURE__ */ jsx("strong", { children: modification.equipmentId }) : modification.equipmentId
18
+ };
19
+ };
20
+ const useModificationLabelComputer = () => {
21
+ const intl = useIntl();
22
+ const getLabel = useCallback(
23
+ (modif) => {
24
+ const modificationMetadata = JSON.parse(modif.messageValues);
25
+ switch (modif.messageType) {
26
+ case MODIFICATION_TYPES.LINE_SPLIT_WITH_VOLTAGE_LEVEL.type:
27
+ return modificationMetadata.lineToSplitId;
28
+ case MODIFICATION_TYPES.LINE_ATTACH_TO_VOLTAGE_LEVEL.type:
29
+ return modificationMetadata.lineToAttachToId;
30
+ case MODIFICATION_TYPES.LINES_ATTACH_TO_SPLIT_LINES.type:
31
+ return modificationMetadata.attachedLineId;
32
+ case MODIFICATION_TYPES.DELETE_VOLTAGE_LEVEL_ON_LINE.type:
33
+ return `${modificationMetadata.lineToAttachTo1Id}/${modificationMetadata.lineToAttachTo2Id}`;
34
+ case MODIFICATION_TYPES.DELETE_ATTACHING_LINE.type:
35
+ return `${modificationMetadata.attachedLineId}/${modificationMetadata.lineToAttachTo1Id}/${modificationMetadata.lineToAttachTo2Id}`;
36
+ case MODIFICATION_TYPES.TABULAR_MODIFICATION.type:
37
+ return intl.formatMessage({
38
+ id: `network_modifications.tabular.${modificationMetadata.tabularModificationType}`
39
+ });
40
+ case MODIFICATION_TYPES.BY_FILTER_DELETION.type:
41
+ return intl.formatMessage({
42
+ id: modificationMetadata.equipmentType === EQUIPMENT_TYPE.HVDC_LINE ? "Hvdc" : modificationMetadata.equipmentType
43
+ });
44
+ case MODIFICATION_TYPES.TABULAR_CREATION.type:
45
+ return intl.formatMessage({
46
+ id: `network_modifications.tabular.${modificationMetadata.tabularCreationType}`
47
+ });
48
+ default:
49
+ return modificationMetadata.equipmentId || "";
50
+ }
51
+ },
52
+ [intl]
53
+ );
54
+ const computeLabel = useCallback(
55
+ (modif, withFormat = true) => {
56
+ const modificationValues = JSON.parse(modif.messageValues);
57
+ switch (modif.messageType) {
58
+ case MODIFICATION_TYPES.OPERATING_STATUS_MODIFICATION.type:
59
+ return getOperatingStatusModificationValues(modificationValues, withFormat);
60
+ case MODIFICATION_TYPES.EQUIPMENT_ATTRIBUTE_MODIFICATION.type:
61
+ return getEquipmentAttributeModificationValues(modificationValues, withFormat);
62
+ default:
63
+ return {
64
+ computedLabel: withFormat ? /* @__PURE__ */ jsx("strong", { children: getLabel(modif) }) : getLabel(modif)
65
+ };
66
+ }
67
+ },
68
+ [getLabel]
69
+ );
70
+ return { computeLabel };
71
+ };
72
+ export {
73
+ useModificationLabelComputer
74
+ };
@@ -34,7 +34,7 @@ function makeMessage(intlRef, snackInputs) {
34
34
  }
35
35
  if (message) {
36
36
  if (header) {
37
- fullMessage += "\n\n";
37
+ fullMessage += "\n";
38
38
  }
39
39
  fullMessage += message;
40
40
  }
@@ -57,7 +57,10 @@ function useSnackMessage() {
57
57
  },
58
58
  [enqueueSnackbar, intlRef]
59
59
  );
60
- const snackError = useCallback((snackInputs) => enqueue(snackInputs, "error"), [enqueue]);
60
+ const snackError = useCallback(
61
+ (snackInputs) => enqueue({ ...snackInputs, persist: true }, "error"),
62
+ [enqueue]
63
+ );
61
64
  const snackWarning = useCallback((snackInputs) => enqueue(snackInputs, "warning"), [enqueue]);
62
65
  const snackInfo = useCallback((snackInputs) => enqueue(snackInputs, "info"), [enqueue]);
63
66
  return { snackError, snackInfo, snackWarning, closeSnackbar };
package/dist/index.js CHANGED
@@ -107,6 +107,7 @@ import { AboutDialog } from "./components/topBar/AboutDialog.js";
107
107
  import { TreeViewFinder, generateTreeViewFinderClass } from "./components/treeViewFinder/TreeViewFinder.js";
108
108
  import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
109
109
  import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
110
+ import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
110
111
  import { useConfidentialityWarning } from "./hooks/useConfidentialityWarning.js";
111
112
  import { useDebounce } from "./hooks/useDebounce.js";
112
113
  import { useIntlRef } from "./hooks/useIntlRef.js";
@@ -116,9 +117,9 @@ import { usePrevious } from "./hooks/usePrevious.js";
116
117
  import { useSnackMessage } from "./hooks/useSnackMessage.js";
117
118
  import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, resetAuthenticationRouterError, setLoggedUser, setLogoutError, setShowAuthenticationRouterLogin, setSignInCallbackError, setUnauthorizedUserInfo, setUserValidationError } from "./redux/actions/authActions.js";
118
119
  import { getUserToken, setCommonStore } from "./redux/commonStore.js";
119
- import { backendFetch, backendFetchJson, getRequestParamFromList } from "./services/utils.js";
120
+ import { backendFetch, backendFetchJson, catchErrorHandler, getRequestParamFromList } from "./services/utils.js";
120
121
  import { createFilter, fetchElementsInfos, saveFilter } from "./services/explore.js";
121
- import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata } from "./services/appsMetadata.js";
122
+ import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
122
123
  import { fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./services/directory.js";
123
124
  import { exportFilter } from "./services/study.js";
124
125
  import { equalsArray } from "./utils/algos.js";
@@ -131,8 +132,9 @@ import { getFileIcon } from "./utils/mapper/getFileIcon.js";
131
132
  import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
132
133
  import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
133
134
  import { ElementType } from "./utils/types/elementType.js";
134
- import { EQUIPMENT_TYPE, EquipmentType, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
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";
137
+ import { MODIFICATION_TYPES, ModificationType } from "./utils/types/modificationType.js";
136
138
  import "./utils/yupConfig.js";
137
139
  import { cardErrorBoundaryEn } from "./translations/en/cardErrorBoundaryEn.js";
138
140
  import { commonButtonEn } from "./translations/en/commonButtonEn.js";
@@ -152,6 +154,7 @@ import { reportViewerEn } from "./translations/en/reportViewerEn.js";
152
154
  import { tableEn } from "./translations/en/tableEn.js";
153
155
  import { topBarEn } from "./translations/en/topBarEn.js";
154
156
  import { treeviewFinderEn } from "./translations/en/treeviewFinderEn.js";
157
+ import { networkModificationsEn } from "./translations/en/networkModificationsEn.js";
155
158
  import { exportParamsEn } from "./translations/en/external/exportParamsEn.js";
156
159
  import { importParamsEn } from "./translations/en/external/importParamsEn.js";
157
160
  import { cardErrorBoundaryFr } from "./translations/fr/cardErrorBoundaryFr.js";
@@ -172,6 +175,7 @@ import { reportViewerFr } from "./translations/fr/reportViewerFr.js";
172
175
  import { tableFr } from "./translations/fr/tableFr.js";
173
176
  import { topBarFr } from "./translations/fr/topBarFr.js";
174
177
  import { treeviewFinderFr } from "./translations/fr/treeviewFinderFr.js";
178
+ import { networkModificationsFr } from "./translations/fr/networkModificationsFr.js";
175
179
  import { exportParamsFr } from "./translations/fr/external/exportParamsFr.js";
176
180
  import { importParamsFr } from "./translations/fr/external/importParamsFr.js";
177
181
  import * as yup from "yup";
@@ -277,7 +281,9 @@ export {
277
281
  Login,
278
282
  LogoText,
279
283
  Logout,
284
+ MODIFICATION_TYPES,
280
285
  MidFormError,
286
+ ModificationType,
281
287
  ModifyElementSelection,
282
288
  MuiSelectInput,
283
289
  MuiVirtualizedTable,
@@ -287,6 +293,7 @@ export {
287
293
  NO_SELECTION_FOR_COPY,
288
294
  NumericEditor,
289
295
  OPERATOR_OPTIONS,
296
+ OperatingStatus,
290
297
  OperatorType,
291
298
  OverflowableText,
292
299
  PHASE_REGULATION_MODE_OPTIONS,
@@ -349,6 +356,7 @@ export {
349
356
  backendFetchJson,
350
357
  cardErrorBoundaryEn,
351
358
  cardErrorBoundaryFr,
359
+ catchErrorHandler,
352
360
  collectibleHelper,
353
361
  commonButtonEn,
354
362
  commonButtonFr,
@@ -433,6 +441,7 @@ export {
433
441
  isFloatNumber,
434
442
  isIntegerNumber,
435
443
  isObjectEmpty,
444
+ isStudyMetadata,
436
445
  keyGenerator,
437
446
  kiloUnitToUnit,
438
447
  login,
@@ -444,6 +453,8 @@ export {
444
453
  microUnitToUnit,
445
454
  multipleSelectionDialogEn,
446
455
  multipleSelectionDialogFr,
456
+ networkModificationsEn,
457
+ networkModificationsFr,
447
458
  noOpHelper,
448
459
  queryValidator,
449
460
  recursiveRemove,
@@ -485,6 +496,7 @@ export {
485
496
  useElementSearch,
486
497
  useIntlRef,
487
498
  useLocalizedCountries,
499
+ useModificationLabelComputer,
488
500
  usePredefinedProperties,
489
501
  usePrevious,
490
502
  useSnackMessage,
@@ -8,6 +8,7 @@ export type Env = {
8
8
  };
9
9
  export declare function fetchEnv(): Promise<Env>;
10
10
  export declare function fetchAppsMetadata(): Promise<Metadata[]>;
11
+ export declare const isStudyMetadata: (metadata: Metadata) => metadata is StudyMetadata;
11
12
  export declare function fetchStudyMetadata(): Promise<StudyMetadata>;
12
13
  export declare function fetchFavoriteAndDefaultCountries(): Promise<{
13
14
  favoriteCountries: string[];
@@ -35,5 +35,6 @@ export {
35
35
  fetchDefaultCountry,
36
36
  fetchEnv,
37
37
  fetchFavoriteAndDefaultCountries,
38
- fetchStudyMetadata
38
+ fetchStudyMetadata,
39
+ isStudyMetadata
39
40
  };
@@ -1,11 +1,12 @@
1
- import { backendFetch, backendFetchJson, getRequestParamFromList } from "./utils.js";
1
+ import { backendFetch, backendFetchJson, catchErrorHandler, getRequestParamFromList } from "./utils.js";
2
2
  import { createFilter, fetchElementsInfos, saveFilter } from "./explore.js";
3
- import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata } from "./appsMetadata.js";
3
+ import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
4
4
  import { fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./directory.js";
5
5
  import { exportFilter } from "./study.js";
6
6
  export {
7
7
  backendFetch,
8
8
  backendFetchJson,
9
+ catchErrorHandler,
9
10
  createFilter,
10
11
  exportFilter,
11
12
  fetchAppsMetadata,
@@ -18,5 +19,6 @@ export {
18
19
  fetchRootFolders,
19
20
  fetchStudyMetadata,
20
21
  getRequestParamFromList,
22
+ isStudyMetadata,
21
23
  saveFilter
22
24
  };
@@ -7,3 +7,4 @@
7
7
  export declare const backendFetch: (url: string, init: any, token?: string) => Promise<any>;
8
8
  export declare const backendFetchJson: (url: string, init: any, token?: string) => Promise<any>;
9
9
  export declare const getRequestParamFromList: (paramName: string, params?: string[]) => URLSearchParams;
10
+ export declare const catchErrorHandler: (error: unknown, callback: (message: string) => void) => void;
@@ -47,8 +47,16 @@ const backendFetchJson = (url, init, token) => {
47
47
  const getRequestParamFromList = (paramName, params = []) => {
48
48
  return new URLSearchParams(params.map((param) => [paramName, param]));
49
49
  };
50
+ const catchErrorHandler = (error, callback) => {
51
+ if (error instanceof Object && "message" in error && typeof error.message === "string") {
52
+ callback(error.message);
53
+ } else {
54
+ callback("unknown error");
55
+ }
56
+ };
50
57
  export {
51
58
  backendFetch,
52
59
  backendFetchJson,
60
+ catchErrorHandler,
53
61
  getRequestParamFromList
54
62
  };
@@ -22,5 +22,6 @@ export * from './reportViewerEn';
22
22
  export * from './tableEn';
23
23
  export * from './topBarEn';
24
24
  export * from './treeviewFinderEn';
25
+ export * from './networkModificationsEn';
25
26
  export * from './external/exportParamsEn';
26
27
  export * from './external/importParamsEn';
@@ -16,6 +16,7 @@ import { reportViewerEn } from "./reportViewerEn.js";
16
16
  import { tableEn } from "./tableEn.js";
17
17
  import { topBarEn } from "./topBarEn.js";
18
18
  import { treeviewFinderEn } from "./treeviewFinderEn.js";
19
+ import { networkModificationsEn } from "./networkModificationsEn.js";
19
20
  import { exportParamsEn } from "./external/exportParamsEn.js";
20
21
  import { importParamsEn } from "./external/importParamsEn.js";
21
22
  export {
@@ -35,6 +36,7 @@ export {
35
36
  inputsEn,
36
37
  loginEn,
37
38
  multipleSelectionDialogEn,
39
+ networkModificationsEn,
38
40
  reportViewerEn,
39
41
  tableEn,
40
42
  topBarEn,
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright (c) 2024, 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 const networkModificationsEn: {
8
+ 'network_modifications.modificationsCount': string;
9
+ 'network_modifications.EQUIPMENT_DELETION': string;
10
+ 'network_modifications.BY_FILTER_DELETION': string;
11
+ 'network_modifications.SUBSTATION_CREATION': string;
12
+ 'network_modifications.SUBSTATION_MODIFICATION': string;
13
+ 'network_modifications.VOLTAGE_LEVEL_CREATION': string;
14
+ 'network_modifications.VOLTAGE_LEVEL_MODIFICATION': string;
15
+ 'network_modifications.LINE_SPLIT_WITH_VOLTAGE_LEVEL': string;
16
+ 'network_modifications.LINE_ATTACH_TO_VOLTAGE_LEVEL': string;
17
+ 'network_modifications.LINES_ATTACH_TO_SPLIT_LINES': string;
18
+ 'network_modifications.LOAD_SCALING': string;
19
+ 'network_modifications.DELETE_VOLTAGE_LEVEL_ON_LINE': string;
20
+ 'network_modifications.DELETE_ATTACHING_LINE': string;
21
+ 'network_modifications.LOAD_CREATION': string;
22
+ 'network_modifications.LOAD_MODIFICATION': string;
23
+ 'network_modifications.BATTERY_CREATION': string;
24
+ 'network_modifications.BATTERY_MODIFICATION': string;
25
+ 'network_modifications.GENERATOR_CREATION': string;
26
+ 'network_modifications.GENERATOR_MODIFICATION': string;
27
+ 'network_modifications.LINE_CREATION': string;
28
+ 'network_modifications.LINE_MODIFICATION': string;
29
+ 'network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION': string;
30
+ 'network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION': string;
31
+ 'network_modifications.OPERATING_STATUS_MODIFICATION': string;
32
+ 'network_modifications.SHUNT_COMPENSATOR_CREATION': string;
33
+ 'network_modifications.SHUNT_COMPENSATOR_MODIFICATION': string;
34
+ 'network_modifications.GENERATOR_SCALING': string;
35
+ 'network_modifications.VSC_CREATION': string;
36
+ 'network_modifications.VSC_MODIFICATION': string;
37
+ 'network_modifications.GROOVY_SCRIPT': string;
38
+ 'network_modifications.EQUIPMENT_ATTRIBUTE_MODIFICATION': string;
39
+ 'network_modifications.creatingModification': string;
40
+ 'network_modifications.deletingModification': string;
41
+ 'network_modifications.updatingModification': string;
42
+ 'network_modifications.stashingModification': string;
43
+ 'network_modifications.restoringModification': string;
44
+ 'network_modifications.modifications': string;
45
+ 'network_modifications.GENERATION_DISPATCH': string;
46
+ 'network_modifications.VOLTAGE_INIT_MODIFICATION': string;
47
+ 'network_modifications.TABULAR_MODIFICATION': string;
48
+ 'network_modifications.tabular.GENERATOR_MODIFICATION': string;
49
+ 'network_modifications.tabular.LOAD_MODIFICATION': string;
50
+ 'network_modifications.BY_FORMULA_MODIFICATION': string;
51
+ 'network_modifications.MODIFICATION_BY_ASSIGNMENT': string;
52
+ 'network_modifications.tabular.LINE_MODIFICATION': string;
53
+ 'network_modifications.tabular.BATTERY_MODIFICATION': string;
54
+ 'network_modifications.tabular.VOLTAGE_LEVEL_MODIFICATION': string;
55
+ 'network_modifications.tabular.TWO_WINDINGS_TRANSFORMER_MODIFICATION': string;
56
+ 'network_modifications.tabular.SHUNT_COMPENSATOR_MODIFICATION': string;
57
+ 'network_modifications.tabular.SUBSTATION_MODIFICATION': string;
58
+ 'network_modifications.TABULAR_CREATION': string;
59
+ 'network_modifications.tabular.GENERATOR_CREATION': string;
60
+ };
@@ -0,0 +1,57 @@
1
+ const networkModificationsEn = {
2
+ "network_modifications.modificationsCount": "{hide, select, false {{count, plural, =0 {no modification} =1 {{count} modification} other {{count} modifications}}} other {...}}",
3
+ "network_modifications.EQUIPMENT_DELETION": "Deletion of {computedLabel}",
4
+ "network_modifications.BY_FILTER_DELETION": "By filter deletion ({computedLabel})",
5
+ "network_modifications.SUBSTATION_CREATION": "Creating substation {computedLabel}",
6
+ "network_modifications.SUBSTATION_MODIFICATION": "Modifying substation {computedLabel}",
7
+ "network_modifications.VOLTAGE_LEVEL_CREATION": "Creating voltage level {computedLabel}",
8
+ "network_modifications.VOLTAGE_LEVEL_MODIFICATION": "Modifying voltage level {computedLabel}",
9
+ "network_modifications.LINE_SPLIT_WITH_VOLTAGE_LEVEL": "Splitting a line {computedLabel}",
10
+ "network_modifications.LINE_ATTACH_TO_VOLTAGE_LEVEL": "Attaching line {computedLabel}",
11
+ "network_modifications.LINES_ATTACH_TO_SPLIT_LINES": "Attaching lines to splitting lines {computedLabel}",
12
+ "network_modifications.LOAD_SCALING": "Load scaling {computedLabel}",
13
+ "network_modifications.DELETE_VOLTAGE_LEVEL_ON_LINE": "Deleting a voltage level on a line {computedLabel}",
14
+ "network_modifications.DELETE_ATTACHING_LINE": "Deleting attaching line {computedLabel}",
15
+ "network_modifications.LOAD_CREATION": "Creating load {computedLabel}",
16
+ "network_modifications.LOAD_MODIFICATION": "Modifying load {computedLabel}",
17
+ "network_modifications.BATTERY_CREATION": "Creating battery {computedLabel}",
18
+ "network_modifications.BATTERY_MODIFICATION": "Modifying battery {computedLabel}",
19
+ "network_modifications.GENERATOR_CREATION": "Creating generator {computedLabel}",
20
+ "network_modifications.GENERATOR_MODIFICATION": "Modifying generator {computedLabel}",
21
+ "network_modifications.LINE_CREATION": "Creating line {computedLabel}",
22
+ "network_modifications.LINE_MODIFICATION": "Modifying line {computedLabel}",
23
+ "network_modifications.TWO_WINDINGS_TRANSFORMER_CREATION": "Creating 2 windings transformer {computedLabel}",
24
+ "network_modifications.TWO_WINDINGS_TRANSFORMER_MODIFICATION": "Modifying 2 windings transformer {computedLabel}",
25
+ "network_modifications.OPERATING_STATUS_MODIFICATION": "{action, select, TRIP {Trip {computedLabel}} LOCKOUT {Lock out {computedLabel}} ENERGISE_END_ONE {Energise {computedLabel} on {energizedEnd}} ENERGISE_END_TWO {Energise {computedLabel} on {energizedEnd}} SWITCH_ON {Switch on {computedLabel}} other {Equipment operating status modification {computedLabel}}}",
26
+ "network_modifications.SHUNT_COMPENSATOR_CREATION": "Creating shunt compensator {computedLabel}",
27
+ "network_modifications.SHUNT_COMPENSATOR_MODIFICATION": "Modifying shunt compensator {computedLabel}",
28
+ "network_modifications.GENERATOR_SCALING": "Generator scaling {computedLabel}",
29
+ "network_modifications.VSC_CREATION": "Creating HVDC (VSC) {computedLabel}",
30
+ "network_modifications.VSC_MODIFICATION": "Modifing HVDC (VSC) {computedLabel}",
31
+ "network_modifications.GROOVY_SCRIPT": "Modification by script",
32
+ "network_modifications.EQUIPMENT_ATTRIBUTE_MODIFICATION": "{equipmentAttributeName, select, open {{equipmentAttributeValue, select, true {Open {computedLabel}} other {Close {computedLabel}}}} other {Equipment modification {computedLabel}}}",
33
+ "network_modifications.creatingModification": "Creating modification ...",
34
+ "network_modifications.deletingModification": "Deleting modification ...",
35
+ "network_modifications.updatingModification": "Updating modification ...",
36
+ "network_modifications.stashingModification": "Stashing modification ...",
37
+ "network_modifications.restoringModification": "Restoring modification ...",
38
+ "network_modifications.modifications": "Updating modification list ...",
39
+ "network_modifications.GENERATION_DISPATCH": "Generation dispatch {computedLabel}",
40
+ "network_modifications.VOLTAGE_INIT_MODIFICATION": "Voltage profile initialization {computedLabel}",
41
+ "network_modifications.TABULAR_MODIFICATION": "Tabular modification - {computedLabel}",
42
+ "network_modifications.tabular.GENERATOR_MODIFICATION": "generator modifications",
43
+ "network_modifications.tabular.LOAD_MODIFICATION": "load modifications",
44
+ "network_modifications.BY_FORMULA_MODIFICATION": "Modification by formula {computedLabel}",
45
+ "network_modifications.MODIFICATION_BY_ASSIGNMENT": "Modification by filter {computedLabel}",
46
+ "network_modifications.tabular.LINE_MODIFICATION": "line modifications",
47
+ "network_modifications.tabular.BATTERY_MODIFICATION": "battery modifications",
48
+ "network_modifications.tabular.VOLTAGE_LEVEL_MODIFICATION": "voltage level modifications",
49
+ "network_modifications.tabular.TWO_WINDINGS_TRANSFORMER_MODIFICATION": "two windings transformer modifications",
50
+ "network_modifications.tabular.SHUNT_COMPENSATOR_MODIFICATION": "linear shunt compensator modifications",
51
+ "network_modifications.tabular.SUBSTATION_MODIFICATION": "substation modifications",
52
+ "network_modifications.TABULAR_CREATION": "Tabular creation - {computedLabel}",
53
+ "network_modifications.tabular.GENERATOR_CREATION": "generator creations"
54
+ };
55
+ export {
56
+ networkModificationsEn
57
+ };
@@ -22,5 +22,6 @@ export * from './reportViewerFr';
22
22
  export * from './tableFr';
23
23
  export * from './topBarFr';
24
24
  export * from './treeviewFinderFr';
25
+ export * from './networkModificationsFr';
25
26
  export * from './external/exportParamsFr';
26
27
  export * from './external/importParamsFr';
@@ -16,6 +16,7 @@ import { reportViewerFr } from "./reportViewerFr.js";
16
16
  import { tableFr } from "./tableFr.js";
17
17
  import { topBarFr } from "./topBarFr.js";
18
18
  import { treeviewFinderFr } from "./treeviewFinderFr.js";
19
+ import { networkModificationsFr } from "./networkModificationsFr.js";
19
20
  import { exportParamsFr } from "./external/exportParamsFr.js";
20
21
  import { importParamsFr } from "./external/importParamsFr.js";
21
22
  export {
@@ -35,6 +36,7 @@ export {
35
36
  inputsFr,
36
37
  loginFr,
37
38
  multipleSelectionDialogFr,
39
+ networkModificationsFr,
38
40
  reportViewerFr,
39
41
  tableFr,
40
42
  topBarFr,