@gridsuite/commons-ui 0.99.0 → 0.101.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 (36) hide show
  1. package/dist/components/announcement/AnnouncementBanner.d.ts +15 -0
  2. package/dist/components/announcement/AnnouncementBanner.js +87 -0
  3. package/dist/components/announcement/AnnouncementNotification.d.ts +7 -0
  4. package/dist/components/announcement/AnnouncementNotification.js +10 -0
  5. package/dist/components/announcement/index.d.ts +3 -0
  6. package/dist/components/announcement/index.js +8 -0
  7. package/dist/components/announcement/useGlobalAnnouncement.d.ts +10 -0
  8. package/dist/components/announcement/useGlobalAnnouncement.js +48 -0
  9. package/dist/components/authentication/utils/authService.d.ts +4 -5
  10. package/dist/components/authentication/utils/authService.js +17 -36
  11. package/dist/components/index.d.ts +1 -0
  12. package/dist/components/index.js +10 -2
  13. package/dist/components/inputs/reactHookForm/text/TextInput.d.ts +3 -1
  14. package/dist/components/inputs/reactHookForm/text/TextInput.js +4 -2
  15. package/dist/components/topBar/DevModeBanner.d.ts +1 -0
  16. package/dist/components/topBar/DevModeBanner.js +42 -0
  17. package/dist/components/topBar/TopBar.js +302 -305
  18. package/dist/components/topBar/UserInformationDialog.js +1 -1
  19. package/dist/components/topBar/index.d.ts +3 -2
  20. package/dist/components/topBar/index.js +4 -2
  21. package/dist/index.js +20 -2
  22. package/dist/services/index.d.ts +1 -0
  23. package/dist/services/index.js +3 -0
  24. package/dist/services/userAdmin.d.ts +3 -3
  25. package/dist/services/userAdmin.js +9 -1
  26. package/dist/utils/constants/notificationsProvider.d.ts +10 -0
  27. package/dist/utils/constants/notificationsProvider.js +17 -0
  28. package/dist/utils/index.d.ts +1 -0
  29. package/dist/utils/index.js +7 -0
  30. package/dist/utils/types/index.js +2 -0
  31. package/dist/utils/types/metadata.d.ts +1 -0
  32. package/dist/utils/types/types.d.ts +12 -0
  33. package/dist/utils/types/types.js +8 -1
  34. package/package.json +1 -1
  35. package/dist/components/topBar/MessageBanner.d.ts +0 -6
  36. package/dist/components/topBar/MessageBanner.js +0 -54
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  import { default as default2 } from "./_mocks_/svg.js";
2
+ import { AnnouncementBanner } from "./components/announcement/AnnouncementBanner.js";
3
+ import { AnnouncementNotification } from "./components/announcement/AnnouncementNotification.js";
4
+ import { useGlobalAnnouncement } from "./components/announcement/useGlobalAnnouncement.js";
2
5
  import { AuthenticationRouter } from "./components/authentication/AuthenticationRouter.js";
3
6
  import { default as default3 } from "./components/authentication/AuthenticationRouterErrorDisplay.js";
4
7
  import { Login } from "./components/authentication/Login.js";
@@ -98,9 +101,10 @@ import { ActivableChip } from "./components/inputs/ActivableChip.js";
98
101
  import { MultipleSelectionDialog } from "./components/multipleSelectionDialog/MultipleSelectionDialog.js";
99
102
  import { OverflowableText } from "./components/overflowableText/OverflowableText.js";
100
103
  import { SnackbarProvider } from "./components/snackbarProvider/SnackbarProvider.js";
101
- import { TopBar } from "./components/topBar/TopBar.js";
102
- import { GridLogo, LogoText } from "./components/topBar/GridLogo.js";
103
104
  import { AboutDialog } from "./components/topBar/AboutDialog.js";
105
+ import { GridLogo, LogoText } from "./components/topBar/GridLogo.js";
106
+ import { DevModeBanner } from "./components/topBar/DevModeBanner.js";
107
+ import { TopBar } from "./components/topBar/TopBar.js";
104
108
  import { TreeViewFinder, generateTreeViewFinderClass } from "./components/treeViewFinder/TreeViewFinder.js";
105
109
  import { NotificationsProvider } from "./components/notifications/NotificationsProvider.js";
106
110
  import { NotificationsContext } from "./components/notifications/contexts/NotificationsContext.js";
