@riil-frontend/component-topology 9.0.0-a.1 → 9.0.0-a.11

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 (59) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +7 -7
  3. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  4. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  5. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  6. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  7. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  8. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  9. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  11. package/es/core/event/topoEventListener.js +22 -0
  12. package/es/core/hooks/useAlarm.js +18 -12
  13. package/es/core/hooks/useCiAttributeChange.js +60 -0
  14. package/es/core/hooks/usePolling.js +163 -60
  15. package/es/core/hooks/useTopoEventListener.js +4 -18
  16. package/es/core/models/Alarm.js +4 -13
  17. package/es/core/models/AttributeMetricDisplay.js +44 -127
  18. package/es/core/models/TopoApp.js +4 -2
  19. package/es/core/models/attributeFormatter/index.js +5 -6
  20. package/es/core/models/cache/CiCache.d.ts +18 -0
  21. package/es/core/models/cache/CiCache.js +78 -0
  22. package/es/core/models/utils/linkUtils.js +10 -13
  23. package/es/core/store/models/topoBizMod.js +4 -0
  24. package/es/core/store/models/viewer/resourceDetail.js +7 -0
  25. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  26. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +100 -46
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  28. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  29. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
  30. package/es/style.js +1 -1
  31. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  32. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  33. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  34. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  35. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  36. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  37. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  38. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  39. package/lib/core/event/topoEventListener.js +27 -0
  40. package/lib/core/hooks/useAlarm.js +19 -12
  41. package/lib/core/hooks/useCiAttributeChange.js +70 -0
  42. package/lib/core/hooks/usePolling.js +166 -61
  43. package/lib/core/hooks/useTopoEventListener.js +3 -17
  44. package/lib/core/models/Alarm.js +5 -16
  45. package/lib/core/models/AttributeMetricDisplay.js +44 -126
  46. package/lib/core/models/TopoApp.js +4 -1
  47. package/lib/core/models/attributeFormatter/index.js +5 -7
  48. package/lib/core/models/cache/CiCache.d.ts +18 -0
  49. package/lib/core/models/cache/CiCache.js +89 -0
  50. package/lib/core/models/utils/linkUtils.js +10 -12
  51. package/lib/core/store/models/topoBizMod.js +4 -0
  52. package/lib/core/store/models/viewer/resourceDetail.js +7 -0
  53. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  54. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +99 -45
  55. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  56. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  57. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
  58. package/lib/style.js +1 -1
  59. package/package.json +3 -3
@@ -523,32 +523,39 @@ function ResourceOverview(props) {
523
523
  switch (_context5.prev = _context5.next) {
524
524
  case 0:
525
525
  _context5.t0 = item.dataIndex;
526
- _context5.next = _context5.t0 === 'display_name' ? 3 : _context5.t0 === 'ciName' ? 7 : _context5.t0 === 'res_address' ? 10 : _context5.t0 === 'imageName' ? 17 : 21;
526
+ _context5.next = _context5.t0 === 'display_name' ? 3 : _context5.t0 === 'ciName' ? 6 : _context5.t0 === 'res_address' ? 9 : _context5.t0 === 'imageName' ? 16 : 20;
527
527
  break;
528
528
 
529
529
  case 3:
530
- link = "/default/pagecenter/resDetail/view/" + id + "?resId=" + id + "&domainCode=" + ciTypeMeta.domain + "&title=" + attributeMap.display_name + "&ciCode=" + ciType; // 资源跳转链接
531
-
532
- value = /*#__PURE__*/_react["default"].createElement("span", {
533
- onClick: onClose
534
- }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
535
- className: _indexModule["default"].link,
536
- title: attributeMap.display_name || '',
537
- to: formatUrl(link)
538
- }, attributeMap.display_name || '-'));
530
+ // 无监控模板不能跳转详情。跳转前需判定资源实例数据属性中是否包含support_templates属性。若不包含,则不能跳转
531
+ if (attributeMap.support_templates) {
532
+ link = "/default/pagecenter/resDetail/view/" + id + "?resId=" + id + "&domainCode=" + ciTypeMeta.domain + "&title=" + attributeMap.display_name + "&ciCode=" + ciType; // 资源跳转链接
533
+
534
+ value = /*#__PURE__*/_react["default"].createElement("span", {
535
+ onClick: onClose
536
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
537
+ className: _indexModule["default"].link,
538
+ disabled: true,
539
+ title: attributeMap.display_name || '',
540
+ to: formatUrl(link)
541
+ }, attributeMap.display_name || '-'));
542
+ } else {
543
+ value = attributeMap.display_name || '-';
544
+ }
545
+
539
546
  contentTitle = attributeMap.display_name || '-';
540
- return _context5.abrupt("break", 22);
547
+ return _context5.abrupt("break", 21);
541
548
 
542
- case 7:
549
+ case 6:
543
550
  value = ciTypeMeta.displayName;
544
551
  contentTitle = value;
545
- return _context5.abrupt("break", 22);
552
+ return _context5.abrupt("break", 21);
546
553
 
547
- case 10:
548
- _context5.next = 12;
554
+ case 9:
555
+ _context5.next = 11;
549
556
  return getAddressFormat(attributeMap);
550
557
 
551
- case 12:
558
+ case 11:
552
559
  address = _context5.sent;
553
560
  owned_computer_room = attributeMap.owned_computer_room, owned_cabinet = attributeMap.owned_cabinet; // 跳转3D机房定位设备
554
561
 
@@ -568,18 +575,18 @@ function ResourceOverview(props) {
568
575
  }
569
576
 
570
577
  contentTitle = address;
571
- return _context5.abrupt("break", 22);
578
+ return _context5.abrupt("break", 21);
572
579
 
573
- case 17:
580
+ case 16:
574
581
  node = topo.getDataModel().getDataByTag(id);
575
582
  value = (node === null || node === void 0 ? void 0 : node.a('customName')) || (node === null || node === void 0 ? void 0 : node.a('name')) || '-';
576
583
  contentTitle = value;
577
- return _context5.abrupt("break", 22);
584
+ return _context5.abrupt("break", 21);
578
585
 
579
- case 21:
580
- return _context5.abrupt("break", 22);
586
+ case 20:
587
+ return _context5.abrupt("break", 21);
581
588
 
582
- case 22:
589
+ case 21:
583
590
  case "end":
584
591
  return _context5.stop();
585
592
  }
@@ -768,7 +775,9 @@ function ResourceOverview(props) {
768
775
  case 11:
769
776
  metricList = _context8.sent;
770
777
  _context8.next = 14;
771
- return (0, _services2.queryLastestValue)({
778
+ return queryMetricList({
779
+ 'name': data.attributes.display_name
780
+ }, {
772
781
  'id': data.attributes.name
773
782
  });
774
783
 
@@ -812,36 +821,81 @@ function ResourceOverview(props) {
812
821
  return _metricColChange.apply(this, arguments);
813
822
  }
814
823
 
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
+
815
885
  var getNewMetricList = function getNewMetricList(data) {
816
886
  return [{
817
887
  errorMsg: null,
818
- mainCiId: "downNetDelayRatio",
819
- metricCode: "downNetDelayRatio",
820
- metricValue: data.downNetDelayRatio,
821
- subCiId: '',
822
- subCiType: null,
823
- mainCiType: null
824
- }, {
825
- errorMsg: null,
826
- mainCiId: "downRetansRatio",
827
- metricCode: "downRetansRatio",
828
- metricValue: data.downRetansRatio,
829
- subCiId: '',
830
- subCiType: null,
831
- mainCiType: null
832
- }, {
833
- errorMsg: null,
834
- mainCiId: "upNetDelayRatio",
835
- metricCode: "upNetDelayRatio",
836
- metricValue: data.upNetDelayRatio,
888
+ mainCiId: "netDelayRatio",
889
+ metricCode: "netDelayRatio",
890
+ metricValue: data.upNetDelayRatio + ' ms' + '|' + data.downNetDelayRatio + ' ms',
837
891
  subCiId: '',
838
892
  subCiType: null,
839
893
  mainCiType: null
840
894
  }, {
841
895
  errorMsg: null,
842
- mainCiId: "upRetransRatio",
843
- metricCode: "upRetransRatio",
844
- metricValue: data.upRetransRatio,
896
+ mainCiId: "retansRatio",
897
+ metricCode: "retansRatio",
898
+ metricValue: data.upRetransRatio + ' %' + '|' + data.downRetansRatio + ' %',
845
899
  subCiId: '',
846
900
  subCiType: null,
847
901
  mainCiType: null
@@ -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,7 +24,7 @@ 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'];
27
+ var arr = ['netDelayRatio', 'retansRatio'];
28
28
  var oldCodes = [];
29
29
  var newCodes = [];
30
30
  linkMetricCodes.map(function (item) {
@@ -52,39 +52,21 @@ function useMetricPolling(_ref) {
52
52
  linkOther: []
53
53
  };
54
54
 
55
- if (newCodes.includes('downNetDelayRatio')) {
55
+ if (newCodes.includes('netDelayRatio')) {
56
56
  datas.linkOther.push({
57
- 'code': 'downNetDelayRatio',
57
+ 'code': 'netDelayRatio',
58
58
  'name': '下行RTT时延',
59
59
  'ts': result.time,
60
- 'value': result.downNetDelayRatio + ' ms'
60
+ 'value': result.upNetDelayRatio + ' ms' + '|' + result.downNetDelayRatio + ' ms'
61
61
  });
62
62
  }
63
63
 
64
- if (newCodes.includes('downRetansRatio')) {
64
+ if (newCodes.includes('retansRatio')) {
65
65
  datas.linkOther.push({
66
- 'code': 'downRetansRatio',
67
- 'name': '下行重传率',
66
+ 'code': 'retansRatio',
67
+ 'name': '重传率',
68
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 + ' %'
69
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
88
70
  });
89
71
  }
90
72
 
@@ -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
  }
package/lib/style.js CHANGED
@@ -3,10 +3,10 @@ require('@alifd/next/lib/box/style');
3
3
  require('@alifd/next/lib/message/style');
4
4
  require('@riil-frontend/component-topology-utils/lib/style');
5
5
  require('@riil-frontend/component-riil-event-emitter/lib/style');
6
+ require('@riil-frontend/utils/lib/style');
6
7
  require('@alifd/next/lib/drawer/style');
7
8
  require('@alifd/next/lib/menu-button/style');
8
9
  require('@alifd/next/lib/search/style');
9
- require('@riil-frontend/utils/lib/style');
10
10
  require('@alifd/next/lib/tab/style');
11
11
  require('@alifd/next/lib/table/style');
12
12
  require('@riil-frontend/component-table-layout/lib/style');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "9.0.0-a.1",
3
+ "version": "9.0.0-a.11",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@alifd/next": "1.21.16",
58
- "@alifd/theme-19926": "^0.39.0",
58
+ "@alifd/theme-19926": "^0.48.2",
59
59
  "@formily/next": "1.3.13",
60
60
  "@formily/next-components": "1.3.13",
61
61
  "@iceworks/spec": "^1.0.0",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.1/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.11/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }