@riil-frontend/component-topology 8.0.8 → 9.0.0-a.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.
Files changed (16) hide show
  1. package/build/index.js +1 -1
  2. package/es/core/models/TopoApp.js +1 -1
  3. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +74 -35
  4. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
  5. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +75 -2
  6. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +68 -6
  7. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +80 -0
  8. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +65 -3
  9. package/lib/core/models/TopoApp.js +1 -1
  10. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +74 -34
  11. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
  12. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +82 -2
  13. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +67 -5
  14. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +86 -0
  15. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +66 -3
  16. package/package.json +2 -2
@@ -53,6 +53,8 @@ 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
+
56
58
  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); }
57
59
 
58
60
  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; }
@@ -166,7 +168,8 @@ function ResourceOverview(props) {
166
168
  isMonite: data.manageStatus !== 0,
167
169
  ciTypeMeta: ciTypeMeta,
168
170
  topo: topo,
169
- resourceOverviewProps: resourceOverviewProps
171
+ resourceOverviewProps: resourceOverviewProps,
172
+ resourceData: data
170
173
  }),
171
174
  monitorMetricModels = _useMetricModels.metricModels;
172
175
 
@@ -520,39 +523,32 @@ function ResourceOverview(props) {
520
523
  switch (_context5.prev = _context5.next) {
521
524
  case 0:
522
525
  _context5.t0 = item.dataIndex;
523
- _context5.next = _context5.t0 === 'display_name' ? 3 : _context5.t0 === 'ciName' ? 6 : _context5.t0 === 'res_address' ? 9 : _context5.t0 === 'imageName' ? 16 : 20;
526
+ _context5.next = _context5.t0 === 'display_name' ? 3 : _context5.t0 === 'ciName' ? 7 : _context5.t0 === 'res_address' ? 10 : _context5.t0 === 'imageName' ? 17 : 21;
524
527
  break;
525
528
 
526
529
  case 3:
527
- // 无监控模板不能跳转详情。跳转前需判定资源实例数据属性中是否包含support_templates属性。若不包含,则不能跳转
528
- if (attributeMap.support_templates) {
529
- link = "/default/pagecenter/resDetail/view/" + id + "?resId=" + id + "&domainCode=" + ciTypeMeta.domain + "&title=" + attributeMap.display_name + "&ciCode=" + ciType; // 资源跳转链接
530
-
531
- value = /*#__PURE__*/_react["default"].createElement("span", {
532
- onClick: onClose
533
- }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
534
- className: _indexModule["default"].link,
535
- disabled: true,
536
- title: attributeMap.display_name || '',
537
- to: formatUrl(link)
538
- }, attributeMap.display_name || '-'));
539
- } else {
540
- value = attributeMap.display_name || '-';
541
- }
542
-
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 || '-'));
543
539
  contentTitle = attributeMap.display_name || '-';
544
- return _context5.abrupt("break", 21);
540
+ return _context5.abrupt("break", 22);
545
541
 
546
- case 6:
542
+ case 7:
547
543
  value = ciTypeMeta.displayName;
548
544
  contentTitle = value;
549
- return _context5.abrupt("break", 21);
545
+ return _context5.abrupt("break", 22);
550
546
 
551
- case 9:
552
- _context5.next = 11;
547
+ case 10:
548
+ _context5.next = 12;
553
549
  return getAddressFormat(attributeMap);
554
550
 
555
- case 11:
551
+ case 12:
556
552
  address = _context5.sent;
557
553
  owned_computer_room = attributeMap.owned_computer_room, owned_cabinet = attributeMap.owned_cabinet; // 跳转3D机房定位设备
558
554
 
@@ -572,18 +568,18 @@ function ResourceOverview(props) {
572
568
  }
573
569
 
574
570
  contentTitle = address;
575
- return _context5.abrupt("break", 21);
571
+ return _context5.abrupt("break", 22);
576
572
 
577
- case 16:
573
+ case 17:
578
574
  node = topo.getDataModel().getDataByTag(id);
579
575
  value = (node === null || node === void 0 ? void 0 : node.a('customName')) || (node === null || node === void 0 ? void 0 : node.a('name')) || '-';
580
576
  contentTitle = value;
581
- return _context5.abrupt("break", 21);
582
-
583
- case 20:
584
- return _context5.abrupt("break", 21);
577
+ return _context5.abrupt("break", 22);
585
578
 
586
579
  case 21:
580
+ return _context5.abrupt("break", 22);
581
+
582
+ case 22:
587
583
  case "end":
588
584
  return _context5.stop();
589
585
  }
@@ -723,7 +719,7 @@ function ResourceOverview(props) {
723
719
  _metricColChange = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(col) {
724
720
  var _col2, _col3;
725
721
 
726
- var codes, endTime, params, _ref5, times, metricList;
722
+ var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
727
723
 
728
724
  return _regenerator["default"].wrap(function _callee8$(_context8) {
729
725
  while (1) {
@@ -771,8 +767,16 @@ function ResourceOverview(props) {
771
767
 
772
768
  case 11:
773
769
  metricList = _context8.sent;
770
+ _context8.next = 14;
771
+ return (0, _services2.queryLastestValue)({
772
+ 'id': data.attributes.name
773
+ });
774
774
 
775
- _rlog.rlog.debug('metricColChange', metricList, monitorMetricModels);
775
+ case 14:
776
+ newMetricList = _context8.sent;
777
+ metricLists = metricList.concat(getNewMetricList(newMetricList));
778
+
779
+ _rlog.rlog.debug('metricColChange', metricLists, monitorMetricModels);
776
780
 
777
781
  setMetric(col.map(function (item, key) {
778
782
  return {
@@ -783,7 +787,7 @@ function ResourceOverview(props) {
783
787
  metricItem: monitorMetricModels.find(function (m_item) {
784
788
  return m_item.code === item.dataIndex;
785
789
  }),
786
- list: metricList.filter(function (m_item) {
790
+ list: metricLists.filter(function (m_item) {
787
791
  return m_item.metricCode === item.dataIndex;
788
792
  })
789
793
  };
@@ -798,7 +802,7 @@ function ResourceOverview(props) {
798
802
  }, 60000);
799
803
  }
800
804
 
801
- case 16:
805
+ case 20:
802
806
  case "end":
803
807
  return _context8.stop();
804
808
  }
@@ -808,6 +812,42 @@ function ResourceOverview(props) {
808
812
  return _metricColChange.apply(this, arguments);
809
813
  }
810
814
 
815
+ var getNewMetricList = function getNewMetricList(data) {
816
+ return [{
817
+ 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,
837
+ subCiId: '',
838
+ subCiType: null,
839
+ mainCiType: null
840
+ }, {
841
+ errorMsg: null,
842
+ mainCiId: "upRetransRatio",
843
+ metricCode: "upRetransRatio",
844
+ metricValue: data.upRetransRatio,
845
+ subCiId: '',
846
+ subCiType: null,
847
+ mainCiType: null
848
+ }];
849
+ };
850
+
811
851
  var defaultCols = (0, _react.useMemo)(function () {
812
852
  var baseInfo = [];
813
853
  var keyIndicators = [];
@@ -19,7 +19,8 @@ var _LinkTopoModule = _interopRequireDefault(require("./LinkTopo.module.scss"));
19
19
 
20
20
  function LinkTopo(props) {
21
21
  var data = props.data,
22
- linkMetricCodes = props.linkMetricCodes;
22
+ linkMetricCodes = props.linkMetricCodes,
23
+ openFlow = props.openFlow;
23
24
  var metricData = (0, _useMetricPolling["default"])({
24
25
  linkCi: data,
25
26
  linkMetricCodes: linkMetricCodes
@@ -32,5 +33,7 @@ function LinkTopo(props) {
32
33
  ,
33
34
  isNarrow: true,
34
35
  jumpto: (0, _componentTopologyUtils.getHistory)().push
35
- }, metricData)));
36
+ }, metricData, {
37
+ openFlow: openFlow
38
+ })));
36
39
  }
@@ -5,7 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports["default"] = LinkTopoCard;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
9
13
 
10
14
  var _BlockBox = _interopRequireDefault(require("../../BlockBox"));
11
15
 
@@ -13,6 +17,12 @@ var _Configurator = _interopRequireDefault(require("../Configurator"));
13
17
 
14
18
  var _LinkTopo = _interopRequireDefault(require("./LinkTopo"));
15
19
 
20
+ var _services = require("./services");
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
16
26
  function LinkTopoCard(props) {
17
27
  var _data$attributes;
18
28
 
@@ -26,6 +36,75 @@ function LinkTopoCard(props) {
26
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) || ''; // 该资源监控模板
27
37
 
28
38
  var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
39
+
40
+ var _useState = (0, _react.useState)(-1),
41
+ openFlow = _useState[0],
42
+ setOpenFlow = _useState[1];
43
+
44
+ var analysisUrl = "../../default/trafficControl/linkConfigure?id=" + data.attributes.name + "&num=0";
45
+ var linkDetailsUrl = "/default/pagecenter/linkDetail/view/" + data.id + "?resId=" + data.id + "&domainCode=network&title=" + data.attributes.name + "&ciCode=network_link&tabByComType=uicbb-res-crucial-link-flow";
46
+
47
+ var isOpenFlows = /*#__PURE__*/function () {
48
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
49
+ var checkMenus, isOpen;
50
+ return _regenerator["default"].wrap(function _callee$(_context) {
51
+ while (1) {
52
+ switch (_context.prev = _context.next) {
53
+ case 0:
54
+ _context.next = 2;
55
+ return (0, _services.checkMenu)();
56
+
57
+ case 2:
58
+ checkMenus = _context.sent;
59
+
60
+ if (!(checkMenus[0].passed == 'PASS')) {
61
+ _context.next = 10;
62
+ break;
63
+ }
64
+
65
+ _context.next = 6;
66
+ return (0, _services.isOpenFlow)({
67
+ 'name': data.attributes.display_name
68
+ });
69
+
70
+ case 6:
71
+ isOpen = _context.sent;
72
+
73
+ //判断是不是有流量分析
74
+ if (isOpen) {
75
+ setOpenFlow({
76
+ name: '跳转关键链路详情',
77
+ url: linkDetailsUrl
78
+ });
79
+ } else {
80
+ setOpenFlow({
81
+ name: '跳转流量分析配置',
82
+ url: analysisUrl
83
+ });
84
+ }
85
+
86
+ _context.next = 11;
87
+ break;
88
+
89
+ case 10:
90
+ setOpenFlow(null);
91
+
92
+ case 11:
93
+ case "end":
94
+ return _context.stop();
95
+ }
96
+ }
97
+ }, _callee);
98
+ }));
99
+
100
+ return function isOpenFlows() {
101
+ return _ref.apply(this, arguments);
102
+ };
103
+ }();
104
+
105
+ (0, _react.useEffect)(function () {
106
+ isOpenFlows();
107
+ }, [data]);
29
108
  return /*#__PURE__*/_react["default"].createElement(_BlockBox["default"], {
30
109
  headerTitle: "\u8FD0\u884C\u60C5\u51B5",
31
110
  headerExtra: /*#__PURE__*/_react["default"].createElement(_Configurator["default"], {
@@ -40,6 +119,7 @@ function LinkTopoCard(props) {
40
119
  })
41
120
  }, /*#__PURE__*/_react["default"].createElement(_LinkTopo["default"], {
42
121
  data: data,
43
- linkMetricCodes: metricCodes
122
+ linkMetricCodes: metricCodes,
123
+ openFlow: openFlow
44
124
  }));
45
125
  }
@@ -24,17 +24,73 @@ 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 = [];
30
+ linkMetricCodes.map(function (item) {
31
+ arr.indexOf(item) > -1 ? newCodes.push(item) : oldCodes.push(item);
32
+ });
27
33
 
28
34
  var _useState = (0, _react.useState)({
29
35
  sourceMetrics: null,
30
36
  destinationMetrics: null,
31
37
  // 链路指标列表
32
38
  linkMetrics: [],
33
- linkMetricsTs: null
39
+ linkMetricsTs: null,
40
+ linkOther: []
34
41
  }),
35
42
  data = _useState[0],
36
- setData = _useState[1]; // 轮询hooks
43
+ setData = _useState[1];
37
44
 
45
+ var queryLastestValues = (0, _ahooks.useRequest)(_services.queryLastestValue, {
46
+ pollingInterval: 1000 * 15,
47
+ pollingWhenHidden: false,
48
+ debounceInterval: 200,
49
+ manual: true,
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));
92
+ }
93
+ }); // 轮询hooks
38
94
 
39
95
  var queryLinkMetricsRequest = (0, _ahooks.useRequest)(_services.queryLinkLatestMetrics, {
40
96
  pollingInterval: 60 * 1000,
@@ -58,17 +114,23 @@ function useMetricPolling(_ref) {
58
114
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
59
115
  }
60
116
  });
61
- var linkMetricCodesStr = linkMetricCodes.map(function (item) {
117
+ var linkMetricCodesStr = oldCodes.map(function (item) {
62
118
  return item;
63
119
  }).sort().join(',');
64
120
  (0, _react.useEffect)(function () {
65
121
  if (linkId) {
66
122
  _rlog["default"].info('链路拓扑指标轮询 切换', {
67
123
  linkCi: linkCi,
68
- linkMetricCodes: linkMetricCodes
124
+ oldCodes: oldCodes
69
125
  });
70
126
 
71
- queryLinkMetricsRequest.run(linkCi, linkMetricCodes);
127
+ queryLinkMetricsRequest.run(linkCi, oldCodes);
128
+
129
+ if (newCodes.length > 0) {
130
+ queryLastestValues.run({
131
+ 'id': linkCi.attributes.name
132
+ });
133
+ }
72
134
  }
73
135
 
74
136
  return function () {};
@@ -3,7 +3,10 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  exports.__esModule = true;
6
+ exports.checkMenu = checkMenu;
7
+ exports.isOpenFlow = isOpenFlow;
6
8
  exports.queryAssetModel = queryAssetModel;
9
+ exports.queryLastestValue = queryLastestValue;
7
10
  exports.queryLatestMetrics = queryLatestMetrics;
8
11
  exports.queryLinkInterfacesLatestMetrics = queryLinkInterfacesLatestMetrics;
9
12
  exports.queryLinkLatestMetrics = queryLinkLatestMetrics;
@@ -152,6 +155,11 @@ function _queryLinkLatestMetrics() {
152
155
  function queryLinkInterfacesLatestMetrics(_x5) {
153
156
  return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
154
157
  }
158
+ /**
159
+ * @name checkMenu 判断当前流量监控权限
160
+ * @returns
161
+ */
162
+
155
163
 
156
164
  function _queryLinkInterfacesLatestMetrics() {
157
165
  _queryLinkInterfacesLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(linkCi) {
@@ -233,4 +241,82 @@ function _queryLinkInterfacesLatestMetrics() {
233
241
  }, _callee4);
234
242
  }));
235
243
  return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
244
+ }
245
+
246
+ function checkMenu() {
247
+ return _checkMenu.apply(this, arguments);
248
+ }
249
+ /**
250
+ * @name isOpenFlow 是否配置流量分析
251
+ * @returns
252
+ */
253
+
254
+
255
+ function _checkMenu() {
256
+ _checkMenu = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
257
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
258
+ while (1) {
259
+ switch (_context5.prev = _context5.next) {
260
+ case 0:
261
+ return _context5.abrupt("return", _componentTopologyUtils.request.post('/authorization/v1/api/authority/check/checkMenuAuthentication', [{
262
+ "url": "/default/trafficControl"
263
+ }]));
264
+
265
+ case 1:
266
+ case "end":
267
+ return _context5.stop();
268
+ }
269
+ }
270
+ }, _callee5);
271
+ }));
272
+ return _checkMenu.apply(this, arguments);
273
+ }
274
+
275
+ function isOpenFlow(_x6) {
276
+ return _isOpenFlow.apply(this, arguments);
277
+ }
278
+ /**
279
+ * @name isOpenFlow 查指标值
280
+ * @returns
281
+ */
282
+
283
+
284
+ function _isOpenFlow() {
285
+ _isOpenFlow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(params) {
286
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
287
+ while (1) {
288
+ switch (_context6.prev = _context6.next) {
289
+ case 0:
290
+ return _context6.abrupt("return", _componentTopologyUtils.request.post('/flow/v1/api/link/isOpenFlowMonitorByName', params));
291
+
292
+ case 1:
293
+ case "end":
294
+ return _context6.stop();
295
+ }
296
+ }
297
+ }, _callee6);
298
+ }));
299
+ return _isOpenFlow.apply(this, arguments);
300
+ }
301
+
302
+ function queryLastestValue(_x7) {
303
+ return _queryLastestValue.apply(this, arguments);
304
+ }
305
+
306
+ function _queryLastestValue() {
307
+ _queryLastestValue = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(params) {
308
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
309
+ while (1) {
310
+ switch (_context7.prev = _context7.next) {
311
+ case 0:
312
+ return _context7.abrupt("return", _componentTopologyUtils.request.post('/flow/v1/api/LinkAnalyse/queryLastestValue', params));
313
+
314
+ case 1:
315
+ case "end":
316
+ return _context7.stop();
317
+ }
318
+ }
319
+ }, _callee7);
320
+ }));
321
+ return _queryLastestValue.apply(this, arguments);
236
322
  }
@@ -15,6 +15,8 @@ var _react = require("react");
15
15
 
16
16
  var _getCiDisplayMetricModels = require("../../../getCiDisplayMetricModels");
17
17
 
18
+ var _services = require("../components/LinkTopo/services");
19
+
18
20
  /**
19
21
  * 概览指标定义
20
22
  * @param {*} props
@@ -26,6 +28,7 @@ var useMetricModels = function useMetricModels(props) {
26
28
  ciType = _props$data.ciType,
27
29
  isMonite = props.isMonite,
28
30
  ciTypeMeta = props.ciTypeMeta,
31
+ resourceData = props.resourceData,
29
32
  topo = props.topo,
30
33
  resourceOverviewProps = props.resourceOverviewProps;
31
34
 
@@ -44,7 +47,7 @@ var useMetricModels = function useMetricModels(props) {
44
47
 
45
48
  function _fetchData() {
46
49
  _fetchData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
47
- var monitorMetrics, ciMonitorMetricModels, displayMetricModels, _metricCodes;
50
+ var monitorMetrics, ciMonitorMetricModels, checkMenus, isOpen, displayMetricModels, _metricCodes;
48
51
 
49
52
  return _regenerator["default"].wrap(function _callee$(_context) {
50
53
  while (1) {
@@ -59,8 +62,68 @@ var useMetricModels = function useMetricModels(props) {
59
62
  return !!monitorMetrics.find(function (item) {
60
63
  return item === m.code;
61
64
  });
62
- }); // 未监控不显示指标,临时在这里处理
65
+ });
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
+
82
+ case 10:
83
+ isOpen = _context.sent;
84
+
85
+ //
86
+ if (isOpen) {
87
+ ciMonitorMetricModels.push({
88
+ changeValue: null,
89
+ code: "downNetDelayRatio",
90
+ id: "downNetDelayRatio",
91
+ isGoldMetric: true,
92
+ key: null,
93
+ name: "下行RTT时延",
94
+ unit: "ms"
95
+ });
96
+ ciMonitorMetricModels.push({
97
+ changeValue: null,
98
+ code: "downRetansRatio",
99
+ id: "downRetansRatio",
100
+ isGoldMetric: true,
101
+ key: null,
102
+ name: "下行重传率",
103
+ unit: "%"
104
+ });
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
+ }
63
124
 
125
+ case 12:
126
+ // 未监控不显示指标,临时在这里处理
64
127
  if (!isMonite) {
65
128
  ciMonitorMetricModels = [];
66
129
  }
@@ -92,7 +155,7 @@ var useMetricModels = function useMetricModels(props) {
92
155
 
93
156
  return _context.abrupt("return", displayMetricModels);
94
157
 
95
- case 9:
158
+ case 17:
96
159
  case "end":
97
160
  return _context.stop();
98
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "8.0.8",
3
+ "version": "9.0.0-a.1",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@8.0.8/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.1/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }