@gridsuite/commons-ui 0.35.0 → 0.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/es/components/AuthenticationRouter/AuthenticationRouter.js +102 -0
- package/es/components/AuthenticationRouter/index.js +7 -0
- package/{lib → es}/components/CardErrorBoundary/card-error-boundary.js +35 -42
- package/es/components/CardErrorBoundary/index.js +7 -0
- package/es/components/ElementSearchDialog/element-search-dialog.js +120 -0
- package/{lib → es}/components/ElementSearchDialog/equipment-item.js +26 -32
- package/es/components/ElementSearchDialog/index.js +8 -0
- package/es/components/ElementSearchDialog/tag-renderer.js +29 -0
- package/{lib → es}/components/FlatParameters/FlatParameters.js +42 -49
- package/es/components/FlatParameters/index.js +8 -0
- package/es/components/Login/Login.js +79 -0
- package/es/components/Login/Logout.js +78 -0
- package/es/components/Login/index.js +7 -0
- package/es/components/MuiVirtualizedTable/ColumnHeader.js +125 -0
- package/{lib → es}/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +18 -25
- package/{lib → es}/components/MuiVirtualizedTable/MuiVirtualizedTable.js +88 -99
- package/es/components/MuiVirtualizedTable/index.js +9 -0
- package/es/components/OverflowableText/index.js +7 -0
- package/{lib → es}/components/OverflowableText/overflowable-text.js +22 -30
- package/es/components/ReportViewer/index.js +7 -0
- package/{lib → es}/components/ReportViewer/log-report-item.js +1 -6
- package/{lib → es}/components/ReportViewer/log-report.js +8 -13
- package/{lib → es}/components/ReportViewer/log-table.js +14 -24
- package/{lib → es}/components/ReportViewer/report-item.js +23 -30
- package/{lib → es}/components/ReportViewer/report-tree-view-context.js +3 -9
- package/{lib → es}/components/ReportViewer/report-viewer.js +32 -40
- package/es/components/ReportViewerDialog/index.js +7 -0
- package/es/components/ReportViewerDialog/report-viewer-dialog.js +67 -0
- package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +19 -0
- package/es/components/SignInCallbackHandler/index.js +7 -0
- package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +19 -0
- package/es/components/SilentRenewCallbackHandler/index.js +7 -0
- package/es/components/SnackbarProvider/SnackbarProvider.js +39 -0
- package/es/components/SnackbarProvider/index.js +7 -0
- package/es/components/TopBar/TopBar.js +565 -0
- package/es/components/TopBar/index.js +7 -0
- package/{lib → es}/components/TreeViewFinder/TreeViewFinder.js +59 -66
- package/es/components/TreeViewFinder/index.js +7 -0
- package/es/components/react-hook-form/autocomplete-input.js +110 -0
- package/es/components/react-hook-form/booleans/boolean-input.js +56 -0
- package/es/components/react-hook-form/booleans/checkbox-input.js +28 -0
- package/es/components/react-hook-form/booleans/switch-input.js +28 -0
- package/es/components/react-hook-form/error-management/error-input.js +50 -0
- package/es/components/react-hook-form/error-management/field-error-alert.js +22 -0
- package/es/components/react-hook-form/error-management/mid-form-error.js +25 -0
- package/es/components/react-hook-form/numbers/float-input.js +40 -0
- package/es/components/react-hook-form/numbers/integer-input.js +35 -0
- package/es/components/react-hook-form/numbers/utils.js +6 -0
- package/es/components/react-hook-form/radio-input.js +55 -0
- package/es/components/react-hook-form/select-input.js +40 -0
- package/es/components/react-hook-form/slider-input.js +48 -0
- package/es/components/react-hook-form/text-input.js +100 -0
- package/es/components/react-hook-form/utils/field-label.js +15 -0
- package/es/components/react-hook-form/utils/functions.js +42 -0
- package/es/components/react-hook-form/utils/submit-button.js +25 -0
- package/es/components/react-hook-form/utils/text-field-with-adornment.js +92 -0
- package/{lib → es}/components/translations/card-error-boundary-en.js +1 -7
- package/{lib → es}/components/translations/card-error-boundary-fr.js +1 -7
- package/{lib → es}/components/translations/element-search-en.js +1 -7
- package/{lib → es}/components/translations/element-search-fr.js +1 -7
- package/{lib → es}/components/translations/equipment-search-en.js +1 -7
- package/{lib → es}/components/translations/equipment-search-fr.js +1 -7
- package/es/components/translations/inputs-en.js +25 -0
- package/es/components/translations/inputs-fr.js +25 -0
- package/{lib → es}/components/translations/login-en.js +1 -7
- package/{lib → es}/components/translations/login-fr.js +1 -7
- package/{lib → es}/components/translations/report-viewer-en.js +1 -7
- package/{lib → es}/components/translations/report-viewer-fr.js +1 -7
- package/{lib → es}/components/translations/table-en.js +1 -7
- package/{lib → es}/components/translations/table-fr.js +1 -7
- package/{lib → es}/components/translations/top-bar-en.js +1 -7
- package/{lib → es}/components/translations/top-bar-fr.js +1 -7
- package/{lib → es}/components/translations/treeview-finder-en.js +1 -7
- package/{lib → es}/components/translations/treeview-finder-fr.js +1 -7
- package/{lib → es}/hooks/useDebounce.js +7 -12
- package/{lib → es}/hooks/useIntlRef.js +7 -10
- package/{lib → es}/hooks/useSnackMessage.js +9 -13
- package/es/index.js +62 -0
- package/{lib → es}/utils/AuthService.js +23 -34
- package/es/utils/ElementType.js +37 -0
- package/{lib → es}/utils/EquipmentType.js +8 -18
- package/{lib → es}/utils/UserManagerMock.js +2 -7
- package/es/utils/actions.js +65 -0
- package/{lib → es}/utils/algos.js +1 -5
- package/{lib → es}/utils/styles.js +4 -11
- package/package.json +10 -4
- package/lib/components/AuthenticationRouter/AuthenticationRouter.js +0 -111
- package/lib/components/AuthenticationRouter/index.js +0 -8
- package/lib/components/CardErrorBoundary/index.js +0 -8
- package/lib/components/ElementSearchDialog/element-search-dialog.js +0 -127
- package/lib/components/ElementSearchDialog/index.js +0 -9
- package/lib/components/ElementSearchDialog/tag-renderer.js +0 -36
- package/lib/components/FlatParameters/index.js +0 -8
- package/lib/components/Login/Login.js +0 -86
- package/lib/components/Login/Logout.js +0 -85
- package/lib/components/Login/index.js +0 -8
- package/lib/components/MuiVirtualizedTable/ColumnHeader.js +0 -134
- package/lib/components/MuiVirtualizedTable/index.js +0 -12
- package/lib/components/OverflowableText/index.js +0 -8
- package/lib/components/ReportViewer/index.js +0 -8
- package/lib/components/ReportViewerDialog/index.js +0 -8
- package/lib/components/ReportViewerDialog/report-viewer-dialog.js +0 -75
- package/lib/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -27
- package/lib/components/SignInCallbackHandler/index.js +0 -8
- package/lib/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -27
- package/lib/components/SilentRenewCallbackHandler/index.js +0 -8
- package/lib/components/SnackbarProvider/SnackbarProvider.js +0 -45
- package/lib/components/SnackbarProvider/index.js +0 -8
- package/lib/components/TopBar/TopBar.js +0 -576
- package/lib/components/TopBar/index.js +0 -8
- package/lib/components/TreeViewFinder/index.js +0 -9
- package/lib/index.js +0 -105
- package/lib/utils/ElementType.js +0 -45
- package/lib/utils/actions.js +0 -83
- /package/{lib → es}/components/images/powsybl_logo.svg +0 -0
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _reactIntl = require("react-intl");
|
|
7
|
-
var _TableCell = _interopRequireDefault(require("@mui/material/TableCell"));
|
|
8
|
-
var _system = require("@mui/system");
|
|
9
|
-
var _MuiVirtualizedTable = _interopRequireDefault(require("../MuiVirtualizedTable"));
|
|
10
|
-
var _styles = require("@mui/material/styles");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
1
|
/**
|
|
15
2
|
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
16
3
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
17
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
18
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
19
6
|
*/
|
|
20
|
-
|
|
7
|
+
import React, { memo, useEffect, useState } from 'react';
|
|
8
|
+
import { useIntl } from 'react-intl';
|
|
9
|
+
import TableCell from '@mui/material/TableCell';
|
|
10
|
+
import { styled } from '@mui/system';
|
|
11
|
+
import MuiVirtualizedTable from '../MuiVirtualizedTable';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
21
13
|
var SEVERITY_COLUMN_FIXED_WIDTH = 100;
|
|
22
14
|
var styles = {
|
|
23
15
|
flexContainer: {
|
|
@@ -39,17 +31,17 @@ var styles = {
|
|
|
39
31
|
variant: 'header'
|
|
40
32
|
}
|
|
41
33
|
};
|
|
42
|
-
var VirtualizedTable =
|
|
34
|
+
var VirtualizedTable = styled(MuiVirtualizedTable)(styles);
|
|
43
35
|
var LogTable = function LogTable(_ref) {
|
|
44
36
|
var logs = _ref.logs,
|
|
45
37
|
onRowClick = _ref.onRowClick;
|
|
46
|
-
var intl =
|
|
47
|
-
var theme =
|
|
48
|
-
var _useState =
|
|
38
|
+
var intl = useIntl();
|
|
39
|
+
var theme = useTheme();
|
|
40
|
+
var _useState = useState(-1),
|
|
49
41
|
selectedRowIndex = _useState[0],
|
|
50
42
|
setSelectedRowIndex = _useState[1];
|
|
51
43
|
var severityCellRender = function severityCellRender(cellData) {
|
|
52
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/React.createElement(TableCell, {
|
|
53
45
|
component: "div",
|
|
54
46
|
variant: "body",
|
|
55
47
|
style: {
|
|
@@ -105,13 +97,13 @@ var LogTable = function LogTable(_ref) {
|
|
|
105
97
|
};
|
|
106
98
|
}
|
|
107
99
|
};
|
|
108
|
-
|
|
100
|
+
useEffect(function () {
|
|
109
101
|
setSelectedRowIndex(-1);
|
|
110
102
|
}, [logs]);
|
|
111
103
|
return (
|
|
112
104
|
/*#__PURE__*/
|
|
113
105
|
//TODO do we need to useMemo/useCallback these props to avoid rerenders ?
|
|
114
|
-
|
|
106
|
+
React.createElement(VirtualizedTable, {
|
|
115
107
|
columns: generateTableColumns(),
|
|
116
108
|
rows: generateTableRows(),
|
|
117
109
|
sortable: false,
|
|
@@ -120,6 +112,4 @@ var LogTable = function LogTable(_ref) {
|
|
|
120
112
|
})
|
|
121
113
|
);
|
|
122
114
|
};
|
|
123
|
-
|
|
124
|
-
exports["default"] = _default;
|
|
125
|
-
module.exports = exports.default;
|
|
115
|
+
export default memo(LogTable);
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
7
|
-
var _system = require("@mui/system");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _TreeItem = _interopRequireDefault(require("@mui/lab/TreeItem"));
|
|
10
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
11
|
-
var _Label = _interopRequireDefault(require("@mui/icons-material/Label"));
|
|
12
|
-
var _reportTreeViewContext = _interopRequireDefault(require("./report-tree-view-context"));
|
|
13
1
|
var _excluded = ["labelText", "labelIconColor", "className"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
4
|
/**
|
|
15
5
|
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
16
6
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
17
7
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
18
8
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
19
9
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
|
|
11
|
+
import React, { useContext } from 'react';
|
|
12
|
+
import Box from '@mui/material/Box';
|
|
13
|
+
import { styled } from '@mui/system';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import TreeItem from '@mui/lab/TreeItem';
|
|
16
|
+
import Typography from '@mui/material/Typography';
|
|
17
|
+
import Label from '@mui/icons-material/Label';
|
|
18
|
+
import ReportTreeViewContext from './report-tree-view-context';
|
|
19
|
+
import { alpha } from '@mui/system';
|
|
25
20
|
var styles = {
|
|
26
21
|
root: function root(theme) {
|
|
27
22
|
return {
|
|
@@ -49,7 +44,7 @@ var styles = {
|
|
|
49
44
|
// same as mui v4 behavior on label text only right after clicking in contrast to after moving away with arrow keys.
|
|
50
45
|
'&.Mui-selected .MuiTreeItem-label:hover, &.Mui-selected.Mui-focused .MuiTreeItem-label': {
|
|
51
46
|
borderRadius: theme.spacing(2),
|
|
52
|
-
backgroundColor:
|
|
47
|
+
backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity)
|
|
53
48
|
},
|
|
54
49
|
'&.Mui-focused .MuiTreeItem-label, &:hover .MuiTreeItem-label, &Mui-selected .MuiTreeItem-label': {
|
|
55
50
|
backgroundColor: 'transparent'
|
|
@@ -99,14 +94,14 @@ var styles = {
|
|
|
99
94
|
};
|
|
100
95
|
var ReportItem = function ReportItem(props) {
|
|
101
96
|
// using a context because TreeItem uses useMemo on this. See report-viewer.js for the provider
|
|
102
|
-
var _useContext =
|
|
97
|
+
var _useContext = useContext(ReportTreeViewContext),
|
|
103
98
|
isHighlighted = _useContext.isHighlighted;
|
|
104
99
|
var highlighted = isHighlighted ? isHighlighted(props.nodeId) : false;
|
|
105
100
|
var labelText = props.labelText,
|
|
106
101
|
labelIconColor = props.labelIconColor,
|
|
107
102
|
className = props.className,
|
|
108
103
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
109
|
-
return /*#__PURE__*/
|
|
104
|
+
return /*#__PURE__*/React.createElement(TreeItem, _extends({
|
|
110
105
|
className: className,
|
|
111
106
|
sx: {
|
|
112
107
|
'&': styles.root,
|
|
@@ -116,23 +111,21 @@ var ReportItem = function ReportItem(props) {
|
|
|
116
111
|
'& .MuiTreeItem-group': styles.group,
|
|
117
112
|
'& .MuiTreeItem-label': styles.label
|
|
118
113
|
},
|
|
119
|
-
label: /*#__PURE__*/
|
|
114
|
+
label: /*#__PURE__*/React.createElement(Box, {
|
|
120
115
|
sx: highlighted ? styles.labelRootHighlighted : styles.labelRoot
|
|
121
|
-
}, /*#__PURE__*/
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
122
117
|
htmlColor: labelIconColor,
|
|
123
118
|
sx: styles.labelIcon
|
|
124
|
-
}), /*#__PURE__*/
|
|
119
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
125
120
|
variant: "body2",
|
|
126
121
|
sx: styles.labelText
|
|
127
122
|
}, labelText))
|
|
128
123
|
}, other));
|
|
129
124
|
};
|
|
130
125
|
ReportItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
131
|
-
bgColor:
|
|
132
|
-
color:
|
|
133
|
-
labelInfo:
|
|
134
|
-
labelText:
|
|
126
|
+
bgColor: PropTypes.string,
|
|
127
|
+
color: PropTypes.string,
|
|
128
|
+
labelInfo: PropTypes.string,
|
|
129
|
+
labelText: PropTypes.string.isRequired
|
|
135
130
|
} : {};
|
|
136
|
-
|
|
137
|
-
exports["default"] = _default;
|
|
138
|
-
module.exports = exports.default;
|
|
131
|
+
export default styled(ReportItem)({});
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
1
|
/**
|
|
7
2
|
* Copyright (c) 2022, RTE (http://www.rte-france.com)
|
|
8
3
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -10,10 +5,9 @@ var _react = require("react");
|
|
|
10
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
11
6
|
*/
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
import { createContext } from 'react';
|
|
9
|
+
var ReportTreeViewContext = createContext({});
|
|
14
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
11
|
ReportTreeViewContext.displayName = 'ReportTreeViewContext';
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
exports["default"] = _default;
|
|
19
|
-
module.exports = exports.default;
|
|
13
|
+
export default ReportTreeViewContext;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = ReportViewer;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _TreeView = _interopRequireDefault(require("@mui/lab/TreeView"));
|
|
7
|
-
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
8
|
-
var _ArrowRight = _interopRequireDefault(require("@mui/icons-material/ArrowRight"));
|
|
9
|
-
var _reportItem = _interopRequireDefault(require("./report-item"));
|
|
10
|
-
var _logReport = _interopRequireDefault(require("./log-report"));
|
|
11
|
-
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
12
|
-
var _logTable = _interopRequireDefault(require("./log-table"));
|
|
13
|
-
var _reportTreeViewContext = _interopRequireDefault(require("./report-tree-view-context"));
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
1
|
/**
|
|
18
2
|
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
19
3
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -21,6 +5,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
22
6
|
*/
|
|
23
7
|
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
+
import TreeView from '@mui/lab/TreeView';
|
|
10
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
11
|
+
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
|
12
|
+
import ReportItem from './report-item';
|
|
13
|
+
import LogReport from './log-report';
|
|
14
|
+
import Grid from '@mui/material/Grid';
|
|
15
|
+
import LogTable from './log-table';
|
|
16
|
+
import ReportTreeViewContext from './report-tree-view-context';
|
|
24
17
|
var MAX_SUB_REPORTS = 500;
|
|
25
18
|
var styles = {
|
|
26
19
|
treeView: {
|
|
@@ -31,31 +24,31 @@ var styles = {
|
|
|
31
24
|
whiteSpace: 'nowrap'
|
|
32
25
|
}
|
|
33
26
|
};
|
|
34
|
-
function ReportViewer(_ref) {
|
|
27
|
+
export default function ReportViewer(_ref) {
|
|
35
28
|
var jsonReport = _ref.jsonReport,
|
|
36
29
|
_ref$maxSubReports = _ref.maxSubReports,
|
|
37
30
|
maxSubReports = _ref$maxSubReports === void 0 ? MAX_SUB_REPORTS : _ref$maxSubReports;
|
|
38
|
-
var _useState =
|
|
31
|
+
var _useState = useState(null),
|
|
39
32
|
selectedNode = _useState[0],
|
|
40
33
|
setSelectedNode = _useState[1];
|
|
41
|
-
var _useState2 =
|
|
34
|
+
var _useState2 = useState([]),
|
|
42
35
|
expandedNodes = _useState2[0],
|
|
43
36
|
setExpandedNodes = _useState2[1];
|
|
44
|
-
var _useState3 =
|
|
37
|
+
var _useState3 = useState(null),
|
|
45
38
|
logs = _useState3[0],
|
|
46
39
|
setLogs = _useState3[1];
|
|
47
|
-
var _useState4 =
|
|
40
|
+
var _useState4 = useState(),
|
|
48
41
|
highlightedReportId = _useState4[0],
|
|
49
42
|
setHighlightedReportId = _useState4[1];
|
|
50
|
-
var rootReport =
|
|
51
|
-
var allReports =
|
|
52
|
-
var treeView =
|
|
53
|
-
var createReporterItem =
|
|
43
|
+
var rootReport = useRef(null);
|
|
44
|
+
var allReports = useRef({});
|
|
45
|
+
var treeView = useRef(null);
|
|
46
|
+
var createReporterItem = useCallback(function (logReport) {
|
|
54
47
|
allReports.current[logReport.getId()] = logReport;
|
|
55
48
|
if (logReport.getSubReports().length > maxSubReports) {
|
|
56
49
|
console.warn('The number (%s) being greater than %s only the first %s subreports will be displayed', logReport.getSubReports().length, maxSubReports, maxSubReports);
|
|
57
50
|
}
|
|
58
|
-
return /*#__PURE__*/
|
|
51
|
+
return /*#__PURE__*/React.createElement(ReportItem, {
|
|
59
52
|
labelText: logReport.getTitle(),
|
|
60
53
|
labelIconColor: logReport.getHighestSeverity().colorName,
|
|
61
54
|
key: logReport.getId().toString(),
|
|
@@ -65,8 +58,8 @@ function ReportViewer(_ref) {
|
|
|
65
58
|
return createReporterItem(value);
|
|
66
59
|
}));
|
|
67
60
|
}, [maxSubReports]);
|
|
68
|
-
|
|
69
|
-
rootReport.current = new
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
rootReport.current = new LogReport(jsonReport);
|
|
70
63
|
var rootId = rootReport.current.getId().toString();
|
|
71
64
|
treeView.current = createReporterItem(rootReport.current);
|
|
72
65
|
setSelectedNode(rootId);
|
|
@@ -92,7 +85,7 @@ function ReportViewer(_ref) {
|
|
|
92
85
|
};
|
|
93
86
|
|
|
94
87
|
// The MUI TreeView/TreeItems use useMemo on our items, so it's important to avoid changing the context
|
|
95
|
-
var isHighlighted =
|
|
88
|
+
var isHighlighted = useMemo(function () {
|
|
96
89
|
return {
|
|
97
90
|
isHighlighted: function isHighlighted(reportId) {
|
|
98
91
|
return highlightedReportId === reportId;
|
|
@@ -119,12 +112,12 @@ function ReportViewer(_ref) {
|
|
|
119
112
|
});
|
|
120
113
|
setHighlightedReportId(data.reportId);
|
|
121
114
|
};
|
|
122
|
-
return rootReport.current && /*#__PURE__*/
|
|
115
|
+
return rootReport.current && /*#__PURE__*/React.createElement(Grid, {
|
|
123
116
|
container: true,
|
|
124
117
|
style: {
|
|
125
118
|
height: '100%'
|
|
126
119
|
}
|
|
127
|
-
}, /*#__PURE__*/
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
128
121
|
item: true,
|
|
129
122
|
xs: 12,
|
|
130
123
|
sm: 3,
|
|
@@ -132,13 +125,13 @@ function ReportViewer(_ref) {
|
|
|
132
125
|
height: '95%',
|
|
133
126
|
borderRight: '1px solid rgba(81, 81, 81, 1)'
|
|
134
127
|
}
|
|
135
|
-
}, /*#__PURE__*/
|
|
128
|
+
}, /*#__PURE__*/React.createElement(ReportTreeViewContext.Provider, {
|
|
136
129
|
value: isHighlighted
|
|
137
|
-
}, /*#__PURE__*/
|
|
130
|
+
}, /*#__PURE__*/React.createElement(TreeView, {
|
|
138
131
|
sx: styles.treeView,
|
|
139
|
-
defaultCollapseIcon: /*#__PURE__*/
|
|
140
|
-
defaultExpandIcon: /*#__PURE__*/
|
|
141
|
-
defaultEndIcon: /*#__PURE__*/
|
|
132
|
+
defaultCollapseIcon: /*#__PURE__*/React.createElement(ArrowDropDownIcon, null),
|
|
133
|
+
defaultExpandIcon: /*#__PURE__*/React.createElement(ArrowRightIcon, null),
|
|
134
|
+
defaultEndIcon: /*#__PURE__*/React.createElement("div", {
|
|
142
135
|
style: {
|
|
143
136
|
width: 24
|
|
144
137
|
}
|
|
@@ -147,16 +140,15 @@ function ReportViewer(_ref) {
|
|
|
147
140
|
onNodeSelect: handleSelectNode,
|
|
148
141
|
selected: selectedNode,
|
|
149
142
|
expanded: expandedNodes
|
|
150
|
-
}, treeView.current))), /*#__PURE__*/
|
|
143
|
+
}, treeView.current))), /*#__PURE__*/React.createElement(Grid, {
|
|
151
144
|
item: true,
|
|
152
145
|
xs: 12,
|
|
153
146
|
sm: 9,
|
|
154
147
|
style: {
|
|
155
148
|
height: '95%'
|
|
156
149
|
}
|
|
157
|
-
}, /*#__PURE__*/
|
|
150
|
+
}, /*#__PURE__*/React.createElement(LogTable, {
|
|
158
151
|
logs: logs,
|
|
159
152
|
onRowClick: onRowClick
|
|
160
153
|
})));
|
|
161
|
-
}
|
|
162
|
-
module.exports = exports.default;
|
|
154
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from './report-viewer-dialog';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021, 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, { useState } from 'react';
|
|
9
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
10
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
11
|
+
import Button from '@mui/material/Button';
|
|
12
|
+
import FullscreenIcon from '@mui/icons-material/Fullscreen';
|
|
13
|
+
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
|
|
14
|
+
import { FormattedMessage } from 'react-intl';
|
|
15
|
+
import { Dialog, DialogContent } from '@mui/material';
|
|
16
|
+
import ReportViewer from '../ReportViewer';
|
|
17
|
+
var styles = {
|
|
18
|
+
fullScreenIcon: {
|
|
19
|
+
cursor: 'pointer'
|
|
20
|
+
},
|
|
21
|
+
paperFullWidth: {
|
|
22
|
+
height: '100%'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export default function ReportViewerDialog(props) {
|
|
26
|
+
var title = props.title,
|
|
27
|
+
open = props.open,
|
|
28
|
+
onClose = props.onClose,
|
|
29
|
+
jsonReport = props.jsonReport;
|
|
30
|
+
var _useState = useState(false),
|
|
31
|
+
fullScreen = _useState[0],
|
|
32
|
+
setFullScreen = _useState[1];
|
|
33
|
+
var showFullScreen = function showFullScreen() {
|
|
34
|
+
setFullScreen(true);
|
|
35
|
+
};
|
|
36
|
+
var hideFullScreen = function hideFullScreen() {
|
|
37
|
+
setFullScreen(false);
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
40
|
+
open: open,
|
|
41
|
+
onClose: onClose,
|
|
42
|
+
fullScreen: fullScreen,
|
|
43
|
+
"aria-labelledby": "dialog-title-report",
|
|
44
|
+
fullWidth: true,
|
|
45
|
+
maxWidth: "lg",
|
|
46
|
+
sx: {
|
|
47
|
+
'& .MuiDialog-paperFullWidth': styles.paperFullWidth
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/React.createElement(DialogTitle, null, title), /*#__PURE__*/React.createElement(DialogContent, {
|
|
50
|
+
dividers: true
|
|
51
|
+
}, /*#__PURE__*/React.createElement(ReportViewer, {
|
|
52
|
+
jsonReport: jsonReport
|
|
53
|
+
})), /*#__PURE__*/React.createElement(DialogActions, null, fullScreen ? /*#__PURE__*/React.createElement(FullscreenExitIcon, {
|
|
54
|
+
onClick: hideFullScreen,
|
|
55
|
+
sx: styles.fullScreenIcon
|
|
56
|
+
}) : /*#__PURE__*/React.createElement(FullscreenIcon, {
|
|
57
|
+
onClick: showFullScreen,
|
|
58
|
+
sx: styles.fullScreenIcon
|
|
59
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
60
|
+
onClick: function onClick() {
|
|
61
|
+
return onClose();
|
|
62
|
+
},
|
|
63
|
+
variant: "text"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
65
|
+
id: "report_viewer/close"
|
|
66
|
+
}))));
|
|
67
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, 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, { useEffect } from 'react';
|
|
9
|
+
var SignInCallbackHandler = function SignInCallbackHandler(_ref) {
|
|
10
|
+
var userManager = _ref.userManager,
|
|
11
|
+
handleSignInCallback = _ref.handleSignInCallback;
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (userManager !== null) {
|
|
14
|
+
handleSignInCallback();
|
|
15
|
+
}
|
|
16
|
+
}, [userManager, handleSignInCallback]);
|
|
17
|
+
return /*#__PURE__*/React.createElement("h1", null, " ");
|
|
18
|
+
};
|
|
19
|
+
export default SignInCallbackHandler;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from './SignInCallbackHandler';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, 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, { useEffect } from 'react';
|
|
9
|
+
var SilentRenewCallbackHandler = function SilentRenewCallbackHandler(_ref) {
|
|
10
|
+
var userManager = _ref.userManager,
|
|
11
|
+
handleSilentRenewCallback = _ref.handleSilentRenewCallback;
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (userManager !== null) {
|
|
14
|
+
handleSilentRenewCallback();
|
|
15
|
+
}
|
|
16
|
+
}, [userManager, handleSilentRenewCallback]);
|
|
17
|
+
return /*#__PURE__*/React.createElement("h1", null, "Technical token renew window, you should not see this");
|
|
18
|
+
};
|
|
19
|
+
export default SilentRenewCallbackHandler;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from './SilentRenewCallbackHandler';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
4
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { useRef } from 'react';
|
|
10
|
+
import Button from '@mui/material/Button';
|
|
11
|
+
import { SnackbarProvider as OrigSnackbarProvider } from 'notistack';
|
|
12
|
+
|
|
13
|
+
/* A wrapper around notistack's SnackbarProvider that provides defaults props */
|
|
14
|
+
var SnackbarProvider = React.forwardRef(function (props, ref) {
|
|
15
|
+
// create our own ref and use it if the parent
|
|
16
|
+
// did not create a ref for us.
|
|
17
|
+
var innerRef = useRef();
|
|
18
|
+
var notistackRef = ref || innerRef;
|
|
19
|
+
return /*#__PURE__*/React.createElement(OrigSnackbarProvider, _extends({
|
|
20
|
+
ref: notistackRef,
|
|
21
|
+
anchorOrigin: {
|
|
22
|
+
horizontal: 'center',
|
|
23
|
+
vertical: 'bottom'
|
|
24
|
+
},
|
|
25
|
+
hideIconVariant: true,
|
|
26
|
+
action: function action(key) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
onClick: function onClick() {
|
|
29
|
+
return notistackRef.current.closeSnackbar(key);
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
color: '#fff',
|
|
33
|
+
fontSize: '20px'
|
|
34
|
+
}
|
|
35
|
+
}, "\u2716");
|
|
36
|
+
}
|
|
37
|
+
}, props));
|
|
38
|
+
});
|
|
39
|
+
export default SnackbarProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from './SnackbarProvider';
|