@riil-frontend/component-topology 9.0.0-a.3 → 9.0.0-a.31

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 (103) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +12 -12
  4. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  5. package/es/core/components/TopoView/GraphViewPanel.js +17 -4
  6. package/es/core/components/TopoView/TopoView.module.scss +17 -3
  7. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  8. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  9. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  10. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  11. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  12. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  13. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  14. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -5
  15. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  16. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  17. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  18. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  19. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  20. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  21. package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
  22. package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
  23. package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
  24. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
  25. package/es/core/editor/config/themes.js +53 -2
  26. package/es/core/event/topoEventListener.js +22 -0
  27. package/es/core/hooks/useAlarm.js +18 -12
  28. package/es/core/hooks/useCanvasTheme.js +12 -4
  29. package/es/core/hooks/useResourceConfig.js +2 -1
  30. package/es/core/hooks/useTopoEdit.js +113 -19
  31. package/es/core/hooks/useTopoEventListener.js +4 -18
  32. package/es/core/hooks/useTopoFullscreen.js +32 -0
  33. package/es/core/models/Alarm.js +4 -13
  34. package/es/core/models/TopoApp.js +1 -1
  35. package/es/core/models/topoData.js +16 -9
  36. package/es/core/models/utils/linkUtils.js +52 -27
  37. package/es/core/store/models/topoConfig.js +51 -20
  38. package/es/core/test/Test.js +52 -0
  39. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +11 -35
  40. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  41. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  42. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -56
  43. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
  44. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
  45. package/es/networkTopo/getTopoData.js +2 -1
  46. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
  47. package/es/networkTopo/services/link.js +1 -1
  48. package/es/networkTopo/services/topo/basic.js +27 -26
  49. package/es/networkTopo/services/topo/networkLink.js +45 -3
  50. package/es/networkTopo/utils/exitLinkUtil.js +262 -0
  51. package/es/utils/ResourceConfigUtil.js +5 -4
  52. package/es/utils/htElementDataUtil.js +1 -7
  53. package/es/utils/htElementUtils.js +21 -21
  54. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  55. package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
  56. package/lib/core/components/TopoView/TopoView.module.scss +17 -3
  57. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  58. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  59. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  60. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  61. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  62. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  63. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  64. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -4
  65. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  66. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  67. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  68. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  69. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  70. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  71. package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
  72. package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
  73. package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
  74. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
  75. package/lib/core/editor/config/themes.js +53 -2
  76. package/lib/core/event/topoEventListener.js +27 -0
  77. package/lib/core/hooks/useAlarm.js +19 -12
  78. package/lib/core/hooks/useCanvasTheme.js +12 -4
  79. package/lib/core/hooks/useResourceConfig.js +2 -1
  80. package/lib/core/hooks/useTopoEdit.js +114 -18
  81. package/lib/core/hooks/useTopoEventListener.js +3 -17
  82. package/lib/core/hooks/useTopoFullscreen.js +42 -0
  83. package/lib/core/models/Alarm.js +5 -16
  84. package/lib/core/models/TopoApp.js +1 -1
  85. package/lib/core/models/topoData.js +16 -9
  86. package/lib/core/models/utils/linkUtils.js +53 -26
  87. package/lib/core/store/models/topoConfig.js +56 -19
  88. package/lib/core/test/Test.js +52 -0
  89. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +10 -35
  90. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  91. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  92. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -55
  93. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
  94. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
  95. package/lib/networkTopo/getTopoData.js +2 -1
  96. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
  97. package/lib/networkTopo/services/topo/basic.js +28 -28
  98. package/lib/networkTopo/services/topo/networkLink.js +45 -3
  99. package/lib/networkTopo/utils/exitLinkUtil.js +274 -0
  100. package/lib/utils/ResourceConfigUtil.js +4 -4
  101. package/lib/utils/htElementDataUtil.js +0 -10
  102. package/lib/utils/htElementUtils.js +21 -21
  103. package/package.json +3 -3
@@ -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,24 +266,26 @@ 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;
277
+ console.log("editState", editState);
275
278
  query = {
276
279
  id: rootState.topoMod.topoId,
277
280
  resources: resources,
278
281
  groups: groups,
279
- exportLinkIdList: exportLinkIdList
282
+ exportLinkIdList: exportLinkIdList,
283
+ ipNodes: ipNodes
280
284
  };
281
- _context2.next = 5;
285
+ _context2.next = 6;
282
286
  return _this2.getTopoByConditions(query);
283
287
 
284
- case 5:
288
+ case 6:
285
289
  data = _context2.sent;
286
290
 
287
291
  _rlog["default"].debug("按配置查询拓扑数据", {
@@ -294,7 +298,7 @@ function _default(topoApp) {
294
298
 
295
299
  return _context2.abrupt("return", data);
296
300
 
297
- case 8:
301
+ case 9:
298
302
  case "end":
299
303
  return _context2.stop();
300
304
  }
@@ -330,36 +334,42 @@ function _default(topoApp) {
330
334
  var _this4 = this;
331
335
 
332
336
  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;
337
+ var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
334
338
 
335
339
  return _regenerator["default"].wrap(function _callee4$(_context4) {
336
340
  while (1) {
337
341
  switch (_context4.prev = _context4.next) {
338
342
  case 0:
339
- // rlog.debug("getTopoByConditions--------", params);
340
- topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
343
+ _rlog["default"].debug("getTopoByConditions--------", params);
344
+
345
+ topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
341
346
  viewConditions = (0, _topoData2.resToConditions)(resources);
342
347
  groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
343
348
  return (0, _extends2["default"])({}, group, {
344
349
  layout: (0, _topoData2.getLayoutId)(group.layout),
345
350
  resources: (0, _topoData2.resToConditions)(group.resources)
346
351
  });
347
- }); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
352
+ });
348
353
 
349
- _context4.next = 5;
350
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
354
+ _rlog["default"].debug("getTopoByConditions--------", viewConditions, groupInfo);
351
355
 
352
- case 5:
356
+ _context4.next = 7;
357
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
358
+
359
+ case 7:
353
360
  data = _context4.sent;
354
- _context4.next = 8;
361
+
362
+ _rlog["default"].debug("getTopoByConditions--------data", data);
363
+
364
+ _context4.next = 11;
355
365
  return (0, _getTopoData.buildData)(data);
356
366
 
357
- case 8:
367
+ case 11:
358
368
  data = _context4.sent;
359
- _context4.next = 11;
369
+ _context4.next = 14;
360
370
  return Promise.all([(0, _getTopoData.addLinkData)(data), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(data)), dispatch.customIcon.loadCustomIcons()]);
361
371
 
362
- case 11:
372
+ case 14:
363
373
  _yield$Promise$all = _context4.sent;
364
374
  dataWithLinkDetail = _yield$Promise$all[0];
365
375
  _combTopoData = (0, _topoData.combTopoData)({
@@ -386,7 +396,7 @@ function _default(topoApp) {
386
396
  topoDataTrans: topoDataTrans
387
397
  });
388
398
 
389
- case 19:
399
+ case 22:
390
400
  case "end":
391
401
  return _context4.stop();
392
402
  }
@@ -416,7 +426,7 @@ function _default(topoApp) {
416
426
  }))
417
427
  };
418
428
 
419
- _rlog["default"].debug('saveGlobalConfig', config);
429
+ _rlog["default"].debug("saveGlobalConfig", config);
420
430
 
421
431
  _context5.next = 5;
422
432
  return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
@@ -485,6 +495,33 @@ function _default(topoApp) {
485
495
  switchToViewMode: function switchToViewMode() {
486
496
  this.reset();
487
497
  dispatch.topoMod.switchToViewMode();
498
+ },
499
+ queryAllLinkByIp: function queryAllLinkByIp(data) {
500
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
501
+ var _result$data;
502
+
503
+ var ids, ip, result;
504
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
505
+ while (1) {
506
+ switch (_context8.prev = _context8.next) {
507
+ case 0:
508
+ ids = data.ids, ip = data.ip;
509
+ console.log("queryAllLinkByIp", ids, ip);
510
+ _context8.next = 4;
511
+ return _networkLink["default"].queryLinksByIp(ids, ip);
512
+
513
+ case 4:
514
+ result = _context8.sent;
515
+ console.log("queryAllLinkByIp-result", result);
516
+ return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
517
+
518
+ case 7:
519
+ case "end":
520
+ return _context8.stop();
521
+ }
522
+ }
523
+ }, _callee8);
524
+ }))();
488
525
  }
489
526
  };
490
527
  }
@@ -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,14 +772,7 @@ function ResourceOverview(props) {
774
772
 
775
773
  case 11:
776
774
  metricList = _context8.sent;
777
- _context8.next = 14;
778
- return (0, _services2.queryLastestValue)({
779
- 'id': data.attributes.name
780
- });
781
-
782
- case 14:
783
- newMetricList = _context8.sent;
784
- metricLists = metricList.concat(getNewMetricList(newMetricList));
775
+ metricLists = metricList.concat(getNewMetricList());
785
776
 
786
777
  _rlog.rlog.debug('metricColChange', metricLists, monitorMetricModels);
787
778
 
@@ -809,7 +800,7 @@ function ResourceOverview(props) {
809
800
  }, 60000);
810
801
  }
811
802
 
812
- case 20:
803
+ case 17:
813
804
  case "end":
814
805
  return _context8.stop();
815
806
  }
@@ -819,36 +810,20 @@ function ResourceOverview(props) {
819
810
  return _metricColChange.apply(this, arguments);
820
811
  }
821
812
 
822
- var getNewMetricList = function getNewMetricList(data) {
813
+ var getNewMetricList = function getNewMetricList() {
823
814
  return [{
824
815
  errorMsg: null,
825
- mainCiId: "downNetDelayRatio",
826
- metricCode: "downNetDelayRatio",
827
- metricValue: data.downNetDelayRatio,
828
- subCiId: '',
829
- subCiType: null,
830
- mainCiType: null
831
- }, {
832
- errorMsg: null,
833
- mainCiId: "downRetansRatio",
834
- metricCode: "downRetansRatio",
835
- metricValue: data.downRetansRatio,
836
- subCiId: '',
837
- subCiType: null,
838
- mainCiType: null
839
- }, {
840
- errorMsg: null,
841
- mainCiId: "upNetDelayRatio",
842
- metricCode: "upNetDelayRatio",
843
- metricValue: data.upNetDelayRatio,
816
+ mainCiId: "netDelayRatio",
817
+ metricCode: "netDelayRatio",
818
+ metricValue: '0',
844
819
  subCiId: '',
845
820
  subCiType: null,
846
821
  mainCiType: null
847
822
  }, {
848
823
  errorMsg: null,
849
- mainCiId: "upRetransRatio",
850
- metricCode: "upRetransRatio",
851
- metricValue: data.upRetransRatio,
824
+ mainCiId: "retansRatio",
825
+ metricCode: "retansRatio",
826
+ metricValue: '0',
852
827
  subCiId: '',
853
828
  subCiType: null,
854
829
  mainCiType: null
@@ -25,6 +25,20 @@ function LinkTopo(props) {
25
25
  linkCi: data,
26
26
  linkMetricCodes: linkMetricCodes
27
27
  });
28
+ var linkMetrics = [].concat(metricData.linkMetrics, metricData.linkOther);
29
+ var linkMetricsList = [];
30
+
31
+ if (linkMetrics.length > 0) {
32
+ linkMetricCodes.forEach(function (e) {
33
+ var linkMetricsData = linkMetrics.filter(function (i) {
34
+ return e == i.code;
35
+ });
36
+ if (linkMetricsData.length > 0) linkMetricsList.push(linkMetricsData[0]);
37
+ });
38
+ metricData.linkMetrics = linkMetricsList;
39
+ metricData.linkOther = [];
40
+ }
41
+
28
42
  return /*#__PURE__*/_react["default"].createElement("div", {
29
43
  className: _LinkTopoModule["default"].container
30
44
  }, /*#__PURE__*/_react["default"].createElement(_componentCrucialLinkTopo["default"], (0, _extends2["default"])({
@@ -35,9 +35,9 @@ function LinkTopoCard(props) {
35
35
 
36
36
  var supportTemplates = (data === null || data === void 0 ? void 0 : (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.support_templates) || ''; // 该资源监控模板
37
37
 
38
- var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
38
+ var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial']; //是不是关键链路
39
39
 
40
- var _useState = (0, _react.useState)(-1),
40
+ var _useState = (0, _react.useState)(null),
41
41
  openFlow = _useState[0],
42
42
  setOpenFlow = _useState[1];
43
43
 
@@ -57,7 +57,7 @@ function LinkTopoCard(props) {
57
57
  case 2:
58
58
  checkMenus = _context.sent;
59
59
 
60
- if (!(checkMenus[0].passed == 'PASS')) {
60
+ if (!(checkMenus[0].passed == 'PASS' && isCrucial)) {
61
61
  _context.next = 10;
62
62
  break;
63
63
  }
@@ -73,12 +73,12 @@ function LinkTopoCard(props) {
73
73
  //判断是不是有流量分析
74
74
  if (isOpen) {
75
75
  setOpenFlow({
76
- name: '跳转关键链路详情',
76
+ name: '查看流量构成',
77
77
  url: linkDetailsUrl
78
78
  });
79
79
  } else {
80
80
  setOpenFlow({
81
- name: '跳转流量分析配置',
81
+ name: '配置流量分析',
82
82
  url: analysisUrl
83
83
  });
84
84
  }
@@ -119,7 +119,9 @@ function LinkTopoCard(props) {
119
119
  })
120
120
  }, /*#__PURE__*/_react["default"].createElement(_LinkTopo["default"], {
121
121
  data: data,
122
- linkMetricCodes: metricCodes,
122
+ linkMetricCodes: openFlow && openFlow.name == '查看流量构成' ? metricCodes : metricCodes.filter(function (i) {
123
+ return i != 'netDelayRatio' && i != 'retansRatio';
124
+ }),
123
125
  openFlow: openFlow
124
126
  }));
125
127
  }
@@ -24,11 +24,11 @@ function useMetricPolling(_ref) {
24
24
  var linkCi = _ref.linkCi,
25
25
  linkMetricCodes = _ref.linkMetricCodes;
26
26
  var linkId = linkCi.id;
27
- var arr = ['downNetDelayRatio', 'downRetansRatio', 'upNetDelayRatio', 'upRetransRatio'];
28
- var oldCodes = [];
29
- var newCodes = [];
27
+ var arr = ['netDelayRatio', 'retansRatio'];
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,53 +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('downNetDelayRatio')) {
56
- datas.linkOther.push({
57
- 'code': 'downNetDelayRatio',
58
- 'name': '下行RTT时延',
59
- 'ts': result.time,
60
- 'value': result.downNetDelayRatio + ' ms'
61
- });
62
- }
63
-
64
- if (newCodes.includes('downRetansRatio')) {
65
- datas.linkOther.push({
66
- 'code': 'downRetansRatio',
67
- 'name': '下行重传率',
68
- 'ts': result.time,
69
- 'value': result.downRetansRatio + ' %'
70
- });
71
- }
72
-
73
- if (newCodes.includes('upNetDelayRatio')) {
74
- datas.linkOther.push({
75
- 'code': 'upNetDelayRatio',
76
- 'name': '上行RTT时延',
77
- 'ts': result.time,
78
- 'value': result.upNetDelayRatio + ' ms'
79
- });
80
- }
81
-
82
- if (newCodes.includes('upRetransRatio')) {
83
- datas.linkOther.push({
84
- 'code': 'upRetransRatio',
85
- 'name': '上行重传率',
86
- 'ts': result.time,
87
- 'value': result.upRetransRatio + ' %'
88
- });
89
- }
90
-
91
- setData((0, _extends2["default"])({}, data, datas));
51
+ setData((0, _extends2["default"])({}, data, {
52
+ linkOther: result
53
+ }));
92
54
  }
93
55
  }); // 轮询hooks
94
56
 
@@ -114,27 +76,38 @@ function useMetricPolling(_ref) {
114
76
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
115
77
  }
116
78
  });
117
- var linkMetricCodesStr = oldCodes.map(function (item) {
79
+ var linkMetricCodesStr = codes.map(function (item) {
118
80
  return item;
119
81
  }).sort().join(',');
120
82
  (0, _react.useEffect)(function () {
121
83
  if (linkId) {
122
84
  _rlog["default"].info('链路拓扑指标轮询 切换', {
123
85
  linkCi: linkCi,
124
- oldCodes: oldCodes
86
+ codes: codes
125
87
  });
126
88
 
127
- queryLinkMetricsRequest.run(linkCi, oldCodes);
128
-
129
- if (newCodes.length > 0) {
130
- queryLastestValues.run({
131
- 'id': linkCi.attributes.name
132
- });
133
- }
89
+ queryLinkMetricsRequest.run(linkCi, codes);
134
90
  }
135
91
 
136
92
  return function () {};
137
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]);
138
111
  (0, _react.useEffect)(function () {
139
112
  if (linkId) {
140
113
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
@@ -10,6 +10,7 @@ exports.queryLastestValue = queryLastestValue;
10
10
  exports.queryLatestMetrics = queryLatestMetrics;
11
11
  exports.queryLinkInterfacesLatestMetrics = queryLinkInterfacesLatestMetrics;
12
12
  exports.queryLinkLatestMetrics = queryLinkLatestMetrics;
13
+ exports.queryRetansRatioNetDelayRatio = queryRetansRatioNetDelayRatio;
13
14
 
14
15
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
16
 
@@ -276,7 +277,7 @@ function isOpenFlow(_x6) {
276
277
  return _isOpenFlow.apply(this, arguments);
277
278
  }
278
279
  /**
279
- * @name isOpenFlow 查指标值
280
+ * @name queryLastestValue 查指标值
280
281
  * @returns
281
282
  */
282
283
 
@@ -319,4 +320,60 @@ function _queryLastestValue() {
319
320
  }, _callee7);
320
321
  }));
321
322
  return _queryLastestValue.apply(this, arguments);
323
+ }
324
+
325
+ function queryRetansRatioNetDelayRatio(_x8, _x9) {
326
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
327
+ }
328
+
329
+ function _queryRetansRatioNetDelayRatio() {
330
+ _queryRetansRatioNetDelayRatio = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(params, retansRatioNetDelayRatioCodes) {
331
+ var result, linkOther;
332
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
333
+ while (1) {
334
+ switch (_context8.prev = _context8.next) {
335
+ case 0:
336
+ if (retansRatioNetDelayRatioCodes.length) {
337
+ _context8.next = 2;
338
+ break;
339
+ }
340
+
341
+ return _context8.abrupt("return", []);
342
+
343
+ case 2:
344
+ _context8.next = 4;
345
+ return queryLastestValue(params);
346
+
347
+ case 4:
348
+ result = _context8.sent;
349
+ linkOther = [];
350
+
351
+ if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
352
+ linkOther.push({
353
+ 'code': 'netDelayRatio',
354
+ 'name': 'RTT时延',
355
+ 'ts': result.time,
356
+ 'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
357
+ });
358
+ }
359
+
360
+ if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
361
+ linkOther.push({
362
+ 'code': 'retansRatio',
363
+ 'name': '重传率',
364
+ 'ts': result.time,
365
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
366
+ });
367
+ }
368
+
369
+ return _context8.abrupt("return", linkOther);
370
+
371
+ case 9:
372
+ case "end":
373
+ return _context8.stop();
374
+ }
375
+ }
376
+ }, _callee8);
377
+ }));
378
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
322
379
  }
