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

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 (31) 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/core/event/topoEventListener.js +22 -0
  6. package/es/core/hooks/useAlarm.js +18 -12
  7. package/es/core/hooks/useTopoEventListener.js +4 -18
  8. package/es/core/models/Alarm.js +4 -13
  9. package/es/core/models/TopoApp.js +1 -1
  10. package/es/core/store/models/viewer/resourceDetail.js +7 -0
  11. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  12. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +99 -6
  13. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
  14. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +78 -3
  15. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +50 -6
  16. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +80 -0
  17. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +25 -2
  18. package/lib/core/event/topoEventListener.js +27 -0
  19. package/lib/core/hooks/useAlarm.js +19 -12
  20. package/lib/core/hooks/useTopoEventListener.js +3 -17
  21. package/lib/core/models/Alarm.js +5 -16
  22. package/lib/core/models/TopoApp.js +1 -1
  23. package/lib/core/store/models/viewer/resourceDetail.js +7 -0
  24. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  25. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +99 -5
  26. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
  27. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +85 -3
  28. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +49 -5
  29. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +86 -0
  30. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +25 -2
  31. package/package.json +3 -3
@@ -0,0 +1,22 @@
1
+ var n = 0;
2
+ export function createTopoEventListener(type, onMessage) {
3
+ var eventListenerName = "topo_" + n++;
4
+ var EE = window.EE;
5
+
6
+ if (EE) {
7
+ EE.on('topo', eventListenerName, function (data) {
8
+ if (data.type === type) {
9
+ onMessage(data.data);
10
+ }
11
+ });
12
+ }
13
+
14
+ return {
15
+ eventListenerName: eventListenerName,
16
+ close: function close() {
17
+ if (EE) {
18
+ window.EE.removeListener('topo', eventListenerName);
19
+ }
20
+ }
21
+ };
22
+ }
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import { useEffect } from "react";
3
3
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
- import { useCbbEventListener } from "@riil-frontend/component-riil-event-emitter";
5
4
  import useGraphAlarmDisplay from "./useGraphAlarmDisplay";
