@riil-frontend/component-topology 9.0.0-a.10 → 9.0.0-a.12

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.
Files changed (50) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +17 -17
  5. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  6. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  7. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  8. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  9. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  10. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  11. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  12. package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
  13. package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +61 -0
  14. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +27 -8
  15. package/es/core/hooks/useTopoEdit.js +133 -16
  16. package/es/core/models/TopoApp.js +1 -1
  17. package/es/core/models/utils/linkUtils.js +18 -0
  18. package/es/core/store/models/topoConfig.js +36 -7
  19. package/es/core/test/Test.js +52 -0
  20. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +7 -78
  21. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -37
  22. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
  23. package/es/networkTopo/services/link.js +1 -1
  24. package/es/networkTopo/services/topo/basic.js +4 -3
  25. package/es/networkTopo/services/topo/networkLink.js +45 -3
  26. package/es/networkTopo/utils/exitLinkUtil.js +110 -0
  27. package/es/utils/htElementUtils.js +43 -21
  28. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  29. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  30. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  31. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  32. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  33. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  34. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  35. package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
  36. package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +74 -0
  37. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +28 -8
  38. package/lib/core/hooks/useTopoEdit.js +133 -15
  39. package/lib/core/models/TopoApp.js +1 -1
  40. package/lib/core/models/utils/linkUtils.js +21 -1
  41. package/lib/core/store/models/topoConfig.js +37 -7
  42. package/lib/core/test/Test.js +52 -0
  43. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +6 -78
  44. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -36
  45. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
  46. package/lib/networkTopo/services/topo/basic.js +5 -3
  47. package/lib/networkTopo/services/topo/networkLink.js +45 -3
  48. package/lib/networkTopo/utils/exitLinkUtil.js +115 -0
  49. package/lib/utils/htElementUtils.js +45 -21
  50. package/package.json +2 -2
@@ -37,6 +37,8 @@ var _htElementDataUtil = require("../../utils/htElementDataUtil");
37
37
 
38
38
  var _clusterUtil = require("../../utils/clusterUtil");
39
39
 
