@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
@@ -1,456 +0,0 @@
1
- /**
2
- * Copyright (c) 2023, 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
-
8
- import React, { useCallback, useEffect, useState } from 'react';
9
- import { Accordion, AccordionDetails, AccordionSummary, Alert, Box, Button, CircularProgress, Collapse, Dialog, DialogActions, DialogContent, DialogTitle, Fade, Grid, Stack, Tooltip, tooltipClasses, Typography, useMediaQuery, useTheme, Zoom } from '@mui/material';
10
- import { LoadingButton } from '@mui/lab';
11
- import { Apps, DnsOutlined, ExpandMore, Gavel, QuestionMark, Refresh, WidgetsOutlined } from '@mui/icons-material';
12
- import { FormattedMessage } from 'react-intl';
13
- import PropTypes from 'prop-types';
14
- import { LogoText } from './GridLogo';
15
- var styles = {
16
- general: {
17
- '.MuiAccordion-root': {
18
- //dunno why the theme has the background as black in dark mode
19
- bgcolor: 'unset'
20
- }
21
- },
22
- mainSection: {
23
- height: '5em'
24
- },
25
- logoSection: {
26
- display: 'flex',
27
- alignItems: 'center',
28
- justifyContent: 'center'
29
- },
30
- mainInfos: {
31
- textAlign: 'center',
32
- marginTop: 0
33
- },
34
- versionField: function versionField(isUnknown) {
35
- return isUnknown ? {
36
- fontSize: '1.5em',
37
- fontWeight: 'bold'
38
- } : {
39
- fontStyle: 'italic'
40
- };
41
- },
42
- detailsSection: {
43
- '.MuiAccordionSummary-content > .MuiSvgIcon-root': {
44
- marginRight: '0.5rem'
45
- }
46
- }
47
- };
48
- function getGlobalVersion(fnPromise, type, setData, setLoader) {
49
- if (fnPromise) {
50
- console.debug('Getting', type, 'global version...');
51
- return new Promise(function (resolve, reject) {
52
- if (setLoader) {
53
- setLoader(true);
54
- }
55
- resolve();
56
- }).then(function () {
57
- return fnPromise();
58
- }).then(function (value) {
59
- console.debug(type, 'global version is', value);
60
- setData(value !== null && value !== void 0 ? value : null);
61
- }, function (reason) {
62
- console.debug(type, "global version isn't available", reason);
63
- setData(null);
64
- })["finally"](function () {
65
- if (setLoader) {
66
- setLoader(false);
67
- }
68
- });
69
- } else {
70
- console.debug('No getter for global version');
71
- setData(null);
72
- }
73
- }
74
- var moduleTypeSort = {
75
- app: 1,
76
- server: 10,
77
- other: 20
78
- };
79
- function compareModules(c1, c2) {
80
- //sort by type then by name
81
- return [moduleTypeSort[c1.type] || 100] - [moduleTypeSort[c2.type] || 100] || (c1.name || '').localeCompare(c2.name || '');
82
- }
83
- var AboutDialog = function AboutDialog(_ref) {
84
- var open = _ref.open,
85
- onClose = _ref.onClose,
86
- globalVersionPromise = _ref.globalVersionPromise,
87
- appName = _ref.appName,
88
- appVersion = _ref.appVersion,
89
- appGitTag = _ref.appGitTag,
90
- appLicense = _ref.appLicense,
91
- additionalModulesPromise = _ref.additionalModulesPromise;
92
- var theme = useTheme();
93
- var _useState = useState(false),
94
- isRefreshing = _useState[0],
95
- setRefreshState = _useState[1];
96
- var _useState2 = useState(false),
97
- loadingGlobalVersion = _useState2[0],
98
- setLoadingGlobalVersion = _useState2[1];
99
- var _useState3 = useState(false),
100
- showGlobalVersion = _useState3[0],
101
- setShowGlobalVersion = _useState3[1];
102
-
103
- /* We want to get the initial version once at first render to detect later a new deploy */
104
- var _useState4 = useState(undefined),
105
- initialGlobalVersion = _useState4[0],
106
- setInitialGlobalVersion = _useState4[1];
107
- useEffect(function () {
108
- if (initialGlobalVersion === undefined) {
109
- getGlobalVersion(globalVersionPromise, 'Initial', setInitialGlobalVersion, undefined);
110
- }
111
- }, [globalVersionPromise, initialGlobalVersion]);
112
- var _useState5 = useState(null),
113
- actualGlobalVersion = _useState5[0],
114
- setActualGlobalVersion = _useState5[1];
115
- useEffect(function () {
116
- if (open) {
117
- getGlobalVersion(globalVersionPromise, 'Actual', setActualGlobalVersion, function (loading) {
118
- setLoadingGlobalVersion(loading);
119
- setShowGlobalVersion(false);
120
- });
121
- }
122
- }, [open, globalVersionPromise]);
123
- var _useState6 = useState(false),
124
- loadingAdditionalModules = _useState6[0],
125
- setLoadingAdditionalModules = _useState6[1];
126
- var _useState7 = useState(null),
127
- modules = _useState7[0],
128
- setModules = _useState7[1];
129
- useEffect(function () {
130
- if (open) {
131
- var currentApp = {
132
- name: "Grid" + appName,
133
- type: 'app',
134
- version: appVersion,
135
- gitTag: appGitTag,
136
- license: appLicense
137
- };
138
- (additionalModulesPromise ? Promise.resolve(setLoadingAdditionalModules(true)).then(function () {
139
- return additionalModulesPromise();
140
- }) : Promise.reject(new Error('no getter'))).then(function (values) {
141
- return Array.isArray(values) ? values : [];
142
- }, function (reason) {
143
- return [];
144
- }).then(function (values) {
145
- setModules([currentApp].concat(values));
146
- })["finally"](function () {
147
- return setLoadingAdditionalModules(false);
148
- });
149
- }
150
- }, [open, additionalModulesPromise, appName, appVersion, appGitTag, appLicense]);
151
- var handleClose = useCallback(function () {
152
- if (onClose) {
153
- onClose();
154
- }
155
- }, [onClose]);
156
- return /*#__PURE__*/React.createElement(Dialog, {
157
- onClose: handleClose,
158
- open: open,
159
- fullWidth: true,
160
- maxWidth: "md",
161
- fullScreen: useMediaQuery(theme.breakpoints.down('md')),
162
- sx: styles.general,
163
- "aria-labelledby": "alert-dialog-title",
164
- "aria-describedby": "alert-dialog-description",
165
- TransitionProps: {
166
- onExited: function onExited(node) {
167
- setModules(null);
168
- setActualGlobalVersion(null);
169
- }
170
- }
171
- }, /*#__PURE__*/React.createElement(DialogTitle, {
172
- id: "alert-dialog-title"
173
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
174
- id: 'about-dialog/title'
175
- }), initialGlobalVersion !== undefined && initialGlobalVersion !== null && actualGlobalVersion !== null && initialGlobalVersion !== actualGlobalVersion && /*#__PURE__*/React.createElement(Collapse, {
176
- "in": open
177
- }, /*#__PURE__*/React.createElement(Alert, {
178
- severity: "warning",
179
- variant: "outlined",
180
- action: /*#__PURE__*/React.createElement(LoadingButton, {
181
- color: "inherit",
182
- size: "small",
183
- startIcon: /*#__PURE__*/React.createElement(Refresh, {
184
- fontSize: "small"
185
- }),
186
- loadingPosition: "start",
187
- loading: isRefreshing,
188
- onClick: function onClick() {
189
- setRefreshState(true);
190
- window.location.reload();
191
- }
192
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
193
- id: "refresh"
194
- })),
195
- sx: {
196
- marginBottom: 2
197
- }
198
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
199
- id: "about-dialog/alert-running-old-version-msg"
200
- }))), /*#__PURE__*/React.createElement(Box, {
201
- sx: styles.mainSection
202
- }, /*#__PURE__*/React.createElement(Box, {
203
- sx: styles.logoSection
204
- }, /*#__PURE__*/React.createElement(LogoText, {
205
- appName: "Suite",
206
- appColor: theme.palette.grey['500']
207
- })), /*#__PURE__*/React.createElement(Box, {
208
- sx: styles.mainInfos
209
- }, /*#__PURE__*/React.createElement(Fade, {
210
- "in": loadingGlobalVersion,
211
- appear: true,
212
- unmountOnExit: true,
213
- onExited: function onExited(node) {
214
- return setShowGlobalVersion(true);
215
- }
216
- }, /*#__PURE__*/React.createElement(CircularProgress, null)), showGlobalVersion && /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement(FormattedMessage, {
217
- id: "about-dialog/version",
218
- defaultMessage: "Version {version}",
219
- values: {
220
- version: /*#__PURE__*/React.createElement(Typography, {
221
- component: "span",
222
- sx: styles.versionField(!loadingGlobalVersion && actualGlobalVersion)
223
- }, actualGlobalVersion || 'unknown')
224
- }
225
- }))))), /*#__PURE__*/React.createElement(DialogContent, {
226
- id: "alert-dialog-description"
227
- }, /*#__PURE__*/React.createElement(Box, {
228
- sx: styles.detailsSection
229
- }, /*#__PURE__*/React.createElement(Accordion, {
230
- disableGutters: true,
231
- variant: "outlined",
232
- disabled: true,
233
- sx: {
234
- display: 'none'
235
- }
236
- }, /*#__PURE__*/React.createElement(AccordionSummary, {
237
- expandIcon: /*#__PURE__*/React.createElement(ExpandMore, null),
238
- "aria-controls": "panel1-content",
239
- id: "panel1-header"
240
- }, /*#__PURE__*/React.createElement(Gavel, {
241
- fontSize: "small"
242
- }), /*#__PURE__*/React.createElement(Typography, {
243
- sx: {
244
- width: '33%',
245
- flexShrink: 0
246
- }
247
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
248
- id: "about-dialog/license"
249
- })), /*#__PURE__*/React.createElement(Typography, {
250
- sx: {
251
- color: 'text.secondary'
252
- }
253
- }, appLicense)), /*#__PURE__*/React.createElement(AccordionDetails, null, "license app summary text")), /*#__PURE__*/React.createElement(Accordion, {
254
- disableGutters: true,
255
- variant: "outlined",
256
- TransitionProps: {
257
- unmountOnExit: true
258
- }
259
- }, /*#__PURE__*/React.createElement(AccordionSummary, {
260
- expandIcon: /*#__PURE__*/React.createElement(ExpandMore, null),
261
- "aria-controls": "panel2-content",
262
- id: "panel2-header"
263
- }, /*#__PURE__*/React.createElement(Apps, {
264
- fontSize: "small"
265
- }), /*#__PURE__*/React.createElement(FormattedMessage, {
266
- id: "about-dialog/modules-section"
267
- })), /*#__PURE__*/React.createElement(AccordionDetails, null, /*#__PURE__*/React.createElement(Grid, {
268
- container: true,
269
- sx: {
270
- pl: 2
271
- },
272
- spacing: 1
273
- }, loadingAdditionalModules ? /*#__PURE__*/React.createElement(Grid, {
274
- item: true,
275
- xs: true,
276
- display: "inline-flex",
277
- justifyContent: "center"
278
- }, /*#__PURE__*/React.createElement(CircularProgress, {
279
- color: "inherit"
280
- })) : Array.isArray(modules) && /*#__PURE__*/React.createElement(React.Fragment, null, [].concat(modules).sort(compareModules).map(function (module, idx) {
281
- return /*#__PURE__*/React.createElement(Module, {
282
- key: "module-" + idx,
283
- type: module.type,
284
- name: module.name,
285
- version: module.version,
286
- gitTag: module.gitTag,
287
- license: module.license
288
- });
289
- })) || /*#__PURE__*/React.createElement(Typography, {
290
- color: function color(theme) {
291
- return theme.palette.error.main;
292
- }
293
- }, "Error")))))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
294
- onClick: handleClose,
295
- autoFocus: true
296
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
297
- id: "close"
298
- }))));
299
- };
300
- export default AboutDialog;
301
- AboutDialog.propTypes = process.env.NODE_ENV !== "production" ? {
302
- open: PropTypes.bool.isRequired,
303
- onClose: PropTypes.func,
304
- appName: PropTypes.string.isRequired,
305
- appVersion: PropTypes.string,
306
- appGitTag: PropTypes.string,
307
- appLicense: PropTypes.string,
308
- globalVersionPromise: PropTypes.func,
309
- additionalModulesPromise: PropTypes.func
310
- } : {};
311
- var moduleStyles = {
312
- icons: {
313
- flexGrow: 0,
314
- position: 'relative',
315
- top: '4px',
316
- flexShrink: 0
317
- },
318
- version: {
319
- flexGrow: 0,
320
- alignSelf: 'flex-end',
321
- flexShrink: 0
322
- },
323
- tooltip: function tooltip(theme) {
324
- var _ref2;
325
- return _ref2 = {}, _ref2["& ." + tooltipClasses.tooltip] = {
326
- border: '1px solid #dadde9',
327
- boxShadow: theme.shadows[1]
328
- }, _ref2;
329
- },
330
- tooltipDetails: {
331
- display: 'grid',
332
- gridTemplateColumns: 'max-content auto',
333
- margin: 0,
334
- dt: {
335
- gridColumnStart: 1,
336
- '&:after': {
337
- content: '" :"'
338
- }
339
- },
340
- dd: {
341
- gridColumnStart: 2,
342
- paddingLeft: '0.5em'
343
- }
344
- }
345
- };
346
- var ModuleTypesIcons = {
347
- app: /*#__PURE__*/React.createElement(WidgetsOutlined, {
348
- sx: moduleStyles.icons,
349
- fontSize: "small",
350
- color: "primary"
351
- }),
352
- server: /*#__PURE__*/React.createElement(DnsOutlined, {
353
- sx: moduleStyles.icons,
354
- fontSize: "small",
355
- color: "secondary"
356
- }),
357
- other: /*#__PURE__*/React.createElement(QuestionMark, {
358
- sx: moduleStyles.icons,
359
- fontSize: "small"
360
- })
361
- };
362
- function insensitiveCaseCompare(str, obj) {
363
- return str.localeCompare(obj, undefined, {
364
- sensitivity: 'base'
365
- });
366
- }
367
- function tooltipTypeLabel(type) {
368
- if (insensitiveCaseCompare('app', type) === 0) {
369
- return 'about-dialog/module-tooltip-app';
370
- } else if (insensitiveCaseCompare('server', type) === 0) {
371
- return 'about-dialog/module-tooltip-server';
372
- } else {
373
- return 'about-dialog/module-tooltip-other';
374
- }
375
- }
376
- var Module = function Module(_ref3) {
377
- var type = _ref3.type,
378
- name = _ref3.name,
379
- version = _ref3.version,
380
- gitTag = _ref3.gitTag,
381
- license = _ref3.license;
382
- return /*#__PURE__*/React.createElement(Grid, {
383
- item: true,
384
- xs: 12,
385
- sm: 6,
386
- md: 4,
387
- sx: {
388
- '.MuiTypography-root': {
389
- minWidth: '3em'
390
- }
391
- }
392
- }, /*#__PURE__*/React.createElement(Tooltip, {
393
- TransitionComponent: Zoom,
394
- enterDelay: 2500,
395
- enterNextDelay: 350,
396
- leaveDelay: 200,
397
- placement: "bottom-start",
398
- arrow: true,
399
- sx: moduleStyles.tooltip,
400
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
401
- variant: "body1"
402
- }, name || '<?>'), /*#__PURE__*/React.createElement(Box, {
403
- component: "dl",
404
- sx: moduleStyles.tooltipDetails
405
- }, /*#__PURE__*/React.createElement(Typography, {
406
- variant: "body2",
407
- component: "dt"
408
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
409
- id: "about-dialog/label-type"
410
- })), /*#__PURE__*/React.createElement(Typography, {
411
- variant: "body2",
412
- component: "dd"
413
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
414
- id: tooltipTypeLabel(type)
415
- })), version && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
416
- variant: "body2",
417
- component: "dt"
418
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
419
- id: "about-dialog/label-version"
420
- })), /*#__PURE__*/React.createElement(Typography, {
421
- variant: "body2",
422
- component: "dd"
423
- }, version)), gitTag && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
424
- variant: "body2",
425
- component: "dt"
426
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
427
- id: "about-dialog/label-git-version"
428
- })), /*#__PURE__*/React.createElement(Typography, {
429
- variant: "body2",
430
- component: "dd"
431
- }, gitTag))))
432
- }, /*#__PURE__*/React.createElement(Stack, {
433
- direction: "row",
434
- justifyContent: "flex-start",
435
- alignItems: "baseline",
436
- spacing: 1
437
- }, ModuleTypesIcons[type] || ModuleTypesIcons['other'], /*#__PURE__*/React.createElement(Typography, {
438
- display: "inline",
439
- noWrap: true
440
- }, name || '<?>'), /*#__PURE__*/React.createElement(Typography, {
441
- variant: "caption",
442
- color: function color(theme) {
443
- return theme.palette.text.secondary;
444
- },
445
- display: "inline",
446
- noWrap: true,
447
- sx: moduleStyles.version
448
- }, gitTag || version || null))));
449
- };
450
- Module.propTypes = process.env.NODE_ENV !== "production" ? {
451
- type: PropTypes.string,
452
- name: PropTypes.string,
453
- version: PropTypes.string,
454
- gitTag: PropTypes.string,
455
- license: PropTypes.string
456
- } : {};
@@ -1,73 +0,0 @@
1
- /**
2
- * Copyright (c) 2023, 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
-
8
- import React from 'react';
9
- import { Box, Typography } from '@mui/material';
10
- import { BrokenImage } from '@mui/icons-material';
11
- import { mergeSx } from '../../utils/styles';
12
- import PropTypes from 'prop-types';
13
- var styles = {
14
- logo: {
15
- flexShrink: 0,
16
- width: 48,
17
- height: 48,
18
- marginBottom: '8px'
19
- },
20
- title: {
21
- marginLeft: '18px'
22
- },
23
- clickable: {
24
- cursor: 'pointer'
25
- }
26
- };
27
- var GridLogo = function GridLogo(_ref) {
28
- var appLogo = _ref.appLogo,
29
- appName = _ref.appName,
30
- appColor = _ref.appColor,
31
- onClick = _ref.onClick;
32
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
33
- sx: mergeSx(styles.logo, onClick && styles.clickable),
34
- onClick: onClick
35
- }, appLogo || /*#__PURE__*/React.createElement(BrokenImage, null)), /*#__PURE__*/React.createElement(LogoText, {
36
- appName: appName,
37
- appColor: appColor,
38
- onClick: onClick,
39
- style: styles.title
40
- }));
41
- };
42
- export default GridLogo;
43
- GridLogo.propTypes = process.env.NODE_ENV !== "production" ? {
44
- appLogo: PropTypes.element,
45
- appName: PropTypes.string.isRequired,
46
- appColor: PropTypes.string.isRequired,
47
- onClick: PropTypes.func
48
- } : {};
49
- export var LogoText = function LogoText(_ref2) {
50
- var appName = _ref2.appName,
51
- appColor = _ref2.appColor,
52
- style = _ref2.style,
53
- onClick = _ref2.onClick;
54
- return /*#__PURE__*/React.createElement(Typography, {
55
- variant: "h4",
56
- sx: mergeSx(style, onClick && styles.clickable),
57
- onClick: onClick
58
- }, /*#__PURE__*/React.createElement("span", {
59
- style: {
60
- fontWeight: 'bold'
61
- }
62
- }, "Grid"), /*#__PURE__*/React.createElement("span", {
63
- style: {
64
- color: appColor
65
- }
66
- }, appName));
67
- };
68
- LogoText.propTypes = process.env.NODE_ENV !== "production" ? {
69
- appName: PropTypes.string.isRequired,
70
- appColor: PropTypes.string.isRequired,
71
- style: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
72
- onClick: PropTypes.func
73
- } : {};