5
+ import useTopoEventListener from "./useTopoEventListener";
6
6
  /**
7
7
  *
8
8
  *
@@ -104,20 +104,26 @@ export default function useAlarm(options) {
104
104
  received: data,
105
105
  all: relateTopoAlarm
106
106
  });
107
- };
107
+ }; // 订阅消息
108
+
108
109
 
109
- useCbbEventListener("topo", {
110
- name: "topo",
110
+ useTopoEventListener({
111
+ type: 'alarm',
111
112
  onMessage: function onMessage(data) {
112
113
  rlog.debug("Topoget--AlertMesage------------", topo, data);
113
-
114
- if (data.type === "alarm") {
115
- topo.alarm.handleAlarmEvent(data.data);
116
- } else if (data.type === "risk") {
117
- handleRiskData(data.data);
118
- } else if (data.type === "relateTopoAlarm") {
119
- handleRelateTopoAlarm(data.data);
120
- }
114
+ topo.alarm.handleAlarmEvent(data);
115
+ }
116
+ });
117
+ useTopoEventListener({
118
+ type: 'risk',
119
+ onMessage: function onMessage(data) {
120
+ handleRiskData(data);
121
+ }
122
+ });
123
+ useTopoEventListener({
124
+ type: 'relateTopoAlarm',
125
+ onMessage: function onMessage(data) {
126
+ handleRelateTopoAlarm(data);
121
127
  }
122
128
  });
123
129
  }
@@ -1,26 +1,12 @@
1
- import { useEffect, useMemo } from 'react';
2
- var n = 0;
1
+ import { useEffect } from 'react';
2
+ import { createTopoEventListener } from "../event/topoEventListener";
3
3
  export default function useTopoEventListener(props) {
4
4
  var type = props.type,
5
5
  onMessage = props.onMessage;
6
- var eventListenerName = useMemo(function () {
7
- return "topo_" + n++;
8
- }, []);
9
6
  useEffect(function () {
10
- var EE = window.EE;
11
-
12
- if (EE) {
13
- window.EE.on('topo', eventListenerName, function (data) {
14
- if (data.type === type) {
15
- onMessage(data.data);
16
- }
17
- });
18
- }
19
-
7
+ var listener = createTopoEventListener(type, onMessage);
20
8
  return function () {
21
- if (EE) {
22
- window.EE.removeListener('topo', eventListenerName);
23
- }
9
+ listener.close();
24
10
  };
25
11
  }, [type, onMessage]);
26
12
  }
@@ -5,9 +5,8 @@ import topoService from "@riil-frontend/component-topology-common/es/services/to
5
5
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
6
  import { EE } from "@riil-frontend/component-riil-event-emitter";
7
7
  import { isAvailableArray } from "@riil-frontend/utils";
8
+ import { createTopoEventListener } from "../event/topoEventListener";
8
9
 
9
- // import moment from "moment";
10
- // import { alarmListDemo } from "./mocks";
11
10
  var Alarm = /*#__PURE__*/function () {
12
11
  function Alarm() {
13
12
  this.topo = void 0;
@@ -375,8 +374,6 @@ var Alarm = /*#__PURE__*/function () {
375
374
  /*#__PURE__*/
376
375
  function () {
377
376
  var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
378
- var _this2 = this;
379
-
380
377
  var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
381
378
 
382
379
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
@@ -409,17 +406,12 @@ var Alarm = /*#__PURE__*/function () {
409
406
  case 10:
410
407
  this.secretKey = _context6.sent;
411
408
  // rlog.debug("openTopoAlarm 获取初始化告警-------------------开始");
412
- EE.on("topo", "topo", function (data, other) {
413
- rlog.debug("openTopoAlarm 获取初始化告警------收到信息", data);
414
-
415
- _this2.handleAlarmEvent(data);
416
- });
417
409
  this.updateState({
418
410
  alarmOpening: false,
419
411
  alarmIsOpened: true
420
412
  });
421
413
 
422
- case 13:
414
+ case 12:
423
415
  case "end":
424
416
  return _context6.stop();
425
417
  }
@@ -463,16 +455,15 @@ var Alarm = /*#__PURE__*/function () {
463
455
  case 3:
464
456
  this.currentTopoId = null;
465
457
  rlog.debug("useAlarm.useEffect 告警WebSocket 结束");
466
- EE.removeListener("topo", "topo");
467
458
  this.updateState({
468
459
  topoAlarmIsOpen: false,
469
460
  alarmOpening: false,
470
461
  alarmPanelIsOpen: false
471
462
  });
472
- _context7.next = 9;
463
+ _context7.next = 8;
473
464
  return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
474
465
 
475
- case 9:
466
+ case 8:
476
467
  case "end":
477
468
  return _context7.stop();
478
469
  }
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "8.0.10" === 'string' ? "8.0.10" : null;
27
+ var version = typeof "9.0.0-a.10" === 'string' ? "9.0.0-a.10" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -21,6 +21,13 @@ export default {
21
21
  visible: false,
22
22
  id: null // 资源id
23
23
 
24
+ };
25
+ },
26
+ close: function close() {
27
+ return {
28
+ visible: false,
29
+ id: null // 资源id
30
+
24
31
  };
25
32
  }
26
33
  },
@@ -76,9 +76,7 @@ function ResourceDetailDrawer(props) {
76
76
  }, []); // 解决切换拓扑图隐藏概览
77
77
 
78
78
  useEffect(function () {
79
- resourceDetailDispatchers.update({
80
- visible: false
81
- }); // TODO 其他数据重置
79
+ close(); // TODO 其他数据重置
82
80
  }, [topoId]);
83
81
 
84
82
  function getUser() {
@@ -154,6 +152,12 @@ function ResourceDetailDrawer(props) {
154
152
  }
155
153
  }
156
154
 
155
+ function close() {
156
+ resourceDetailDispatchers.update({
157
+ visible: false
158
+ });
159
+ }
160
+
157
161
  function init(data, targetType) {
158
162
  // console.log('初始化基本信息', data, targetType);
159
163
  var id = data.id,
@@ -214,7 +218,8 @@ function ResourceDetailDrawer(props) {
214
218
  topo: topo,
215
219
  userId: userId,
216
220
  activeData: activeData,
217
- resourceData: resourceData
221
+ resourceData: resourceData,
222
+ onClose: close
218
223
  }));
219
224
  };
220
225
 
@@ -228,11 +233,7 @@ function ResourceDetailDrawer(props) {
228
233
  })),
229
234
  width: 580,
230
235
  hasMask: false,
231
- onClose: function onClose() {
232
- return resourceDetailDispatchers.update({
233
- visible: false
234
- });
235
- }
236
+ onClose: close
236
237
  }, visible && resourceData && renderContent()));
237
238
  }
238
239
 
@@ -29,7 +29,8 @@ import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
29
29
  import Configurator from "./components/Configurator";
30
30
  import { formatMetric } from "../../../../../../models/attributeFormatter";
31
31
  import LinkTopoCard from "./components/LinkTopo/LinkTopoCard";
32
- import EventsCard from "./EventsCard"; // url 处理,UICBB 的地址需截取前缀
32
+ import EventsCard from "./EventsCard";
33
+ import { checkMenu, isOpenFlow, queryLastestValue } from "./components/LinkTopo/services"; // url 处理,UICBB 的地址需截取前缀
33
34
 
34
35
  function formatUrl(url) {
35
36
  var _window, _window$location;
@@ -133,7 +134,8 @@ export default function ResourceOverview(props) {
133
134
  isMonite: data.manageStatus !== 0,
134
135
  ciTypeMeta: ciTypeMeta,
135
136
  topo: topo,
136
- resourceOverviewProps: resourceOverviewProps
137
+ resourceOverviewProps: resourceOverviewProps,
138
+ resourceData: data
137
139
  }),
138
140
  monitorMetricModels = _useMetricModels.metricModels;
139
141
 
