versacall-core-library-react 2.0.44 → 2.0.46
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.
|
@@ -7,11 +7,21 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _styles = require("@material-ui/core/styles");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
|
|
15
|
+
|
|
16
|
+
var _Badge = _interopRequireDefault(require("@material-ui/core/Badge"));
|
|
17
|
+
|
|
18
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
19
|
+
|
|
20
|
+
var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
|
|
21
|
+
|
|
22
|
+
var _Drawer = _interopRequireDefault(require("@material-ui/core/Drawer"));
|
|
23
|
+
|
|
24
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
15
25
|
|
|
16
26
|
var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
|
|
17
27
|
|
|
@@ -19,31 +29,37 @@ var _ListItemIcon = _interopRequireDefault(require("@material-ui/core/ListItemIc
|
|
|
19
29
|
|
|
20
30
|
var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));
|
|
21
31
|
|
|
32
|
+
var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
|
|
33
|
+
|
|
34
|
+
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
35
|
+
|
|
36
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
37
|
+
|
|
22
38
|
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
23
39
|
|
|
24
|
-
var
|
|
40
|
+
var _AccountCircle = _interopRequireDefault(require("@material-ui/icons/AccountCircle"));
|
|
25
41
|
|
|
26
|
-
var
|
|
42
|
+
var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
|
|
27
43
|
|
|
28
|
-
var
|
|
44
|
+
var _LocationCity = _interopRequireDefault(require("@material-ui/icons/LocationCity"));
|
|
29
45
|
|
|
30
|
-
var
|
|
46
|
+
var _Menu2 = _interopRequireDefault(require("@material-ui/icons/Menu"));
|
|
31
47
|
|
|
32
|
-
var
|
|
48
|
+
var _ExitToApp = _interopRequireDefault(require("@material-ui/icons/ExitToApp"));
|
|
33
49
|
|
|
34
|
-
var
|
|
50
|
+
var _Notifications = _interopRequireDefault(require("@material-ui/icons/Notifications"));
|
|
35
51
|
|
|
36
|
-
var
|
|
52
|
+
var _Error = _interopRequireDefault(require("@material-ui/icons/Error"));
|
|
37
53
|
|
|
38
|
-
var
|
|
54
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
39
55
|
|
|
40
|
-
var
|
|
56
|
+
var _Warning = _interopRequireDefault(require("@material-ui/icons/Warning"));
|
|
41
57
|
|
|
42
|
-
var
|
|
58
|
+
var _StarBorder = _interopRequireDefault(require("@material-ui/icons/StarBorder"));
|
|
43
59
|
|
|
44
|
-
var
|
|
60
|
+
var _Star = _interopRequireDefault(require("@material-ui/icons/Star"));
|
|
45
61
|
|
|
46
|
-
var
|
|
62
|
+
var _reactIntl = require("react-intl");
|
|
47
63
|
|
|
48
64
|
var _context = require("../../context");
|
|
49
65
|
|
|
@@ -83,7 +99,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
83
99
|
|
|
84
100
|
var namespace = 'CoreSideBar';
|
|
85
101
|
|
|
86
|
-
var styles = function styles() {
|
|
102
|
+
var styles = function styles(theme) {
|
|
87
103
|
return {
|
|
88
104
|
root: {
|
|
89
105
|
display: 'flex',
|
|
@@ -127,6 +143,29 @@ var styles = function styles() {
|
|
|
127
143
|
height: 24,
|
|
128
144
|
width: 24,
|
|
129
145
|
filter: 'invert(1)'
|
|
146
|
+
},
|
|
147
|
+
inline: {
|
|
148
|
+
display: 'inline',
|
|
149
|
+
color: '#cccccc'
|
|
150
|
+
},
|
|
151
|
+
notificationRoot: {
|
|
152
|
+
width: 200
|
|
153
|
+
},
|
|
154
|
+
badgeError: {
|
|
155
|
+
backgroundColor: theme.palette.error.light,
|
|
156
|
+
color: theme.palette.error.contrastText
|
|
157
|
+
},
|
|
158
|
+
badgeWarning: {
|
|
159
|
+
backgroundColor: theme.palette.warning.light,
|
|
160
|
+
color: theme.palette.warning.contrastText
|
|
161
|
+
},
|
|
162
|
+
badgeInfo: {
|
|
163
|
+
backgroundColor: theme.palette.info.light,
|
|
164
|
+
color: theme.palette.info.contrastText
|
|
165
|
+
},
|
|
166
|
+
menuIconButton: {// background: '#3f5c67',
|
|
167
|
+
// borderRadius: 10,
|
|
168
|
+
// marginRight: 10,
|
|
130
169
|
}
|
|
131
170
|
};
|
|
132
171
|
};
|
|
@@ -166,6 +205,24 @@ var style = {
|
|
|
166
205
|
pointerEvents: 'none'
|
|
167
206
|
}
|
|
168
207
|
};
|
|
208
|
+
/* const getNotificationsBadgeColor = notifications => {
|
|
209
|
+
return 'warning';
|
|
210
|
+
let hasError = false;
|
|
211
|
+
let hasWarning = false;
|
|
212
|
+
notifications.forEach(notification => {
|
|
213
|
+
if (notification.type === 'error') {
|
|
214
|
+
hasError = true;
|
|
215
|
+
} if (notification.type === 'warning') {
|
|
216
|
+
hasWarning = true;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
if (hasError) {
|
|
220
|
+
return 'error';
|
|
221
|
+
} if (hasWarning) {
|
|
222
|
+
return 'warning';
|
|
223
|
+
}
|
|
224
|
+
return 'primary';
|
|
225
|
+
}; */
|
|
169
226
|
|
|
170
227
|
var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
171
228
|
_inherits(CoreSideBar, _Component);
|
|
@@ -183,10 +240,13 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
183
240
|
organizationAnchorEl: null,
|
|
184
241
|
entityAnchorEl: null,
|
|
185
242
|
authenticationAnchorEl: null,
|
|
243
|
+
notificationsAnchorEl: null,
|
|
186
244
|
apps: [],
|
|
187
245
|
organizations: [],
|
|
188
246
|
entities: [],
|
|
189
|
-
favorites: []
|
|
247
|
+
favorites: [],
|
|
248
|
+
// subscription: null,
|
|
249
|
+
notifications: []
|
|
190
250
|
};
|
|
191
251
|
return _this;
|
|
192
252
|
}
|
|
@@ -194,7 +254,9 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
194
254
|
_createClass(CoreSideBar, [{
|
|
195
255
|
key: "componentDidMount",
|
|
196
256
|
value: function componentDidMount() {
|
|
197
|
-
this.getOrganizations();
|
|
257
|
+
this.getOrganizations(); // this.getSubscription();
|
|
258
|
+
|
|
259
|
+
this.getNotifications();
|
|
198
260
|
}
|
|
199
261
|
}, {
|
|
200
262
|
key: "componentDidUpdate",
|
|
@@ -209,7 +271,9 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
209
271
|
|
|
210
272
|
if (this.props.authentication.didChange(prevProps.authentication) || this.props.organization.didChange(prevProps.organization)) {
|
|
211
273
|
this.getApps();
|
|
212
|
-
this.getFavorites();
|
|
274
|
+
this.getFavorites(); // this.getSubscription();
|
|
275
|
+
|
|
276
|
+
this.getNotifications();
|
|
213
277
|
}
|
|
214
278
|
}
|
|
215
279
|
}, {
|
|
@@ -315,6 +379,53 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
315
379
|
});
|
|
316
380
|
}
|
|
317
381
|
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "getNotifications",
|
|
384
|
+
value: function getNotifications() {
|
|
385
|
+
var _this6 = this;
|
|
386
|
+
|
|
387
|
+
var methodName = 'getNotifications()';
|
|
388
|
+
var _this$props = this.props,
|
|
389
|
+
authentication = _this$props.authentication,
|
|
390
|
+
core = _this$props.core,
|
|
391
|
+
organization = _this$props.organization;
|
|
392
|
+
|
|
393
|
+
if (organization.organization !== null && organization.entity !== null) {
|
|
394
|
+
authentication.http({
|
|
395
|
+
method: 'get',
|
|
396
|
+
url: "".concat(core.baseUrl, "/api/user/activity/notifications"),
|
|
397
|
+
params: {
|
|
398
|
+
organizationId: organization.organization.id,
|
|
399
|
+
entityId: organization.entity.id
|
|
400
|
+
}
|
|
401
|
+
}).then(function (res) {
|
|
402
|
+
_this6.setState({
|
|
403
|
+
notifications: res.data
|
|
404
|
+
});
|
|
405
|
+
}).catch(function (error) {
|
|
406
|
+
core.log('error', namespace, methodName, error);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/* getSubscription() {
|
|
411
|
+
const methodName = 'getSubscription()';
|
|
412
|
+
const { authentication, core, organization } = this.props;
|
|
413
|
+
if (organization.organization !== null && organization.entity !== null) {
|
|
414
|
+
authentication.http({
|
|
415
|
+
method: 'get',
|
|
416
|
+
url: `${core.baseUrl}/api/subscriptions/primary`,
|
|
417
|
+
params: {
|
|
418
|
+
organizationId: organization.organization.id,
|
|
419
|
+
entityId: organization.entity.id,
|
|
420
|
+
},
|
|
421
|
+
}).then(res => {
|
|
422
|
+
this.setState({ subscription: res.data });
|
|
423
|
+
}).catch(error => {
|
|
424
|
+
core.log('error', namespace, methodName, error);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
} */
|
|
428
|
+
|
|
318
429
|
}, {
|
|
319
430
|
key: "getUsersInitials",
|
|
320
431
|
value: function getUsersInitials() {
|
|
@@ -333,10 +444,68 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
333
444
|
|
|
334
445
|
return initials;
|
|
335
446
|
}
|
|
447
|
+
}, {
|
|
448
|
+
key: "getNotificationBadgeClass",
|
|
449
|
+
value: function getNotificationBadgeClass() {
|
|
450
|
+
var notifications = this.state.notifications;
|
|
451
|
+
var classes = this.props.classes;
|
|
452
|
+
var hasError = false;
|
|
453
|
+
var hasWarning = false;
|
|
454
|
+
notifications.forEach(function (notification) {
|
|
455
|
+
if (notification.type === 'error') {
|
|
456
|
+
hasError = true;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (notification.type === 'warning') {
|
|
460
|
+
hasWarning = true;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
if (hasError) {
|
|
465
|
+
return classes.badgeError;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (hasWarning) {
|
|
469
|
+
return classes.badgeWarning;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return classes.badgeInfo;
|
|
473
|
+
}
|
|
474
|
+
}, {
|
|
475
|
+
key: "getNotificationIcon",
|
|
476
|
+
value: function getNotificationIcon(type) {
|
|
477
|
+
var theme = this.props.theme;
|
|
478
|
+
|
|
479
|
+
switch (type.toLowerCase()) {
|
|
480
|
+
case 'error':
|
|
481
|
+
// '#ff6666'
|
|
482
|
+
return /*#__PURE__*/_react.default.createElement(_Error.default, {
|
|
483
|
+
style: {
|
|
484
|
+
color: theme.palette.error.light
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
case 'warning':
|
|
489
|
+
// 'yellow'
|
|
490
|
+
return /*#__PURE__*/_react.default.createElement(_Warning.default, {
|
|
491
|
+
style: {
|
|
492
|
+
color: theme.palette.warning.light
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
default:
|
|
497
|
+
// 'lightblue'
|
|
498
|
+
return /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
499
|
+
style: {
|
|
500
|
+
color: theme.palette.info.light
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
}
|
|
336
505
|
}, {
|
|
337
506
|
key: "favoriteApp",
|
|
338
507
|
value: function favoriteApp() {
|
|
339
|
-
var
|
|
508
|
+
var _this7 = this;
|
|
340
509
|
|
|
341
510
|
var methodName = 'favoriteApp()';
|
|
342
511
|
|
|
@@ -350,16 +519,34 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
350
519
|
favorite: !this.state.favorites.includes(this.props.componentID)
|
|
351
520
|
}
|
|
352
521
|
}).then(function () {
|
|
353
|
-
|
|
522
|
+
_this7.getFavorites();
|
|
354
523
|
}).catch(function (error) {
|
|
355
|
-
|
|
524
|
+
_this7.props.core.log('error', namespace, methodName, error);
|
|
356
525
|
});
|
|
357
526
|
}
|
|
358
527
|
}
|
|
528
|
+
}, {
|
|
529
|
+
key: "dismissNotification",
|
|
530
|
+
value: function dismissNotification(id) {
|
|
531
|
+
var methodName = "dismissNotification(".concat(id, ")");
|
|
532
|
+
var _this$props2 = this.props,
|
|
533
|
+
authentication = _this$props2.authentication,
|
|
534
|
+
core = _this$props2.core;
|
|
535
|
+
authentication.http({
|
|
536
|
+
method: 'delete',
|
|
537
|
+
url: "".concat(core.baseUrl, "/api/user/activity/notifications/").concat(id)
|
|
538
|
+
}).catch(function (error) {
|
|
539
|
+
core.log('error', namespace, methodName, error);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
359
542
|
}, {
|
|
360
543
|
key: "handleMessage",
|
|
361
544
|
value: function handleMessage(channel, obj) {
|
|
362
545
|
switch (obj.what) {
|
|
546
|
+
case 'notifications_changed':
|
|
547
|
+
this.getNotifications();
|
|
548
|
+
break;
|
|
549
|
+
|
|
363
550
|
case 'package_enabled':
|
|
364
551
|
case 'package_disabled':
|
|
365
552
|
case 'package_added':
|
|
@@ -381,20 +568,23 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
381
568
|
}, {
|
|
382
569
|
key: "render",
|
|
383
570
|
value: function render() {
|
|
384
|
-
var
|
|
385
|
-
|
|
386
|
-
var _this$
|
|
387
|
-
title = _this$
|
|
388
|
-
componentID = _this$
|
|
389
|
-
authentication = _this$
|
|
390
|
-
organization = _this$
|
|
391
|
-
classes = _this$
|
|
571
|
+
var _this8 = this;
|
|
572
|
+
|
|
573
|
+
var _this$props3 = this.props,
|
|
574
|
+
title = _this$props3.title,
|
|
575
|
+
componentID = _this$props3.componentID,
|
|
576
|
+
authentication = _this$props3.authentication,
|
|
577
|
+
organization = _this$props3.organization,
|
|
578
|
+
classes = _this$props3.classes;
|
|
579
|
+
var _this$state = this.state,
|
|
580
|
+
notificationsAnchorEl = _this$state.notificationsAnchorEl,
|
|
581
|
+
notifications = _this$state.notifications;
|
|
392
582
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
393
583
|
className: classes.root
|
|
394
584
|
}, /*#__PURE__*/_react.default.createElement(_context.ChannelsConsumer, {
|
|
395
585
|
id: "coreappbar",
|
|
396
586
|
handler: function handler(channel, obj) {
|
|
397
|
-
return
|
|
587
|
+
return _this8.handleMessage(channel, obj);
|
|
398
588
|
}
|
|
399
589
|
}), /*#__PURE__*/_react.default.createElement(_Drawer.default, {
|
|
400
590
|
variant: "permanent",
|
|
@@ -419,18 +609,18 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
419
609
|
},
|
|
420
610
|
color: "inherit",
|
|
421
611
|
onClick: function onClick() {
|
|
422
|
-
return
|
|
612
|
+
return _this8.setState({
|
|
423
613
|
drawer: true
|
|
424
614
|
});
|
|
425
615
|
}
|
|
426
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
616
|
+
}, /*#__PURE__*/_react.default.createElement(_Menu2.default, null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
427
617
|
style: style.orgEntity
|
|
428
618
|
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
429
619
|
color: "inherit",
|
|
430
620
|
style: style.titleButton,
|
|
431
621
|
variant: "text",
|
|
432
622
|
onClick: this.state.entities.length > 1 ? function (e) {
|
|
433
|
-
return
|
|
623
|
+
return _this8.setState({
|
|
434
624
|
entityAnchorEl: e.currentTarget
|
|
435
625
|
});
|
|
436
626
|
} : null
|
|
@@ -445,56 +635,63 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
445
635
|
minHeight: 0,
|
|
446
636
|
overflow: 'auto'
|
|
447
637
|
}
|
|
448
|
-
}, this.props.content), /*#__PURE__*/_react.default.createElement(_Divider.default, null),
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
onClick: function onClick() {
|
|
452
|
-
return _this7.favoriteApp();
|
|
638
|
+
}, this.props.content), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
639
|
+
style: {
|
|
640
|
+
padding: 5
|
|
453
641
|
}
|
|
454
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
642
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
643
|
+
title: "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName)
|
|
644
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
645
|
+
color: "inherit",
|
|
646
|
+
onClick: function onClick(e) {
|
|
647
|
+
return _this8.setState({
|
|
648
|
+
authenticationAnchorEl: e.currentTarget
|
|
649
|
+
});
|
|
650
|
+
},
|
|
651
|
+
className: classes.menuIconButton
|
|
652
|
+
}, /*#__PURE__*/_react.default.createElement(_AccountCircle.default, null))), /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
653
|
+
title: notifications.length > 0 ? "You have ".concat(notifications.length, " notification").concat(notifications.length > 0 ? 's' : '') : 'There are no notifications'
|
|
654
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
655
|
+
color: "inherit",
|
|
656
|
+
onClick: notifications.length > 0 ? function (e) {
|
|
657
|
+
return _this8.setState({
|
|
658
|
+
notificationsAnchorEl: e.currentTarget
|
|
659
|
+
});
|
|
660
|
+
} : null,
|
|
661
|
+
className: classes.menuIconButton
|
|
662
|
+
}, /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
|
663
|
+
badgeContent: notifications.length,
|
|
455
664
|
classes: {
|
|
456
|
-
|
|
665
|
+
badge: this.getNotificationBadgeClass()
|
|
457
666
|
},
|
|
458
|
-
|
|
667
|
+
showZero: false
|
|
668
|
+
}, /*#__PURE__*/_react.default.createElement(_Notifications.default, null)))), componentID.length > 0 && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
669
|
+
title: this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
670
|
+
id: "__favorite"
|
|
671
|
+
}) : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
672
|
+
id: "__click_to_favorite"
|
|
673
|
+
})
|
|
674
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
675
|
+
color: "inherit",
|
|
676
|
+
onClick: function onClick() {
|
|
677
|
+
return _this8.favoriteApp();
|
|
678
|
+
},
|
|
679
|
+
className: classes.menuIconButton
|
|
459
680
|
}, this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_Star.default, {
|
|
460
681
|
color: "inherit"
|
|
461
682
|
}) : /*#__PURE__*/_react.default.createElement(_StarBorder.default, {
|
|
462
683
|
color: "inherit"
|
|
463
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
464
|
-
classes: {
|
|
465
|
-
primary: classes.listItemRoot
|
|
466
|
-
},
|
|
467
|
-
color: "inherit"
|
|
468
|
-
}, this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
469
|
-
id: "__favorite"
|
|
470
|
-
}) : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
471
|
-
id: "__click_to_favorite"
|
|
472
|
-
}))), /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
473
|
-
button: true,
|
|
474
|
-
onClick: function onClick(e) {
|
|
475
|
-
return _this7.setState({
|
|
476
|
-
authenticationAnchorEl: e.currentTarget
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, {
|
|
480
|
-
classes: {
|
|
481
|
-
root: classes.listItemRoot
|
|
482
|
-
}
|
|
483
|
-
}, /*#__PURE__*/_react.default.createElement(_AccountCircle.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
|
|
484
|
-
classes: {
|
|
485
|
-
primary: classes.listItemRoot
|
|
486
|
-
}
|
|
487
|
-
}, "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
684
|
+
}))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
488
685
|
className: classes.content
|
|
489
686
|
}, this.props.children), /*#__PURE__*/_react.default.createElement(_CoreSideBarDrawer.default, {
|
|
490
687
|
open: this.state.drawer,
|
|
491
688
|
onClose: function onClose() {
|
|
492
|
-
return
|
|
689
|
+
return _this8.setState({
|
|
493
690
|
drawer: false
|
|
494
691
|
});
|
|
495
692
|
},
|
|
496
693
|
apps: this.state.apps
|
|
497
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
694
|
+
}), /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
498
695
|
open: !!this.state.organizationAnchorEl,
|
|
499
696
|
anchorEl: this.state.organizationAnchorEl,
|
|
500
697
|
anchorOrigin: {
|
|
@@ -506,7 +703,7 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
506
703
|
horizontal: 'center'
|
|
507
704
|
},
|
|
508
705
|
onClose: function onClose() {
|
|
509
|
-
return
|
|
706
|
+
return _this8.setState({
|
|
510
707
|
organizationAnchorEl: null
|
|
511
708
|
});
|
|
512
709
|
}
|
|
@@ -516,7 +713,7 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
516
713
|
onClick: function onClick() {
|
|
517
714
|
organization.setOrganization(org);
|
|
518
715
|
|
|
519
|
-
|
|
716
|
+
_this8.setState({
|
|
520
717
|
organizationAnchorEl: null
|
|
521
718
|
});
|
|
522
719
|
}
|
|
@@ -524,7 +721,7 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
524
721
|
primary: org.name,
|
|
525
722
|
inset: true
|
|
526
723
|
}));
|
|
527
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
724
|
+
})), /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
528
725
|
classes: {
|
|
529
726
|
paper: classes.menuPaper
|
|
530
727
|
},
|
|
@@ -539,7 +736,7 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
539
736
|
},
|
|
540
737
|
open: !!this.state.entityAnchorEl,
|
|
541
738
|
onClose: function onClose() {
|
|
542
|
-
return
|
|
739
|
+
return _this8.setState({
|
|
543
740
|
entityAnchorEl: null
|
|
544
741
|
});
|
|
545
742
|
}
|
|
@@ -552,7 +749,7 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
552
749
|
onClick: function onClick() {
|
|
553
750
|
organization.setEntity(entity);
|
|
554
751
|
|
|
555
|
-
|
|
752
|
+
_this8.setState({
|
|
556
753
|
entityAnchorEl: null
|
|
557
754
|
});
|
|
558
755
|
}
|
|
@@ -567,14 +764,14 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
567
764
|
primary: entity.name,
|
|
568
765
|
inset: true
|
|
569
766
|
}));
|
|
570
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
767
|
+
})), /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
571
768
|
classes: {
|
|
572
769
|
paper: classes.menuPaper
|
|
573
770
|
},
|
|
574
771
|
open: !!this.state.authenticationAnchorEl,
|
|
575
772
|
anchorEl: this.state.authenticationAnchorEl,
|
|
576
773
|
onClose: function onClose() {
|
|
577
|
-
return
|
|
774
|
+
return _this8.setState({
|
|
578
775
|
authenticationAnchorEl: null
|
|
579
776
|
});
|
|
580
777
|
}
|
|
@@ -616,7 +813,58 @@ var CoreSideBar = /*#__PURE__*/function (_Component) {
|
|
|
616
813
|
}
|
|
617
814
|
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
618
815
|
id: "__log_out"
|
|
619
|
-
})))
|
|
816
|
+
}))), /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
817
|
+
classes: {
|
|
818
|
+
paper: classes.menuPaper,
|
|
819
|
+
root: classes.notificationRoot
|
|
820
|
+
},
|
|
821
|
+
open: !!notificationsAnchorEl,
|
|
822
|
+
anchorEl: notificationsAnchorEl,
|
|
823
|
+
onClose: function onClose() {
|
|
824
|
+
return _this8.setState({
|
|
825
|
+
notificationsAnchorEl: null
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
}, notifications.map(function (notification) {
|
|
829
|
+
return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
830
|
+
key: notification.id,
|
|
831
|
+
classes: {
|
|
832
|
+
root: classes.menuItemRoot
|
|
833
|
+
}
|
|
834
|
+
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, _this8.getNotificationIcon(notification.type)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
|
|
835
|
+
primary: notification.title,
|
|
836
|
+
secondary: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
837
|
+
component: "span",
|
|
838
|
+
variant: "body2",
|
|
839
|
+
className: classes.inline,
|
|
840
|
+
color: "inherit"
|
|
841
|
+
}, notification.description))
|
|
842
|
+
}), notification.url && notification.url.length > 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
843
|
+
style: {
|
|
844
|
+
marginLeft: 5
|
|
845
|
+
},
|
|
846
|
+
"aria-label": "navigate",
|
|
847
|
+
onClick: function onClick() {
|
|
848
|
+
return window.open(notification.url, '__BLANK');
|
|
849
|
+
}
|
|
850
|
+
}, /*#__PURE__*/_react.default.createElement(_ExitToApp.default, {
|
|
851
|
+
style: {
|
|
852
|
+
color: '#ffffff'
|
|
853
|
+
}
|
|
854
|
+
})), notification.isDismissable && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
855
|
+
style: {
|
|
856
|
+
marginLeft: 5
|
|
857
|
+
},
|
|
858
|
+
"aria-label": "delete",
|
|
859
|
+
onClick: function onClick() {
|
|
860
|
+
return _this8.dismissNotification(notification.id);
|
|
861
|
+
}
|
|
862
|
+
}, /*#__PURE__*/_react.default.createElement(_Delete.default, {
|
|
863
|
+
style: {
|
|
864
|
+
color: '#ffffff'
|
|
865
|
+
}
|
|
866
|
+
})));
|
|
867
|
+
})));
|
|
620
868
|
}
|
|
621
869
|
}]);
|
|
622
870
|
|
|
@@ -632,6 +880,7 @@ CoreSideBar.propTypes = {
|
|
|
632
880
|
// intl: PropTypes.shape().isRequired,
|
|
633
881
|
organization: _propTypes.default.shape().isRequired,
|
|
634
882
|
classes: _propTypes.default.shape().isRequired,
|
|
883
|
+
theme: _propTypes.default.shape().isRequired,
|
|
635
884
|
children: _propTypes.default.node,
|
|
636
885
|
content: _propTypes.default.node
|
|
637
886
|
};
|
|
@@ -643,6 +892,6 @@ CoreSideBar.defaultProps = {
|
|
|
643
892
|
content: null
|
|
644
893
|
};
|
|
645
894
|
|
|
646
|
-
var _default = (0, _reactIntl.injectIntl)((0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)((0, _styles.withStyles)(styles)(CoreSideBar)))));
|
|
895
|
+
var _default = (0, _reactIntl.injectIntl)((0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)((0, _styles.withTheme)((0, _styles.withStyles)(styles)(CoreSideBar))))));
|
|
647
896
|
|
|
648
897
|
exports.default = _default;
|
|
@@ -93,6 +93,26 @@ var style = {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
var consolidateTags = function consolidateTags(tagList) {
|
|
97
|
+
var newTagList = [];
|
|
98
|
+
tagList.forEach(function (tagInfo) {
|
|
99
|
+
var existing = newTagList.find(function (x) {
|
|
100
|
+
return x.tag === tagInfo.tag;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (existing) {
|
|
104
|
+
existing.count += tagInfo.count;
|
|
105
|
+
} else {
|
|
106
|
+
newTagList.push({
|
|
107
|
+
tag: tagInfo.tag,
|
|
108
|
+
type: tagInfo.type,
|
|
109
|
+
count: tagInfo.count
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return newTagList;
|
|
114
|
+
};
|
|
115
|
+
|
|
96
116
|
function TagFilterBuilder(props) {
|
|
97
117
|
var _useState = (0, _react.useState)(''),
|
|
98
118
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -269,9 +289,9 @@ function TagFilterBuilder(props) {
|
|
|
269
289
|
var columns = 0;
|
|
270
290
|
if (showModules) columns++;
|
|
271
291
|
if (showMonitoringPoints) columns++; // Add any tags that aren't on the supplied list to the supplied list. This is needed in case we reference tags that have been deleted/etc.
|
|
292
|
+
// const adjustedModuleTags = [...tags.moduleTags];
|
|
272
293
|
|
|
273
|
-
var adjustedModuleTags =
|
|
274
|
-
|
|
294
|
+
var adjustedModuleTags = consolidateTags(tags.moduleTags);
|
|
275
295
|
filter.moduleTagFilters.forEach(function (x) {
|
|
276
296
|
if (!adjustedModuleTags.find(function (tagInfo) {
|
|
277
297
|
return tagInfo.tag === x;
|
|
@@ -281,10 +301,9 @@ function TagFilterBuilder(props) {
|
|
|
281
301
|
count: 0
|
|
282
302
|
});
|
|
283
303
|
}
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
var adjustedLocationTags = _toConsumableArray(tags.locationTags);
|
|
304
|
+
}); // const adjustedLocationTags = [...tags.locationTags];
|
|
287
305
|
|
|
306
|
+
var adjustedLocationTags = consolidateTags(tags.locationTags);
|
|
288
307
|
filter.moduleLocationFilters.forEach(function (x) {
|
|
289
308
|
if (!adjustedLocationTags.find(function (tagInfo) {
|
|
290
309
|
return tagInfo.tag === x;
|
|
@@ -294,10 +313,9 @@ function TagFilterBuilder(props) {
|
|
|
294
313
|
count: 0
|
|
295
314
|
});
|
|
296
315
|
}
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
var adjustedMonitoringPointTags = _toConsumableArray(tags.monitoringPointTags);
|
|
316
|
+
}); // const adjustedMonitoringPointTags = [...tags.monitoringPointTags];
|
|
300
317
|
|
|
318
|
+
var adjustedMonitoringPointTags = consolidateTags(tags.monitoringPointTags);
|
|
301
319
|
filter.monitoringPointTagFilters.forEach(function (x) {
|
|
302
320
|
if (!adjustedMonitoringPointTags.find(function (tagInfo) {
|
|
303
321
|
return tagInfo.tag === x;
|
|
@@ -307,10 +325,9 @@ function TagFilterBuilder(props) {
|
|
|
307
325
|
count: 0
|
|
308
326
|
});
|
|
309
327
|
}
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
var adjustedMonitoringPointTypes = _toConsumableArray(tags.typeTags);
|
|
328
|
+
}); // const adjustedMonitoringPointTypes = [...tags.typeTags];
|
|
313
329
|
|
|
330
|
+
var adjustedMonitoringPointTypes = consolidateTags(tags.typeTags);
|
|
314
331
|
filter.monitoringPointTypeFilters.forEach(function (x) {
|
|
315
332
|
if (!adjustedMonitoringPointTypes.find(function (tagInfo) {
|
|
316
333
|
return tagInfo.tag === x;
|
|
@@ -337,7 +354,11 @@ function TagFilterBuilder(props) {
|
|
|
337
354
|
}) : _toConsumableArray(adjustedMonitoringPointTags);
|
|
338
355
|
var filteredTypeTags = search.length > 0 ? adjustedMonitoringPointTypes.filter(function (x) {
|
|
339
356
|
return x.tag.includes(search);
|
|
340
|
-
}) : _toConsumableArray(adjustedMonitoringPointTypes); //
|
|
357
|
+
}) : _toConsumableArray(adjustedMonitoringPointTypes); // const filteredModuleTags = adjustedModuleTags;
|
|
358
|
+
// const filteredLocationTags = adjustedLocationTags;
|
|
359
|
+
// const filteredMonitoringPointTags = adjustedMonitoringPointTags;
|
|
360
|
+
// const filteredTypeTags = adjustedMonitoringPointTypes;
|
|
361
|
+
// Sort by highest quantities of tags
|
|
341
362
|
|
|
342
363
|
filteredModuleTags.sort(function (a, b) {
|
|
343
364
|
return b.count - a.count;
|
|
@@ -15,6 +15,7 @@ require("./CoreTheme.css");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
+
// https://v4.mui.com/customization/default-theme/?expand-path=$.palette
|
|
18
19
|
var theme = (0, _styles.createTheme)({
|
|
19
20
|
palette: {
|
|
20
21
|
primary: {
|
|
@@ -23,6 +24,13 @@ var theme = (0, _styles.createTheme)({
|
|
|
23
24
|
secondary: {
|
|
24
25
|
main: '#496b78'
|
|
25
26
|
}
|
|
27
|
+
/* warning: {
|
|
28
|
+
light: '#ffb74d',
|
|
29
|
+
main: '#ff9800',
|
|
30
|
+
dark: '#f57c00',
|
|
31
|
+
contrastText: 'rgba(0, 0, 0, 0.87)',
|
|
32
|
+
}, */
|
|
33
|
+
|
|
26
34
|
},
|
|
27
35
|
typography: {
|
|
28
36
|
useNextVariants: true
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"versacall": {
|
|
3
3
|
"title": "Versacall Core Library React",
|
|
4
4
|
"applicationType": "react-library",
|
|
5
|
-
"build":
|
|
5
|
+
"build": 46
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-core-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.46",
|
|
9
9
|
"description": "Versacall Core Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|