@riil-frontend/component-topology 2.15.22 → 2.15.23
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/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +23 -23
- package/es/core/components/AlarmListPanel/index.js +17 -35
- package/es/core/components/TopoView/topoView.js +2 -0
- package/es/core/components/titlebar/TitleBar.js +3 -3
- package/es/core/models/Alarm.js +30 -51
- package/es/core/models/AttributeMetricDisplay.js +22 -13
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +1 -1
- package/es/core/viewer/components/plugins/BaseInfo/index.js +58 -79
- package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +31 -29
- package/es/style.js +1 -0
- package/es/topoCenter/components/TopoView.js +7 -6
- package/lib/core/components/AlarmListPanel/index.js +19 -36
- package/lib/core/components/TopoView/topoView.js +2 -0
- package/lib/core/components/titlebar/TitleBar.js +2 -2
- package/lib/core/models/Alarm.js +30 -51
- package/lib/core/models/AttributeMetricDisplay.js +22 -13
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +1 -1
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +58 -79
- package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +33 -28
- package/lib/style.js +1 -0
- package/lib/topoCenter/components/TopoView.js +5 -4
- package/package.json +4 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _Dialog from "@alifd/next/es/dialog";
|
|
2
1
|
import _List from "@alifd/next/es/list";
|
|
3
2
|
import React, { useState, useEffect } from "react";
|
|
4
3
|
import AlarmListItem from "./components/AlarmListItem";
|
|
@@ -6,23 +5,22 @@ import { Link } from "react-router-dom";
|
|
|
6
5
|
import NoDataPage from "@riil-frontend/component-no-data-page";
|
|
7
6
|
import styles from "./index.module.scss";
|
|
8
7
|
import { alarmListDemo } from "./mocks";
|
|
8
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
9
9
|
|
|
10
10
|
function AlarmListPanel(props, ref) {
|
|
11
11
|
// 传入参数
|
|
12
12
|
var topo = props.topo,
|
|
13
13
|
target = props.toolBarRef,
|
|
14
|
+
titleBarRef = props.titleBarRef,
|
|
14
15
|
visible = props.visible;
|
|
15
|
-
var alarm = topo.alarm;
|
|
16
16
|
|
|
17
17
|
var _useState = useState([]),
|
|
18
18
|
alarmList = _useState[0],
|
|
19
19
|
setAlarmList = _useState[1];
|
|
20
20
|
|
|
21
|
-
var _topo$store$useModel = topo.store.useModel(
|
|
21
|
+
var _topo$store$useModel = topo.store.useModel("topoAlarm"),
|
|
22
22
|
alarmState = _topo$store$useModel[0],
|
|
23
|
-
alarmDispatchers = _topo$store$useModel[1];
|
|
24
|
-
// const{ alarmPanelIsOpen } = store.getState().topoMod;
|
|
25
|
-
|
|
23
|
+
alarmDispatchers = _topo$store$useModel[1];
|
|
26
24
|
|
|
27
25
|
var alarmData = alarmState.alarmData,
|
|
28
26
|
alarmPanelIsOpen = alarmState.alarmPanelIsOpen,
|
|
@@ -34,42 +32,19 @@ function AlarmListPanel(props, ref) {
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
useEffect(function () {
|
|
37
|
-
// console.log(
|
|
38
|
-
// "AlarmListPanel-useEffect",
|
|
39
|
-
// topo,
|
|
40
|
-
// alarmPanelIsOpen,
|
|
41
|
-
// alarmIsOpened,
|
|
42
|
-
// alarmData,
|
|
43
|
-
// alarmList
|
|
44
|
-
// );
|
|
45
35
|
if (alarmData) {
|
|
46
36
|
var _alarmData$slice;
|
|
47
37
|
|
|
48
|
-
topo.alarm.switchAlarmPopPanel(alarmIsOpened &&
|
|
49
|
-
|
|
38
|
+
rlog.debug("AlarmListPanel-useEffect", alarmIsOpened); // topo.alarm.switchAlarmPopPanel(alarmIsOpened && alarmData?.length > 0);
|
|
39
|
+
|
|
40
|
+
setAlarmList((_alarmData$slice = alarmData === null || alarmData === void 0 ? void 0 : alarmData.slice(0, 10)) !== null && _alarmData$slice !== void 0 ? _alarmData$slice : []);
|
|
50
41
|
} else {
|
|
51
42
|
setAlarmList([]);
|
|
52
43
|
}
|
|
53
44
|
}, [alarmData]);
|
|
54
|
-
return /*#__PURE__*/React.createElement(
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
46
|
className: styles.AlarmListPanel,
|
|
56
|
-
id: "AlarmListPanel"
|
|
57
|
-
align: false,
|
|
58
|
-
top: 100,
|
|
59
|
-
overlayProps: {
|
|
60
|
-
style: {
|
|
61
|
-
right: 15,
|
|
62
|
-
top: 100
|
|
63
|
-
},
|
|
64
|
-
target: {
|
|
65
|
-
target: target
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
onClose: onClose,
|
|
69
|
-
hasMask: false,
|
|
70
|
-
closeMode: "close",
|
|
71
|
-
visible: alarmPanelIsOpen,
|
|
72
|
-
footer: false
|
|
47
|
+
id: "AlarmListPanel"
|
|
73
48
|
}, /*#__PURE__*/React.createElement(_List, {
|
|
74
49
|
header: /*#__PURE__*/React.createElement("div", {
|
|
75
50
|
style: {
|
|
@@ -80,7 +55,14 @@ function AlarmListPanel(props, ref) {
|
|
|
80
55
|
}, "\u5173\u8054\u544A\u8B66\u4FE1\u606F"), /*#__PURE__*/React.createElement(Link, {
|
|
81
56
|
className: styles.listTitleLink,
|
|
82
57
|
to: "/default/alarmCenter/alarmList"
|
|
83
|
-
}, "\u67E5\u770B\u6240\u6709\u544A\u8B66")
|
|
58
|
+
}, "\u67E5\u770B\u6240\u6709\u544A\u8B66"), /*#__PURE__*/React.createElement("a", {
|
|
59
|
+
role: "button",
|
|
60
|
+
"aria-label": "\u5173\u95ED",
|
|
61
|
+
className: "next-dialog-close",
|
|
62
|
+
onClick: onClose
|
|
63
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
64
|
+
className: "next-icon next-icon-close next-medium next-dialog-close-icon"
|
|
65
|
+
}))),
|
|
84
66
|
dataSource: alarmList,
|
|
85
67
|
emptyContent: /*#__PURE__*/React.createElement(NoDataPage, {
|
|
86
68
|
className: styles.emptyContent,
|
|
@@ -64,6 +64,7 @@ var TopoView = function TopoView(props) {
|
|
|
64
64
|
tData = _useState[0],
|
|
65
65
|
setTData = _useState[1];
|
|
66
66
|
|
|
67
|
+
var titleBarRef = useRef();
|
|
67
68
|
var topoEdit = useTopoEdit({
|
|
68
69
|
topo: topo,
|
|
69
70
|
topoId: topoId,
|
|
@@ -264,6 +265,7 @@ var TopoView = function TopoView(props) {
|
|
|
264
265
|
}), isEditMode && /*#__PURE__*/React.createElement(EditorPlugin, {
|
|
265
266
|
topo: topo,
|
|
266
267
|
topoEdit: topoEdit,
|
|
268
|
+
titleBarRef: titleBarRef,
|
|
267
269
|
topoContext: {
|
|
268
270
|
urlParams: urlParams
|
|
269
271
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["topo", "render", "viewerProps"];
|
|
4
|
-
import React, { useState, useEffect, useRef, useCallback } from
|
|
4
|
+
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import TopoViewerTitleBar from "../../viewer/components/titlebar/TopoViewerTitleBar";
|
|
7
7
|
import TopoEditorTitleBar from "../../editor/components/titlebar/TopoEditorTitleBar";
|
|
@@ -14,11 +14,11 @@ function TitleBar(props) {
|
|
|
14
14
|
|
|
15
15
|
var store = topo.store;
|
|
16
16
|
|
|
17
|
-
var _store$useModel = store.useModel(
|
|
17
|
+
var _store$useModel = store.useModel("topoMod"),
|
|
18
18
|
topoState = _store$useModel[0];
|
|
19
19
|
|
|
20
20
|
var viewState = topoState.viewState;
|
|
21
|
-
var isEditMode = viewState ===
|
|
21
|
+
var isEditMode = viewState === "edit";
|
|
22
22
|
|
|
23
23
|
if (render) {
|
|
24
24
|
return render({
|
package/es/core/models/Alarm.js
CHANGED
|
@@ -216,12 +216,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
216
216
|
while (1) {
|
|
217
217
|
switch (_context3.prev = _context3.next) {
|
|
218
218
|
case 0:
|
|
219
|
-
|
|
219
|
+
console.log("switchAlarmPopPanel", flag);
|
|
220
|
+
topoDispatchers = this.topo.store.getModelDispatchers("topoAlarm");
|
|
220
221
|
topoDispatchers.update({
|
|
221
222
|
alarmPanelIsOpen: flag
|
|
222
223
|
});
|
|
223
224
|
|
|
224
|
-
case
|
|
225
|
+
case 3:
|
|
225
226
|
case "end":
|
|
226
227
|
return _context3.stop();
|
|
227
228
|
}
|
|
@@ -360,35 +361,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
360
361
|
* 打开\关闭告警列表弹窗
|
|
361
362
|
*
|
|
362
363
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
370
|
-
while (1) {
|
|
371
|
-
switch (_context6.prev = _context6.next) {
|
|
372
|
-
case 0:
|
|
373
|
-
console.log("switchAlarmPopPanel", flag);
|
|
374
|
-
this.updateState({
|
|
375
|
-
alarmPanelIsOpen: flag
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
case 2:
|
|
379
|
-
case "end":
|
|
380
|
-
return _context6.stop();
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}, _callee6, this);
|
|
384
|
-
}));
|
|
364
|
+
// async switchAlarmPopPanel(flag) {
|
|
365
|
+
// console.log("switchAlarmPopPanel", flag);
|
|
366
|
+
// this.updateState({
|
|
367
|
+
// alarmPanelIsOpen: flag,
|
|
368
|
+
// });
|
|
369
|
+
// }
|
|
385
370
|
|
|
386
|
-
function switchAlarmPopPanel(_x5) {
|
|
387
|
-
return _switchAlarmPopPanel2.apply(this, arguments);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return switchAlarmPopPanel;
|
|
391
|
-
}()
|
|
392
371
|
/**
|
|
393
372
|
* 当资源变化时,需要刷新。
|
|
394
373
|
*/
|
|
@@ -397,22 +376,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
397
376
|
_proto.restart =
|
|
398
377
|
/*#__PURE__*/
|
|
399
378
|
function () {
|
|
400
|
-
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
379
|
+
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
401
380
|
var id;
|
|
402
|
-
return _regeneratorRuntime.wrap(function
|
|
381
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
403
382
|
while (1) {
|
|
404
|
-
switch (
|
|
383
|
+
switch (_context6.prev = _context6.next) {
|
|
405
384
|
case 0:
|
|
406
385
|
id = this.currentTopoId;
|
|
407
|
-
|
|
386
|
+
_context6.next = 3;
|
|
408
387
|
return this.openTopoAlarm(id);
|
|
409
388
|
|
|
410
389
|
case 3:
|
|
411
390
|
case "end":
|
|
412
|
-
return
|
|
391
|
+
return _context6.stop();
|
|
413
392
|
}
|
|
414
393
|
}
|
|
415
|
-
},
|
|
394
|
+
}, _callee6, this);
|
|
416
395
|
}));
|
|
417
396
|
|
|
418
397
|
function restart() {
|
|
@@ -430,12 +409,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
430
409
|
_proto.getAlarmByEE =
|
|
431
410
|
/*#__PURE__*/
|
|
432
411
|
function () {
|
|
433
|
-
var _getAlarmByEE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
412
|
+
var _getAlarmByEE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(alertData) {
|
|
434
413
|
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist;
|
|
435
414
|
|
|
436
|
-
return _regeneratorRuntime.wrap(function
|
|
415
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
437
416
|
while (1) {
|
|
438
|
-
switch (
|
|
417
|
+
switch (_context7.prev = _context7.next) {
|
|
439
418
|
case 0:
|
|
440
419
|
_this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
|
|
441
420
|
resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
|
|
@@ -445,7 +424,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
445
424
|
console.log("getAlarmByEE-接收到推送的原始告警信息", alertData);
|
|
446
425
|
|
|
447
426
|
if (!(isAvailableArray(alertData) && isAvailableArray(resIdsList))) {
|
|
448
|
-
|
|
427
|
+
_context7.next = 25;
|
|
449
428
|
break;
|
|
450
429
|
}
|
|
451
430
|
|
|
@@ -478,19 +457,19 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
478
457
|
}); // rlog.debug("before-combAlarmData", al, bizState);
|
|
479
458
|
|
|
480
459
|
if (!(sendAl.length > 0)) {
|
|
481
|
-
|
|
460
|
+
_context7.next = 25;
|
|
482
461
|
break;
|
|
483
462
|
}
|
|
484
463
|
|
|
485
464
|
rlog.debug("过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl", alarmIsOpened, sendAl);
|
|
486
|
-
|
|
487
|
-
|
|
465
|
+
_context7.prev = 13;
|
|
466
|
+
_context7.next = 16;
|
|
488
467
|
return alarmDispatchers.combAlarmData({
|
|
489
468
|
alarmdata: sendAl
|
|
490
469
|
});
|
|
491
470
|
|
|
492
471
|
case 16:
|
|
493
|
-
_yield$alarmDispatche =
|
|
472
|
+
_yield$alarmDispatche = _context7.sent;
|
|
494
473
|
eqFlag = _yield$alarmDispatche.eqFlag;
|
|
495
474
|
alarmlist = _yield$alarmDispatche.alarmlist;
|
|
496
475
|
|
|
@@ -499,23 +478,23 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
499
478
|
this.hmGetTopoAlarm();
|
|
500
479
|
}
|
|
501
480
|
|
|
502
|
-
|
|
481
|
+
_context7.next = 25;
|
|
503
482
|
break;
|
|
504
483
|
|
|
505
484
|
case 22:
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
rlog.error("告警发送异常",
|
|
485
|
+
_context7.prev = 22;
|
|
486
|
+
_context7.t0 = _context7["catch"](13);
|
|
487
|
+
rlog.error("告警发送异常", _context7.t0);
|
|
509
488
|
|
|
510
489
|
case 25:
|
|
511
490
|
case "end":
|
|
512
|
-
return
|
|
491
|
+
return _context7.stop();
|
|
513
492
|
}
|
|
514
493
|
}
|
|
515
|
-
},
|
|
494
|
+
}, _callee7, this, [[13, 22]]);
|
|
516
495
|
}));
|
|
517
496
|
|
|
518
|
-
function getAlarmByEE(
|
|
497
|
+
function getAlarmByEE(_x5) {
|
|
519
498
|
return _getAlarmByEE.apply(this, arguments);
|
|
520
499
|
}
|
|
521
500
|
|
|
@@ -511,20 +511,29 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
511
511
|
attributeMap = ciData.attributeMap;
|
|
512
512
|
ciRefAttributeMap[id] = [];
|
|
513
513
|
|
|
514
|
-
_this5.topo.ciTyeCache.getCiType(ciType)
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
514
|
+
var ciTypeMeta = _this5.topo.ciTyeCache.getCiType(ciType);
|
|
515
|
+
|
|
516
|
+
if (ciTypeMeta) {
|
|
517
|
+
ciTypeMeta.attributes.filter(function (attributeMeta) {
|
|
518
|
+
return !!attributeMeta.refCi;
|
|
519
|
+
}).forEach(function (attributeMeta) {
|
|
520
|
+
var refId = attributeMap[attributeMeta.code];
|
|
521
|
+
|
|
522
|
+
if (refId && !refIdMap[refId]) {
|
|
523
|
+
refIdMap[refId] = true;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
ciRefAttributeMap[id].push({
|
|
527
|
+
attrCode: attributeMeta.code,
|
|
528
|
+
id: refId
|
|
529
|
+
});
|
|
526
530
|
});
|
|
527
|
-
}
|
|
531
|
+
} else {
|
|
532
|
+
rlog.warn('推送属性指标数据:未查询到ciType', {
|
|
533
|
+
ciData: ciData,
|
|
534
|
+
ciType: ciType
|
|
535
|
+
});
|
|
536
|
+
}
|
|
528
537
|
});
|
|
529
538
|
refIds = Object.keys(refIdMap);
|
|
530
539
|
|
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "2.15.
|
|
23
|
+
var version = typeof "2.15.23" === 'string' ? "2.15.23" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -100,10 +100,6 @@ function BaseInfo(props) {
|
|
|
100
100
|
userId = _useState4[0],
|
|
101
101
|
setUserId = _useState4[1];
|
|
102
102
|
|
|
103
|
-
var _useState5 = useState(null),
|
|
104
|
-
paramData = _useState5[0],
|
|
105
|
-
setParamData = _useState5[1];
|
|
106
|
-
|
|
107
103
|
useEffect(function () {
|
|
108
104
|
var notifier = topo.view.topoClient.notifier;
|
|
109
105
|
notifier.on(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
|
|
@@ -120,111 +116,94 @@ function BaseInfo(props) {
|
|
|
120
116
|
}, []); // 解决切换拓扑图隐藏概览
|
|
121
117
|
|
|
122
118
|
useEffect(function () {
|
|
123
|
-
setVisible(false);
|
|
124
|
-
setParamData(null); // TODO 其他数据重置
|
|
119
|
+
setVisible(false); // TODO 其他数据重置
|
|
125
120
|
}, [topoId]);
|
|
126
121
|
|
|
127
122
|
function getUser() {
|
|
128
123
|
return _getUser.apply(this, arguments);
|
|
129
|
-
} //
|
|
130
|
-
// const data = node.getAttrObject()
|
|
131
|
-
// console.log('单击切换基本信息', data);
|
|
132
|
-
// setVisible(prev => {
|
|
133
|
-
// prev && openOverview(data)
|
|
134
|
-
// return prev
|
|
135
|
-
// })
|
|
136
|
-
// }
|
|
137
|
-
// function openOverview (data) {
|
|
138
|
-
// console.log('双击打开基本信息', data);
|
|
139
|
-
// const {
|
|
140
|
-
// id,
|
|
141
|
-
// name,
|
|
142
|
-
// type,
|
|
143
|
-
// ciType,
|
|
144
|
-
// ciName,
|
|
145
|
-
// operation,
|
|
146
|
-
// } = data
|
|
147
|
-
// // 仅展示资源和链路的概览
|
|
148
|
-
// if (!['node', 'link', 'linkGroup'].includes(type)) return
|
|
149
|
-
// // 应用拓扑中没有链路详情
|
|
150
|
-
// if (topo.options.resourceOverviewDrawer?.getData && type === 'link') return
|
|
151
|
-
// // 没有权限不显示
|
|
152
|
-
// if (!operation) return
|
|
153
|
-
// setActiveData({
|
|
154
|
-
// id,
|
|
155
|
-
// name,
|
|
156
|
-
// type: type === 'linkGroup' ? 'link' : type,
|
|
157
|
-
// ciType,
|
|
158
|
-
// ciName
|
|
159
|
-
// })
|
|
160
|
-
// const { metrics } = topo.ciTyeCache.getCiType(ciType)
|
|
161
|
-
// topoDispatchers.update({
|
|
162
|
-
// id,
|
|
163
|
-
// metricCodes: metrics.slice(0, 6).map(item => item.code), // 需要展示的关键指标 code
|
|
164
|
-
// })
|
|
165
|
-
// setVisible(true)
|
|
166
|
-
// }
|
|
124
|
+
} // select切换
|
|
167
125
|
|
|
168
126
|
|
|
169
127
|
function _getUser() {
|
|
170
|
-
_getUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
171
|
-
|
|
172
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
128
|
+
_getUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
129
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
173
130
|
while (1) {
|
|
174
|
-
switch (
|
|
131
|
+
switch (_context2.prev = _context2.next) {
|
|
175
132
|
case 0:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
133
|
+
setUserId( /*#__PURE__*/function () {
|
|
134
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(prev) {
|
|
135
|
+
var res;
|
|
136
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
137
|
+
while (1) {
|
|
138
|
+
switch (_context.prev = _context.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
console.log('获取用户id', prev); // 如果已经获取过,就不再重新获取
|
|
141
|
+
|
|
142
|
+
if (!prev) {
|
|
143
|
+
_context.next = 3;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return _context.abrupt("return", prev);
|
|
148
|
+
|
|
149
|
+
case 3:
|
|
150
|
+
_context.next = 5;
|
|
151
|
+
return service.getUserId();
|
|
152
|
+
|
|
153
|
+
case 5:
|
|
154
|
+
res = _context.sent;
|
|
155
|
+
return _context.abrupt("return", (res === null || res === void 0 ? void 0 : res.user_id) || '');
|
|
156
|
+
|
|
157
|
+
case 7:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context.stop();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, _callee);
|
|
163
|
+
}));
|
|
164
|
+
|
|
165
|
+
return function (_x) {
|
|
166
|
+
return _ref2.apply(this, arguments);
|
|
167
|
+
};
|
|
168
|
+
}());
|
|
169
|
+
|
|
170
|
+
case 1:
|
|
184
171
|
case "end":
|
|
185
|
-
return
|
|
172
|
+
return _context2.stop();
|
|
186
173
|
}
|
|
187
174
|
}
|
|
188
|
-
},
|
|
175
|
+
}, _callee2);
|
|
189
176
|
}));
|
|
190
177
|
return _getUser.apply(this, arguments);
|
|
191
178
|
}
|
|
192
179
|
|
|
193
180
|
function onChangeActive(activeNode) {
|
|
194
|
-
|
|
195
|
-
activeNode && openOverview(_extends({}, activeNode, {
|
|
181
|
+
activeNode && init(_extends({}, activeNode, {
|
|
196
182
|
type: 'node'
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
183
|
+
}), 'select');
|
|
184
|
+
} // 单击切换
|
|
199
185
|
|
|
200
|
-
useEffect(function () {
|
|
201
|
-
(visible || (paramData === null || paramData === void 0 ? void 0 : paramData.isVisible)) && paramData && init(paramData);
|
|
202
|
-
}, [paramData, visible]);
|
|
203
186
|
|
|
204
187
|
function changeOverview(node) {
|
|
205
188
|
var data = node.getAttrObject();
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
189
|
+
init(data, 'click');
|
|
190
|
+
} // 双击打开
|
|
191
|
+
|
|
209
192
|
|
|
210
193
|
function openOverview(data) {
|
|
211
|
-
|
|
212
|
-
setParamData(_extends({}, data, {
|
|
213
|
-
isVisible: true
|
|
214
|
-
}));
|
|
194
|
+
init(data, 'doubleClick');
|
|
215
195
|
}
|
|
216
196
|
|
|
217
|
-
function init(data) {
|
|
197
|
+
function init(data, targetType) {
|
|
218
198
|
var _topo$options$resourc;
|
|
219
199
|
|
|
220
|
-
console.log('初始化基本信息', data);
|
|
200
|
+
console.log('初始化基本信息', data, targetType);
|
|
221
201
|
var id = data.id,
|
|
222
202
|
name = data.name,
|
|
223
203
|
type = data.type,
|
|
224
204
|
ciType = data.ciType,
|
|
225
205
|
ciName = data.ciName,
|
|
226
|
-
operation = data.operation
|
|
227
|
-
isVisible = data.isVisible; // 仅展示资源和链路的概览
|
|
206
|
+
operation = data.operation; // 仅展示资源和链路的概览
|
|
228
207
|
|
|
229
208
|
if (!['node', 'link', 'linkGroup'].includes(type)) return; // 应用拓扑中没有链路详情
|
|
230
209
|
|
|
@@ -250,9 +229,9 @@ function BaseInfo(props) {
|
|
|
250
229
|
|
|
251
230
|
}); // 显示隐藏
|
|
252
231
|
|
|
253
|
-
|
|
232
|
+
targetType === 'doubleClick' && setVisible(true); // userId
|
|
254
233
|
|
|
255
|
-
|
|
234
|
+
getUser();
|
|
256
235
|
}
|
|
257
236
|
|
|
258
237
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Drawer, {
|
|
@@ -273,7 +252,7 @@ function BaseInfo(props) {
|
|
|
273
252
|
}, /*#__PURE__*/React.createElement(_Tab.Item, {
|
|
274
253
|
title: "\u8D44\u6E90\u6982\u89C8",
|
|
275
254
|
key: "1"
|
|
276
|
-
}, /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
|
|
255
|
+
}, activeData.id && /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
|
|
277
256
|
userId: userId
|
|
278
257
|
}))))));
|
|
279
258
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _Button from "@alifd/next/es/button";
|
|
2
2
|
import _Icon from "@alifd/next/es/icon";
|
|
3
|
-
import
|
|
3
|
+
import _Overlay from "@alifd/next/es/overlay";
|
|
4
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
4
5
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
|
6
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
7
|
+
var Popup = _Overlay.Popup;
|
|
5
8
|
/**
|
|
6
9
|
* 元素拖拽开关
|
|
7
10
|
*
|
|
@@ -10,41 +13,40 @@ import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
|
|
10
13
|
|
|
11
14
|
export default function AlarmListShowButton(props) {
|
|
12
15
|
var topo = props.topo,
|
|
13
|
-
style = props.style
|
|
16
|
+
style = props.style,
|
|
17
|
+
viewerProps = props.viewerProps;
|
|
18
|
+
var AlarmListPanel = viewerProps.AlarmListPanel;
|
|
14
19
|
var store = topo.store;
|
|
15
20
|
|
|
16
21
|
var _store$useModel = store.useModel("topoAlarm"),
|
|
17
22
|
topoState = _store$useModel[0];
|
|
18
23
|
|
|
19
|
-
var alarmPanelIsOpen = topoState.alarmPanelIsOpen;
|
|
20
|
-
|
|
21
|
-
// if (movable) {
|
|
22
|
-
// setVisiable(false);
|
|
23
|
-
// }
|
|
24
|
-
// }, []);
|
|
25
|
-
// 初始化时注册打开设置事件
|
|
26
|
-
// useEffect(() => {
|
|
27
|
-
// const handleRefresh = (e) => {
|
|
28
|
-
// setMovable(false);
|
|
29
|
-
// };
|
|
30
|
-
// notifier && notifier.on(TopoEvent.EVENT_REFRESH, handleRefresh);
|
|
31
|
-
// return () => {
|
|
32
|
-
// notifier && notifier.off(TopoEvent.EVENT_REFRESH, handleRefresh);
|
|
33
|
-
// };
|
|
34
|
-
// }, [notifier]);
|
|
24
|
+
var alarmPanelIsOpen = topoState.alarmPanelIsOpen;
|
|
25
|
+
var alarmBtn = useRef();
|
|
35
26
|
|
|
36
27
|
var showAlarmList = function showAlarmList() {
|
|
37
|
-
|
|
38
|
-
//setVisiable(flag);
|
|
39
|
-
topo.alarm.switchAlarmPopPanel(true); // topo.getGraphView().setMovableFunc((data) => {
|
|
40
|
-
// return flag; // self._graphView.dm().sm().getSelection().size()===1 && !(data instanceof ht.Grid);
|
|
41
|
-
// });
|
|
28
|
+
topo.alarm.switchAlarmPopPanel(true);
|
|
42
29
|
};
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
var onVisibleChange = function onVisibleChange(visible) {
|
|
32
|
+
topo.alarm.switchAlarmPopPanel(visible);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
36
|
+
trigger: /*#__PURE__*/React.createElement(_Button, {
|
|
37
|
+
style: style,
|
|
38
|
+
ref: alarmBtn
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
40
|
+
type: "warning"
|
|
41
|
+
})),
|
|
42
|
+
cache: true,
|
|
43
|
+
defaultVisible: true,
|
|
44
|
+
visible: alarmPanelIsOpen,
|
|
45
|
+
onVisibleChange: onVisibleChange,
|
|
46
|
+
offset: [112, 5],
|
|
47
|
+
triggerType: "click",
|
|
48
|
+
safeNode: function safeNode() {
|
|
49
|
+
return alarmBtn;
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(AlarmListPanel, props));
|
|
50
52
|
}
|
package/es/style.js
CHANGED
|
@@ -23,6 +23,7 @@ import '@alifd/next/es/divider/style';
|
|
|
23
23
|
import '@alifd/next/es/box/style';
|
|
24
24
|
import '@alifd/next/es/dropdown/style';
|
|
25
25
|
import '@alifd/next/es/menu/style';
|
|
26
|
+
import '@alifd/next/es/overlay/style';
|
|
26
27
|
import '@alifd/next/es/radio/style';
|
|
27
28
|
import '@alifd/next/es/checkbox/style';
|
|
28
29
|
import '@alifd/next/es/grid/style';
|