@@ -690,7 +692,7 @@ export default function ResourceOverview(props) {
690
692
  _metricColChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(col) {
691
693
  var _col2, _col3;
692
694
 
693
- var codes, endTime, params, _ref5, times, metricList;
695
+ var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
694
696
 
695
697
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
696
698
  while (1) {
@@ -738,7 +740,17 @@ export default function ResourceOverview(props) {
738
740
 
739
741
  case 11:
740
742
  metricList = _context8.sent;
741
- rlog.debug('metricColChange', metricList, monitorMetricModels);
743
+ _context8.next = 14;
744
+ return queryMetricList({
745
+ 'name': data.attributes.display_name
746
+ }, {
747
+ 'id': data.attributes.name
748
+ });
749
+
750
+ case 14:
751
+ newMetricList = _context8.sent;
752
+ metricLists = metricList.concat(getNewMetricList(newMetricList));
753
+ rlog.debug('metricColChange', metricLists, monitorMetricModels);
742
754
  setMetric(col.map(function (item, key) {
743
755
  return {
744
756
  code: item.dataIndex,
@@ -748,7 +760,7 @@ export default function ResourceOverview(props) {
748
760
  metricItem: monitorMetricModels.find(function (m_item) {
749
761
  return m_item.code === item.dataIndex;
750
762
  }),
751
- list: metricList.filter(function (m_item) {
763
+ list: metricLists.filter(function (m_item) {
752
764
  return m_item.metricCode === item.dataIndex;
753
765
  })
754
766
  };
@@ -763,7 +775,7 @@ export default function ResourceOverview(props) {
763
775
  }, 60000);
764
776
  }
765
777
 
766
- case 16:
778
+ case 20:
767
779
  case "end":
768
780
  return _context8.stop();
769
781
  }
@@ -773,6 +785,87 @@ export default function ResourceOverview(props) {
773
785
  return _metricColChange.apply(this, arguments);
774
786
  }
775
787
 
788
+ function queryMetricList(_x9, _x10) {
789
+ return _queryMetricList.apply(this, arguments);
790
+ }
791
+
792
+ function _queryMetricList() {
793
+ _queryMetricList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, param) {
794
+ var checkMenus, isOpen, list;
795
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
796
+ while (1) {
797
+ switch (_context9.prev = _context9.next) {
798
+ case 0:
799
+ if (!(ciType !== 'network_link')) {
800
+ _context9.next = 2;
801
+ break;
802
+ }
803
+
804
+ return _context9.abrupt("return", []);
805
+
806
+ case 2:
807
+ _context9.next = 4;
808
+ return checkMenu();
809
+
810
+ case 4:
811
+ checkMenus = _context9.sent;
812
+
813
+ if (!(checkMenus[0].passed == 'PASS')) {
814
+ _context9.next = 14;
815
+ break;
816
+ }
817
+
818
+ _context9.next = 8;
819
+ return isOpenFlow(data);
820
+
821
+ case 8:
822
+ isOpen = _context9.sent;
823
+
824
+ if (!isOpen) {
825
+ _context9.next = 14;
826
+ break;
827
+ }
828
+
829
+ _context9.next = 12;
830
+ return queryLastestValue(param);
831
+
832
+ case 12:
833
+ list = _context9.sent;
834
+ return _context9.abrupt("return", list);
835
+
836
+ case 14:
837
+ return _context9.abrupt("return", []);
838
+
839
+ case 15:
840
+ case "end":
841
+ return _context9.stop();
842
+ }
843
+ }
844
+ }, _callee9);
845
+ }));
846
+ return _queryMetricList.apply(this, arguments);
847
+ }
848
+
849
+ var getNewMetricList = function getNewMetricList(data) {
850
+ return [{
851
+ errorMsg: null,
852
+ mainCiId: "netDelayRatio",
853
+ metricCode: "netDelayRatio",
854
+ metricValue: data.upNetDelayRatio + ' ms' + '|' + data.downNetDelayRatio + ' ms',
855
+ subCiId: '',
856
+ subCiType: null,
857
+ mainCiType: null
858
+ }, {
859
+ errorMsg: null,
860
+ mainCiId: "retansRatio",
861
+ metricCode: "retansRatio",
862
+ metricValue: data.upRetransRatio + ' %' + '|' + data.downRetansRatio + ' %',
863
+ subCiId: '',
864
+ subCiType: null,
865
+ mainCiType: null
866
+ }];
867
+ };
868
+
776
869
  var defaultCols = useMemo(function () {
777
870
  var baseInfo = [];
778
871
  var keyIndicators = [];
@@ -6,7 +6,8 @@ import useMetricPolling from "./hooks/useMetricPolling";
6
6
  import styles from "./LinkTopo.module.scss";
7
7
  export default function LinkTopo(props) {
8
8
  var data = props.data,
9
- linkMetricCodes = props.linkMetricCodes;
9
+ linkMetricCodes = props.linkMetricCodes,
10
+ openFlow = props.openFlow;
10
11
  var metricData = useMetricPolling({
11
12
  linkCi: data,
12
13
  linkMetricCodes: linkMetricCodes
@@ -19,5 +20,7 @@ export default function LinkTopo(props) {
19
20
  ,
20
21
  isNarrow: true,
21
22
  jumpto: getHistory().push
22
- }, metricData)));
23
+ }, metricData, {
24
+ openFlow: openFlow
25
+ })));
23
26
  }
@@ -1,7 +1,10 @@
1
- import React from 'react';
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import React, { useEffect, useState } from 'react';
2
4
  import BlockBox from "../../BlockBox";
3
5
  import Configurator from "../Configurator";
4
6
  import LinkTopo from "./LinkTopo";
7
+ import { isOpenFlow, checkMenu } from "./services";
5
8
  export default function LinkTopoCard(props) {
6
9
  var _data$attributes;
7
10
 
@@ -14,7 +17,76 @@ export default function LinkTopoCard(props) {
14
17
 
15
18
  var supportTemplates = (data === null || data === void 0 ? void 0 : (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.support_templates) || ''; // 该资源监控模板
16
19
 
17
- var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
20
+ var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial']; //是不是关键链路
21
+
22
+ var _useState = useState(null),
23
+ openFlow = _useState[0],
24
+ setOpenFlow = _useState[1];
25
+
26
+ var analysisUrl = "../../default/trafficControl/linkConfigure?id=" + data.attributes.name + "&num=0";
27
+ 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";
28
+
29
+ var isOpenFlows = /*#__PURE__*/function () {
30
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
+ var checkMenus, isOpen;
32
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
33
+ while (1) {
34
+ switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _context.next = 2;
37
+ return checkMenu();
38
+
39
+ case 2:
40
+ checkMenus = _context.sent;
41
+
42
+ if (!(checkMenus[0].passed == 'PASS' && isCrucial)) {
43
+ _context.next = 10;
44
+ break;
45
+ }
46
+
47
+ _context.next = 6;
48
+ return isOpenFlow({
49
+ 'name': data.attributes.display_name
50
+ });
51
+
52
+ case 6:
53
+ isOpen = _context.sent;
54
+
55
+ //判断是不是有流量分析
56
+ if (isOpen) {
57
+ setOpenFlow({
58
+ name: '查看流量构成',
59
+ url: linkDetailsUrl
60
+ });
61
+ } else {
62
+ setOpenFlow({
63
+ name: '配置流量分析',
64
+ url: analysisUrl
65
+ });
66
+ }
67
+
68
+ _context.next = 11;
69
+ break;
70
+
71
+ case 10:
72
+ setOpenFlow(null);
73
+
74
+ case 11:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }
79
+ }, _callee);
80
+ }));
81
+
82
+ return function isOpenFlows() {
83
+ return _ref.apply(this, arguments);
84
+ };
85
+ }();
86
+
87
+ useEffect(function () {
88
+ isOpenFlows();
89
+ }, [data]);
18
90
  return /*#__PURE__*/React.createElement(BlockBox, {
19
91
  headerTitle: "\u8FD0\u884C\u60C5\u51B5",
20
92
  headerExtra: /*#__PURE__*/React.createElement(Configurator, {
@@ -29,6 +101,9 @@ export default function LinkTopoCard(props) {
29
101
  })
30
102
  }, /*#__PURE__*/React.createElement(LinkTopo, {
31
103
  data: data,
32
- linkMetricCodes: metricCodes
104
+ linkMetricCodes: openFlow && openFlow.name == '查看流量构成' ? metricCodes : metricCodes.filter(function (i) {
105
+ return i != 'netDelayRatio' && i != 'retansRatio';
106
+ }),
107
+ openFlow: openFlow
33
108
  }));
34
109
  }
@@ -1,24 +1,62 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { useRequest } from 'ahooks';
4
- import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics } from "../services";
4
+ import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics, queryLastestValue } from "../services";
5
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog'; // 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
6
6
 
7
7
  export default function useMetricPolling(_ref) {
8
8
  var linkCi = _ref.linkCi,
9
9
  linkMetricCodes = _ref.linkMetricCodes;
10
10
  var linkId = linkCi.id;
11
+ var arr = ['netDelayRatio', 'retansRatio'];
12
+ var oldCodes = [];
13
+ var newCodes = [];
14
+ linkMetricCodes.map(function (item) {
15
+ arr.indexOf(item) > -1 ? newCodes.push(item) : oldCodes.push(item);
16
+ });
11
17
 
12
18
  var _useState = useState({
13
19
  sourceMetrics: null,
14
20
  destinationMetrics: null,
15
21
  // 链路指标列表
16
22
  linkMetrics: [],
17
- linkMetricsTs: null
23
+ linkMetricsTs: null,
24
+ linkOther: []
18
25
  }),
19
26
  data = _useState[0],
20
- setData = _useState[1]; // 轮询hooks
27
+ setData = _useState[1];
28
+
29
+ var queryLastestValues = useRequest(queryLastestValue, {
30
+ pollingInterval: 1000 * 15,
31
+ pollingWhenHidden: false,
32
+ debounceInterval: 200,
33
+ manual: true,
34
+ onSuccess: function onSuccess(result) {
35
+ var datas = {
36
+ linkOther: []
37
+ };
38
+
39
+ if (newCodes.includes('netDelayRatio')) {
40
+ datas.linkOther.push({
41
+ 'code': 'netDelayRatio',
42
+ 'name': '下行RTT时延',
43
+ 'ts': result.time,
44
+ 'value': result.upNetDelayRatio + ' ms' + '|' + result.downNetDelayRatio + ' ms'
45
+ });
46
+ }
21
47
 
48
+ if (newCodes.includes('retansRatio')) {
49
+ datas.linkOther.push({
50
+ 'code': 'retansRatio',
51
+ 'name': '重传率',
52
+ 'ts': result.time,
53
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
54
+ });
55
+ }
56
+
57
+ setData(_extends({}, data, datas));
58
+ }
59
+ }); // 轮询hooks
22
60
 
23
61
  var queryLinkMetricsRequest = useRequest(queryLinkLatestMetrics, {
24
62
  pollingInterval: 60 * 1000,
@@ -40,16 +78,22 @@ export default function useMetricPolling(_ref) {
40
78
  rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
41
79
  }
42
80
  });
43
- var linkMetricCodesStr = linkMetricCodes.map(function (item) {
81
+ var linkMetricCodesStr = oldCodes.map(function (item) {
44
82
  return item;
45
83
  }).sort().join(',');
46
84
  useEffect(function () {
47
85
  if (linkId) {
48
86
  rlog.info('链路拓扑指标轮询 切换', {
49
87
  linkCi: linkCi,
50
- linkMetricCodes: linkMetricCodes
88
+ oldCodes: oldCodes
51
89
  });
52
- queryLinkMetricsRequest.run(linkCi, linkMetricCodes);
90
+ queryLinkMetricsRequest.run(linkCi, oldCodes);
91
+
92
+ if (newCodes.length > 0) {
93
+ queryLastestValues.run({
94
+ 'id': linkCi.attributes.name
95
+ });
96
+ }
53
97
  }
54
98
 
55
99
  return function () {};
@@ -132,6 +132,10 @@ function _queryLinkLatestMetrics() {
132
132
  export function queryLinkInterfacesLatestMetrics(_x5) {
133
133
  return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
134
134
  }
135
+ /**
136
+ * @name checkMenu 判断当前流量监控权限
137
+ * @returns
138
+ */
135
139
 
136
140
  function _queryLinkInterfacesLatestMetrics() {
137
141
  _queryLinkInterfacesLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(linkCi) {
@@ -207,4 +211,80 @@ function _queryLinkInterfacesLatestMetrics() {
207
211
  }, _callee4);
208
212
  }));
209
213
  return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
214
+ }
215
+
216
+ export function checkMenu() {
217
+ return _checkMenu.apply(this, arguments);
218
+ }
219
+ /**
220
+ * @name isOpenFlow 是否配置流量分析
221
+ * @returns
222
+ */
223
+
224
+ function _checkMenu() {
225
+ _checkMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
226
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
227
+ while (1) {
228
+ switch (_context5.prev = _context5.next) {
229
+ case 0:
230
+ return _context5.abrupt("return", request.post('/authorization/v1/api/authority/check/checkMenuAuthentication', [{
231
+ "url": "/default/trafficControl"
232
+ }]));
233
+
234
+ case 1:
235
+ case "end":
236
+ return _context5.stop();
237
+ }
238
+ }
239
+ }, _callee5);
240
+ }));
241
+ return _checkMenu.apply(this, arguments);
242
+ }
243
+
244
+ export function isOpenFlow(_x6) {
245
+ return _isOpenFlow.apply(this, arguments);
246
+ }
247
+ /**
248
+ * @name isOpenFlow 查指标值
249
+ * @returns
250
+ */
251
+
252
+ function _isOpenFlow() {
253
+ _isOpenFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params) {
254
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
255
+ while (1) {
256
+ switch (_context6.prev = _context6.next) {
257
+ case 0:
258
+ return _context6.abrupt("return", request.post('/flow/v1/api/link/isOpenFlowMonitorByName', params));
259
+
260
+ case 1:
261
+ case "end":
262
+ return _context6.stop();
263
+ }
264
+ }
265
+ }, _callee6);
266
+ }));
267
+ return _isOpenFlow.apply(this, arguments);
268
+ }
269
+
270
+ export function queryLastestValue(_x7) {
271
+ return _queryLastestValue.apply(this, arguments);
272
+ }
273
+
274
+ function _queryLastestValue() {
275
+ _queryLastestValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(params) {
276
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
277
+ while (1) {
278
+ switch (_context7.prev = _context7.next) {
279
+ case 0:
280
+ return _context7.abrupt("return", request.post('/flow/v1/api/LinkAnalyse/queryLastestValue', params));
281
+
282
+ case 1:
283
+ case "end":
284
+ return _context7.stop();
285
+ }
286
+ }
287
+ }, _callee7);
288
+ }));
289
+ return _queryLastestValue.apply(this, arguments);
210
290
  }