@riil-frontend/component-topology 12.0.0-dev.8 → 12.1.0-dev.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 +58 -3
- 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 +16 -2
- 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 -30
- 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 -58
- package/es/core/models/Alarm.js +69 -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/models/utils/linkUtils.js +20 -13
- 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 +12 -13
- 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/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 +60 -3
- 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 -31
- 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 -57
- package/lib/core/models/Alarm.js +69 -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/models/utils/linkUtils.js +21 -13
- 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 +12 -13
- 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/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
@@ -127,10 +127,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
127
127
|
return topoDispatchers.setTopoType(_template.TPL_TREE);
|
128
128
|
|
129
129
|
case 7:
|
130
|
-
// 更新配置
|
131
|
-
// resourceConfig.updateConfig(config);
|
132
|
-
// 更新配置对应的资源、链路
|
133
|
-
// editDispatchers.fetchDataByConfig();
|
134
130
|
topo.historyManager.endTransaction();
|
135
131
|
|
136
132
|
case 8:
|
@@ -383,33 +379,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
383
379
|
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(node) {
|
384
380
|
var _node$getEdges$toArra, _node$getEdges;
|
385
381
|
|
386
|
-
var
|
382
|
+
var edges;
|
387
383
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
388
384
|
while (1) switch (_context4.prev = _context4.next) {
|
389
385
|
case 0:
|
390
|
-
|
386
|
+
// console.log("删除关联在节点上的出口链路- node, config", node, config);
|
387
|
+
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
388
|
|
392
|
-
|
389
|
+
if (edges.length > 0) {
|
390
|
+
edges.map(function (edge) {
|
391
|
+
if (edge.getTag()) {
|
392
|
+
var link = topo.dataModel.getDataById(edge.getTag());
|
393
393
|
|
394
|
-
|
395
|
-
|
396
|
-
|
394
|
+
if (link && (0, _linkUtils.isExitLink)(link)) {
|
395
|
+
topo.getGraphView().dm().remove(edge);
|
396
|
+
}
|
397
|
+
}
|
398
|
+
});
|
397
399
|
}
|
398
400
|
|
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:
|
401
|
+
case 2:
|
413
402
|
case "end":
|
414
403
|
return _context4.stop();
|
415
404
|
}
|
@@ -591,7 +580,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
591
580
|
|
592
581
|
function _bindViewResources() {
|
593
582
|
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
|
594
|
-
var config,
|
583
|
+
var config, result, _elements;
|
595
584
|
|
596
585
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
597
586
|
while (1) switch (_context12.prev = _context12.next) {
|
@@ -607,15 +596,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
607
596
|
return editDispatchers.fetchDataByConfig();
|
608
597
|
|
609
598
|
case 6:
|
610
|
-
|
611
|
-
|
612
|
-
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
599
|
+
result = _context12.sent;
|
600
|
+
console.log("fetchDataByConfig", result);
|
613
601
|
|
614
|
-
if (
|
615
|
-
|
602
|
+
if (result) {
|
603
|
+
_elements = result.elements;
|
604
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
605
|
+
|
606
|
+
if (topo.linkDynamicStyleExecutor) {
|
607
|
+
topo.linkDynamicStyleExecutor.execute();
|
608
|
+
}
|
616
609
|
}
|
617
610
|
|
618
|
-
case
|
611
|
+
case 9:
|
619
612
|
case "end":
|
620
613
|
return _context12.stop();
|
621
614
|
}
|
@@ -630,7 +623,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
630
623
|
|
631
624
|
function _addLayerResources() {
|
632
625
|
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
|
633
|
-
var _yield$
|
626
|
+
var _yield$editDispatcher3, elements, newElements;
|
634
627
|
|
635
628
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
636
629
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -645,8 +638,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
645
638
|
return editDispatchers.fetchDataByConfig();
|
646
639
|
|
647
640
|
case 5:
|
648
|
-
_yield$
|
649
|
-
elements = _yield$
|
641
|
+
_yield$editDispatcher3 = _context13.sent;
|
642
|
+
elements = _yield$editDispatcher3.elements;
|
650
643
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
651
644
|
newElements = findUNExistedElements(elements);
|
652
645
|
|
@@ -869,7 +862,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
869
862
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
870
863
|
while (1) switch (_context8.prev = _context8.next) {
|
871
864
|
case 0:
|
872
|
-
dm = htTopo.getGraphView().dm(); //
|
865
|
+
dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
|
866
|
+
|
867
|
+
dm.remove(node); // 创建
|
873
868
|
|
874
869
|
newLinkElements = findUNExistedLinkElements(elements);
|
875
870
|
createElementsData = null;
|
@@ -931,22 +926,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
931
926
|
|
932
927
|
|
933
928
|
sm = htTopo.getGraphView().sm();
|
934
|
-
sm.setSelection([newElement]); //
|
929
|
+
sm.setSelection([newElement]); // 临时放这里,仅拓扑中心有
|
935
930
|
|
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
931
|
if (topo.linkDynamicStyleExecutor) {
|
946
932
|
topo.linkDynamicStyleExecutor.execute();
|
947
933
|
}
|
948
934
|
|
949
|
-
case
|
935
|
+
case 11:
|
950
936
|
case "end":
|
951
937
|
return _context8.stop();
|
952
938
|
}
|
@@ -1011,11 +997,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1011
997
|
break;
|
1012
998
|
}
|
1013
999
|
|
1000
|
+
topo.historyManager.endTransaction();
|
1001
|
+
|
1014
1002
|
_message["default"].error("关联资源失败");
|
1015
1003
|
|
1016
|
-
_rlog["default"].
|
1004
|
+
_rlog["default"].error("关联资源失败");
|
1017
1005
|
|
1018
|
-
topo.historyManager.endTransaction();
|
1019
1006
|
return _context9.abrupt("return", false);
|
1020
1007
|
|
1021
1008
|
case 23:
|
@@ -1047,7 +1034,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1034
|
|
1048
1035
|
function _relateNodeIp() {
|
1049
1036
|
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
1050
|
-
var dm, isUnique,
|
1037
|
+
var dm, isUnique, ipNodeData, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1051
1038
|
|
1052
1039
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1053
1040
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1069,16 +1056,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1069
1056
|
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1070
1057
|
|
1071
1058
|
if (!isUnique) {
|
1072
|
-
_context15.next =
|
1059
|
+
_context15.next = 24;
|
1073
1060
|
break;
|
1074
1061
|
}
|
1075
1062
|
|
1076
|
-
|
1063
|
+
ipNodeData = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1077
1064
|
_context15.next = 8;
|
1078
1065
|
return deleteExLink(nodeElement);
|
1079
1066
|
|
1080
1067
|
case 8:
|
1081
|
-
nodeElement.a(
|
1068
|
+
nodeElement.a(ipNodeData);
|
1082
1069
|
nodeElement.setName(txtValue);
|
1083
1070
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1084
1071
|
|
@@ -1093,8 +1080,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1093
1080
|
case 16:
|
1094
1081
|
configData = _context15.sent;
|
1095
1082
|
// console.log("configData",configObj, configData);
|
1096
|
-
|
1097
|
-
newLinkElements = findUNExistedLinkElements(
|
1083
|
+
_elements2 = configData.elements;
|
1084
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1098
1085
|
|
1099
1086
|
newLink = newLinkElements.filter(function (item) {
|
1100
1087
|
return item.type === "link";
|
@@ -1109,15 +1096,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1109
1096
|
nodes: [],
|
1110
1097
|
links: newLink,
|
1111
1098
|
linkGroups: newLinkGroup
|
1112
|
-
};
|
1099
|
+
};
|
1100
|
+
console.log("createElementsData", createElementsData);
|
1113
1101
|
|
1114
1102
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1115
1103
|
_htTopo = topo.getHtTopo();
|
1116
1104
|
|
1117
|
-
_htTopo.createElements(createElementsData);
|
1105
|
+
_htTopo.createElements(createElementsData); // 临时放这里,仅拓扑中心有
|
1106
|
+
|
1107
|
+
|
1108
|
+
if (topo.linkDynamicStyleExecutor) {
|
1109
|
+
topo.linkDynamicStyleExecutor.execute();
|
1110
|
+
}
|
1118
1111
|
}
|
1119
1112
|
|
1120
|
-
case
|
1113
|
+
case 24:
|
1121
1114
|
case "end":
|
1122
1115
|
return _context15.stop();
|
1123
1116
|
}
|
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 = 27;
|
564
485
|
break;
|
565
486
|
}
|
566
487
|
|
567
488
|
sendAl = [];
|
568
489
|
idsList = [].concat(nodeIdsList, linkIdsList);
|
569
490
|
operations = [];
|
491
|
+
console.log('idsList---------', idsList);
|
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,29 +507,31 @@ 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) {
|
591
515
|
sendAl.push(obj);
|
592
516
|
}
|
593
|
-
});
|
517
|
+
});
|
518
|
+
console.log("before-combAlarmData", sendAl, idsList);
|
594
519
|
|
595
520
|
if (!(sendAl.length > 0)) {
|
596
|
-
|
521
|
+
_context8.next = 27;
|
597
522
|
break;
|
598
523
|
}
|
599
524
|
|
600
525
|
_componentTopologyUtils.rlog.debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
|
601
526
|
|
602
|
-
|
603
|
-
|
527
|
+
_context8.prev = 15;
|
528
|
+
_context8.next = 18;
|
604
529
|
return alarmDispatchers.combAlarmData({
|
605
530
|
alarmdata: sendAl
|
606
531
|
});
|
607
532
|
|
608
|
-
case
|
609
|
-
_yield$alarmDispatche2 =
|
533
|
+
case 18:
|
534
|
+
_yield$alarmDispatche2 = _context8.sent;
|
610
535
|
eqFlag = _yield$alarmDispatche2.eqFlag;
|
611
536
|
alarmlist = _yield$alarmDispatche2.alarmlist;
|
612
537
|
|
@@ -626,23 +551,23 @@ var Alarm = /*#__PURE__*/function () {
|
|
626
551
|
}
|
627
552
|
}
|
628
553
|
|
629
|
-
|
554
|
+
_context8.next = 27;
|
630
555
|
break;
|
631
556
|
|
632
|
-
case
|
633
|
-
|
634
|
-
|
557
|
+
case 24:
|
558
|
+
_context8.prev = 24;
|
559
|
+
_context8.t0 = _context8["catch"](15);
|
635
560
|
|
636
|
-
_componentTopologyUtils.rlog.error('告警发送异常',
|
561
|
+
_componentTopologyUtils.rlog.error('告警发送异常', _context8.t0);
|
637
562
|
|
638
|
-
case
|
563
|
+
case 27:
|
639
564
|
case "end":
|
640
|
-
return
|
565
|
+
return _context8.stop();
|
641
566
|
}
|
642
|
-
},
|
567
|
+
}, _callee8, this, [[15, 24]]);
|
643
568
|
}));
|
644
569
|
|
645
|
-
function handleAlarmEvent(
|
570
|
+
function handleAlarmEvent(_x6) {
|
646
571
|
return _handleAlarmEvent.apply(this, arguments);
|
647
572
|
}
|
648
573
|
|