@gridsuite/commons-ui 0.22.1 → 0.23.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.
- package/lib/components/CardErrorBoundary/card-error-boundary.js +171 -0
- package/lib/components/CardErrorBoundary/index.js +12 -0
- package/lib/components/MuiVirtualizedTable/MuiVirtualizedTable.js +2 -1
- package/lib/components/ReportViewer/report-viewer.js +2 -2
- package/lib/components/translations/card-error-boundary-en.js +12 -0
- package/lib/components/translations/card-error-boundary-fr.js +12 -0
- package/lib/index.js +12 -0
- package/lib/utils/AuthService.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var React = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
9
|
+
|
|
10
|
+
var _Card = _interopRequireDefault(require("@mui/material/Card"));
|
|
11
|
+
|
|
12
|
+
var _CardHeader = _interopRequireDefault(require("@mui/material/CardHeader"));
|
|
13
|
+
|
|
14
|
+
var _CardContent = _interopRequireDefault(require("@mui/material/CardContent"));
|
|
15
|
+
|
|
16
|
+
var _CardActions = _interopRequireDefault(require("@mui/material/CardActions"));
|
|
17
|
+
|
|
18
|
+
var _Collapse = _interopRequireDefault(require("@mui/material/Collapse"));
|
|
19
|
+
|
|
20
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
21
|
+
|
|
22
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
23
|
+
|
|
24
|
+
var _Replay = _interopRequireDefault(require("@mui/icons-material/Replay"));
|
|
25
|
+
|
|
26
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
27
|
+
|
|
28
|
+
var _styles = require("@mui/material/styles");
|
|
29
|
+
|
|
30
|
+
var _reactIntl = require("react-intl");
|
|
31
|
+
|
|
32
|
+
var _excluded = ["expand"];
|
|
33
|
+
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
+
|
|
42
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
43
|
+
|
|
44
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
var ExpandMore = (0, _styles.styled)(function (props) {
|
|
49
|
+
var expand = props.expand,
|
|
50
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/React.createElement(_IconButton["default"], other);
|
|
53
|
+
})(function (_ref) {
|
|
54
|
+
var theme = _ref.theme,
|
|
55
|
+
expand = _ref.expand;
|
|
56
|
+
return {
|
|
57
|
+
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)',
|
|
58
|
+
marginLeft: 'auto',
|
|
59
|
+
transition: theme.transitions.create('transform', {
|
|
60
|
+
duration: theme.transitions.duration.shortest
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
var CardErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
66
|
+
_inheritsLoose(CardErrorBoundary, _React$Component);
|
|
67
|
+
|
|
68
|
+
function CardErrorBoundary(props) {
|
|
69
|
+
var _this;
|
|
70
|
+
|
|
71
|
+
_this = _React$Component.call(this, props) || this;
|
|
72
|
+
_this.state = {
|
|
73
|
+
hasError: false,
|
|
74
|
+
expanded: false,
|
|
75
|
+
error: undefined
|
|
76
|
+
};
|
|
77
|
+
_this.handleExpandClick = _this.handleExpandClick.bind(_assertThisInitialized(_this));
|
|
78
|
+
_this.handleReloadClick = _this.handleReloadClick.bind(_assertThisInitialized(_this));
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
CardErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
|
|
83
|
+
// Update state so the next render will show the fallback UI.
|
|
84
|
+
return {
|
|
85
|
+
hasError: true,
|
|
86
|
+
error: error
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var _proto = CardErrorBoundary.prototype;
|
|
91
|
+
|
|
92
|
+
_proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
|
|
93
|
+
// You can also log the error to an error reporting service
|
|
94
|
+
console.error('CardErrorBoundary caught: ', error, errorInfo);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
_proto.handleExpandClick = function handleExpandClick() {
|
|
98
|
+
this.setState(function (state) {
|
|
99
|
+
return {
|
|
100
|
+
expanded: !state.expanded
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
_proto.handleReloadClick = function handleReloadClick() {
|
|
106
|
+
this.setState(function (state) {
|
|
107
|
+
return {
|
|
108
|
+
hasError: false,
|
|
109
|
+
expanded: false,
|
|
110
|
+
error: undefined
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
_proto.render = function render() {
|
|
116
|
+
if (this.state.hasError) {
|
|
117
|
+
var _this$state = this.state,
|
|
118
|
+
error = _this$state.error,
|
|
119
|
+
expanded = _this$state.expanded;
|
|
120
|
+
return /*#__PURE__*/React.createElement(_Box["default"], {
|
|
121
|
+
sx: {
|
|
122
|
+
p: 4
|
|
123
|
+
}
|
|
124
|
+
}, /*#__PURE__*/React.createElement(_Card["default"], {
|
|
125
|
+
sx: {
|
|
126
|
+
mx: 'auto',
|
|
127
|
+
maxWidth: 600
|
|
128
|
+
}
|
|
129
|
+
}, /*#__PURE__*/React.createElement(_CardHeader["default"], {
|
|
130
|
+
title: /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
|
|
131
|
+
id: "card_error_boundary/title",
|
|
132
|
+
defaultMessage: "Sorry, Unexpected error :("
|
|
133
|
+
})
|
|
134
|
+
}), /*#__PURE__*/React.createElement(_CardContent["default"], null, /*#__PURE__*/React.createElement(_Typography["default"], {
|
|
135
|
+
variant: "body2",
|
|
136
|
+
color: "text.secondary"
|
|
137
|
+
}, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
|
|
138
|
+
id: "card_error_boundary/content",
|
|
139
|
+
defaultMessage: "Please reload, or close and reopen this application, or contact support."
|
|
140
|
+
}))), /*#__PURE__*/React.createElement(_CardActions["default"], {
|
|
141
|
+
disableSpacing: true
|
|
142
|
+
}, /*#__PURE__*/React.createElement(_IconButton["default"], {
|
|
143
|
+
onClick: this.handleReloadClick,
|
|
144
|
+
"aria-label": "reload"
|
|
145
|
+
}, /*#__PURE__*/React.createElement(_Replay["default"], null)), /*#__PURE__*/React.createElement(ExpandMore, {
|
|
146
|
+
expand: expanded,
|
|
147
|
+
onClick: this.handleExpandClick,
|
|
148
|
+
"aria-expanded": expanded,
|
|
149
|
+
"aria-label": "show more"
|
|
150
|
+
}, /*#__PURE__*/React.createElement(_ExpandMore["default"], null))), /*#__PURE__*/React.createElement(_Collapse["default"], {
|
|
151
|
+
"in": expanded
|
|
152
|
+
}, /*#__PURE__*/React.createElement(_CardContent["default"], null, /*#__PURE__*/React.createElement(_Typography["default"], {
|
|
153
|
+
variant: "body2",
|
|
154
|
+
color: "text.secondary"
|
|
155
|
+
}, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
|
|
156
|
+
id: "card_error_boundary/expandederrorheader",
|
|
157
|
+
defaultMessage: "Error message (and see more information in the developper console):"
|
|
158
|
+
})), /*#__PURE__*/React.createElement(_Typography["default"], {
|
|
159
|
+
variant: "caption"
|
|
160
|
+
}, error.message)))));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return this.props.children;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return CardErrorBoundary;
|
|
167
|
+
}(React.Component);
|
|
168
|
+
|
|
169
|
+
var _default = CardErrorBoundary;
|
|
170
|
+
exports["default"] = _default;
|
|
171
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _cardErrorBoundary = _interopRequireDefault(require("./card-error-boundary.js"));
|
|
7
|
+
|
|
8
|
+
exports["default"] = _cardErrorBoundary["default"];
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
module.exports = exports.default;
|
|
@@ -241,7 +241,8 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
241
241
|
className: (0, _clsx3["default"])(classes.tableCell, classes.flexContainer, (_clsx2 = {}, _clsx2[classes.noClick] = displayedValue === undefined || onCellClick == null || columns[columnIndex].clickable === undefined || !columns[columnIndex].clickable, _clsx2[classes.tableCellColor] = displayedValue === undefined || onCellClick !== null && columns[columnIndex].clickable !== undefined && columns[columnIndex].clickable, _clsx2)),
|
|
242
242
|
variant: "body",
|
|
243
243
|
style: {
|
|
244
|
-
height: rowHeight
|
|
244
|
+
height: rowHeight,
|
|
245
|
+
whiteSpace: 'pre-line'
|
|
245
246
|
},
|
|
246
247
|
align: columnIndex != null && columns[columnIndex].numeric || false ? 'right' : 'left',
|
|
247
248
|
onClick: function onClick() {
|
|
@@ -121,7 +121,7 @@ function ReportViewer(_ref) {
|
|
|
121
121
|
xs: 12,
|
|
122
122
|
sm: 3,
|
|
123
123
|
style: {
|
|
124
|
-
height: '
|
|
124
|
+
height: '95%',
|
|
125
125
|
borderRight: '1px solid rgba(81, 81, 81, 1)'
|
|
126
126
|
}
|
|
127
127
|
}, /*#__PURE__*/_react["default"].createElement(_TreeView["default"], {
|
|
@@ -142,7 +142,7 @@ function ReportViewer(_ref) {
|
|
|
142
142
|
xs: 12,
|
|
143
143
|
sm: 9,
|
|
144
144
|
style: {
|
|
145
|
-
height: '
|
|
145
|
+
height: '95%'
|
|
146
146
|
}
|
|
147
147
|
}, /*#__PURE__*/_react["default"].createElement(_logTable["default"], {
|
|
148
148
|
logs: logs
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var card_error_boundary_en = {
|
|
6
|
+
'card_error_boundary/title': 'Sorry, unexpected error :(',
|
|
7
|
+
'card_error_boundary/content': 'Please reload, or close and reopen this application, or contact support.',
|
|
8
|
+
'card_error_boundary/expandederrorheader': 'Error message (and see more information in the developper console):'
|
|
9
|
+
};
|
|
10
|
+
var _default = card_error_boundary_en;
|
|
11
|
+
exports["default"] = _default;
|
|
12
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var card_error_boundary_fr = {
|
|
6
|
+
'card_error_boundary/title': 'Désolé, erreur inattendue :(',
|
|
7
|
+
'card_error_boundary/content': 'Veuillez recharger, ou fermer et réouvrir cette application, ou contacter le support.',
|
|
8
|
+
'card_error_boundary/expandederrorheader': "Message d'erreur (et voir plus d'informations dans la console developpeur):"
|
|
9
|
+
};
|
|
10
|
+
var _default = card_error_boundary_fr;
|
|
11
|
+
exports["default"] = _default;
|
|
12
|
+
module.exports = exports.default;
|
package/lib/index.js
CHANGED
|
@@ -136,10 +136,22 @@ var _equipmentSearchFr = _interopRequireDefault(require("./components/translatio
|
|
|
136
136
|
|
|
137
137
|
exports.equipment_search_fr = _equipmentSearchFr["default"];
|
|
138
138
|
|
|
139
|
+
var _cardErrorBoundaryEn = _interopRequireDefault(require("./components/translations/card-error-boundary-en"));
|
|
140
|
+
|
|
141
|
+
exports.card_error_boundary_en = _cardErrorBoundaryEn["default"];
|
|
142
|
+
|
|
143
|
+
var _cardErrorBoundaryFr = _interopRequireDefault(require("./components/translations/card-error-boundary-fr"));
|
|
144
|
+
|
|
145
|
+
exports.card_error_boundary_fr = _cardErrorBoundaryFr["default"];
|
|
146
|
+
|
|
139
147
|
var _equipmentItem = require("./components/ElementSearchDialog/equipment-item");
|
|
140
148
|
|
|
141
149
|
exports.EquipmentItem = _equipmentItem.EquipmentItem;
|
|
142
150
|
|
|
151
|
+
var _CardErrorBoundary2 = _interopRequireDefault(require("./components/CardErrorBoundary"));
|
|
152
|
+
|
|
153
|
+
exports.CardErrorBoundary = _CardErrorBoundary2["default"];
|
|
154
|
+
|
|
143
155
|
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); }
|
|
144
156
|
|
|
145
157
|
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; }
|
package/lib/utils/AuthService.js
CHANGED
|
@@ -191,8 +191,9 @@ function handleUser(dispatch, userManager) {
|
|
|
191
191
|
|
|
192
192
|
if (idTokenExpiresIn < 0) {
|
|
193
193
|
console.log('Error in silent renew, idtoken expired: ' + idTokenExpiresIn + ' => Logging out.', error); // TODO here allow to continue to use the app but in some kind of frozen state because we can't make API calls anymore
|
|
194
|
+
// remove the user from our app, but don't sso logout on all other apps
|
|
194
195
|
|
|
195
|
-
return
|
|
196
|
+
return dispatch((0, _actions.setLoggedUser)(null));
|
|
196
197
|
} else if (userManager.idpSettings.maxExpiresIn) {
|
|
197
198
|
if (idTokenExpiresIn < userManager.idpSettings.maxExpiresIn) {
|
|
198
199
|
// TODO here attempt last chance login ? snackbar to notify the user ? Popup ?
|