@agilemotion/oui-react-js 1.8.26 → 1.8.27
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/dist/ApplicationManager.js +28 -1
- package/dist/view/Dashboard.js +7 -3
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ class ApplicationManager {
|
|
|
24
24
|
constructor() {
|
|
25
25
|
if (!ApplicationManager.instance) {
|
|
26
26
|
this.views = [];
|
|
27
|
+
this.dashboardViews = [];
|
|
27
28
|
this.props = {};
|
|
28
29
|
this.listeners = [];
|
|
29
30
|
this.libs = {};
|
|
@@ -355,6 +356,26 @@ class ApplicationManager {
|
|
|
355
356
|
applicationContext[key] = values[key];
|
|
356
357
|
});
|
|
357
358
|
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* add view configuration
|
|
362
|
+
*
|
|
363
|
+
* @param view the listener to be added
|
|
364
|
+
* @param path
|
|
365
|
+
* @param forward
|
|
366
|
+
*/
|
|
367
|
+
addDashboardView = (view, path) => {
|
|
368
|
+
this.dashboardViews.push(view);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* clear dashboard view configuration
|
|
373
|
+
*
|
|
374
|
+
*/
|
|
375
|
+
clearDashboardViews = () => {
|
|
376
|
+
this.dashboardViews.splice(0, this.dashboardViews.length);
|
|
377
|
+
};
|
|
378
|
+
|
|
358
379
|
/**
|
|
359
380
|
* add view configuration
|
|
360
381
|
*
|
|
@@ -493,7 +514,7 @@ class ApplicationManager {
|
|
|
493
514
|
return view;
|
|
494
515
|
}
|
|
495
516
|
}
|
|
496
|
-
return
|
|
517
|
+
return this.dashboardViews.find(v => v.config.id === id);
|
|
497
518
|
};
|
|
498
519
|
getViewComponent = (view, id) => {
|
|
499
520
|
if (!_Utils.default.isNull(view) && !_Utils.default.isNull(view.handle) && !_Utils.default.isNull(view.handle.api)) {
|
|
@@ -523,6 +544,12 @@ class ApplicationManager {
|
|
|
523
544
|
return graph;
|
|
524
545
|
}
|
|
525
546
|
}
|
|
547
|
+
for (const view of this.dashboardViews) {
|
|
548
|
+
let component = this.getViewComponent(view, id);
|
|
549
|
+
if (component) {
|
|
550
|
+
return component;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
526
553
|
if (this.views.length === 0) {
|
|
527
554
|
return this.getViewComponent(this.props.dashboardView, id);
|
|
528
555
|
}
|
package/dist/view/Dashboard.js
CHANGED
|
@@ -27,6 +27,7 @@ const location = window.location.protocol + '//' + window.location.hostname;
|
|
|
27
27
|
const text = response => {
|
|
28
28
|
return response.text();
|
|
29
29
|
};
|
|
30
|
+
let keyCounter = 0;
|
|
30
31
|
const alertBarHandle = {};
|
|
31
32
|
const DashboardCard = props => {
|
|
32
33
|
const [path, setPath] = _react.default.useState(null);
|
|
@@ -39,7 +40,6 @@ const DashboardCard = props => {
|
|
|
39
40
|
const [id, setId] = _react.default.useState(props.settings.id);
|
|
40
41
|
const [content, setContent] = _react.default.useState(null);
|
|
41
42
|
const [ref] = _react.default.useState(/*#__PURE__*/_react.default.createRef());
|
|
42
|
-
const keyCounter = (0, _react.useRef)(0);
|
|
43
43
|
_react.default.useEffect(() => {
|
|
44
44
|
const accessToken = sessionStorage.getItem('accessToken');
|
|
45
45
|
const idToken = sessionStorage.getItem('idToken');
|
|
@@ -56,6 +56,7 @@ const DashboardCard = props => {
|
|
|
56
56
|
if (path && displayType) {
|
|
57
57
|
if (displayType === 'VIEW') {
|
|
58
58
|
(0, _RestUtils.sendRequest)(path, data => {
|
|
59
|
+
data.id = data.id + "-" + keyCounter++;
|
|
59
60
|
let dashboardView = {};
|
|
60
61
|
let defaultModel = {};
|
|
61
62
|
dashboardView.config = data;
|
|
@@ -73,9 +74,9 @@ const DashboardCard = props => {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
|
-
_ApplicationManager.default.
|
|
77
|
+
_ApplicationManager.default.addDashboardView(dashboardView, path);
|
|
77
78
|
let element = /*#__PURE__*/_react.default.createElement(_View.View, {
|
|
78
|
-
key: data.id
|
|
79
|
+
key: data.id,
|
|
79
80
|
config: data,
|
|
80
81
|
parameters: [],
|
|
81
82
|
handle: dashboardView.handle
|
|
@@ -464,6 +465,9 @@ const Dashboard = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.f
|
|
|
464
465
|
_ApplicationManager.default.setDashboardView({
|
|
465
466
|
handle: handle
|
|
466
467
|
});
|
|
468
|
+
return () => {
|
|
469
|
+
_ApplicationManager.default.clearDashboardViews();
|
|
470
|
+
};
|
|
467
471
|
}, []);
|
|
468
472
|
const addDashboardCard = item => {
|
|
469
473
|
let path = item.eventHandlingConfig.subscriptions[0].actions[0].path;
|