@riil-frontend/component-topology 8.0.10 → 9.0.0-a.2
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.
- package/build/index.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +52 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +75 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +68 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +80 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +65 -3
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +52 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +5 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +82 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +67 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +86 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +66 -3
- package/package.json +2 -2
@@ -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 "
|
27
|
+
var version = typeof "9.0.0-a.2" === 'string' ? "9.0.0-a.2" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -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";
|
32
|
+
import EventsCard from "./EventsCard";
|
33
|
+
import { 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,15 @@ export default function ResourceOverview(props) {
|
|
738
740
|
|
739
741
|
case 11:
|
740
742
|
metricList = _context8.sent;
|
741
|
-
|
743
|
+
_context8.next = 14;
|
744
|
+
return queryLastestValue({
|
745
|
+
'id': data.attributes.name
|
746
|
+
});
|
747
|
+
|
748
|
+
case 14:
|
749
|
+
newMetricList = _context8.sent;
|
750
|
+
metricLists = metricList.concat(getNewMetricList(newMetricList));
|
751
|
+
rlog.debug('metricColChange', metricLists, monitorMetricModels);
|
742
752
|
setMetric(col.map(function (item, key) {
|
743
753
|
return {
|
744
754
|
code: item.dataIndex,
|
@@ -748,7 +758,7 @@ export default function ResourceOverview(props) {
|
|
748
758
|
metricItem: monitorMetricModels.find(function (m_item) {
|
749
759
|
return m_item.code === item.dataIndex;
|
750
760
|
}),
|
751
|
-
list:
|
761
|
+
list: metricLists.filter(function (m_item) {
|
752
762
|
return m_item.metricCode === item.dataIndex;
|
753
763
|
})
|
754
764
|
};
|
@@ -763,7 +773,7 @@ export default function ResourceOverview(props) {
|
|
763
773
|
}, 60000);
|
764
774
|
}
|
765
775
|
|
766
|
-
case
|
776
|
+
case 20:
|
767
777
|
case "end":
|
768
778
|
return _context8.stop();
|
769
779
|
}
|
@@ -773,6 +783,42 @@ export default function ResourceOverview(props) {
|
|
773
783
|
return _metricColChange.apply(this, arguments);
|
774
784
|
}
|
775
785
|
|
786
|
+
var getNewMetricList = function getNewMetricList(data) {
|
787
|
+
return [{
|
788
|
+
errorMsg: null,
|
789
|
+
mainCiId: "downNetDelayRatio",
|
790
|
+
metricCode: "downNetDelayRatio",
|
791
|
+
metricValue: data.downNetDelayRatio,
|
792
|
+
subCiId: '',
|
793
|
+
subCiType: null,
|
794
|
+
mainCiType: null
|
795
|
+
}, {
|
796
|
+
errorMsg: null,
|
797
|
+
mainCiId: "downRetansRatio",
|
798
|
+
metricCode: "downRetansRatio",
|
799
|
+
metricValue: data.downRetansRatio,
|
800
|
+
subCiId: '',
|
801
|
+
subCiType: null,
|
802
|
+
mainCiType: null
|
803
|
+
}, {
|
804
|
+
errorMsg: null,
|
805
|
+
mainCiId: "upNetDelayRatio",
|
806
|
+
metricCode: "upNetDelayRatio",
|
807
|
+
metricValue: data.upNetDelayRatio,
|
808
|
+
subCiId: '',
|
809
|
+
subCiType: null,
|
810
|
+
mainCiType: null
|
811
|
+
}, {
|
812
|
+
errorMsg: null,
|
813
|
+
mainCiId: "upRetransRatio",
|
814
|
+
metricCode: "upRetransRatio",
|
815
|
+
metricValue: data.upRetransRatio,
|
816
|
+
subCiId: '',
|
817
|
+
subCiType: null,
|
818
|
+
mainCiType: null
|
819
|
+
}];
|
820
|
+
};
|
821
|
+
|
776
822
|
var defaultCols = useMemo(function () {
|
777
823
|
var baseInfo = [];
|
778
824
|
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
|
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
|
|
@@ -15,6 +18,75 @@ export default function LinkTopoCard(props) {
|
|
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
20
|
var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
|
21
|
+
|
22
|
+
var _useState = useState(-1),
|
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')) {
|
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,7 @@ export default function LinkTopoCard(props) {
|
|
29
101
|
})
|
30
102
|
}, /*#__PURE__*/React.createElement(LinkTopo, {
|
31
103
|
data: data,
|
32
|
-
linkMetricCodes: metricCodes
|
104
|
+
linkMetricCodes: metricCodes,
|
105
|
+
openFlow: openFlow
|
33
106
|
}));
|
34
107
|
}
|
@@ -1,24 +1,80 @@
|
|
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 = ['downNetDelayRatio', 'downRetansRatio', 'upNetDelayRatio', 'upRetransRatio'];
|
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];
|
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
|
+
};
|
21
38
|
|
39
|
+
if (newCodes.includes('downNetDelayRatio')) {
|
40
|
+
datas.linkOther.push({
|
41
|
+
'code': 'downNetDelayRatio',
|
42
|
+
'name': '下行RTT时延',
|
43
|
+
'ts': result.time,
|
44
|
+
'value': result.downNetDelayRatio + ' ms'
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
if (newCodes.includes('downRetansRatio')) {
|
49
|
+
datas.linkOther.push({
|
50
|
+
'code': 'downRetansRatio',
|
51
|
+
'name': '下行重传率',
|
52
|
+
'ts': result.time,
|
53
|
+
'value': result.downRetansRatio + ' %'
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
if (newCodes.includes('upNetDelayRatio')) {
|
58
|
+
datas.linkOther.push({
|
59
|
+
'code': 'upNetDelayRatio',
|
60
|
+
'name': '上行RTT时延',
|
61
|
+
'ts': result.time,
|
62
|
+
'value': result.upNetDelayRatio + ' ms'
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
if (newCodes.includes('upRetransRatio')) {
|
67
|
+
datas.linkOther.push({
|
68
|
+
'code': 'upRetransRatio',
|
69
|
+
'name': '上行重传率',
|
70
|
+
'ts': result.time,
|
71
|
+
'value': result.upRetransRatio + ' %'
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
setData(_extends({}, data, datas));
|
76
|
+
}
|
77
|
+
}); // 轮询hooks
|
22
78
|
|
23
79
|
var queryLinkMetricsRequest = useRequest(queryLinkLatestMetrics, {
|
24
80
|
pollingInterval: 60 * 1000,
|
@@ -40,16 +96,22 @@ export default function useMetricPolling(_ref) {
|
|
40
96
|
rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
|
41
97
|
}
|
42
98
|
});
|
43
|
-
var linkMetricCodesStr =
|
99
|
+
var linkMetricCodesStr = oldCodes.map(function (item) {
|
44
100
|
return item;
|
45
101
|
}).sort().join(',');
|
46
102
|
useEffect(function () {
|
47
103
|
if (linkId) {
|
48
104
|
rlog.info('链路拓扑指标轮询 切换', {
|
49
105
|
linkCi: linkCi,
|
50
|
-
|
106
|
+
oldCodes: oldCodes
|
51
107
|
});
|
52
|
-
queryLinkMetricsRequest.run(linkCi,
|
108
|
+
queryLinkMetricsRequest.run(linkCi, oldCodes);
|
109
|
+
|
110
|
+
if (newCodes.length > 0) {
|
111
|
+
queryLastestValues.run({
|
112
|
+
'id': linkCi.attributes.name
|
113
|
+
});
|
114
|
+
}
|
53
115
|
}
|
54
116
|
|
55
117
|
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
|
}
|
@@ -3,6 +3,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useRequest } from 'ahooks';
|
4
4
|
import { useEffect, useState } from 'react';
|
5
5
|
import { queryCiMonitorMetricCodes } from "../../../getCiDisplayMetricModels";
|
6
|
+
import { checkMenu, isOpenFlow } from "../components/LinkTopo/services";
|
6
7
|
/**
|
7
8
|
* 概览指标定义
|
8
9
|
* @param {*} props
|
@@ -15,6 +16,7 @@ var useMetricModels = function useMetricModels(props) {
|
|
15
16
|
ciType = _props$data.ciType,
|
16
17
|
isMonite = props.isMonite,
|
17
18
|
ciTypeMeta = props.ciTypeMeta,
|
19
|
+
resourceData = props.resourceData,
|
18
20
|
topo = props.topo,
|
19
21
|
resourceOverviewProps = props.resourceOverviewProps;
|
20
22
|
|
@@ -33,7 +35,7 @@ var useMetricModels = function useMetricModels(props) {
|
|
33
35
|
|
34
36
|
function _fetchData() {
|
35
37
|
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
36
|
-
var monitorMetrics, ciMonitorMetricModels, displayMetricModels, _metricCodes;
|
38
|
+
var monitorMetrics, ciMonitorMetricModels, checkMenus, isOpen, displayMetricModels, _metricCodes;
|
37
39
|
|
38
40
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
39
41
|
while (1) {
|
@@ -48,8 +50,68 @@ var useMetricModels = function useMetricModels(props) {
|
|
48
50
|
return !!monitorMetrics.find(function (item) {
|
49
51
|
return item === m.code;
|
50
52
|
});
|
51
|
-
});
|
53
|
+
});
|
54
|
+
_context.next = 6;
|
55
|
+
return checkMenu();
|
52
56
|
|
57
|
+
case 6:
|
58
|
+
checkMenus = _context.sent;
|
59
|
+
|
60
|
+
if (!(checkMenus[0].passed == 'PASS' && resourceData.attributes.display_name && resourceData.attributes['network_link.is_crucial'])) {
|
61
|
+
_context.next = 12;
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
|
65
|
+
_context.next = 10;
|
66
|
+
return isOpenFlow({
|
67
|
+
'name': resourceData.attributes.display_name
|
68
|
+
});
|
69
|
+
|
70
|
+
case 10:
|
71
|
+
isOpen = _context.sent;
|
72
|
+
|
73
|
+
//
|
74
|
+
if (isOpen) {
|
75
|
+
ciMonitorMetricModels.push({
|
76
|
+
changeValue: null,
|
77
|
+
code: "downNetDelayRatio",
|
78
|
+
id: "downNetDelayRatio",
|
79
|
+
isGoldMetric: true,
|
80
|
+
key: null,
|
81
|
+
name: "下行RTT时延",
|
82
|
+
unit: "ms"
|
83
|
+
});
|
84
|
+
ciMonitorMetricModels.push({
|
85
|
+
changeValue: null,
|
86
|
+
code: "downRetansRatio",
|
87
|
+
id: "downRetansRatio",
|
88
|
+
isGoldMetric: true,
|
89
|
+
key: null,
|
90
|
+
name: "下行重传率",
|
91
|
+
unit: "%"
|
92
|
+
});
|
93
|
+
ciMonitorMetricModels.push({
|
94
|
+
changeValue: null,
|
95
|
+
code: "upNetDelayRatio",
|
96
|
+
id: "upNetDelayRatio",
|
97
|
+
isGoldMetric: true,
|
98
|
+
key: null,
|
99
|
+
name: "上行RTT时延",
|
100
|
+
unit: "ms"
|
101
|
+
});
|
102
|
+
ciMonitorMetricModels.push({
|
103
|
+
changeValue: null,
|
104
|
+
code: "upRetransRatio",
|
105
|
+
id: "upRetransRatio",
|
106
|
+
isGoldMetric: true,
|
107
|
+
key: null,
|
108
|
+
name: "上行重传率",
|
109
|
+
unit: "%"
|
110
|
+
});
|
111
|
+
}
|
112
|
+
|
113
|
+
case 12:
|
114
|
+
// 未监控不显示指标,临时在这里处理
|
53
115
|
if (!isMonite) {
|
54
116
|
ciMonitorMetricModels = [];
|
55
117
|
}
|
@@ -81,7 +143,7 @@ var useMetricModels = function useMetricModels(props) {
|
|
81
143
|
|
82
144
|
return _context.abrupt("return", displayMetricModels);
|
83
145
|
|
84
|
-
case
|
146
|
+
case 17:
|
85
147
|
case "end":
|
86
148
|
return _context.stop();
|
87
149
|
}
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "
|
59
|
+
var version = typeof "9.0.0-a.2" === 'string' ? "9.0.0-a.2" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -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
|
|
@@ -723,7 +726,7 @@ function ResourceOverview(props) {
|
|
723
726
|
_metricColChange = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(col) {
|
724
727
|
var _col2, _col3;
|
725
728
|
|
726
|
-
var codes, endTime, params, _ref5, times, metricList;
|
729
|
+
var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
|
727
730
|
|
728
731
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
729
732
|
while (1) {
|
@@ -771,8 +774,16 @@ function ResourceOverview(props) {
|
|
771
774
|
|
772
775
|
case 11:
|
773
776
|
metricList = _context8.sent;
|
777
|
+
_context8.next = 14;
|
778
|
+
return (0, _services2.queryLastestValue)({
|
779
|
+
'id': data.attributes.name
|
780
|
+
});
|
774
781
|
|
775
|
-
|
782
|
+
case 14:
|
783
|
+
newMetricList = _context8.sent;
|
784
|
+
metricLists = metricList.concat(getNewMetricList(newMetricList));
|
785
|
+
|
786
|
+
_rlog.rlog.debug('metricColChange', metricLists, monitorMetricModels);
|
776
787
|
|
777
788
|
setMetric(col.map(function (item, key) {
|
778
789
|
return {
|
@@ -783,7 +794,7 @@ function ResourceOverview(props) {
|
|
783
794
|
metricItem: monitorMetricModels.find(function (m_item) {
|
784
795
|
return m_item.code === item.dataIndex;
|
785
796
|
}),
|
786
|
-
list:
|
797
|
+
list: metricLists.filter(function (m_item) {
|
787
798
|
return m_item.metricCode === item.dataIndex;
|
788
799
|
})
|
789
800
|
};
|
@@ -798,7 +809,7 @@ function ResourceOverview(props) {
|
|
798
809
|
}, 60000);
|
799
810
|
}
|
800
811
|
|
801
|
-
case
|
812
|
+
case 20:
|
802
813
|
case "end":
|
803
814
|
return _context8.stop();
|
804
815
|
}
|
@@ -808,6 +819,42 @@ function ResourceOverview(props) {
|
|
808
819
|
return _metricColChange.apply(this, arguments);
|
809
820
|
}
|
810
821
|
|
822
|
+
var getNewMetricList = function getNewMetricList(data) {
|
823
|
+
return [{
|
824
|
+
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,
|
844
|
+
subCiId: '',
|
845
|
+
subCiType: null,
|
846
|
+
mainCiType: null
|
847
|
+
}, {
|
848
|
+
errorMsg: null,
|
849
|
+
mainCiId: "upRetransRatio",
|
850
|
+
metricCode: "upRetransRatio",
|
851
|
+
metricValue: data.upRetransRatio,
|
852
|
+
subCiId: '',
|
853
|
+
subCiType: null,
|
854
|
+
mainCiType: null
|
855
|
+
}];
|
856
|
+
};
|
857
|
+
|
811
858
|
var defaultCols = (0, _react.useMemo)(function () {
|
812
859
|
var baseInfo = [];
|
813
860
|
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
|
}
|