40
+ var _linkUtils = require("../models/utils/linkUtils");
41
+
40
42
  var useTopoEdit = function useTopoEdit(params) {
41
43
  var topo = params.topo,
42
44
  topoId = params.topoId,
@@ -342,7 +344,7 @@ var useTopoEdit = function useTopoEdit(params) {
342
344
 
343
345
  edges.map(function (edge) {
344
346
  if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
345
- // exLink.push(edge);
347
+ // exLink.push(edge);
346
348
  topo.getGraphView().dm().remove(edge);
347
349
  exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
348
350
  }
@@ -406,8 +408,8 @@ var useTopoEdit = function useTopoEdit(params) {
406
408
  };
407
409
  /**
408
410
  * 获得未存在的连线元素
409
- * @param {*} elements
410
- * @returns
411
+ * @param {*} elements
412
+ * @returns
411
413
  */
412
414
 
413
415
 
@@ -420,8 +422,8 @@ var useTopoEdit = function useTopoEdit(params) {
420
422
  }
421
423
  /**
422
424
  * 获得未存在的元素
423
- * @param {Array} elements
424
- * @returns
425
+ * @param {Array} elements
426
+ * @returns
425
427
  */
426
428
 
427
429
 
@@ -600,7 +602,7 @@ var useTopoEdit = function useTopoEdit(params) {
600
602
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
601
603
  newElements = findUNExistedElements(elements);
602
604
 
603
- _rlog["default"].debug('添加分层资源', {
605
+ _rlog["default"].debug("添加分层资源", {
604
606
  layer: group,
605
607
  newElements: newElements
606
608
  });
@@ -674,8 +676,8 @@ var useTopoEdit = function useTopoEdit(params) {
674
676
  }
675
677
  /**
676
678
  * 未选中元素添加资源
677
- *
678
- * @param {*} data
679
+ *
680
+ * @param {*} data
679
681
  */
680
682
 
681
683
 
@@ -835,7 +837,7 @@ var useTopoEdit = function useTopoEdit(params) {
835
837
  newLinkElements = findUNExistedLinkElements(elements);
836
838
  createElementsData = null;
837
839
 
838
- if (newData.type === 'group') {
840
+ if (newData.type === "group") {
839
841
  groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
840
842
  newGroupChildren = [];
841
843
  existedGroupChildren = [];
@@ -852,10 +854,10 @@ var useTopoEdit = function useTopoEdit(params) {
852
854
  groups: [newData],
853
855
  nodes: newGroupChildren,
854
856
  links: newLinkElements.filter(function (item) {
855
- return item.type === 'link';
857
+ return item.type === "link";
856
858
  }),
857
859
  linkGroups: newLinkElements.filter(function (item) {
858
- return item.type === 'linkGroup';
860
+ return item.type === "linkGroup";
859
861
  })
860
862
  };
861
863
  htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
@@ -870,16 +872,16 @@ var useTopoEdit = function useTopoEdit(params) {
870
872
  groups: [],
871
873
  nodes: [newData],
872
874
  links: newLinkElements.filter(function (item) {
873
- return item.type === 'link';
875
+ return item.type === "link";
874
876
  }),
875
877
  linkGroups: newLinkElements.filter(function (item) {
876
- return item.type === 'linkGroup';
878
+ return item.type === "linkGroup";
877
879
  })
878
880
  };
879
881
  htTopo.createElements(createElementsData);
880
882
  }
881
883
 
882
- _rlog["default"].debug('批量创建元素', createElementsData); // 恢复图标、大小、位置
884
+ _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
883
885
 
884
886
 
885
887
  newElement = dm.getDataByTag(newData.id);
@@ -999,6 +1001,117 @@ var useTopoEdit = function useTopoEdit(params) {
999
1001
  return _ref8.apply(this, arguments);
1000
1002
  };
1001
1003
  }();
1004
+ /**
1005
+ * 关联IP的图片节点
1006
+ */
1007
+
1008
+
1009
+ function relateNodeIp(_x15, _x16) {
1010
+ return _relateNodeIp.apply(this, arguments);
1011
+ }
1012
+
1013
+ function _relateNodeIp() {
1014
+ _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
1015
+ var dm, htTopo, elements, _yield$editDispatcher5, elementDatas, isUnique, ipTxt, ids, ip, re, config, linksData, createElementsData;
1016
+
1017
+ return _regenerator["default"].wrap(function _callee16$(_context16) {
1018
+ while (1) {
1019
+ switch (_context16.prev = _context16.next) {
1020
+ case 0:
1021
+ // console.log("bindIPtoNode", data);
1022
+ // 根据配置查询拓扑数据
1023
+ dm = topo.getDataModel();
1024
+ htTopo = topo.getHtTopo();
1025
+ elements = (0, _htElementUtils.getNodes)(dm);
1026
+ _context16.next = 5;
1027
+ return editDispatchers.fetchDataByConfig();
1028
+
1029
+ case 5:
1030
+ _yield$editDispatcher5 = _context16.sent;
1031
+ elementDatas = _yield$editDispatcher5.elementDatas;
1032
+ console.log("bindIPtoNode", txtValue, nodeElement, elements);
1033
+ console.log("elementDatas", elementDatas);
1034
+ isUnique = true;
1035
+ ipTxt = txtValue;
1036
+ ids = []; // 执行唯一性验证
1037
+
1038
+ elements.map(function (element) {
1039
+ // if (node.getId() !== element.getId()) {
1040
+ // }
1041
+ if (element.getTag()) {
1042
+ ids.push(element.getTag());
1043
+ }
1044
+ });
1045
+ ip = {
1046
+ id: "ip_1.1.1.1",
1047
+ name: "1.1.1.1",
1048
+ customName: null,
1049
+ // 'groupId': null,
1050
+ // 'groupTag': null,
1051
+ ipAddress: "1.1.1.1",
1052
+ // 'attributes': [],
1053
+ // 'metrics': [],
1054
+ type: "node" // 'dtype': 'device'
1055
+
1056
+ }; // 获取关联链路
1057
+
1058
+ if (!isUnique) {
1059
+ _context16.next = 27;
1060
+ break;
1061
+ }
1062
+
1063
+ nodeElement.a(ip);
1064
+ nodeElement.setName(txtValue);
1065
+ nodeElement.a("name", txtValue);
1066
+ nodeElement.a("customName", null);
1067
+ nodeElement.setTag("ip_" + txtValue);
1068
+ _context16.next = 22;
1069
+ return editDispatchers.queryAllLinkByIp({
1070
+ ids: ids,
1071
+ ip: txtValue
1072
+ });
1073
+
1074
+ case 22:
1075
+ re = _context16.sent;
1076
+ console.log("queryAllLinkByIp", re);
1077
+ config = resourceConfig.getConfig();
1078
+ console.log("resourceConfig.getConfig", config);
1079
+
1080
+ if (re && re.length > 0) {
1081
+ linksData = [];
1082
+ re.map(function (link) {
1083
+ var sourceId = link.attributes["network_link.source_device_id"];
1084
+ var source = dm.getDataByTag(sourceId);
1085
+ var target = nodeElement; // console.log("source, nodeElement, link", source, target, link);
1086
+
1087
+ if (source && target) {
1088
+ var linkData = (0, _linkUtils.mergeExportLinkData)({
1089
+ source: source,
1090
+ target: target,
1091
+ link: link
1092
+ });
1093
+ console.log("linkData", linkData);
1094
+ linksData.push(linkData); // htTopo.createEdge(source, target, link);
1095
+ }
1096
+ });
1097
+ createElementsData = {
1098
+ groups: [],
1099
+ nodes: [],
1100
+ links: [].concat(linksData),
1101
+ linkGroups: []
1102
+ };
1103
+ htTopo.createElements(createElementsData); // htTopo.addElements({ lines: [...re] });
1104
+ }
1105
+
1106
+ case 27:
1107
+ case "end":
1108
+ return _context16.stop();
1109
+ }
1110
+ }
1111
+ }, _callee16);
1112
+ }));
1113
+ return _relateNodeIp.apply(this, arguments);
1114
+ }
1002
1115
 
1003
1116
  var onEvent = function onEvent(e) {
1004
1117
  var map = {};
@@ -1016,7 +1129,7 @@ var useTopoEdit = function useTopoEdit(params) {
1016
1129
  */
1017
1130
 
1018
1131
  var setViewMouseMode = function setViewMouseMode(mode) {
1019
- _rlog["default"].debug('设置视图鼠标模式', mode);
1132
+ _rlog["default"].debug("设置视图鼠标模式", mode);
1020
1133
 
1021
1134
  topo.getHtTopo().setViewMouseMode(mode);
1022
1135
  topoEditDispatchers.update({
@@ -1095,6 +1208,11 @@ var useTopoEdit = function useTopoEdit(params) {
1095
1208
  */
1096
1209
  onDeleteElement: onDeleteElement,
1097
1210
 
1211
+ /**
1212
+ * 绑定图片ip
1213
+ */
1214
+ relateNodeIp: relateNodeIp,
1215
+
1098
1216
  /**
1099
1217
  * 拓扑图保存回调
1100
1218
  */
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
56
56
  var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
57
57
 
58
58
  // eslint-disable-next-line no-undef
59
- var version = typeof "9.0.0-a.10" === 'string' ? "9.0.0-a.10" : null;
59
+ var version = typeof "9.0.0-a.12" === 'string' ? "9.0.0-a.12" : null;
60
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
61
61
  /**
62
62
  * 拓扑显示和编辑
@@ -8,6 +8,7 @@ exports.compatibleWith = void 0;
8
8
  exports.getLinksDetail = getLinksDetail;
9
9
  exports.isCrucialLink = isCrucialLink;
10
10
  exports.isExitLink = isExitLink;
11
+ exports.mergeExportLinkData = void 0;
11
12
  exports.mergeLinksData = mergeLinksData;
12
13
  exports.showLinkByConfig = exports.plurals = void 0;
13
14
 
@@ -218,4 +219,23 @@ var showLinkByConfig = function showLinkByConfig(props) {
218
219
  }
219
220
  };
220
221
 
221
- exports.showLinkByConfig = showLinkByConfig;
222
+ exports.showLinkByConfig = showLinkByConfig;
223
+
224
+ var mergeExportLinkData = function mergeExportLinkData(props) {
225
+ var source = props.source,
226
+ target = props.target,
227
+ link = props.link;
228
+ var attrObj = link.attributes;
229
+ var linkData = (0, _extends2["default"])({}, link, {
230
+ name: attrObj.name,
231
+ source: attrObj["network_link.source_device_id"],
232
+ target: attrObj.destination_type === 'ip' ? target.getTag() : attrObj["network_link.destination_device_id"],
233
+ operation: attrObj.operation,
234
+ interfaceSource: attrObj["source_id"],
235
+ interfaceTarget: attrObj["destination_id"],
236
+ ciType: link.typeCode
237
+ });
238
+ return linkData;
239
+ };
240
+
241
+ exports.mergeExportLinkData = mergeExportLinkData;
@@ -27,6 +27,8 @@ var _topoData = require("../../../utils/topoData");
27
27
 
28
28
  var _topoData2 = require("../../../core/models/topoData");
29
29
 
30
+ var _networkLink = _interopRequireDefault(require("../../../networkTopo/services/topo/networkLink"));
31
+
30
32
  var _getTopoData = require("../../../networkTopo/getTopoData");
31
33
 
32
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -264,19 +266,20 @@ function _default(topoApp) {
264
266
  var _this2 = this;
265
267
 
266
268
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
267
- var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
269
+ var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, _editState$ipNodes, ipNodes, query, data;
268
270
 
269
271
  return _regenerator["default"].wrap(function _callee2$(_context2) {
270
272
  while (1) {
271
273
  switch (_context2.prev = _context2.next) {
272
274
  case 0:
273
275
  editState = rootState.topoConfig;
274
- resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink;
276
+ resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink, _editState$ipNodes = editState.ipNodes, ipNodes = _editState$ipNodes === void 0 ? [] : _editState$ipNodes;
275
277
  query = {
276
278
  id: rootState.topoMod.topoId,
277
279
  resources: resources,
278
280
  groups: groups,
279
- exportLinkIdList: exportLinkIdList
281
+ exportLinkIdList: exportLinkIdList,
282
+ ipNodes: ipNodes
280
283
  };
281
284
  _context2.next = 5;
282
285
  return _this2.getTopoByConditions(query);
@@ -330,14 +333,14 @@ function _default(topoApp) {
330
333
  var _this4 = this;
331
334
 
332
335
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
333
- var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
336
+ var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
334
337
 
335
338
  return _regenerator["default"].wrap(function _callee4$(_context4) {
336
339
  while (1) {
337
340
  switch (_context4.prev = _context4.next) {
338
341
  case 0:
339
342
  // rlog.debug("getTopoByConditions--------", params);
340
- topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
343
+ topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
341
344
  viewConditions = (0, _topoData2.resToConditions)(resources);
342
345
  groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
343
346
  return (0, _extends2["default"])({}, group, {
@@ -347,7 +350,7 @@ function _default(topoApp) {
347
350
  }); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
348
351
 
349
352
  _context4.next = 5;
350
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
353
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
351
354
 
352
355
  case 5:
353
356
  data = _context4.sent;
@@ -416,7 +419,7 @@ function _default(topoApp) {
416
419
  }))
417
420
  };
418
421
 
419
- _rlog["default"].debug('saveGlobalConfig', config);
422
+ _rlog["default"].debug("saveGlobalConfig", config);
420
423
 
421
424
  _context5.next = 5;
422
425
  return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
@@ -485,6 +488,33 @@ function _default(topoApp) {
485
488
  switchToViewMode: function switchToViewMode() {
486
489
  this.reset();
487
490
  dispatch.topoMod.switchToViewMode();
491
+ },
492
+ queryAllLinkByIp: function queryAllLinkByIp(data) {
493
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
494
+ var _result$data;
495
+
496
+ var ids, ip, result;
497
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
498
+ while (1) {
499
+ switch (_context8.prev = _context8.next) {
500
+ case 0:
501
+ ids = data.ids, ip = data.ip;
502
+ console.log("queryAllLinkByIp", ids, ip);
503
+ _context8.next = 4;
504
+ return _networkLink["default"].queryLinksByIp(ids, ip);
505
+
506
+ case 4:
507
+ result = _context8.sent;
508
+ console.log("queryAllLinkByIp-result", result);
509
+ return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
510
+
511
+ case 7:
512
+ case "end":
513
+ return _context8.stop();
514
+ }
515
+ }
516
+ }, _callee8);
517
+ }))();
488
518
  }
489
519
  };
490
520
  }
@@ -27,6 +27,58 @@ var Test = /*#__PURE__*/function () {
27
27
  _proto.onReady = function onReady() {// TODO 待移除测试代码
28
28
  // this.iconManage.openUpload()
29
29
  // this.topo.store.getModelDispatchers('linkDynamicStyleConfig').open({type: 'networkLink'});
30
+ }
31
+ /**
32
+ * 关联IP示例代码
33
+ */
34
+ ;
35
+
36
+ _proto.createExportLink = function createExportLink() {
37
+ var htTopo = this.topo.getHtTopo();
38
+ var dm = htTopo.getGraphView().dm(); // 设置节点关联IP
39
+
40
+ var nodeElement = htTopo.getGraphView().sm().fd();
41
+ var ip = {
42
+ 'id': 'ip_1.1.1.1',
43
+ 'name': '1.1.1.1',
44
+ customName: null,
45
+ // 'groupId': null,
46
+ // 'groupTag': null,
47
+ 'ipAddress': '1.1.1.1',
48
+ // 'attributes': [],
49
+ // 'metrics': [],
50
+ 'type': 'node' // 'dtype': 'device'
51
+
52
+ };
53
+ nodeElement.a(ip);
54
+ nodeElement.setTag('ip_1.1.1.1');
55
+ var link = {
56
+ 'id': '0000000019b462d1',
57
+ 'name': '172.17.160.116(Gi2/2/0/1) - 172.27.130.13(Gi 0/9)',
58
+ 'source': '00000000029f9411',
59
+ 'target': 'ip_1.1.1.1',
60
+ 'operation': 'delete',
61
+ 'interfaceSource': '0000000018080aee',
62
+ 'interfaceTarget': '000000000341b015',
63
+ 'ciType': 'network_link',
64
+ 'attributes': [],
65
+ 'manageStatus': 0,
66
+ 'permission': {
67
+ 'readable': true,
68
+ 'writeable': true,
69
+ 'deleteable': true
70
+ },
71
+ 'metrics': [],
72
+ 'type': 'link',
73
+ 'dtype': 'link'
74
+ };
75
+ var createElementsData = {
76
+ groups: [],
77
+ nodes: [],
78
+ links: [link],
79
+ linkGroups: []
80
+ };
81
+ htTopo.createElements(createElementsData);
30
82
  };
31
83
 
32
84
  return Test;
@@ -53,8 +53,6 @@ var _LinkTopoCard = _interopRequireDefault(require("./components/LinkTopo/LinkTo
53
53
 
54
54
  var _EventsCard = _interopRequireDefault(require("./EventsCard"));
55
55
 
56
- var _services2 = require("./components/LinkTopo/services");
57
-
58
56
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
59
57
 
60
58
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -726,7 +724,7 @@ function ResourceOverview(props) {
726
724
  _metricColChange = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(col) {
727
725
  var _col2, _col3;
728
726
 
729
- var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
727
+ var codes, endTime, params, _ref5, times, metricList, metricLists;
730
728
 
731
729
  return _regenerator["default"].wrap(function _callee8$(_context8) {
732
730
  while (1) {
@@ -774,16 +772,7 @@ function ResourceOverview(props) {
774
772
 
775
773
  case 11:
776
774
  metricList = _context8.sent;
777
- _context8.next = 14;
778
- return queryMetricList({
779
- 'name': data.attributes.display_name
780
- }, {
781
- 'id': data.attributes.name
782
- });
783
-
784
- case 14:
785
- newMetricList = _context8.sent;
786
- metricLists = metricList.concat(getNewMetricList(newMetricList));
775
+ metricLists = metricList.concat(getNewMetricList());
787
776
 
788
777
  _rlog.rlog.debug('metricColChange', metricLists, monitorMetricModels);
789
778
 
@@ -811,7 +800,7 @@ function ResourceOverview(props) {
811
800
  }, 60000);
812
801
  }
813
802
 
814
- case 20:
803
+ case 17:
815
804
  case "end":
816
805
  return _context8.stop();
817
806
  }
@@ -821,73 +810,12 @@ function ResourceOverview(props) {
821
810
  return _metricColChange.apply(this, arguments);
822
811
  }
823
812
 
824
- function queryMetricList(_x9, _x10) {
825
- return _queryMetricList.apply(this, arguments);
826
- }
827
-
828
- function _queryMetricList() {
829
- _queryMetricList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data, param) {
830
- var checkMenus, isOpen, list;
831
- return _regenerator["default"].wrap(function _callee9$(_context9) {
832
- while (1) {
833
- switch (_context9.prev = _context9.next) {
834
- case 0:
835
- if (!(ciType !== 'network_link')) {
836
- _context9.next = 2;
837
- break;
838
- }
839
-
840
- return _context9.abrupt("return", []);
841
-
842
- case 2:
843
- _context9.next = 4;
844
- return (0, _services2.checkMenu)();
845
-
846
- case 4:
847
- checkMenus = _context9.sent;
848
-
849
- if (!(checkMenus[0].passed == 'PASS')) {
850
- _context9.next = 14;
851
- break;
852
- }
853
-
854
- _context9.next = 8;
855
- return (0, _services2.isOpenFlow)(data);
856
-
857
- case 8:
858
- isOpen = _context9.sent;
859
-
860
- if (!isOpen) {
861
- _context9.next = 14;
862
- break;
863
- }
864
-
865
- _context9.next = 12;
866
- return (0, _services2.queryLastestValue)(param);
867
-
868
- case 12:
869
- list = _context9.sent;
870
- return _context9.abrupt("return", list);
871
-
872
- case 14:
873
- return _context9.abrupt("return", []);
874
-
875
- case 15:
876
- case "end":
877
- return _context9.stop();
878
- }
879
- }
880
- }, _callee9);
881
- }));
882
- return _queryMetricList.apply(this, arguments);
883
- }
884
-
885
- var getNewMetricList = function getNewMetricList(data) {
813
+ var getNewMetricList = function getNewMetricList() {
886
814
  return [{
887
815
  errorMsg: null,
888
816
  mainCiId: "netDelayRatio",
889
817
  metricCode: "netDelayRatio",
890
- metricValue: data.upNetDelayRatio + ' ms' + '|' + data.downNetDelayRatio + ' ms',
818
+ metricValue: '0',
891
819
  subCiId: '',
892
820
  subCiType: null,
893
821
  mainCiType: null
@@ -895,7 +823,7 @@ function ResourceOverview(props) {
895
823
  errorMsg: null,
896
824
  mainCiId: "retansRatio",
897
825
  metricCode: "retansRatio",
898
- metricValue: data.upRetransRatio + ' %' + '|' + data.downRetansRatio + ' %',
826
+ metricValue: '0',
899
827
  subCiId: '',
900
828
  subCiType: null,
901
829
  mainCiType: null
@@ -25,10 +25,10 @@ function useMetricPolling(_ref) {
25
25
  linkMetricCodes = _ref.linkMetricCodes;
26
26
  var linkId = linkCi.id;
27
27
  var arr = ['netDelayRatio', 'retansRatio'];
28
- var oldCodes = [];
29
- var newCodes = [];
28
+ var codes = [];
29
+ var retansRatioNetDelayRatioCodes = [];
30
30
  linkMetricCodes.map(function (item) {
31
- arr.indexOf(item) > -1 ? newCodes.push(item) : oldCodes.push(item);
31
+ arr.indexOf(item) > -1 ? retansRatioNetDelayRatioCodes.push(item) : codes.push(item);
32
32
  });
33
33
 
34
34
  var _useState = (0, _react.useState)({
@@ -42,35 +42,15 @@ function useMetricPolling(_ref) {
42
42
  data = _useState[0],
43
43
  setData = _useState[1];
44
44
 
45
- var queryLastestValues = (0, _ahooks.useRequest)(_services.queryLastestValue, {
45
+ var queryLastestValues = (0, _ahooks.useRequest)(_services.queryRetansRatioNetDelayRatio, {
46
46
  pollingInterval: 1000 * 15,
47
47
  pollingWhenHidden: false,
48
48
  debounceInterval: 200,
49
49
  manual: true,
50
50
  onSuccess: function onSuccess(result) {
51
- var datas = {
52
- linkOther: []
53
- };
54
-
55
- if (newCodes.includes('netDelayRatio')) {
56
- datas.linkOther.push({
57
- 'code': 'netDelayRatio',
58
- 'name': '下行RTT时延',
59
- 'ts': result.time,
60
- 'value': result.upNetDelayRatio + ' ms' + '|' + result.downNetDelayRatio + ' ms'
61
- });
62
- }
63
-
64
- if (newCodes.includes('retansRatio')) {
65
- datas.linkOther.push({
66
- 'code': 'retansRatio',
67
- 'name': '重传率',
68
- 'ts': result.time,
69
- 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
70
- });
71
- }
72
-
73
- setData((0, _extends2["default"])({}, data, datas));
51
+ setData((0, _extends2["default"])({}, data, {
52
+ linkOther: result
53
+ }));
74
54
  }
75
55
  }); // 轮询hooks
76
56
 
@@ -96,27 +76,38 @@ function useMetricPolling(_ref) {
96
76
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
97
77
  }
98
78
  });
99
- var linkMetricCodesStr = oldCodes.map(function (item) {
79
+ var linkMetricCodesStr = codes.map(function (item) {
100
80
  return item;
101
81
  }).sort().join(',');
102
82
  (0, _react.useEffect)(function () {
103
83
  if (linkId) {
104
84
  _rlog["default"].info('链路拓扑指标轮询 切换', {
105
85
  linkCi: linkCi,
106
- oldCodes: oldCodes
86
+ codes: codes
107
87
  });
108
88
 
109
- queryLinkMetricsRequest.run(linkCi, oldCodes);
110
-
111
- if (newCodes.length > 0) {
112
- queryLastestValues.run({
113
- 'id': linkCi.attributes.name
114
- });
115
- }
89
+ queryLinkMetricsRequest.run(linkCi, codes);
116
90
  }
117
91
 
118
92
  return function () {};
119
93
  }, [linkId, linkMetricCodesStr]);
94
+ var retansRatioNetDelayRatioCodesStr = retansRatioNetDelayRatioCodes.map(function (item) {
95
+ return item;
96
+ }).sort().join(',');
97
+ (0, _react.useEffect)(function () {
98
+ if (linkId) {
99
+ _rlog["default"].info('链路拓扑指标勾选rtt|重传率 轮询', {
100
+ linkCi: linkCi,
101
+ retansRatioNetDelayRatioCodes: retansRatioNetDelayRatioCodes
102
+ });
103
+
104
+ queryLastestValues.run({
105
+ 'id': linkCi.attributes.name
106
+ }, retansRatioNetDelayRatioCodes);
107
+ }
108
+
109
+ return function () {};
110
+ }, [linkId, retansRatioNetDelayRatioCodesStr]);
120
111
  (0, _react.useEffect)(function () {
121
112
  if (linkId) {
122
113
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {