@gridsuite/commons-ui 0.46.0 → 0.48.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 (271) hide show
  1. package/README.md +0 -17
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
  4. package/dist/components/AuthenticationRouter/index.d.ts +1 -0
  5. package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
  6. package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
  7. package/dist/components/CardErrorBoundary/index.d.ts +1 -0
  8. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
  9. package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
  10. package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
  11. package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
  12. package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
  13. package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
  14. package/dist/components/ElementSearchDialog/index.d.ts +2 -0
  15. package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
  16. package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
  17. package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
  18. package/dist/components/FlatParameters/FlatParameters.js +411 -0
  19. package/dist/components/FlatParameters/index.d.ts +1 -0
  20. package/dist/components/Login/Login.d.ts +5 -0
  21. package/dist/components/Login/Login.js +78 -0
  22. package/dist/components/Login/Logout.d.ts +5 -0
  23. package/dist/components/Login/Logout.js +69 -0
  24. package/dist/components/Login/index.d.ts +1 -0
  25. package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
  26. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
  27. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
  28. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
  29. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
  30. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
  31. package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
  32. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
  33. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
  34. package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
  35. package/dist/components/OverflowableText/index.d.ts +1 -0
  36. package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
  37. package/dist/components/OverflowableText/overflowable-text.js +87 -0
  38. package/dist/components/ReportViewer/filter-button.d.ts +1 -0
  39. package/dist/components/ReportViewer/filter-button.js +64 -0
  40. package/dist/components/ReportViewer/index.d.ts +1 -0
  41. package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
  42. package/dist/components/ReportViewer/log-report-item.js +95 -0
  43. package/dist/components/ReportViewer/log-report.d.ts +21 -0
  44. package/dist/components/ReportViewer/log-report.js +49 -0
  45. package/dist/components/ReportViewer/log-table.d.ts +8 -0
  46. package/dist/components/ReportViewer/log-table.js +131 -0
  47. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
  48. package/dist/components/ReportViewer/multi-select-list.js +40 -0
  49. package/dist/components/ReportViewer/report-item.d.ts +13 -0
  50. package/dist/components/ReportViewer/report-item.js +112 -0
  51. package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
  52. package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
  53. package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
  54. package/dist/components/ReportViewer/report-viewer.js +158 -0
  55. package/dist/components/ReportViewerDialog/index.d.ts +1 -0
  56. package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
  57. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
  58. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
  59. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
  60. package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
  61. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
  62. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
  63. package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
  64. package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
  65. package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
  66. package/dist/components/SnackbarProvider/index.d.ts +1 -0
  67. package/dist/components/TopBar/AboutDialog.d.ts +24 -0
  68. package/dist/components/TopBar/AboutDialog.js +467 -0
  69. package/dist/components/TopBar/GridLogo.d.ts +34 -0
  70. package/dist/components/TopBar/GridLogo.js +71 -0
  71. package/dist/components/TopBar/TopBar.d.ts +53 -0
  72. package/dist/components/TopBar/TopBar.js +679 -0
  73. package/dist/components/TopBar/index.d.ts +3 -0
  74. package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
  75. package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
  76. package/dist/components/TreeViewFinder/index.d.ts +1 -0
  77. package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
  78. package/dist/components/react-hook-form/autocomplete-input.js +96 -0
  79. package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
  80. package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
  81. package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
  82. package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
  83. package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
  84. package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
  85. package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
  86. package/dist/components/react-hook-form/directory-items-input.js +185 -0
  87. package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
  88. package/dist/components/react-hook-form/error-management/error-input.js +42 -0
  89. package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
  90. package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
  91. package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
  92. package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
  93. package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
  94. package/dist/components/react-hook-form/numbers/float-input.js +51 -0
  95. package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
  96. package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
  97. package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
  98. package/dist/components/react-hook-form/numbers/utils.js +10 -0
  99. package/dist/components/react-hook-form/radio-input.d.ts +18 -0
  100. package/dist/components/react-hook-form/radio-input.js +44 -0
  101. package/{es/components/MultipleSelectionDialog/index.js → dist/components/react-hook-form/raw-read-only-input.d.ts} +3 -2
  102. package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
  103. package/dist/components/react-hook-form/select-input.d.ts +17 -0
  104. package/dist/components/react-hook-form/select-input.js +31 -0
  105. package/dist/components/react-hook-form/slider-input.d.ts +21 -0
  106. package/dist/components/react-hook-form/slider-input.js +43 -0
  107. package/dist/components/react-hook-form/text-input.d.ts +33 -0
  108. package/dist/components/react-hook-form/text-input.js +94 -0
  109. package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
  110. package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
  111. package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
  112. package/dist/components/react-hook-form/utils/field-label.js +12 -0
  113. package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
  114. package/dist/components/react-hook-form/utils/functions.js +41 -0
  115. package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
  116. package/dist/components/react-hook-form/utils/submit-button.js +23 -0
  117. package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
  118. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
  119. package/{es/components/translations/report-viewer-fr.js → dist/components/translations/card-error-boundary-en.d.ts} +5 -6
  120. package/dist/components/translations/card-error-boundary-en.js +8 -0
  121. package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
  122. package/dist/components/translations/card-error-boundary-fr.js +8 -0
  123. package/dist/components/translations/common-button-en.d.ts +5 -0
  124. package/dist/components/translations/common-button-en.js +7 -0
  125. package/dist/components/translations/common-button-fr.d.ts +5 -0
  126. package/dist/components/translations/common-button-fr.js +7 -0
  127. package/{es/components/translations/element-search-en.js → dist/components/translations/element-search-en.d.ts} +4 -5
  128. package/dist/components/translations/element-search-en.js +7 -0
  129. package/dist/components/translations/element-search-fr.d.ts +11 -0
  130. package/dist/components/translations/element-search-fr.js +7 -0
  131. package/dist/components/translations/equipment-search-en.d.ts +25 -0
  132. package/dist/components/translations/equipment-search-en.js +21 -0
  133. package/dist/components/translations/equipment-search-fr.d.ts +25 -0
  134. package/dist/components/translations/equipment-search-fr.js +21 -0
  135. package/{es/components/translations/flat-parameters-en.js → dist/components/translations/flat-parameters-en.d.ts} +5 -6
  136. package/dist/components/translations/flat-parameters-en.js +8 -0
  137. package/{es/components/translations/common-button-en.js → dist/components/translations/flat-parameters-fr.d.ts} +5 -5
  138. package/dist/components/translations/flat-parameters-fr.js +8 -0
  139. package/dist/components/translations/login-en.d.ts +18 -0
  140. package/dist/components/translations/login-en.js +14 -0
  141. package/dist/components/translations/login-fr.d.ts +18 -0
  142. package/dist/components/translations/login-fr.js +14 -0
  143. package/{es/components/translations/flat-parameters-fr.js → dist/components/translations/multiple-selection-dialog-en.d.ts} +5 -6
  144. package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
  145. package/{es/components/translations/common-button-fr.js → dist/components/translations/multiple-selection-dialog-fr.d.ts} +5 -5
  146. package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
  147. package/{es/components/translations/report-viewer-en.js → dist/components/translations/report-viewer-en.d.ts} +5 -6
  148. package/dist/components/translations/report-viewer-en.js +8 -0
  149. package/{es/components/translations/element-search-fr.js → dist/components/translations/report-viewer-fr.d.ts} +5 -5
  150. package/dist/components/translations/report-viewer-fr.js +8 -0
  151. package/{es/components/translations/table-en.js → dist/components/translations/table-en.d.ts} +3 -4
  152. package/dist/components/translations/table-en.js +6 -0
  153. package/{es/components/translations/table-fr.js → dist/components/translations/table-fr.d.ts} +3 -4
  154. package/dist/components/translations/table-fr.js +6 -0
  155. package/dist/components/translations/top-bar-en.d.ts +31 -0
  156. package/dist/components/translations/top-bar-en.js +27 -0
  157. package/dist/components/translations/top-bar-fr.d.ts +31 -0
  158. package/dist/components/translations/top-bar-fr.js +27 -0
  159. package/dist/components/translations/treeview-finder-en.d.ts +16 -0
  160. package/dist/components/translations/treeview-finder-en.js +12 -0
  161. package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
  162. package/dist/components/translations/treeview-finder-fr.js +12 -0
  163. package/dist/hooks/useDebounce.d.ts +1 -0
  164. package/dist/hooks/useDebounce.js +17 -0
  165. package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
  166. package/dist/hooks/useIntlRef.js +13 -0
  167. package/dist/hooks/useSnackMessage.d.ts +5 -0
  168. package/dist/hooks/useSnackMessage.js +81 -0
  169. package/dist/index.d.ts +234 -0
  170. package/dist/index.js +158 -0
  171. package/dist/utils/AuthService.d.ts +9 -0
  172. package/dist/utils/AuthService.js +336 -0
  173. package/dist/utils/ElementType.d.ts +13 -0
  174. package/dist/utils/ElementType.js +42 -0
  175. package/dist/utils/EquipmentType.d.ts +136 -0
  176. package/dist/utils/EquipmentType.js +132 -0
  177. package/dist/utils/UserManagerMock.d.ts +34 -0
  178. package/dist/utils/UserManagerMock.js +85 -0
  179. package/dist/utils/actions.d.ts +50 -0
  180. package/dist/utils/actions.js +71 -0
  181. package/{es/components/CardErrorBoundary/index.js → dist/utils/algos.d.ts} +1 -1
  182. package/dist/utils/algos.js +24 -0
  183. package/dist/utils/styles.d.ts +5 -0
  184. package/dist/utils/styles.js +13 -0
  185. package/package.json +36 -21
  186. package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
  187. package/es/components/AuthenticationRouter/index.js +0 -7
  188. package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
  189. package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
  190. package/es/components/ElementSearchDialog/equipment-item.js +0 -63
  191. package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
  192. package/es/components/FlatParameters/FlatParameters.js +0 -448
  193. package/es/components/FlatParameters/index.js +0 -8
  194. package/es/components/Login/Login.js +0 -79
  195. package/es/components/Login/Logout.js +0 -78
  196. package/es/components/Login/index.js +0 -7
  197. package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
  198. package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
  199. package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
  200. package/es/components/MuiVirtualizedTable/index.js +0 -9
  201. package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
  202. package/es/components/OverflowableText/index.js +0 -7
  203. package/es/components/OverflowableText/overflowable-text.js +0 -81
  204. package/es/components/ReportViewer/filter-button.js +0 -77
  205. package/es/components/ReportViewer/index.js +0 -7
  206. package/es/components/ReportViewer/log-report-item.js +0 -97
  207. package/es/components/ReportViewer/log-report.js +0 -63
  208. package/es/components/ReportViewer/log-table.js +0 -130
  209. package/es/components/ReportViewer/multi-select-list.js +0 -56
  210. package/es/components/ReportViewer/report-item.js +0 -131
  211. package/es/components/ReportViewer/report-tree-view-context.js +0 -13
  212. package/es/components/ReportViewer/report-viewer.js +0 -167
  213. package/es/components/ReportViewerDialog/index.js +0 -7
  214. package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
  215. package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
  216. package/es/components/SignInCallbackHandler/index.js +0 -7
  217. package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
  218. package/es/components/SilentRenewCallbackHandler/index.js +0 -7
  219. package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
  220. package/es/components/SnackbarProvider/index.js +0 -7
  221. package/es/components/TopBar/AboutDialog.js +0 -456
  222. package/es/components/TopBar/GridLogo.js +0 -73
  223. package/es/components/TopBar/TopBar.js +0 -487
  224. package/es/components/TopBar/index.js +0 -9
  225. package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
  226. package/es/components/TreeViewFinder/index.js +0 -7
  227. package/es/components/images/powsybl_logo.svg +0 -35
  228. package/es/components/react-hook-form/autocomplete-input.js +0 -110
  229. package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
  230. package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
  231. package/es/components/react-hook-form/booleans/switch-input.js +0 -28
  232. package/es/components/react-hook-form/error-management/error-input.js +0 -50
  233. package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
  234. package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
  235. package/es/components/react-hook-form/numbers/float-input.js +0 -105
  236. package/es/components/react-hook-form/numbers/integer-input.js +0 -35
  237. package/es/components/react-hook-form/numbers/utils.js +0 -6
  238. package/es/components/react-hook-form/radio-input.js +0 -55
  239. package/es/components/react-hook-form/select-input.js +0 -40
  240. package/es/components/react-hook-form/slider-input.js +0 -48
  241. package/es/components/react-hook-form/text-input.js +0 -100
  242. package/es/components/react-hook-form/utils/cancel-button.js +0 -28
  243. package/es/components/react-hook-form/utils/field-label.js +0 -15
  244. package/es/components/react-hook-form/utils/functions.js +0 -42
  245. package/es/components/react-hook-form/utils/submit-button.js +0 -29
  246. package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
  247. package/es/components/translations/card-error-boundary-en.js +0 -13
  248. package/es/components/translations/card-error-boundary-fr.js +0 -13
  249. package/es/components/translations/equipment-search-en.js +0 -26
  250. package/es/components/translations/equipment-search-fr.js +0 -26
  251. package/es/components/translations/inputs-en.js +0 -25
  252. package/es/components/translations/inputs-fr.js +0 -25
  253. package/es/components/translations/login-en.js +0 -19
  254. package/es/components/translations/login-fr.js +0 -19
  255. package/es/components/translations/multiple-selection-dialog-en.js +0 -13
  256. package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
  257. package/es/components/translations/top-bar-en.js +0 -32
  258. package/es/components/translations/top-bar-fr.js +0 -32
  259. package/es/components/translations/treeview-finder-en.js +0 -17
  260. package/es/components/translations/treeview-finder-fr.js +0 -17
  261. package/es/hooks/useDebounce.js +0 -26
  262. package/es/hooks/useIntlRef.js +0 -22
  263. package/es/hooks/useSnackMessage.js +0 -81
  264. package/es/index.js +0 -71
  265. package/es/utils/AuthService.js +0 -312
  266. package/es/utils/ElementType.js +0 -53
  267. package/es/utils/EquipmentType.js +0 -133
  268. package/es/utils/UserManagerMock.js +0 -81
  269. package/es/utils/actions.js +0 -65
  270. package/es/utils/algos.js +0 -29
  271. package/es/utils/styles.js +0 -35
@@ -0,0 +1,467 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useState, useEffect, useCallback } from "react";
3
+ import { useTheme, Dialog, useMediaQuery, DialogTitle, Collapse, Alert, Box, Fade, CircularProgress, Typography, DialogContent, Accordion, AccordionSummary, AccordionDetails, Grid, DialogActions, Button, Tooltip, Zoom, Stack, tooltipClasses } from "@mui/material";
4
+ import { LoadingButton } from "@mui/lab";
5
+ import { Refresh, ExpandMore, Gavel, Apps, WidgetsOutlined, DnsOutlined, QuestionMark } from "@mui/icons-material";
6
+ import { FormattedMessage } from "react-intl";
7
+ import PropTypes from "prop-types";
8
+ import { LogoText } from "./GridLogo.js";
9
+ const styles = {
10
+ general: {
11
+ ".MuiAccordion-root": {
12
+ //dunno why the theme has the background as black in dark mode
13
+ bgcolor: "unset"
14
+ }
15
+ },
16
+ mainSection: { height: "5em" },
17
+ logoSection: {
18
+ display: "flex",
19
+ alignItems: "center",
20
+ justifyContent: "center"
21
+ },
22
+ mainInfos: {
23
+ textAlign: "center",
24
+ marginTop: 0
25
+ },
26
+ versionField: (isUnknown) => isUnknown ? {
27
+ fontSize: "1.5em",
28
+ fontWeight: "bold"
29
+ } : {
30
+ fontStyle: "italic"
31
+ },
32
+ detailsSection: {
33
+ ".MuiAccordionSummary-content > .MuiSvgIcon-root": {
34
+ marginRight: "0.5rem"
35
+ }
36
+ }
37
+ };
38
+ function getGlobalVersion(fnPromise, type, setData, setLoader) {
39
+ if (fnPromise) {
40
+ console.debug("Getting", type, "global version...");
41
+ return new Promise((resolve, reject) => {
42
+ if (setLoader) {
43
+ setLoader(true);
44
+ }
45
+ resolve();
46
+ }).then(() => fnPromise()).then(
47
+ (value) => {
48
+ console.debug(type, "global version is", value);
49
+ setData(value ?? null);
50
+ },
51
+ (reason) => {
52
+ console.debug(
53
+ type,
54
+ "global version isn't available",
55
+ reason
56
+ );
57
+ setData(null);
58
+ }
59
+ ).finally(() => {
60
+ if (setLoader) {
61
+ setLoader(false);
62
+ }
63
+ });
64
+ } else {
65
+ console.debug("No getter for global version");
66
+ setData(null);
67
+ }
68
+ }
69
+ const moduleTypeSort = {
70
+ app: 1,
71
+ server: 10,
72
+ other: 20
73
+ };
74
+ function compareModules(c1, c2) {
75
+ return [moduleTypeSort[c1.type] || 100] - [moduleTypeSort[c2.type] || 100] || (c1.name || "").localeCompare(c2.name || "");
76
+ }
77
+ const AboutDialog = ({
78
+ open,
79
+ onClose,
80
+ globalVersionPromise,
81
+ appName,
82
+ appVersion,
83
+ appGitTag,
84
+ appLicense,
85
+ additionalModulesPromise
86
+ }) => {
87
+ const theme = useTheme();
88
+ const [isRefreshing, setRefreshState] = useState(false);
89
+ const [loadingGlobalVersion, setLoadingGlobalVersion] = useState(false);
90
+ const [showGlobalVersion, setShowGlobalVersion] = useState(false);
91
+ const [initialGlobalVersion, setInitialGlobalVersion] = useState(void 0);
92
+ useEffect(() => {
93
+ if (initialGlobalVersion === void 0) {
94
+ getGlobalVersion(
95
+ globalVersionPromise,
96
+ "Initial",
97
+ setInitialGlobalVersion,
98
+ void 0
99
+ );
100
+ }
101
+ }, [globalVersionPromise, initialGlobalVersion]);
102
+ const [actualGlobalVersion, setActualGlobalVersion] = useState(null);
103
+ useEffect(() => {
104
+ if (open) {
105
+ getGlobalVersion(
106
+ globalVersionPromise,
107
+ "Actual",
108
+ setActualGlobalVersion,
109
+ (loading) => {
110
+ setLoadingGlobalVersion(loading);
111
+ setShowGlobalVersion(false);
112
+ }
113
+ );
114
+ }
115
+ }, [open, globalVersionPromise]);
116
+ const [loadingAdditionalModules, setLoadingAdditionalModules] = useState(false);
117
+ const [modules, setModules] = useState(null);
118
+ useEffect(() => {
119
+ if (open) {
120
+ const currentApp = {
121
+ name: `Grid${appName}`,
122
+ type: "app",
123
+ version: appVersion,
124
+ gitTag: appGitTag,
125
+ license: appLicense
126
+ };
127
+ (additionalModulesPromise ? Promise.resolve(setLoadingAdditionalModules(true)).then(
128
+ () => additionalModulesPromise()
129
+ ) : Promise.reject(new Error("no getter"))).then(
130
+ (values) => Array.isArray(values) ? values : [],
131
+ (reason) => []
132
+ ).then((values) => {
133
+ setModules([currentApp, ...values]);
134
+ }).finally(() => setLoadingAdditionalModules(false));
135
+ }
136
+ }, [
137
+ open,
138
+ additionalModulesPromise,
139
+ appName,
140
+ appVersion,
141
+ appGitTag,
142
+ appLicense
143
+ ]);
144
+ const handleClose = useCallback(() => {
145
+ if (onClose) {
146
+ onClose();
147
+ }
148
+ }, [onClose]);
149
+ return /* @__PURE__ */ jsxs(
150
+ Dialog,
151
+ {
152
+ onClose: handleClose,
153
+ open,
154
+ fullWidth: true,
155
+ maxWidth: "md",
156
+ fullScreen: useMediaQuery(theme.breakpoints.down("md")),
157
+ sx: styles.general,
158
+ "aria-labelledby": "alert-dialog-title",
159
+ "aria-describedby": "alert-dialog-description",
160
+ TransitionProps: {
161
+ onExited: (node) => {
162
+ setModules(null);
163
+ setActualGlobalVersion(null);
164
+ }
165
+ },
166
+ children: [
167
+ /* @__PURE__ */ jsxs(DialogTitle, { id: "alert-dialog-title", children: [
168
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/title" }),
169
+ initialGlobalVersion !== void 0 && initialGlobalVersion !== null && actualGlobalVersion !== null && initialGlobalVersion !== actualGlobalVersion && /* @__PURE__ */ jsx(Collapse, { in: open, children: /* @__PURE__ */ jsx(
170
+ Alert,
171
+ {
172
+ severity: "warning",
173
+ variant: "outlined",
174
+ action: /* @__PURE__ */ jsx(
175
+ LoadingButton,
176
+ {
177
+ color: "inherit",
178
+ size: "small",
179
+ startIcon: /* @__PURE__ */ jsx(Refresh, { fontSize: "small" }),
180
+ loadingPosition: "start",
181
+ loading: isRefreshing,
182
+ onClick: () => {
183
+ setRefreshState(true);
184
+ window.location.reload();
185
+ },
186
+ children: /* @__PURE__ */ jsx(FormattedMessage, { id: "refresh" })
187
+ }
188
+ ),
189
+ sx: { marginBottom: 2 },
190
+ children: /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/alert-running-old-version-msg" })
191
+ }
192
+ ) }),
193
+ /* @__PURE__ */ jsxs(Box, { sx: styles.mainSection, children: [
194
+ /* @__PURE__ */ jsx(Box, { sx: styles.logoSection, children: /* @__PURE__ */ jsx(
195
+ LogoText,
196
+ {
197
+ appName: "Suite",
198
+ appColor: theme.palette.grey["500"]
199
+ }
200
+ ) }),
201
+ /* @__PURE__ */ jsxs(Box, { sx: styles.mainInfos, children: [
202
+ /* @__PURE__ */ jsx(
203
+ Fade,
204
+ {
205
+ in: loadingGlobalVersion,
206
+ appear: true,
207
+ unmountOnExit: true,
208
+ onExited: (node) => setShowGlobalVersion(true),
209
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
210
+ }
211
+ ),
212
+ showGlobalVersion && /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(
213
+ FormattedMessage,
214
+ {
215
+ id: "about-dialog/version",
216
+ defaultMessage: "Version {version}",
217
+ values: {
218
+ version: /* @__PURE__ */ jsx(
219
+ Typography,
220
+ {
221
+ component: "span",
222
+ sx: styles.versionField(
223
+ !loadingGlobalVersion && actualGlobalVersion
224
+ ),
225
+ children: actualGlobalVersion || "unknown"
226
+ }
227
+ )
228
+ }
229
+ }
230
+ ) })
231
+ ] })
232
+ ] })
233
+ ] }),
234
+ /* @__PURE__ */ jsx(DialogContent, { id: "alert-dialog-description", children: /* @__PURE__ */ jsxs(Box, { sx: styles.detailsSection, children: [
235
+ /* @__PURE__ */ jsxs(
236
+ Accordion,
237
+ {
238
+ disableGutters: true,
239
+ variant: "outlined",
240
+ disabled: true,
241
+ sx: { display: "none" },
242
+ children: [
243
+ /* @__PURE__ */ jsxs(
244
+ AccordionSummary,
245
+ {
246
+ expandIcon: /* @__PURE__ */ jsx(ExpandMore, {}),
247
+ "aria-controls": "panel1-content",
248
+ id: "panel1-header",
249
+ children: [
250
+ /* @__PURE__ */ jsx(Gavel, { fontSize: "small" }),
251
+ /* @__PURE__ */ jsx(Typography, { sx: { width: "33%", flexShrink: 0 }, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/license" }) }),
252
+ /* @__PURE__ */ jsx(Typography, { sx: { color: "text.secondary" }, children: appLicense })
253
+ ]
254
+ }
255
+ ),
256
+ /* @__PURE__ */ jsx(AccordionDetails, { children: "license app summary text" })
257
+ ]
258
+ }
259
+ ),
260
+ /* @__PURE__ */ jsxs(
261
+ Accordion,
262
+ {
263
+ disableGutters: true,
264
+ variant: "outlined",
265
+ TransitionProps: { unmountOnExit: true },
266
+ children: [
267
+ /* @__PURE__ */ jsxs(
268
+ AccordionSummary,
269
+ {
270
+ expandIcon: /* @__PURE__ */ jsx(ExpandMore, {}),
271
+ "aria-controls": "panel2-content",
272
+ id: "panel2-header",
273
+ children: [
274
+ /* @__PURE__ */ jsx(Apps, { fontSize: "small" }),
275
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/modules-section" })
276
+ ]
277
+ }
278
+ ),
279
+ /* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx(Grid, { container: true, sx: { pl: 2 }, spacing: 1, children: loadingAdditionalModules ? /* @__PURE__ */ jsx(
280
+ Grid,
281
+ {
282
+ item: true,
283
+ xs: true,
284
+ display: "inline-flex",
285
+ justifyContent: "center",
286
+ children: /* @__PURE__ */ jsx(CircularProgress, { color: "inherit" })
287
+ }
288
+ ) : Array.isArray(modules) && /* @__PURE__ */ jsx(Fragment, { children: [...modules].sort(compareModules).map((module, idx) => /* @__PURE__ */ jsx(
289
+ Module,
290
+ {
291
+ type: module.type,
292
+ name: module.name,
293
+ version: module.version,
294
+ gitTag: module.gitTag,
295
+ license: module.license
296
+ },
297
+ `module-${idx}`
298
+ )) }) || /* @__PURE__ */ jsx(
299
+ Typography,
300
+ {
301
+ color: (theme2) => theme2.palette.error.main,
302
+ children: "Error"
303
+ }
304
+ ) }) })
305
+ ]
306
+ }
307
+ )
308
+ ] }) }),
309
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: handleClose, autoFocus: true, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "close" }) }) })
310
+ ]
311
+ }
312
+ );
313
+ };
314
+ AboutDialog.propTypes = {
315
+ open: PropTypes.bool.isRequired,
316
+ onClose: PropTypes.func,
317
+ appName: PropTypes.string.isRequired,
318
+ appVersion: PropTypes.string,
319
+ appGitTag: PropTypes.string,
320
+ appLicense: PropTypes.string,
321
+ globalVersionPromise: PropTypes.func,
322
+ additionalModulesPromise: PropTypes.func
323
+ };
324
+ const moduleStyles = {
325
+ icons: {
326
+ flexGrow: 0,
327
+ position: "relative",
328
+ top: "4px",
329
+ flexShrink: 0
330
+ },
331
+ version: {
332
+ flexGrow: 0,
333
+ alignSelf: "flex-end",
334
+ flexShrink: 0
335
+ },
336
+ tooltip: (theme) => ({
337
+ [`& .${tooltipClasses.tooltip}`]: {
338
+ border: "1px solid #dadde9",
339
+ boxShadow: theme.shadows[1]
340
+ }
341
+ }),
342
+ tooltipDetails: {
343
+ display: "grid",
344
+ gridTemplateColumns: "max-content auto",
345
+ margin: 0,
346
+ dt: {
347
+ gridColumnStart: 1,
348
+ "&:after": {
349
+ content: '" :"'
350
+ }
351
+ },
352
+ dd: {
353
+ gridColumnStart: 2,
354
+ paddingLeft: "0.5em"
355
+ }
356
+ }
357
+ };
358
+ const ModuleTypesIcons = {
359
+ app: /* @__PURE__ */ jsx(
360
+ WidgetsOutlined,
361
+ {
362
+ sx: moduleStyles.icons,
363
+ fontSize: "small",
364
+ color: "primary"
365
+ }
366
+ ),
367
+ server: /* @__PURE__ */ jsx(
368
+ DnsOutlined,
369
+ {
370
+ sx: moduleStyles.icons,
371
+ fontSize: "small",
372
+ color: "secondary"
373
+ }
374
+ ),
375
+ other: /* @__PURE__ */ jsx(QuestionMark, { sx: moduleStyles.icons, fontSize: "small" })
376
+ };
377
+ function insensitiveCaseCompare(str, obj) {
378
+ return str.localeCompare(obj, void 0, {
379
+ sensitivity: "base"
380
+ });
381
+ }
382
+ function tooltipTypeLabel(type) {
383
+ if (insensitiveCaseCompare("app", type) === 0) {
384
+ return "about-dialog/module-tooltip-app";
385
+ } else if (insensitiveCaseCompare("server", type) === 0) {
386
+ return "about-dialog/module-tooltip-server";
387
+ } else {
388
+ return "about-dialog/module-tooltip-other";
389
+ }
390
+ }
391
+ const Module = ({ type, name, version, gitTag, license }) => {
392
+ return /* @__PURE__ */ jsx(
393
+ Grid,
394
+ {
395
+ item: true,
396
+ xs: 12,
397
+ sm: 6,
398
+ md: 4,
399
+ sx: {
400
+ ".MuiTypography-root": {
401
+ minWidth: "3em"
402
+ }
403
+ },
404
+ children: /* @__PURE__ */ jsx(
405
+ Tooltip,
406
+ {
407
+ TransitionComponent: Zoom,
408
+ enterDelay: 2500,
409
+ enterNextDelay: 350,
410
+ leaveDelay: 200,
411
+ placement: "bottom-start",
412
+ arrow: true,
413
+ sx: moduleStyles.tooltip,
414
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [
415
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", children: name || "<?>" }),
416
+ /* @__PURE__ */ jsxs(Box, { component: "dl", sx: moduleStyles.tooltipDetails, children: [
417
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dt", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/label-type" }) }),
418
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dd", children: /* @__PURE__ */ jsx(FormattedMessage, { id: tooltipTypeLabel(type) }) }),
419
+ version && /* @__PURE__ */ jsxs(Fragment, { children: [
420
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dt", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/label-version" }) }),
421
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dd", children: version })
422
+ ] }),
423
+ gitTag && /* @__PURE__ */ jsxs(Fragment, { children: [
424
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dt", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "about-dialog/label-git-version" }) }),
425
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "dd", children: gitTag })
426
+ ] })
427
+ ] })
428
+ ] }),
429
+ children: /* @__PURE__ */ jsxs(
430
+ Stack,
431
+ {
432
+ direction: "row",
433
+ justifyContent: "flex-start",
434
+ alignItems: "baseline",
435
+ spacing: 1,
436
+ children: [
437
+ ModuleTypesIcons[type] || ModuleTypesIcons["other"],
438
+ /* @__PURE__ */ jsx(Typography, { display: "inline", noWrap: true, children: name || "<?>" }),
439
+ /* @__PURE__ */ jsx(
440
+ Typography,
441
+ {
442
+ variant: "caption",
443
+ color: (theme) => theme.palette.text.secondary,
444
+ display: "inline",
445
+ noWrap: true,
446
+ sx: moduleStyles.version,
447
+ children: gitTag || version || null
448
+ }
449
+ )
450
+ ]
451
+ }
452
+ )
453
+ }
454
+ )
455
+ }
456
+ );
457
+ };
458
+ Module.propTypes = {
459
+ type: PropTypes.string,
460
+ name: PropTypes.string,
461
+ version: PropTypes.string,
462
+ gitTag: PropTypes.string,
463
+ license: PropTypes.string
464
+ };
465
+ export {
466
+ AboutDialog as default
467
+ };
@@ -0,0 +1,34 @@
1
+ export default GridLogo;
2
+ export function LogoText({ appName, appColor, style, onClick }: {
3
+ appName: any;
4
+ appColor: any;
5
+ style: any;
6
+ onClick: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ export namespace LogoText {
9
+ namespace propTypes {
10
+ const appName: PropTypes.Validator<string>;
11
+ const appColor: PropTypes.Validator<string>;
12
+ const style: PropTypes.Requireable<object>;
13
+ const onClick: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }
15
+ }
16
+ declare function GridLogo({ appLogo, appName, appColor, onClick }: {
17
+ appLogo: any;
18
+ appName: any;
19
+ appColor: any;
20
+ onClick: any;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ declare namespace GridLogo {
23
+ export namespace propTypes_1 {
24
+ export const appLogo: PropTypes.Requireable<PropTypes.ReactElementLike>;
25
+ const appName_1: PropTypes.Validator<string>;
26
+ export { appName_1 as appName };
27
+ const appColor_1: PropTypes.Validator<string>;
28
+ export { appColor_1 as appColor };
29
+ const onClick_1: PropTypes.Requireable<(...args: any[]) => any>;
30
+ export { onClick_1 as onClick };
31
+ }
32
+ export { propTypes_1 as propTypes };
33
+ }
34
+ import PropTypes from 'prop-types';
@@ -0,0 +1,71 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Box, Typography } from "@mui/material";
4
+ import { BrokenImage } from "@mui/icons-material";
5
+ import { mergeSx } from "../../utils/styles.js";
6
+ import PropTypes from "prop-types";
7
+ const styles = {
8
+ logo: {
9
+ flexShrink: 0,
10
+ width: 48,
11
+ height: 48,
12
+ marginBottom: "8px"
13
+ },
14
+ title: {
15
+ marginLeft: "18px"
16
+ },
17
+ clickable: {
18
+ cursor: "pointer"
19
+ }
20
+ };
21
+ const GridLogo = ({ appLogo, appName, appColor, onClick }) => {
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ /* @__PURE__ */ jsx(
24
+ Box,
25
+ {
26
+ sx: mergeSx(styles.logo, onClick && styles.clickable),
27
+ onClick,
28
+ children: appLogo || /* @__PURE__ */ jsx(BrokenImage, {})
29
+ }
30
+ ),
31
+ /* @__PURE__ */ jsx(
32
+ LogoText,
33
+ {
34
+ appName,
35
+ appColor,
36
+ onClick,
37
+ style: styles.title
38
+ }
39
+ )
40
+ ] });
41
+ };
42
+ GridLogo.propTypes = {
43
+ appLogo: PropTypes.element,
44
+ appName: PropTypes.string.isRequired,
45
+ appColor: PropTypes.string.isRequired,
46
+ onClick: PropTypes.func
47
+ };
48
+ const LogoText = ({ appName, appColor, style, onClick }) => {
49
+ return /* @__PURE__ */ jsxs(
50
+ Typography,
51
+ {
52
+ variant: "h4",
53
+ sx: mergeSx(style, onClick && styles.clickable),
54
+ onClick,
55
+ children: [
56
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: "bold" }, children: "Grid" }),
57
+ /* @__PURE__ */ jsx("span", { style: { color: appColor }, children: appName })
58
+ ]
59
+ }
60
+ );
61
+ };
62
+ LogoText.propTypes = {
63
+ appName: PropTypes.string.isRequired,
64
+ appColor: PropTypes.string.isRequired,
65
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
66
+ onClick: PropTypes.func
67
+ };
68
+ export {
69
+ LogoText,
70
+ GridLogo as default
71
+ };
@@ -0,0 +1,53 @@
1
+ export const DARK_THEME: "Dark";
2
+ export const LIGHT_THEME: "Light";
3
+ export const LANG_SYSTEM: "sys";
4
+ export const LANG_ENGLISH: "en";
5
+ export const LANG_FRENCH: "fr";
6
+ export default TopBar;
7
+ declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, onParametersClick, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, }: {
8
+ appName: any;
9
+ appColor: any;
10
+ appLogo: any;
11
+ appVersion: any;
12
+ appLicense: any;
13
+ onParametersClick: any;
14
+ onLogoutClick: any;
15
+ onLogoClick: any;
16
+ user: any;
17
+ children: any;
18
+ appsAndUrls: any;
19
+ onAboutClick: any;
20
+ globalVersionPromise: any;
21
+ additionalModulesPromise: any;
22
+ onThemeClick: any;
23
+ theme: any;
24
+ onEquipmentLabellingClick: any;
25
+ equipmentLabelling: any;
26
+ onLanguageClick: any;
27
+ language: any;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ declare namespace TopBar {
30
+ namespace propTypes {
31
+ const onParametersClick: PropTypes.Requireable<(...args: any[]) => any>;
32
+ const onLogoutClick: PropTypes.Requireable<(...args: any[]) => any>;
33
+ const onLogoClick: PropTypes.Requireable<(...args: any[]) => any>;
34
+ const appName: PropTypes.Requireable<string>;
35
+ const appColor: PropTypes.Requireable<string>;
36
+ const appLogo: PropTypes.Requireable<object>;
37
+ const appVersion: PropTypes.Requireable<string>;
38
+ const appLicense: PropTypes.Requireable<string>;
39
+ const user: PropTypes.Requireable<object>;
40
+ const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
41
+ const appsAndUrls: PropTypes.Requireable<any[]>;
42
+ const onThemeClick: PropTypes.Requireable<(...args: any[]) => any>;
43
+ const theme: PropTypes.Requireable<string>;
44
+ const onAboutClick: PropTypes.Requireable<(...args: any[]) => any>;
45
+ const globalVersionPromise: PropTypes.Requireable<(...args: any[]) => any>;
46
+ const additionalModulesPromise: PropTypes.Requireable<(...args: any[]) => any>;
47
+ const onEquipmentLabellingClick: PropTypes.Requireable<(...args: any[]) => any>;
48
+ const equipmentLabelling: PropTypes.Requireable<boolean>;
49
+ const onLanguageClick: PropTypes.Validator<(...args: any[]) => any>;
50
+ const language: PropTypes.Validator<string>;
51
+ }
52
+ }
53
+ import PropTypes from 'prop-types';