@@ -152,6 +156,7 @@ import { createFilter, createParameter, fetchElementsInfos, saveFilter, updatePa
152
156
  import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
153
157
  import { elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./services/directory.js";
154
158
  import { exportFilter } from "./services/study.js";
159
+ import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
155
160
  import { equalsArray } from "./utils/algos.js";
156
161
  import { FetchStatus } from "./utils/constants/fetchStatus.js";
157
162
  import { FieldConstants } from "./utils/constants/fieldConstants.js";
@@ -162,10 +167,12 @@ import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/fun
162
167
  import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
163
168
  import { getFileIcon } from "./utils/mapper/getFileIcon.js";
164
169
  import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
170
+ import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./utils/constants/notificationsProvider.js";
165
171
  import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
166
172
  import { ElementType } from "./utils/types/elementType.js";
167
173
  import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
168
174
  import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
175
+ import { AnnouncementSeverity } from "./utils/types/types.js";
169
176
  import { MODIFICATION_TYPES, ModificationType } from "./utils/types/modificationType.js";
170
177
  import { FieldType } from "./utils/types/fieldType.js";
171
178
  import { ParameterType } from "./utils/types/parameters.type.js";
@@ -225,6 +232,9 @@ export {
225
232
  AboutDialog,
226
233
  ActivableChip,
227
234
  AddButton,
235
+ AnnouncementBanner,
236
+ AnnouncementNotification,
237
+ AnnouncementSeverity,
228
238
  AuthenticationRouter,
229
239
  default3 as AuthenticationRouterErrorDisplay,
230
240
  AutocompleteInput,
@@ -280,6 +290,7 @@ export {
280
290
  DataType,
281
291
  DescriptionField,
282
292
  DescriptionModificationDialog,
293
+ DevModeBanner,
283
294
  DirectoryItemSelector,
284
295
  DirectoryItemsInput,
285
296
  DistributionType,
@@ -373,6 +384,7 @@ export {
373
384
  NO_ITEM_SELECTION_FOR_COPY,
374
385
  NotificationsContext,
375
386
  NotificationsProvider,
387
+ NotificationsUrlKeys,
376
388
  NumericEditor,
377
389
  OHM,
378
390
  OPERATOR_OPTIONS,
@@ -391,6 +403,9 @@ export {
391
403
  PERCENTAGE,
392
404
  PHASE_REGULATION_MODE_OPTIONS,
393
405
  PHASE_SHIFTER_REGULATION_ON,
406
+ PREFIX_CONFIG_NOTIFICATION_WS,
407
+ PREFIX_DIRECTORY_NOTIFICATION_WS,
408
+ PREFIX_STUDY_NOTIFICATION_WS,
394
409
  PROVIDER,
395
410
  ParameterFloat,
396
411
  ParameterGroup,
@@ -507,6 +522,7 @@ export {
507
522
  exportParamsFr,
508
523
  extractDefault,
509
524
  fetchAppsMetadata,
525
+ fetchCurrentAnnouncement,
510
526
  fetchDefaultCountry,
511
527
  fetchDirectoryContent,
512
528
  fetchDirectoryElementPath,
@@ -515,6 +531,7 @@ export {
515
531
  fetchFavoriteAndDefaultCountries,
516
532
  fetchRootFolders,
517
533
  fetchStudyMetadata,
534
+ fetchUserDetails,
518
535
  filterEn,
519
536
  filterExpertEn,
520
537
  filterExpertFr,
@@ -618,6 +635,7 @@ export {
618
635
  useDebounce,
619
636
  useElementSearch,
620
637
  useFormatLabelWithUnit,
638
+ useGlobalAnnouncement,
621
639
  useIntlRef,
622
640
  useListenerManager,
623
641
  useLocalizedCountries,
@@ -9,3 +9,4 @@ export * from './explore';
9
9
  export * from './appsMetadata';
10
10
  export * from './directory';
11
11
  export * from './study';
12
+ export * from './userAdmin';
@@ -3,6 +3,7 @@ import { createFilter, createParameter, fetchElementsInfos, saveFilter, updatePa
3
3
  import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
4
4
  import { elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./directory.js";
5
5
  import { exportFilter } from "./study.js";
6
+ import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
6
7
  export {
7
8
  backendFetch,
8
9
  backendFetchJson,
@@ -13,6 +14,7 @@ export {
13
14
  elementAlreadyExists,
14
15
  exportFilter,
15
16
  fetchAppsMetadata,
17
+ fetchCurrentAnnouncement,
16
18
  fetchDefaultCountry,
17
19
  fetchDirectoryContent,
18
20
  fetchDirectoryElementPath,
@@ -21,6 +23,7 @@ export {
21
23
  fetchFavoriteAndDefaultCountries,
22
24
  fetchRootFolders,
23
25
  fetchStudyMetadata,
26
+ fetchUserDetails,
24
27
  getRequestParamFromList,
25
28
  isStudyMetadata,
26
29
  saveFilter,
@@ -1,3 +1,3 @@
1
- import { UserDetail } from '../utils/types/types';
2
- declare function fetchUserDetails(user: string): Promise<UserDetail>;
3
- export default fetchUserDetails;
1
+ import { AnnouncementDto, UserDetail } from '../utils/types/types';
2
+ export declare function fetchUserDetails(user: string): Promise<UserDetail>;
3
+ export declare function fetchCurrentAnnouncement(): Promise<AnnouncementDto | null>;
@@ -7,6 +7,14 @@ function fetchUserDetails(user) {
7
7
  headers: { "Content-Type": "application/json" }
8
8
  });
9
9
  }
10
+ function fetchCurrentAnnouncement() {
11
+ console.info(`Fetching current announcement ...`);
12
+ const url = `${PREFIX_USER_ADMIN_QUERIES}/announcements/current`;
13
+ return backendFetchJson(url, {
14
+ method: "get"
15
+ });
16
+ }
10
17
  export {
11
- fetchUserDetails as default
18
+ fetchCurrentAnnouncement,
19
+ fetchUserDetails
12
20
  };
@@ -0,0 +1,10 @@
1
+ export declare enum NotificationsUrlKeys {
2
+ CONFIG = "CONFIG",
3
+ GLOBAL_CONFIG = "GLOBAL_CONFIG",
4
+ STUDY = "STUDY",
5
+ DIRECTORY = "DIRECTORY",
6
+ DIRECTORY_DELETE_STUDY = "DIRECTORY_DELETE_STUDY"
7
+ }
8
+ export declare const PREFIX_CONFIG_NOTIFICATION_WS: string;
9
+ export declare const PREFIX_STUDY_NOTIFICATION_WS: string;
10
+ export declare const PREFIX_DIRECTORY_NOTIFICATION_WS: string;
@@ -0,0 +1,17 @@
1
+ var NotificationsUrlKeys = /* @__PURE__ */ ((NotificationsUrlKeys2) => {
2
+ NotificationsUrlKeys2["CONFIG"] = "CONFIG";
3
+ NotificationsUrlKeys2["GLOBAL_CONFIG"] = "GLOBAL_CONFIG";
4
+ NotificationsUrlKeys2["STUDY"] = "STUDY";
5
+ NotificationsUrlKeys2["DIRECTORY"] = "DIRECTORY";
6
+ NotificationsUrlKeys2["DIRECTORY_DELETE_STUDY"] = "DIRECTORY_DELETE_STUDY";
7
+ return NotificationsUrlKeys2;
8
+ })(NotificationsUrlKeys || {});
9
+ const PREFIX_CONFIG_NOTIFICATION_WS = `${"ws/gateway"}/config-notification`;
10
+ const PREFIX_STUDY_NOTIFICATION_WS = `${"ws/gateway"}/study-notification`;
11
+ const PREFIX_DIRECTORY_NOTIFICATION_WS = `${"ws/gateway"}/directory-notification`;
12
+ export {
13
+ NotificationsUrlKeys,
14
+ PREFIX_CONFIG_NOTIFICATION_WS,
15
+ PREFIX_DIRECTORY_NOTIFICATION_WS,
16
+ PREFIX_STUDY_NOTIFICATION_WS
17
+ };
@@ -10,6 +10,7 @@ export * from './conversionUtils';
10
10
  export * from './functions';
11
11
  export * from './langs';
12
12
  export * from './mapper';
13
+ export * from './constants/notificationsProvider';
13
14
  export * from './styles';
14
15
  export * from './types';
15
16
  export { default as yupConfig } from './yupConfig';
@@ -8,10 +8,12 @@ import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions
8
8
  import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
9
9
  import { getFileIcon } from "./mapper/getFileIcon.js";
10
10
  import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
11
+ import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./constants/notificationsProvider.js";
11
12
  import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
12
13
  import { ElementType } from "./types/elementType.js";
13
14
  import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
14
15
  import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./types/equipmentTypes.js";
16
+ import { AnnouncementSeverity } from "./types/types.js";
15
17
  import { MODIFICATION_TYPES, ModificationType } from "./types/modificationType.js";
16
18
  import { FieldType } from "./types/fieldType.js";
17
19
  import { ParameterType } from "./types/parameters.type.js";
@@ -22,6 +24,7 @@ import "./yupConfig.js";
22
24
  import * as yup from "yup";
23
25
  export {
24
26
  AMPERE,
27
+ AnnouncementSeverity,
25
28
  BASE_EQUIPMENTS,
26
29
  Battery,
27
30
  BusBar,
@@ -58,9 +61,13 @@ export {
58
61
  MICRO_SIEMENS,
59
62
  MODIFICATION_TYPES,
60
63
  ModificationType,
64
+ NotificationsUrlKeys,
61
65
  OHM,
62
66
  OperatingStatus,
63
67
  PERCENTAGE,
68
+ PREFIX_CONFIG_NOTIFICATION_WS,
69
+ PREFIX_DIRECTORY_NOTIFICATION_WS,
70
+ PREFIX_STUDY_NOTIFICATION_WS,
64
71
  ParameterType,
65
72
  SEARCH_EQUIPMENTS,
66
73
  SIEMENS,
@@ -1,6 +1,7 @@
1
1
  import { ElementType } from "./elementType.js";
2
2
  import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./equipmentType.js";
3
3
  import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./equipmentTypes.js";
4
+ import { AnnouncementSeverity } from "./types.js";
4
5
  import { MODIFICATION_TYPES, ModificationType } from "./modificationType.js";
5
6
  import { FieldType } from "./fieldType.js";
6
7
  import { ParameterType } from "./parameters.type.js";
@@ -8,6 +9,7 @@ import { SolverTypeInfos } from "./dynamic-simulation.type.js";
8
9
  import { EnergySource } from "./non-evacuated-energy.type.js";
9
10
  import { DistributionType, SensitivityType } from "./sensitivity-analysis.type.js";
10
11
  export {
12
+ AnnouncementSeverity,
11
13
  BASE_EQUIPMENTS,
12
14
  Battery,
13
15
  BusBar,
@@ -21,5 +21,6 @@ export type StudyMetadata = Metadata & {
21
21
  };
22
22
  defaultCountry?: string;
23
23
  favoriteCountries?: string[];
24
+ substationPropertiesGlobalFilters?: Map<string, string[]>;
24
25
  };
25
26
  export {};
@@ -44,3 +44,15 @@ export type UserDetail = {
44
44
  numberCasesUsed: number;
45
45
  maxAllowedBuilds: number;
46
46
  };
47
+ export declare enum AnnouncementSeverity {
48
+ INFO = "INFO",
49
+ WARN = "WARN"
50
+ }
51
+ export type AnnouncementDto = {
52
+ id: UUID;
53
+ startDate: Date;
54
+ endDate: Date;
55
+ message: string;
56
+ severity: AnnouncementSeverity;
57
+ remainingDuration: number;
58
+ };
@@ -1 +1,8 @@
1
-
1
+ var AnnouncementSeverity = /* @__PURE__ */ ((AnnouncementSeverity2) => {
2
+ AnnouncementSeverity2["INFO"] = "INFO";
3
+ AnnouncementSeverity2["WARN"] = "WARN";
4
+ return AnnouncementSeverity2;
5
+ })(AnnouncementSeverity || {});
6
+ export {
7
+ AnnouncementSeverity
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.99.0",
3
+ "version": "0.101.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface MessageBannerProps {
3
- children: ReactNode;
4
- }
5
- declare function MessageBanner({ children }: MessageBannerProps): false | import("react/jsx-runtime").JSX.Element;
6
- export default MessageBanner;
@@ -1,54 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { Box } from "@mui/material";
4
- import { WarningAmber, Close } from "@mui/icons-material";
5
- const styles = {
6
- banner: (theme) => ({
7
- left: 0,
8
- width: "100%",
9
- backgroundColor: "#f6b26b",
10
- color: "black",
11
- padding: theme.spacing(1),
12
- textAlign: "left",
13
- boxShadow: "0px 2px 5px rgba(0, 0, 0, 0.1)",
14
- zIndex: 1e3,
15
- display: "flex",
16
- justifyContent: "flex-start",
17
- alignItems: "center"
18
- }),
19
- icon: (theme) => ({
20
- paddingRight: theme.spacing(0.75),
21
- color: "red",
22
- marginTop: theme.spacing(0.5)
23
- }),
24
- message: {
25
- flexGrow: 1
26
- },
27
- button: (theme) => ({
28
- backgroundColor: "#f6b26b",
29
- border: "none",
30
- cursor: "pointer",
31
- borderRadius: theme.spacing(0.5),
32
- marginRight: theme.spacing(0.5),
33
- width: theme.spacing(3.5),
34
- height: theme.spacing(3.5),
35
- "&:hover": {
36
- backgroundColor: "#e39648"
37
- },
38
- "& svg": {
39
- width: "100%",
40
- height: "100%"
41
- }
42
- })
43
- };
44
- function MessageBanner({ children }) {
45
- const [visible, setVisible] = useState(true);
46
- return visible && /* @__PURE__ */ jsxs(Box, { sx: styles.banner, children: [
47
- /* @__PURE__ */ jsx(Box, { sx: styles.icon, children: /* @__PURE__ */ jsx(WarningAmber, {}) }),
48
- /* @__PURE__ */ jsx(Box, { sx: styles.message, children }),
49
- /* @__PURE__ */ jsx(Box, { sx: styles.button, onClick: () => setVisible(false), children: /* @__PURE__ */ jsx(Close, {}) })
50
- ] });
51
- }
52
- export {
53
- MessageBanner as default
54
- };