@riil-frontend/component-topology 12.0.0-dev.8 → 12.0.1
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 +14 -14
- package/es/components/TemplateButton/index.module.scss +1 -1
- package/es/core/components/AlarmListPanel/components/AlarmListItem.js +59 -4
- package/es/core/components/TopoView/topoView.js +5 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +5 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +27 -10
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +21 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +9 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/Layout/index.js +17 -3
- package/es/core/editor/hooks/useKeyboardShortcut.js +3 -1
- package/es/core/editor/utils/copyElementUtil.js +12 -0
- package/es/core/editor/utils/edgeTypeStyleUtil.js +8 -7
- package/es/core/hooks/useAlarm.js +131 -81
- package/es/core/hooks/useCmpLinkAlarm.js +153 -0
- package/es/core/hooks/useEventData.js +1 -2
- package/es/core/hooks/useGraphAlarmDisplay.js +91 -56
- package/es/core/hooks/useResourceConfig.js +1 -3
- package/es/core/hooks/useTopoEdit.js +51 -54
- package/es/core/models/Alarm.js +68 -142
- package/es/core/models/AttributeMetricDisplay.js +14 -5
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiCache.d.ts +1 -1
- package/es/core/models/cache/CiCache.js +3 -3
- package/es/core/models/cache/CiTypeCache.js +4 -0
- package/es/core/models/topoData.js +0 -1
- package/es/core/services/index.js +1 -1
- package/es/core/services/topo/basic.js +2 -2
- package/es/core/store/models/topoConfig.js +7 -10
- package/es/core/store/models/topoMod.js +81 -134
- package/es/core/utils/edgeUtil.js +8 -0
- package/es/core/utils/metricUtil.js +8 -4
- package/es/core/utils/showGraphManageStatusUtil.js +3 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +59 -22
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +8 -0
- package/es/core/viewer/components/plugins/ViewerPlugin.js +3 -1
- package/es/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
- package/es/networkTopo/components/TopoView.js +6 -11
- package/es/networkTopo/hooks/useEdgeExpand.js +2 -3
- package/es/networkTopo/services/topo/basic.js +3 -3
- package/es/networkTopo/store/topoCenter.js +260 -223
- package/es/style.js +1 -1
- package/es/utils/ResourceConfigUtil.js +3 -36
- package/es/utils/ciRefAttributeTranslateUtil.d.ts +19 -0
- package/es/utils/ciRefAttributeTranslateUtil.js +155 -0
- package/es/utils/topoData.js +4 -2
- package/lib/components/TemplateButton/index.module.scss +1 -1
- package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +61 -4
- package/lib/core/components/TopoView/topoView.js +5 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +6 -12
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +27 -9
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +21 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +16 -2
- package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -0
- package/lib/core/editor/utils/copyElementUtil.js +15 -0
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +8 -6
- package/lib/core/hooks/useAlarm.js +130 -79
- package/lib/core/hooks/useCmpLinkAlarm.js +166 -0
- package/lib/core/hooks/useEventData.js +1 -2
- package/lib/core/hooks/useGraphAlarmDisplay.js +91 -55
- package/lib/core/hooks/useResourceConfig.js +1 -3
- package/lib/core/hooks/useTopoEdit.js +50 -53
- package/lib/core/models/Alarm.js +68 -144
- package/lib/core/models/AttributeMetricDisplay.js +16 -4
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiCache.d.ts +1 -1
- package/lib/core/models/cache/CiCache.js +3 -3
- package/lib/core/models/cache/CiTypeCache.js +4 -0
- package/lib/core/models/topoData.js +0 -1
- package/lib/core/services/index.js +1 -1
- package/lib/core/services/topo/basic.js +2 -2
- package/lib/core/store/models/topoConfig.js +7 -10
- package/lib/core/store/models/topoMod.js +81 -134
- package/lib/core/utils/edgeUtil.js +10 -0
- package/lib/core/utils/metricUtil.js +8 -4
- package/lib/core/utils/showGraphManageStatusUtil.js +3 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +60 -22
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +8 -0
- package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
- package/lib/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
- package/lib/networkTopo/components/TopoView.js +5 -14
- package/lib/networkTopo/hooks/useEdgeExpand.js +2 -3
- package/lib/networkTopo/services/topo/basic.js +3 -3
- package/lib/networkTopo/store/topoCenter.js +262 -225
- package/lib/style.js +1 -1
- package/lib/utils/ResourceConfigUtil.js +3 -38
- package/lib/utils/ciRefAttributeTranslateUtil.d.ts +19 -0
- package/lib/utils/ciRefAttributeTranslateUtil.js +168 -0
- package/lib/utils/topoData.js +4 -2
- package/package.json +3 -3
@@ -383,33 +383,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
383
383
|
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(node) {
|
384
384
|
var _node$getEdges$toArra, _node$getEdges;
|
385
385
|
|
386
|
-
var
|
386
|
+
var edges;
|
387
387
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
388
388
|
while (1) switch (_context4.prev = _context4.next) {
|
389
389
|
case 0:
|
390
|
-
|
390
|
+
// console.log("删除关联在节点上的出口链路- node, config", node, config);
|
391
|
+
edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : [];
|
391
392
|
|
392
|
-
|
393
|
+
if (edges.length > 0) {
|
394
|
+
edges.map(function (edge) {
|
395
|
+
if (edge.getTag()) {
|
396
|
+
var link = topo.dataModel.getDataById(edge.getTag());
|
393
397
|
|
394
|
-
|
395
|
-
|
396
|
-
|
398
|
+
if (link && (0, _linkUtils.isExitLink)(link)) {
|
399
|
+
topo.getGraphView().dm().remove(edge);
|
400
|
+
}
|
401
|
+
}
|
402
|
+
});
|
397
403
|
}
|
398
404
|
|
399
|
-
|
400
|
-
|
401
|
-
edges.map(function (edge) {
|
402
|
-
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
403
|
-
// exLink.push(edge);
|
404
|
-
topo.getGraphView().dm().remove(edge);
|
405
|
-
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
406
|
-
}
|
407
|
-
});
|
408
|
-
config.exportLinkIdList = exportLinkIdList;
|
409
|
-
_context4.next = 8;
|
410
|
-
return resourceConfig.updateConfig(config);
|
411
|
-
|
412
|
-
case 8:
|
405
|
+
case 2:
|
413
406
|
case "end":
|
414
407
|
return _context4.stop();
|
415
408
|
}
|
@@ -591,7 +584,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
591
584
|
|
592
585
|
function _bindViewResources() {
|
593
586
|
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
|
594
|
-
var config,
|
587
|
+
var config, result, _elements;
|
595
588
|
|
596
589
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
597
590
|
while (1) switch (_context12.prev = _context12.next) {
|
@@ -607,15 +600,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
607
600
|
return editDispatchers.fetchDataByConfig();
|
608
601
|
|
609
602
|
case 6:
|
610
|
-
|
611
|
-
|
612
|
-
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
603
|
+
result = _context12.sent;
|
604
|
+
console.log("fetchDataByConfig", result);
|
613
605
|
|
614
|
-
if (
|
615
|
-
|
606
|
+
if (result) {
|
607
|
+
_elements = result.elements;
|
608
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
609
|
+
|
610
|
+
if (topo.linkDynamicStyleExecutor) {
|
611
|
+
topo.linkDynamicStyleExecutor.execute();
|
612
|
+
}
|
616
613
|
}
|
617
614
|
|
618
|
-
case
|
615
|
+
case 9:
|
619
616
|
case "end":
|
620
617
|
return _context12.stop();
|
621
618
|
}
|
@@ -630,7 +627,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
630
627
|
|
631
628
|
function _addLayerResources() {
|
632
629
|
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
|
633
|
-
var _yield$
|
630
|
+
var _yield$editDispatcher3, elements, newElements;
|
634
631
|
|
635
632
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
636
633
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -645,8 +642,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
645
642
|
return editDispatchers.fetchDataByConfig();
|
646
643
|
|
647
644
|
case 5:
|
648
|
-
_yield$
|
649
|
-
elements = _yield$
|
645
|
+
_yield$editDispatcher3 = _context13.sent;
|
646
|
+
elements = _yield$editDispatcher3.elements;
|
650
647
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
651
648
|
newElements = findUNExistedElements(elements);
|
652
649
|
|
@@ -869,7 +866,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
869
866
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
870
867
|
while (1) switch (_context8.prev = _context8.next) {
|
871
868
|
case 0:
|
872
|
-
dm = htTopo.getGraphView().dm(); //
|
869
|
+
dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
|
870
|
+
|
871
|
+
dm.remove(node); // 创建
|
873
872
|
|
874
873
|
newLinkElements = findUNExistedLinkElements(elements);
|
875
874
|
createElementsData = null;
|
@@ -931,22 +930,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
931
930
|
|
932
931
|
|
933
932
|
sm = htTopo.getGraphView().sm();
|
934
|
-
sm.setSelection([newElement]); //
|
933
|
+
sm.setSelection([newElement]); // 临时放这里,仅拓扑中心有
|
935
934
|
|
936
|
-
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
937
|
-
// node.a("customName", null);
|
938
|
-
// 删除关联在节点上的出口链路
|
939
|
-
|
940
|
-
_context8.next = 12;
|
941
|
-
return deleteExLink(node);
|
942
|
-
|
943
|
-
case 12:
|
944
|
-
// 临时放这里,仅拓扑中心有
|
945
935
|
if (topo.linkDynamicStyleExecutor) {
|
946
936
|
topo.linkDynamicStyleExecutor.execute();
|
947
937
|
}
|
948
938
|
|
949
|
-
case
|
939
|
+
case 11:
|
950
940
|
case "end":
|
951
941
|
return _context8.stop();
|
952
942
|
}
|
@@ -1011,11 +1001,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1011
1001
|
break;
|
1012
1002
|
}
|
1013
1003
|
|
1004
|
+
topo.historyManager.endTransaction();
|
1005
|
+
|
1014
1006
|
_message["default"].error("关联资源失败");
|
1015
1007
|
|
1016
|
-
_rlog["default"].
|
1008
|
+
_rlog["default"].error("关联资源失败");
|
1017
1009
|
|
1018
|
-
topo.historyManager.endTransaction();
|
1019
1010
|
return _context9.abrupt("return", false);
|
1020
1011
|
|
1021
1012
|
case 23:
|
@@ -1047,7 +1038,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1038
|
|
1048
1039
|
function _relateNodeIp() {
|
1049
1040
|
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
1050
|
-
var dm, isUnique,
|
1041
|
+
var dm, isUnique, ipNodeData, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1051
1042
|
|
1052
1043
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1053
1044
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1069,16 +1060,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1069
1060
|
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1070
1061
|
|
1071
1062
|
if (!isUnique) {
|
1072
|
-
_context15.next =
|
1063
|
+
_context15.next = 24;
|
1073
1064
|
break;
|
1074
1065
|
}
|
1075
1066
|
|
1076
|
-
|
1067
|
+
ipNodeData = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1077
1068
|
_context15.next = 8;
|
1078
1069
|
return deleteExLink(nodeElement);
|
1079
1070
|
|
1080
1071
|
case 8:
|
1081
|
-
nodeElement.a(
|
1072
|
+
nodeElement.a(ipNodeData);
|
1082
1073
|
nodeElement.setName(txtValue);
|
1083
1074
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1084
1075
|
|
@@ -1093,8 +1084,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1093
1084
|
case 16:
|
1094
1085
|
configData = _context15.sent;
|
1095
1086
|
// console.log("configData",configObj, configData);
|
1096
|
-
|
1097
|
-
newLinkElements = findUNExistedLinkElements(
|
1087
|
+
_elements2 = configData.elements;
|
1088
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1098
1089
|
|
1099
1090
|
newLink = newLinkElements.filter(function (item) {
|
1100
1091
|
return item.type === "link";
|
@@ -1109,15 +1100,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1109
1100
|
nodes: [],
|
1110
1101
|
links: newLink,
|
1111
1102
|
linkGroups: newLinkGroup
|
1112
|
-
};
|
1103
|
+
};
|
1104
|
+
console.log("createElementsData", createElementsData);
|
1113
1105
|
|
1114
1106
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1115
1107
|
_htTopo = topo.getHtTopo();
|
1116
1108
|
|
1117
|
-
_htTopo.createElements(createElementsData);
|
1109
|
+
_htTopo.createElements(createElementsData); // 临时放这里,仅拓扑中心有
|
1110
|
+
|
1111
|
+
|
1112
|
+
if (topo.linkDynamicStyleExecutor) {
|
1113
|
+
topo.linkDynamicStyleExecutor.execute();
|
1114
|
+
}
|
1118
1115
|
}
|
1119
1116
|
|
1120
|
-
case
|
1117
|
+
case 24:
|
1121
1118
|
case "end":
|
1122
1119
|
return _context15.stop();
|
1123
1120
|
}
|
package/lib/core/models/Alarm.js
CHANGED
@@ -96,8 +96,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
96
96
|
|
97
97
|
_componentTopologyUtils.rlog.info('Alarm.open 打开告警通道', id);
|
98
98
|
|
99
|
-
this.openTopoAlarm(id);
|
100
|
-
|
99
|
+
this.openTopoAlarm(id);
|
101
100
|
this.hmGetTopoAlarmByDoc(id);
|
102
101
|
}
|
103
102
|
/**
|
@@ -227,85 +226,6 @@ var Alarm = /*#__PURE__*/function () {
|
|
227
226
|
}
|
228
227
|
|
229
228
|
return hmGetTopoAlarmByDoc;
|
230
|
-
}();
|
231
|
-
|
232
|
-
_proto.hmGetTopoAlarm = /*#__PURE__*/function () {
|
233
|
-
var _hmGetTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(id) {
|
234
|
-
var mainCiIdList, endTime, startTime, parms, result;
|
235
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
236
|
-
while (1) switch (_context3.prev = _context3.next) {
|
237
|
-
case 0:
|
238
|
-
mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
|
239
|
-
return !!ci.operation;
|
240
|
-
}) // 过滤掉权限
|
241
|
-
.map(function (ci) {
|
242
|
-
return ci.id;
|
243
|
-
});
|
244
|
-
|
245
|
-
if (!(mainCiIdList.length === 0)) {
|
246
|
-
_context3.next = 4;
|
247
|
-
break;
|
248
|
-
}
|
249
|
-
|
250
|
-
this.updateState({
|
251
|
-
alarmData: [],
|
252
|
-
alarmPanelIsOpen: false
|
253
|
-
});
|
254
|
-
return _context3.abrupt("return");
|
255
|
-
|
256
|
-
case 4:
|
257
|
-
//rlog.debug("获取告警列表", mainCiIdList);
|
258
|
-
endTime = null; // new Date().valueOf();
|
259
|
-
|
260
|
-
startTime = null; // moment().subtract(1, "months").valueOf();
|
261
|
-
|
262
|
-
parms = {
|
263
|
-
mainCiIdList: mainCiIdList,
|
264
|
-
alertStatusList: ['toDeal', 'dealing'],
|
265
|
-
pageNum: 1,
|
266
|
-
pageSize: 10,
|
267
|
-
sortField: 'alertLevel',
|
268
|
-
alertLevelList: [],
|
269
|
-
orders: [{
|
270
|
-
property: 'alertLevel',
|
271
|
-
direction: 'ASC'
|
272
|
-
}, {
|
273
|
-
property: 'createTime',
|
274
|
-
direction: 'DESC'
|
275
|
-
}],
|
276
|
-
createTime: {
|
277
|
-
startTime: startTime,
|
278
|
-
endTime: endTime
|
279
|
-
}
|
280
|
-
};
|
281
|
-
_context3.next = 9;
|
282
|
-
return _topo["default"].getAlarmByIds(parms);
|
283
|
-
|
284
|
-
case 9:
|
285
|
-
result = _context3.sent;
|
286
|
-
|
287
|
-
_componentTopologyUtils.rlog.debug('getAlarmById-result', result); // if (alarmIsOpened) {
|
288
|
-
// //this.topo.loadAlarm(result.datas);
|
289
|
-
// this.handleAlarmEvent({ type: "alarm", data: result.datas });
|
290
|
-
// }
|
291
|
-
// this.updateState({
|
292
|
-
// alarmData: result.datas.length > 0 ? result.datas : [],
|
293
|
-
// alarmPanelIsOpen: result.datas.length > 0,
|
294
|
-
// });
|
295
|
-
|
296
|
-
|
297
|
-
case 11:
|
298
|
-
case "end":
|
299
|
-
return _context3.stop();
|
300
|
-
}
|
301
|
-
}, _callee3, this);
|
302
|
-
}));
|
303
|
-
|
304
|
-
function hmGetTopoAlarm(_x2) {
|
305
|
-
return _hmGetTopoAlarm.apply(this, arguments);
|
306
|
-
}
|
307
|
-
|
308
|
-
return hmGetTopoAlarm;
|
309
229
|
}()
|
310
230
|
/**
|
311
231
|
* 直接装载告警数据(可装载mock列表)
|
@@ -316,9 +236,9 @@ var Alarm = /*#__PURE__*/function () {
|
|
316
236
|
_proto.setAlarmDataByMock =
|
317
237
|
/*#__PURE__*/
|
318
238
|
function () {
|
319
|
-
var _setAlarmDataByMock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
320
|
-
return _regenerator["default"].wrap(function
|
321
|
-
while (1) switch (
|
239
|
+
var _setAlarmDataByMock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(datas) {
|
240
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
241
|
+
while (1) switch (_context3.prev = _context3.next) {
|
322
242
|
case 0:
|
323
243
|
this.updateState({
|
324
244
|
alarmData: datas.length > 0 ? datas : [],
|
@@ -327,12 +247,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
327
247
|
|
328
248
|
case 1:
|
329
249
|
case "end":
|
330
|
-
return
|
250
|
+
return _context3.stop();
|
331
251
|
}
|
332
|
-
},
|
252
|
+
}, _callee3, this);
|
333
253
|
}));
|
334
254
|
|
335
|
-
function setAlarmDataByMock(
|
255
|
+
function setAlarmDataByMock(_x2) {
|
336
256
|
return _setAlarmDataByMock.apply(this, arguments);
|
337
257
|
}
|
338
258
|
|
@@ -347,10 +267,10 @@ var Alarm = /*#__PURE__*/function () {
|
|
347
267
|
_proto.switchAlarmPopPanel =
|
348
268
|
/*#__PURE__*/
|
349
269
|
function () {
|
350
|
-
var _switchAlarmPopPanel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
270
|
+
var _switchAlarmPopPanel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(flag) {
|
351
271
|
var topoDispatchers;
|
352
|
-
return _regenerator["default"].wrap(function
|
353
|
-
while (1) switch (
|
272
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
273
|
+
while (1) switch (_context4.prev = _context4.next) {
|
354
274
|
case 0:
|
355
275
|
// console.log("switchAlarmPopPanel", flag);
|
356
276
|
topoDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
@@ -360,12 +280,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
360
280
|
|
361
281
|
case 2:
|
362
282
|
case "end":
|
363
|
-
return
|
283
|
+
return _context4.stop();
|
364
284
|
}
|
365
|
-
},
|
285
|
+
}, _callee4, this);
|
366
286
|
}));
|
367
287
|
|
368
|
-
function switchAlarmPopPanel(
|
288
|
+
function switchAlarmPopPanel(_x3) {
|
369
289
|
return _switchAlarmPopPanel.apply(this, arguments);
|
370
290
|
}
|
371
291
|
|
@@ -381,21 +301,21 @@ var Alarm = /*#__PURE__*/function () {
|
|
381
301
|
_proto.openTopoAlarm =
|
382
302
|
/*#__PURE__*/
|
383
303
|
function () {
|
384
|
-
var _openTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
304
|
+
var _openTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(id) {
|
385
305
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
386
306
|
|
387
|
-
return _regenerator["default"].wrap(function
|
388
|
-
while (1) switch (
|
307
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
308
|
+
while (1) switch (_context5.prev = _context5.next) {
|
389
309
|
case 0:
|
390
310
|
// 如果当前拓扑图开启中或已开启则退出
|
391
311
|
_this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
|
392
312
|
|
393
313
|
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
394
|
-
|
314
|
+
_context5.next = 3;
|
395
315
|
break;
|
396
316
|
}
|
397
317
|
|
398
|
-
return
|
318
|
+
return _context5.abrupt("return");
|
399
319
|
|
400
320
|
case 3:
|
401
321
|
this.currentTopoId = id;
|
@@ -403,16 +323,16 @@ var Alarm = /*#__PURE__*/function () {
|
|
403
323
|
alarmOpening: true
|
404
324
|
});
|
405
325
|
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
406
|
-
|
326
|
+
_context5.next = 8;
|
407
327
|
return alarmDispatchers.resetAlarmDoc();
|
408
328
|
|
409
329
|
case 8:
|
410
|
-
|
411
|
-
|
330
|
+
_context5.prev = 8;
|
331
|
+
_context5.next = 11;
|
412
332
|
return this.topo.serverApi.openTopoAlarm(id);
|
413
333
|
|
414
334
|
case 11:
|
415
|
-
this.secretKey =
|
335
|
+
this.secretKey = _context5.sent;
|
416
336
|
|
417
337
|
_componentTopologyUtils.rlog.info('openTopoAlarm 打开拓扑告警推送-------------------开始');
|
418
338
|
|
@@ -420,12 +340,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
420
340
|
alarmOpening: false,
|
421
341
|
alarmIsOpened: true
|
422
342
|
});
|
423
|
-
|
343
|
+
_context5.next = 20;
|
424
344
|
break;
|
425
345
|
|
426
346
|
case 16:
|
427
|
-
|
428
|
-
|
347
|
+
_context5.prev = 16;
|
348
|
+
_context5.t0 = _context5["catch"](8);
|
429
349
|
|
430
350
|
_componentTopologyUtils.rlog.error('打开拓扑告警推送 失败');
|
431
351
|
|
@@ -435,12 +355,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
435
355
|
|
436
356
|
case 20:
|
437
357
|
case "end":
|
438
|
-
return
|
358
|
+
return _context5.stop();
|
439
359
|
}
|
440
|
-
},
|
360
|
+
}, _callee5, this, [[8, 16]]);
|
441
361
|
}));
|
442
362
|
|
443
|
-
function openTopoAlarm(
|
363
|
+
function openTopoAlarm(_x4) {
|
444
364
|
return _openTopoAlarm.apply(this, arguments);
|
445
365
|
}
|
446
366
|
|
@@ -456,21 +376,21 @@ var Alarm = /*#__PURE__*/function () {
|
|
456
376
|
_proto.closeTopoAlarm =
|
457
377
|
/*#__PURE__*/
|
458
378
|
function () {
|
459
|
-
var _closeTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
379
|
+
var _closeTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id) {
|
460
380
|
var _this$getState3, alarmIsOpened, alarmOpening;
|
461
381
|
|
462
|
-
return _regenerator["default"].wrap(function
|
463
|
-
while (1) switch (
|
382
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
383
|
+
while (1) switch (_context6.prev = _context6.next) {
|
464
384
|
case 0:
|
465
385
|
// 如果未开启则退出
|
466
386
|
_this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
|
467
387
|
|
468
388
|
if (!(!alarmIsOpened && !alarmOpening)) {
|
469
|
-
|
389
|
+
_context6.next = 3;
|
470
390
|
break;
|
471
391
|
}
|
472
392
|
|
473
|
-
return
|
393
|
+
return _context6.abrupt("return");
|
474
394
|
|
475
395
|
case 3:
|
476
396
|
this.currentTopoId = null;
|
@@ -482,17 +402,17 @@ var Alarm = /*#__PURE__*/function () {
|
|
482
402
|
alarmOpening: false,
|
483
403
|
alarmPanelIsOpen: false
|
484
404
|
});
|
485
|
-
|
405
|
+
_context6.next = 8;
|
486
406
|
return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
|
487
407
|
|
488
408
|
case 8:
|
489
409
|
case "end":
|
490
|
-
return
|
410
|
+
return _context6.stop();
|
491
411
|
}
|
492
|
-
},
|
412
|
+
}, _callee6, this);
|
493
413
|
}));
|
494
414
|
|
495
|
-
function closeTopoAlarm(
|
415
|
+
function closeTopoAlarm(_x5) {
|
496
416
|
return _closeTopoAlarm.apply(this, arguments);
|
497
417
|
}
|
498
418
|
|
@@ -517,20 +437,20 @@ var Alarm = /*#__PURE__*/function () {
|
|
517
437
|
_proto.restart =
|
518
438
|
/*#__PURE__*/
|
519
439
|
function () {
|
520
|
-
var _restart = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
440
|
+
var _restart = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
521
441
|
var id;
|
522
|
-
return _regenerator["default"].wrap(function
|
523
|
-
while (1) switch (
|
442
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
443
|
+
while (1) switch (_context7.prev = _context7.next) {
|
524
444
|
case 0:
|
525
445
|
id = this.currentTopoId;
|
526
|
-
|
446
|
+
_context7.next = 3;
|
527
447
|
return this.openTopoAlarm(id);
|
528
448
|
|
529
449
|
case 3:
|
530
450
|
case "end":
|
531
|
-
return
|
451
|
+
return _context7.stop();
|
532
452
|
}
|
533
|
-
},
|
453
|
+
}, _callee7, this);
|
534
454
|
}));
|
535
455
|
|
536
456
|
function restart() {
|
@@ -547,26 +467,28 @@ var Alarm = /*#__PURE__*/function () {
|
|
547
467
|
_proto.handleAlarmEvent =
|
548
468
|
/*#__PURE__*/
|
549
469
|
function () {
|
550
|
-
var _handleAlarmEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
470
|
+
var _handleAlarmEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(alertData) {
|
551
471
|
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche2, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
|
552
472
|
|
553
|
-
return _regenerator["default"].wrap(function
|
554
|
-
while (1) switch (
|
473
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
474
|
+
while (1) switch (_context8.prev = _context8.next) {
|
555
475
|
case 0:
|
556
476
|
_this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
|
557
477
|
resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
|
558
478
|
resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
|
559
479
|
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm'); // 添加事件
|
560
|
-
|
480
|
+
|
481
|
+
console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
|
561
482
|
|
562
483
|
if (!((0, _utils.isAvailableArray)(alertData) && (0, _utils.isAvailableArray)(resIdsList))) {
|
563
|
-
|
484
|
+
_context8.next = 25;
|
564
485
|
break;
|
565
486
|
}
|
566
487
|
|
567
488
|
sendAl = [];
|
568
489
|
idsList = [].concat(nodeIdsList, linkIdsList);
|
569
|
-
operations = [];
|
490
|
+
operations = []; // console.log('idsList---------', idsList)
|
491
|
+
|
570
492
|
idsList.forEach(function (idItem) {
|
571
493
|
if (idItem.operation === null) {
|
572
494
|
operations.push(idItem.ciId);
|
@@ -576,6 +498,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
576
498
|
var _item$resourceId;
|
577
499
|
|
578
500
|
var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
|
501
|
+
var isSub = false;
|
579
502
|
var obj = {
|
580
503
|
id: ciId,
|
581
504
|
level: item.alertLevel,
|
@@ -584,7 +507,8 @@ var Alarm = /*#__PURE__*/function () {
|
|
584
507
|
obj: item,
|
585
508
|
info: item.alertType,
|
586
509
|
ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
|
587
|
-
ruleId: item === null || item === void 0 ? void 0 : item.ruleId
|
510
|
+
ruleId: item === null || item === void 0 ? void 0 : item.ruleId,
|
511
|
+
isSub: isSub
|
588
512
|
};
|
589
513
|
|
590
514
|
if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
|
@@ -593,20 +517,20 @@ var Alarm = /*#__PURE__*/function () {
|
|
593
517
|
}); // console.log("before-combAlarmData", sendAl, idsList);
|
594
518
|
|
595
519
|
if (!(sendAl.length > 0)) {
|
596
|
-
|
520
|
+
_context8.next = 25;
|
597
521
|
break;
|
598
522
|
}
|
599
523
|
|
600
524
|
_componentTopologyUtils.rlog.debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
|
601
525
|
|
602
|
-
|
603
|
-
|
526
|
+
_context8.prev = 13;
|
527
|
+
_context8.next = 16;
|
604
528
|
return alarmDispatchers.combAlarmData({
|
605
529
|
alarmdata: sendAl
|
606
530
|
});
|
607
531
|
|
608
|
-
case
|
609
|
-
_yield$alarmDispatche2 =
|
532
|
+
case 16:
|
533
|
+
_yield$alarmDispatche2 = _context8.sent;
|
610
534
|
eqFlag = _yield$alarmDispatche2.eqFlag;
|
611
535
|
alarmlist = _yield$alarmDispatche2.alarmlist;
|
612
536
|
|
@@ -626,23 +550,23 @@ var Alarm = /*#__PURE__*/function () {
|
|
626
550
|
}
|
627
551
|
}
|
628
552
|
|
629
|
-
|
553
|
+
_context8.next = 25;
|
630
554
|
break;
|
631
555
|
|
632
|
-
case
|
633
|
-
|
634
|
-
|
556
|
+
case 22:
|
557
|
+
_context8.prev = 22;
|
558
|
+
_context8.t0 = _context8["catch"](13);
|
635
559
|
|
636
|
-
_componentTopologyUtils.rlog.error('告警发送异常',
|
560
|
+
_componentTopologyUtils.rlog.error('告警发送异常', _context8.t0);
|
637
561
|
|
638
|
-
case
|
562
|
+
case 25:
|
639
563
|
case "end":
|
640
|
-
return
|
564
|
+
return _context8.stop();
|
641
565
|
}
|
642
|
-
},
|
566
|
+
}, _callee8, this, [[13, 22]]);
|
643
567
|
}));
|
644
568
|
|
645
|
-
function handleAlarmEvent(
|
569
|
+
function handleAlarmEvent(_x6) {
|
646
570
|
return _handleAlarmEvent.apply(this, arguments);
|
647
571
|
}
|
648
572
|
|