@@ -15,8 +15,6 @@ var _react = require("react");
15
15
 
16
16
  var _getCiDisplayMetricModels = require("../../../getCiDisplayMetricModels");
17
17
 
18
- var _services = require("../components/LinkTopo/services");
19
-
20
18
  /**
21
19
  * 概览指标定义
22
20
  * @param {*} props
@@ -47,7 +45,7 @@ var useMetricModels = function useMetricModels(props) {
47
45
 
48
46
  function _fetchData() {
49
47
  _fetchData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
50
- var monitorMetrics, ciMonitorMetricModels, checkMenus, isOpen, displayMetricModels, _metricCodes;
48
+ var monitorMetrics, ciMonitorMetricModels, displayMetricModels, _metricCodes;
51
49
 
52
50
  return _regenerator["default"].wrap(function _callee$(_context) {
53
51
  while (1) {
@@ -63,67 +61,29 @@ var useMetricModels = function useMetricModels(props) {
63
61
  return item === m.code;
64
62
  });
65
63
  });
66
- _context.next = 6;
67
- return (0, _services.checkMenu)();
68
-
69
- case 6:
70
- checkMenus = _context.sent;
71
-
72
- if (!(checkMenus[0].passed == 'PASS' && resourceData.attributes.display_name && resourceData.attributes['network_link.is_crucial'])) {
73
- _context.next = 12;
74
- break;
75
- }
76
-
77
- _context.next = 10;
78
- return (0, _services.isOpenFlow)({
79
- 'name': resourceData.attributes.display_name
80
- });
81
64
 
82
- case 10:
83
- isOpen = _context.sent;
84
-
85
- //
86
- if (isOpen) {
87
- ciMonitorMetricModels.push({
65
+ if (resourceData.attributes['network_link.is_crucial']) {
66
+ ciMonitorMetricModels.unshift({
88
67
  changeValue: null,
89
- code: "downNetDelayRatio",
90
- id: "downNetDelayRatio",
68
+ code: "netDelayRatio",
69
+ id: "netDelayRatio",
91
70
  isGoldMetric: true,
92
71
  key: null,
93
- name: "下行RTT时延",
72
+ name: "RTT时延",
94
73
  unit: "ms"
95
74
  });
96
- ciMonitorMetricModels.push({
75
+ ciMonitorMetricModels.unshift({
97
76
  changeValue: null,
98
- code: "downRetansRatio",
99
- id: "downRetansRatio",
77
+ code: "retansRatio",
78
+ id: "retansRatio",
100
79
  isGoldMetric: true,
101
80
  key: null,
102
- name: "下行重传率",
81
+ name: "重传率",
103
82
  unit: "%"
104
83
  });
105
- ciMonitorMetricModels.push({
106
- changeValue: null,
107
- code: "upNetDelayRatio",
108
- id: "upNetDelayRatio",
109
- isGoldMetric: true,
110
- key: null,
111
- name: "上行RTT时延",
112
- unit: "ms"
113
- });
114
- ciMonitorMetricModels.push({
115
- changeValue: null,
116
- code: "upRetransRatio",
117
- id: "upRetransRatio",
118
- isGoldMetric: true,
119
- key: null,
120
- name: "上行重传率",
121
- unit: "%"
122
- });
123
- }
84
+ } // 未监控不显示指标,临时在这里处理
85
+
124
86
 
125
- case 12:
126
- // 未监控不显示指标,临时在这里处理
127
87
  if (!isMonite) {
128
88
  ciMonitorMetricModels = [];
129
89
  }
@@ -155,7 +115,7 @@ var useMetricModels = function useMetricModels(props) {
155
115
 
156
116
  return _context.abrupt("return", displayMetricModels);
157
117
 
158
- case 17:
118
+ case 10:
159
119
  case "end":
160
120
  return _context.stop();
161
121
  }