@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
@@ -15,7 +15,7 @@ import useGroupAddResource from "./useGroupAddResource";
|
|
15
15
|
import { findGroupChildren } from "../../utils/topoData";
|
16
16
|
import { isResourceElement } from "../../utils/htElementDataUtil";
|
17
17
|
import { isClusterHtElement, isClusterMemberHtElement } from "../../utils/clusterUtil";
|
18
|
-
import { mergeExportLinkData } from "../models/utils/linkUtils";
|
18
|
+
import { isExitLink, mergeExportLinkData } from "../models/utils/linkUtils";
|
19
19
|
import { isUniqueIp, buildIpNode } from "../../networkTopo/utils/exitLinkUtil";
|
20
20
|
|
21
21
|
var useTopoEdit = function useTopoEdit(params) {
|
@@ -95,10 +95,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
95
95
|
return topoDispatchers.setTopoType(TPL_TREE);
|
96
96
|
|
97
97
|
case 7:
|
98
|
-
// 更新配置
|
99
|
-
// resourceConfig.updateConfig(config);
|
100
|
-
// 更新配置对应的资源、链路
|
101
|
-
// editDispatchers.fetchDataByConfig();
|
102
98
|
topo.historyManager.endTransaction();
|
103
99
|
|
104
100
|
case 8:
|
@@ -349,33 +345,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
349
345
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
|
350
346
|
var _node$getEdges$toArra, _node$getEdges;
|
351
347
|
|
352
|
-
var
|
348
|
+
var edges;
|
353
349
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
354
350
|
while (1) switch (_context4.prev = _context4.next) {
|
355
351
|
case 0:
|
356
|
-
|
352
|
+
// console.log("删除关联在节点上的出口链路- node, config", node, config);
|
353
|
+
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 : [];
|
357
354
|
|
358
|
-
|
355
|
+
if (edges.length > 0) {
|
356
|
+
edges.map(function (edge) {
|
357
|
+
if (edge.getTag()) {
|
358
|
+
var link = topo.dataModel.getDataById(edge.getTag());
|
359
359
|
|
360
|
-
|
361
|
-
|
362
|
-
|
360
|
+
if (link && isExitLink(link)) {
|
361
|
+
topo.getGraphView().dm().remove(edge);
|
362
|
+
}
|
363
|
+
}
|
364
|
+
});
|
363
365
|
}
|
364
366
|
|
365
|
-
|
366
|
-
|
367
|
-
edges.map(function (edge) {
|
368
|
-
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
369
|
-
// exLink.push(edge);
|
370
|
-
topo.getGraphView().dm().remove(edge);
|
371
|
-
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
372
|
-
}
|
373
|
-
});
|
374
|
-
config.exportLinkIdList = exportLinkIdList;
|
375
|
-
_context4.next = 8;
|
376
|
-
return resourceConfig.updateConfig(config);
|
377
|
-
|
378
|
-
case 8:
|
367
|
+
case 2:
|
379
368
|
case "end":
|
380
369
|
return _context4.stop();
|
381
370
|
}
|
@@ -554,7 +543,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
554
543
|
|
555
544
|
function _bindViewResources() {
|
556
545
|
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
|
557
|
-
var config,
|
546
|
+
var config, result, _elements;
|
558
547
|
|
559
548
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
560
549
|
while (1) switch (_context12.prev = _context12.next) {
|
@@ -570,15 +559,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
570
559
|
return editDispatchers.fetchDataByConfig();
|
571
560
|
|
572
561
|
case 6:
|
573
|
-
|
574
|
-
|
575
|
-
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
562
|
+
result = _context12.sent;
|
563
|
+
console.log("fetchDataByConfig", result);
|
576
564
|
|
577
|
-
if (
|
578
|
-
|
565
|
+
if (result) {
|
566
|
+
_elements = result.elements;
|
567
|
+
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
568
|
+
|
569
|
+
if (topo.linkDynamicStyleExecutor) {
|
570
|
+
topo.linkDynamicStyleExecutor.execute();
|
571
|
+
}
|
579
572
|
}
|
580
573
|
|
581
|
-
case
|
574
|
+
case 9:
|
582
575
|
case "end":
|
583
576
|
return _context12.stop();
|
584
577
|
}
|
@@ -593,7 +586,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
593
586
|
|
594
587
|
function _addLayerResources() {
|
595
588
|
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
|
596
|
-
var _yield$
|
589
|
+
var _yield$editDispatcher3, elements, newElements;
|
597
590
|
|
598
591
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
599
592
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -608,8 +601,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
608
601
|
return editDispatchers.fetchDataByConfig();
|
609
602
|
|
610
603
|
case 5:
|
611
|
-
_yield$
|
612
|
-
elements = _yield$
|
604
|
+
_yield$editDispatcher3 = _context13.sent;
|
605
|
+
elements = _yield$editDispatcher3.elements;
|
613
606
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
614
607
|
newElements = findUNExistedElements(elements);
|
615
608
|
rlog.debug("添加分层资源", {
|
@@ -827,7 +820,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
827
820
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
828
821
|
while (1) switch (_context8.prev = _context8.next) {
|
829
822
|
case 0:
|
830
|
-
dm = htTopo.getGraphView().dm(); //
|
823
|
+
dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
|
824
|
+
|
825
|
+
dm.remove(node); // 创建
|
831
826
|
|
832
827
|
newLinkElements = findUNExistedLinkElements(elements);
|
833
828
|
createElementsData = null;
|
@@ -888,22 +883,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
888
883
|
|
889
884
|
|
890
885
|
sm = htTopo.getGraphView().sm();
|
891
|
-
sm.setSelection([newElement]); //
|
886
|
+
sm.setSelection([newElement]); // 临时放这里,仅拓扑中心有
|
892
887
|
|
893
|
-
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
894
|
-
// node.a("customName", null);
|
895
|
-
// 删除关联在节点上的出口链路
|
896
|
-
|
897
|
-
_context8.next = 12;
|
898
|
-
return deleteExLink(node);
|
899
|
-
|
900
|
-
case 12:
|
901
|
-
// 临时放这里,仅拓扑中心有
|
902
888
|
if (topo.linkDynamicStyleExecutor) {
|
903
889
|
topo.linkDynamicStyleExecutor.execute();
|
904
890
|
}
|
905
891
|
|
906
|
-
case
|
892
|
+
case 11:
|
907
893
|
case "end":
|
908
894
|
return _context8.stop();
|
909
895
|
}
|
@@ -966,10 +952,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
966
952
|
break;
|
967
953
|
}
|
968
954
|
|
955
|
+
topo.historyManager.endTransaction();
|
956
|
+
|
969
957
|
_Message.error("关联资源失败");
|
970
958
|
|
971
|
-
rlog.
|
972
|
-
topo.historyManager.endTransaction();
|
959
|
+
rlog.error("关联资源失败");
|
973
960
|
return _context9.abrupt("return", false);
|
974
961
|
|
975
962
|
case 23:
|
@@ -1001,7 +988,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1001
988
|
|
1002
989
|
function _relateNodeIp() {
|
1003
990
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
1004
|
-
var dm, isUnique,
|
991
|
+
var dm, isUnique, ipNodeData, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1005
992
|
|
1006
993
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
1007
994
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1023,16 +1010,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1023
1010
|
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1024
1011
|
|
1025
1012
|
if (!isUnique) {
|
1026
|
-
_context15.next =
|
1013
|
+
_context15.next = 24;
|
1027
1014
|
break;
|
1028
1015
|
}
|
1029
1016
|
|
1030
|
-
|
1017
|
+
ipNodeData = buildIpNode(txtValue);
|
1031
1018
|
_context15.next = 8;
|
1032
1019
|
return deleteExLink(nodeElement);
|
1033
1020
|
|
1034
1021
|
case 8:
|
1035
|
-
nodeElement.a(
|
1022
|
+
nodeElement.a(ipNodeData);
|
1036
1023
|
nodeElement.setName(txtValue);
|
1037
1024
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1038
1025
|
|
@@ -1047,8 +1034,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1034
|
case 16:
|
1048
1035
|
configData = _context15.sent;
|
1049
1036
|
// console.log("configData",configObj, configData);
|
1050
|
-
|
1051
|
-
newLinkElements = findUNExistedLinkElements(
|
1037
|
+
_elements2 = configData.elements;
|
1038
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1052
1039
|
|
1053
1040
|
newLink = newLinkElements.filter(function (item) {
|
1054
1041
|
return item.type === "link";
|
@@ -1063,15 +1050,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1063
1050
|
nodes: [],
|
1064
1051
|
links: newLink,
|
1065
1052
|
linkGroups: newLinkGroup
|
1066
|
-
};
|
1053
|
+
};
|
1054
|
+
console.log("createElementsData", createElementsData);
|
1067
1055
|
|
1068
1056
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1069
1057
|
_htTopo = topo.getHtTopo();
|
1070
1058
|
|
1071
|
-
_htTopo.createElements(createElementsData);
|
1059
|
+
_htTopo.createElements(createElementsData); // 临时放这里,仅拓扑中心有
|
1060
|
+
|
1061
|
+
|
1062
|
+
if (topo.linkDynamicStyleExecutor) {
|
1063
|
+
topo.linkDynamicStyleExecutor.execute();
|
1064
|
+
}
|
1072
1065
|
}
|
1073
1066
|
|
1074
|
-
case
|
1067
|
+
case 24:
|
1075
1068
|
case "end":
|
1076
1069
|
return _context15.stop();
|
1077
1070
|
}
|
package/es/core/models/Alarm.js
CHANGED
@@ -83,8 +83,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
83
83
|
}
|
84
84
|
|
85
85
|
rlog.info('Alarm.open 打开告警通道', id);
|
86
|
-
this.openTopoAlarm(id);
|
87
|
-
|
86
|
+
this.openTopoAlarm(id);
|
88
87
|
this.hmGetTopoAlarmByDoc(id);
|
89
88
|
}
|
90
89
|
/**
|
@@ -211,83 +210,6 @@ var Alarm = /*#__PURE__*/function () {
|
|
211
210
|
}
|
212
211
|
|
213
212
|
return hmGetTopoAlarmByDoc;
|
214
|
-
}();
|
215
|
-
|
216
|
-
_proto.hmGetTopoAlarm = /*#__PURE__*/function () {
|
217
|
-
var _hmGetTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
218
|
-
var mainCiIdList, endTime, startTime, parms, result;
|
219
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
220
|
-
while (1) switch (_context3.prev = _context3.next) {
|
221
|
-
case 0:
|
222
|
-
mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
|
223
|
-
return !!ci.operation;
|
224
|
-
}) // 过滤掉权限
|
225
|
-
.map(function (ci) {
|
226
|
-
return ci.id;
|
227
|
-
});
|
228
|
-
|
229
|
-
if (!(mainCiIdList.length === 0)) {
|
230
|
-
_context3.next = 4;
|
231
|
-
break;
|
232
|
-
}
|
233
|
-
|
234
|
-
this.updateState({
|
235
|
-
alarmData: [],
|
236
|
-
alarmPanelIsOpen: false
|
237
|
-
});
|
238
|
-
return _context3.abrupt("return");
|
239
|
-
|
240
|
-
case 4:
|
241
|
-
//rlog.debug("获取告警列表", mainCiIdList);
|
242
|
-
endTime = null; // new Date().valueOf();
|
243
|
-
|
244
|
-
startTime = null; // moment().subtract(1, "months").valueOf();
|
245
|
-
|
246
|
-
parms = {
|
247
|
-
mainCiIdList: mainCiIdList,
|
248
|
-
alertStatusList: ['toDeal', 'dealing'],
|
249
|
-
pageNum: 1,
|
250
|
-
pageSize: 10,
|
251
|
-
sortField: 'alertLevel',
|
252
|
-
alertLevelList: [],
|
253
|
-
orders: [{
|
254
|
-
property: 'alertLevel',
|
255
|
-
direction: 'ASC'
|
256
|
-
}, {
|
257
|
-
property: 'createTime',
|
258
|
-
direction: 'DESC'
|
259
|
-
}],
|
260
|
-
createTime: {
|
261
|
-
startTime: startTime,
|
262
|
-
endTime: endTime
|
263
|
-
}
|
264
|
-
};
|
265
|
-
_context3.next = 9;
|
266
|
-
return topoService.getAlarmByIds(parms);
|
267
|
-
|
268
|
-
case 9:
|
269
|
-
result = _context3.sent;
|
270
|
-
rlog.debug('getAlarmById-result', result); // if (alarmIsOpened) {
|
271
|
-
// //this.topo.loadAlarm(result.datas);
|
272
|
-
// this.handleAlarmEvent({ type: "alarm", data: result.datas });
|
273
|
-
// }
|
274
|
-
// this.updateState({
|
275
|
-
// alarmData: result.datas.length > 0 ? result.datas : [],
|
276
|
-
// alarmPanelIsOpen: result.datas.length > 0,
|
277
|
-
// });
|
278
|
-
|
279
|
-
case 11:
|
280
|
-
case "end":
|
281
|
-
return _context3.stop();
|
282
|
-
}
|
283
|
-
}, _callee3, this);
|
284
|
-
}));
|
285
|
-
|
286
|
-
function hmGetTopoAlarm(_x2) {
|
287
|
-
return _hmGetTopoAlarm.apply(this, arguments);
|
288
|
-
}
|
289
|
-
|
290
|
-
return hmGetTopoAlarm;
|
291
213
|
}()
|
292
214
|
/**
|
293
215
|
* 直接装载告警数据(可装载mock列表)
|
@@ -298,9 +220,9 @@ var Alarm = /*#__PURE__*/function () {
|
|
298
220
|
_proto.setAlarmDataByMock =
|
299
221
|
/*#__PURE__*/
|
300
222
|
function () {
|
301
|
-
var _setAlarmDataByMock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
302
|
-
return _regeneratorRuntime.wrap(function
|
303
|
-
while (1) switch (
|
223
|
+
var _setAlarmDataByMock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(datas) {
|
224
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
225
|
+
while (1) switch (_context3.prev = _context3.next) {
|
304
226
|
case 0:
|
305
227
|
this.updateState({
|
306
228
|
alarmData: datas.length > 0 ? datas : [],
|
@@ -309,12 +231,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
309
231
|
|
310
232
|
case 1:
|
311
233
|
case "end":
|
312
|
-
return
|
234
|
+
return _context3.stop();
|
313
235
|
}
|
314
|
-
},
|
236
|
+
}, _callee3, this);
|
315
237
|
}));
|
316
238
|
|
317
|
-
function setAlarmDataByMock(
|
239
|
+
function setAlarmDataByMock(_x2) {
|
318
240
|
return _setAlarmDataByMock.apply(this, arguments);
|
319
241
|
}
|
320
242
|
|
@@ -329,10 +251,10 @@ var Alarm = /*#__PURE__*/function () {
|
|
329
251
|
_proto.switchAlarmPopPanel =
|
330
252
|
/*#__PURE__*/
|
331
253
|
function () {
|
332
|
-
var _switchAlarmPopPanel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
254
|
+
var _switchAlarmPopPanel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(flag) {
|
333
255
|
var topoDispatchers;
|
334
|
-
return _regeneratorRuntime.wrap(function
|
335
|
-
while (1) switch (
|
256
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
257
|
+
while (1) switch (_context4.prev = _context4.next) {
|
336
258
|
case 0:
|
337
259
|
// console.log("switchAlarmPopPanel", flag);
|
338
260
|
topoDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
@@ -342,12 +264,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
342
264
|
|
343
265
|
case 2:
|
344
266
|
case "end":
|
345
|
-
return
|
267
|
+
return _context4.stop();
|
346
268
|
}
|
347
|
-
},
|
269
|
+
}, _callee4, this);
|
348
270
|
}));
|
349
271
|
|
350
|
-
function switchAlarmPopPanel(
|
272
|
+
function switchAlarmPopPanel(_x3) {
|
351
273
|
return _switchAlarmPopPanel.apply(this, arguments);
|
352
274
|
}
|
353
275
|
|
@@ -363,21 +285,21 @@ var Alarm = /*#__PURE__*/function () {
|
|
363
285
|
_proto.openTopoAlarm =
|
364
286
|
/*#__PURE__*/
|
365
287
|
function () {
|
366
|
-
var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
288
|
+
var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
|
367
289
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
368
290
|
|
369
|
-
return _regeneratorRuntime.wrap(function
|
370
|
-
while (1) switch (
|
291
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
292
|
+
while (1) switch (_context5.prev = _context5.next) {
|
371
293
|
case 0:
|
372
294
|
// 如果当前拓扑图开启中或已开启则退出
|
373
295
|
_this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
|
374
296
|
|
375
297
|
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
376
|
-
|
298
|
+
_context5.next = 3;
|
377
299
|
break;
|
378
300
|
}
|
379
301
|
|
380
|
-
return
|
302
|
+
return _context5.abrupt("return");
|
381
303
|
|
382
304
|
case 3:
|
383
305
|
this.currentTopoId = id;
|
@@ -385,27 +307,27 @@ var Alarm = /*#__PURE__*/function () {
|
|
385
307
|
alarmOpening: true
|
386
308
|
});
|
387
309
|
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
388
|
-
|
310
|
+
_context5.next = 8;
|
389
311
|
return alarmDispatchers.resetAlarmDoc();
|
390
312
|
|
391
313
|
case 8:
|
392
|
-
|
393
|
-
|
314
|
+
_context5.prev = 8;
|
315
|
+
_context5.next = 11;
|
394
316
|
return this.topo.serverApi.openTopoAlarm(id);
|
395
317
|
|
396
318
|
case 11:
|
397
|
-
this.secretKey =
|
319
|
+
this.secretKey = _context5.sent;
|
398
320
|
rlog.info('openTopoAlarm 打开拓扑告警推送-------------------开始');
|
399
321
|
this.updateState({
|
400
322
|
alarmOpening: false,
|
401
323
|
alarmIsOpened: true
|
402
324
|
});
|
403
|
-
|
325
|
+
_context5.next = 20;
|
404
326
|
break;
|
405
327
|
|
406
328
|
case 16:
|
407
|
-
|
408
|
-
|
329
|
+
_context5.prev = 16;
|
330
|
+
_context5.t0 = _context5["catch"](8);
|
409
331
|
rlog.error('打开拓扑告警推送 失败');
|
410
332
|
this.updateState({
|
411
333
|
alarmOpening: false
|
@@ -413,12 +335,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
413
335
|
|
414
336
|
case 20:
|
415
337
|
case "end":
|
416
|
-
return
|
338
|
+
return _context5.stop();
|
417
339
|
}
|
418
|
-
},
|
340
|
+
}, _callee5, this, [[8, 16]]);
|
419
341
|
}));
|
420
342
|
|
421
|
-
function openTopoAlarm(
|
343
|
+
function openTopoAlarm(_x4) {
|
422
344
|
return _openTopoAlarm.apply(this, arguments);
|
423
345
|
}
|
424
346
|
|
@@ -434,21 +356,21 @@ var Alarm = /*#__PURE__*/function () {
|
|
434
356
|
_proto.closeTopoAlarm =
|
435
357
|
/*#__PURE__*/
|
436
358
|
function () {
|
437
|
-
var _closeTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
359
|
+
var _closeTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
|
438
360
|
var _this$getState3, alarmIsOpened, alarmOpening;
|
439
361
|
|
440
|
-
return _regeneratorRuntime.wrap(function
|
441
|
-
while (1) switch (
|
362
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
363
|
+
while (1) switch (_context6.prev = _context6.next) {
|
442
364
|
case 0:
|
443
365
|
// 如果未开启则退出
|
444
366
|
_this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
|
445
367
|
|
446
368
|
if (!(!alarmIsOpened && !alarmOpening)) {
|
447
|
-
|
369
|
+
_context6.next = 3;
|
448
370
|
break;
|
449
371
|
}
|
450
372
|
|
451
|
-
return
|
373
|
+
return _context6.abrupt("return");
|
452
374
|
|
453
375
|
case 3:
|
454
376
|
this.currentTopoId = null;
|
@@ -458,17 +380,17 @@ var Alarm = /*#__PURE__*/function () {
|
|
458
380
|
alarmOpening: false,
|
459
381
|
alarmPanelIsOpen: false
|
460
382
|
});
|
461
|
-
|
383
|
+
_context6.next = 8;
|
462
384
|
return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
|
463
385
|
|
464
386
|
case 8:
|
465
387
|
case "end":
|
466
|
-
return
|
388
|
+
return _context6.stop();
|
467
389
|
}
|
468
|
-
},
|
390
|
+
}, _callee6, this);
|
469
391
|
}));
|
470
392
|
|
471
|
-
function closeTopoAlarm(
|
393
|
+
function closeTopoAlarm(_x5) {
|
472
394
|
return _closeTopoAlarm.apply(this, arguments);
|
473
395
|
}
|
474
396
|
|
@@ -493,20 +415,20 @@ var Alarm = /*#__PURE__*/function () {
|
|
493
415
|
_proto.restart =
|
494
416
|
/*#__PURE__*/
|
495
417
|
function () {
|
496
|
-
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
418
|
+
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
497
419
|
var id;
|
498
|
-
return _regeneratorRuntime.wrap(function
|
499
|
-
while (1) switch (
|
420
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
421
|
+
while (1) switch (_context7.prev = _context7.next) {
|
500
422
|
case 0:
|
501
423
|
id = this.currentTopoId;
|
502
|
-
|
424
|
+
_context7.next = 3;
|
503
425
|
return this.openTopoAlarm(id);
|
504
426
|
|
505
427
|
case 3:
|
506
428
|
case "end":
|
507
|
-
return
|
429
|
+
return _context7.stop();
|
508
430
|
}
|
509
|
-
},
|
431
|
+
}, _callee7, this);
|
510
432
|
}));
|
511
433
|
|
512
434
|
function restart() {
|
@@ -523,26 +445,28 @@ var Alarm = /*#__PURE__*/function () {
|
|
523
445
|
_proto.handleAlarmEvent =
|
524
446
|
/*#__PURE__*/
|
525
447
|
function () {
|
526
|
-
var _handleAlarmEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
448
|
+
var _handleAlarmEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(alertData) {
|
527
449
|
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche2, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
|
528
450
|
|
529
|
-
return _regeneratorRuntime.wrap(function
|
530
|
-
while (1) switch (
|
451
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
452
|
+
while (1) switch (_context8.prev = _context8.next) {
|
531
453
|
case 0:
|
532
454
|
_this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
|
533
455
|
resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
|
534
456
|
resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
|
535
457
|
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm'); // 添加事件
|
536
|
-
|
458
|
+
|
459
|
+
console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
|
537
460
|
|
538
461
|
if (!(isAvailableArray(alertData) && isAvailableArray(resIdsList))) {
|
539
|
-
|
462
|
+
_context8.next = 27;
|
540
463
|
break;
|
541
464
|
}
|
542
465
|
|
543
466
|
sendAl = [];
|
544
467
|
idsList = [].concat(nodeIdsList, linkIdsList);
|
545
468
|
operations = [];
|
469
|
+
console.log('idsList---------', idsList);
|
546
470
|
idsList.forEach(function (idItem) {
|
547
471
|
if (idItem.operation === null) {
|
548
472
|
operations.push(idItem.ciId);
|
@@ -552,6 +476,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
552
476
|
var _item$resourceId;
|
553
477
|
|
554
478
|
var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
|
479
|
+
var isSub = false;
|
555
480
|
var obj = {
|
556
481
|
id: ciId,
|
557
482
|
level: item.alertLevel,
|
@@ -560,28 +485,30 @@ var Alarm = /*#__PURE__*/function () {
|
|
560
485
|
obj: item,
|
561
486
|
info: item.alertType,
|
562
487
|
ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
|
563
|
-
ruleId: item === null || item === void 0 ? void 0 : item.ruleId
|
488
|
+
ruleId: item === null || item === void 0 ? void 0 : item.ruleId,
|
489
|
+
isSub: isSub
|
564
490
|
};
|
565
491
|
|
566
492
|
if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
|
567
493
|
sendAl.push(obj);
|
568
494
|
}
|
569
|
-
});
|
495
|
+
});
|
496
|
+
console.log("before-combAlarmData", sendAl, idsList);
|
570
497
|
|
571
498
|
if (!(sendAl.length > 0)) {
|
572
|
-
|
499
|
+
_context8.next = 27;
|
573
500
|
break;
|
574
501
|
}
|
575
502
|
|
576
503
|
rlog.debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
|
577
|
-
|
578
|
-
|
504
|
+
_context8.prev = 15;
|
505
|
+
_context8.next = 18;
|
579
506
|
return alarmDispatchers.combAlarmData({
|
580
507
|
alarmdata: sendAl
|
581
508
|
});
|
582
509
|
|
583
|
-
case
|
584
|
-
_yield$alarmDispatche2 =
|
510
|
+
case 18:
|
511
|
+
_yield$alarmDispatche2 = _context8.sent;
|
585
512
|
eqFlag = _yield$alarmDispatche2.eqFlag;
|
586
513
|
alarmlist = _yield$alarmDispatche2.alarmlist;
|
587
514
|
|
@@ -601,22 +528,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
601
528
|
}
|
602
529
|
}
|
603
530
|
|
604
|
-
|
531
|
+
_context8.next = 27;
|
605
532
|
break;
|
606
533
|
|
607
|
-
case 21:
|
608
|
-
_context9.prev = 21;
|
609
|
-
_context9.t0 = _context9["catch"](12);
|
610
|
-
rlog.error('告警发送异常', _context9.t0);
|
611
|
-
|
612
534
|
case 24:
|
535
|
+
_context8.prev = 24;
|
536
|
+
_context8.t0 = _context8["catch"](15);
|
537
|
+
rlog.error('告警发送异常', _context8.t0);
|
538
|
+
|
539
|
+
case 27:
|
613
540
|
case "end":
|
614
|
-
return
|
541
|
+
return _context8.stop();
|
615
542
|
}
|
616
|
-
},
|
543
|
+
}, _callee8, this, [[15, 24]]);
|
617
544
|
}));
|
618
545
|
|
619
|
-
function handleAlarmEvent(
|
546
|
+
function handleAlarmEvent(_x6) {
|
620
547
|
return _handleAlarmEvent.apply(this, arguments);
|
621
548
|
}
|
622
549
|
|