@riil-frontend/component-topology 9.0.0-a.8 → 9.0.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.
- package/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +15 -15
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/es/core/components/TopoView/GraphViewPanel.js +17 -4
- package/es/core/components/TopoView/TopoView.module.scss +17 -3
- package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/es/core/editor/components/EditorPlugin.js +4 -1
- package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +20 -5
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/es/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -2
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
- package/es/core/editor/config/themes.js +53 -2
- package/es/core/editor/utils/edgeTypeStyleUtil.js +38 -0
- package/es/core/hooks/useCanvasTheme.js +12 -4
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useTopoEdit.js +120 -19
- package/es/core/hooks/useTopoFullscreen.js +32 -0
- package/es/core/models/AttributeMetricDisplay.js +89 -74
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/attributeFormatter/index.js +16 -16
- package/es/core/models/topoData.js +16 -9
- package/es/core/models/utils/linkUtils.js +52 -27
- package/es/core/store/models/topoConfig.js +51 -20
- package/es/core/test/Test.js +52 -0
- package/es/core/utils/graphLinkUtil.js +11 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +16 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +8 -78
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -37
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
- package/es/networkTopo/getTopoData.js +2 -1
- package/es/networkTopo/models/IpNodeTagsTipsBuilder.js +113 -0
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
- package/es/networkTopo/models/TopoCenter.js +4 -3
- package/es/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +27 -26
- package/es/networkTopo/services/topo/networkLink.js +45 -3
- package/es/networkTopo/utils/exitLinkUtil.js +257 -0
- package/es/style.js +1 -0
- package/es/utils/ResourceConfigUtil.js +5 -4
- package/es/utils/htElementDataUtil.js +1 -7
- package/es/utils/htElementUtils.js +21 -21
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
- package/lib/core/components/TopoView/TopoView.module.scss +17 -3
- package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/lib/core/editor/components/EditorPlugin.js +7 -1
- package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +19 -3
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/lib/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
- package/lib/core/editor/config/themes.js +53 -2
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +39 -0
- package/lib/core/hooks/useCanvasTheme.js +12 -4
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +121 -18
- package/lib/core/hooks/useTopoFullscreen.js +42 -0
- package/lib/core/models/AttributeMetricDisplay.js +85 -74
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/attributeFormatter/index.js +14 -14
- package/lib/core/models/topoData.js +16 -9
- package/lib/core/models/utils/linkUtils.js +53 -26
- package/lib/core/store/models/topoConfig.js +56 -19
- package/lib/core/test/Test.js +52 -0
- package/lib/core/utils/graphLinkUtil.js +10 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +15 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +7 -78
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -36
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
- package/lib/networkTopo/getTopoData.js +2 -1
- package/lib/networkTopo/models/IpNodeTagsTipsBuilder.js +123 -0
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
- package/lib/networkTopo/models/TopoCenter.js +4 -3
- package/lib/networkTopo/services/topo/basic.js +28 -28
- package/lib/networkTopo/services/topo/networkLink.js +45 -3
- package/lib/networkTopo/utils/exitLinkUtil.js +269 -0
- package/lib/style.js +1 -0
- package/lib/utils/ResourceConfigUtil.js +4 -4
- package/lib/utils/htElementDataUtil.js +0 -10
- package/lib/utils/htElementUtils.js +21 -21
- package/package.json +2 -2
@@ -1,7 +1,7 @@
|
|
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,
|
4
|
+
import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics, queryRetansRatioNetDelayRatio } from "../services";
|
5
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog'; // 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
|
6
6
|
|
7
7
|
export default function useMetricPolling(_ref) {
|
@@ -9,10 +9,10 @@ export default function useMetricPolling(_ref) {
|
|
9
9
|
linkMetricCodes = _ref.linkMetricCodes;
|
10
10
|
var linkId = linkCi.id;
|
11
11
|
var arr = ['netDelayRatio', 'retansRatio'];
|
12
|
-
var
|
13
|
-
var
|
12
|
+
var codes = [];
|
13
|
+
var retansRatioNetDelayRatioCodes = [];
|
14
14
|
linkMetricCodes.map(function (item) {
|
15
|
-
arr.indexOf(item) > -1 ?
|
15
|
+
arr.indexOf(item) > -1 ? retansRatioNetDelayRatioCodes.push(item) : codes.push(item);
|
16
16
|
});
|
17
17
|
|
18
18
|
var _useState = useState({
|
@@ -26,35 +26,15 @@ export default function useMetricPolling(_ref) {
|
|
26
26
|
data = _useState[0],
|
27
27
|
setData = _useState[1];
|
28
28
|
|
29
|
-
var queryLastestValues = useRequest(
|
29
|
+
var queryLastestValues = useRequest(queryRetansRatioNetDelayRatio, {
|
30
30
|
pollingInterval: 1000 * 15,
|
31
31
|
pollingWhenHidden: false,
|
32
32
|
debounceInterval: 200,
|
33
33
|
manual: true,
|
34
34
|
onSuccess: function onSuccess(result) {
|
35
|
-
|
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
|
-
}
|
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));
|
35
|
+
setData(_extends({}, data, {
|
36
|
+
linkOther: result
|
37
|
+
}));
|
58
38
|
}
|
59
39
|
}); // 轮询hooks
|
60
40
|
|
@@ -78,26 +58,36 @@ export default function useMetricPolling(_ref) {
|
|
78
58
|
rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
|
79
59
|
}
|
80
60
|
});
|
81
|
-
var linkMetricCodesStr =
|
61
|
+
var linkMetricCodesStr = codes.map(function (item) {
|
82
62
|
return item;
|
83
63
|
}).sort().join(',');
|
84
64
|
useEffect(function () {
|
85
65
|
if (linkId) {
|
86
66
|
rlog.info('链路拓扑指标轮询 切换', {
|
87
67
|
linkCi: linkCi,
|
88
|
-
|
68
|
+
codes: codes
|
89
69
|
});
|
90
|
-
queryLinkMetricsRequest.run(linkCi,
|
91
|
-
|
92
|
-
if (newCodes.length > 0) {
|
93
|
-
queryLastestValues.run({
|
94
|
-
'id': linkCi.attributes.name
|
95
|
-
});
|
96
|
-
}
|
70
|
+
queryLinkMetricsRequest.run(linkCi, codes);
|
97
71
|
}
|
98
72
|
|
99
73
|
return function () {};
|
100
74
|
}, [linkId, linkMetricCodesStr]);
|
75
|
+
var retansRatioNetDelayRatioCodesStr = retansRatioNetDelayRatioCodes.map(function (item) {
|
76
|
+
return item;
|
77
|
+
}).sort().join(',');
|
78
|
+
useEffect(function () {
|
79
|
+
if (linkId) {
|
80
|
+
rlog.info('链路拓扑指标勾选rtt|重传率 轮询', {
|
81
|
+
linkCi: linkCi,
|
82
|
+
retansRatioNetDelayRatioCodes: retansRatioNetDelayRatioCodes
|
83
|
+
});
|
84
|
+
queryLastestValues.run({
|
85
|
+
'id': linkCi.attributes.name
|
86
|
+
}, retansRatioNetDelayRatioCodes);
|
87
|
+
}
|
88
|
+
|
89
|
+
return function () {};
|
90
|
+
}, [linkId, retansRatioNetDelayRatioCodesStr]);
|
101
91
|
useEffect(function () {
|
102
92
|
if (linkId) {
|
103
93
|
rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
|
@@ -245,7 +245,7 @@ export function isOpenFlow(_x6) {
|
|
245
245
|
return _isOpenFlow.apply(this, arguments);
|
246
246
|
}
|
247
247
|
/**
|
248
|
-
* @name
|
248
|
+
* @name queryLastestValue 查指标值
|
249
249
|
* @returns
|
250
250
|
*/
|
251
251
|
|
@@ -287,4 +287,60 @@ function _queryLastestValue() {
|
|
287
287
|
}, _callee7);
|
288
288
|
}));
|
289
289
|
return _queryLastestValue.apply(this, arguments);
|
290
|
+
}
|
291
|
+
|
292
|
+
export function queryRetansRatioNetDelayRatio(_x8, _x9) {
|
293
|
+
return _queryRetansRatioNetDelayRatio.apply(this, arguments);
|
294
|
+
}
|
295
|
+
|
296
|
+
function _queryRetansRatioNetDelayRatio() {
|
297
|
+
_queryRetansRatioNetDelayRatio = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, retansRatioNetDelayRatioCodes) {
|
298
|
+
var result, linkOther;
|
299
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
300
|
+
while (1) {
|
301
|
+
switch (_context8.prev = _context8.next) {
|
302
|
+
case 0:
|
303
|
+
if (retansRatioNetDelayRatioCodes.length) {
|
304
|
+
_context8.next = 2;
|
305
|
+
break;
|
306
|
+
}
|
307
|
+
|
308
|
+
return _context8.abrupt("return", []);
|
309
|
+
|
310
|
+
case 2:
|
311
|
+
_context8.next = 4;
|
312
|
+
return queryLastestValue(params);
|
313
|
+
|
314
|
+
case 4:
|
315
|
+
result = _context8.sent;
|
316
|
+
linkOther = [];
|
317
|
+
|
318
|
+
if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
|
319
|
+
linkOther.push({
|
320
|
+
'code': 'netDelayRatio',
|
321
|
+
'name': 'RTT时延',
|
322
|
+
'ts': result.time,
|
323
|
+
'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
|
324
|
+
});
|
325
|
+
}
|
326
|
+
|
327
|
+
if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
|
328
|
+
linkOther.push({
|
329
|
+
'code': 'retansRatio',
|
330
|
+
'name': '重传率',
|
331
|
+
'ts': result.time,
|
332
|
+
'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
|
333
|
+
});
|
334
|
+
}
|
335
|
+
|
336
|
+
return _context8.abrupt("return", linkOther);
|
337
|
+
|
338
|
+
case 9:
|
339
|
+
case "end":
|
340
|
+
return _context8.stop();
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}, _callee8);
|
344
|
+
}));
|
345
|
+
return _queryRetansRatioNetDelayRatio.apply(this, arguments);
|
290
346
|
}
|
@@ -77,6 +77,7 @@ function _addLinkData() {
|
|
77
77
|
|
78
78
|
case 4:
|
79
79
|
networkLinks = _context.sent;
|
80
|
+
console.log("如果是网络链路,补充详情信息", networkLinks);
|
80
81
|
otherLinks = links.filter(function (link) {
|
81
82
|
return link.ciType !== 'network_link';
|
82
83
|
});
|
@@ -85,7 +86,7 @@ function _addLinkData() {
|
|
85
86
|
linkGroups: []
|
86
87
|
}));
|
87
88
|
|
88
|
-
case
|
89
|
+
case 8:
|
89
90
|
case "end":
|
90
91
|
return _context.stop();
|
91
92
|
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
/**
|
2
|
+
* 连线组标注、悬浮框数据构建
|
3
|
+
*/
|
4
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
5
|
+
import { getEdgeGroups } from "../../utils/htElementUtils";
|
6
|
+
import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与计算的链路指标
|
7
|
+
|
8
|
+
var metrics = [// 总流速
|
9
|
+
{
|
10
|
+
code: "interface_totalbps",
|
11
|
+
calcType: "sum"
|
12
|
+
}, // 带宽利用率
|
13
|
+
{
|
14
|
+
code: "bandwidth_utilization",
|
15
|
+
calcType: "avg"
|
16
|
+
}, // 发送带宽利用率
|
17
|
+
{
|
18
|
+
code: "out_bandwidth_utilization",
|
19
|
+
calcType: "avg",
|
20
|
+
showWhenSameSource: true
|
21
|
+
}, // 接收带宽利用率
|
22
|
+
{
|
23
|
+
code: "in_bandwidth_utilization",
|
24
|
+
calcType: "avg",
|
25
|
+
showWhenSameSource: true
|
26
|
+
}, {
|
27
|
+
code: "out_rate",
|
28
|
+
calcType: "sum",
|
29
|
+
showWhenSameSource: true
|
30
|
+
}, {
|
31
|
+
code: "in_rate",
|
32
|
+
calcType: "sum",
|
33
|
+
showWhenSameSource: true
|
34
|
+
}];
|
35
|
+
var calcFnMap = {
|
36
|
+
sum: function sum(values) {
|
37
|
+
return values.reduce(function (total, val) {
|
38
|
+
return total + parseInt(val || 0, 10);
|
39
|
+
}, 0);
|
40
|
+
},
|
41
|
+
avg: function avg(values) {
|
42
|
+
return values.reduce(function (total, val) {
|
43
|
+
return total + parseFloat(val || 0, 10);
|
44
|
+
}, 0) / values.length;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
|
49
|
+
function IpNodeTagsTipsBuilder(amDisplay) {
|
50
|
+
this.amDisplay = void 0;
|
51
|
+
this.topo = void 0;
|
52
|
+
this.amDisplay = amDisplay;
|
53
|
+
this.topo = amDisplay.topo;
|
54
|
+
}
|
55
|
+
|
56
|
+
var _proto = IpNodeTagsTipsBuilder.prototype;
|
57
|
+
|
58
|
+
_proto.getExtElementTagsAndTips = function getExtElementTagsAndTips() {
|
59
|
+
return this.getIpNodeTagsAndTips();
|
60
|
+
};
|
61
|
+
|
62
|
+
_proto.getIpNodeTagsAndTips = function getIpNodeTagsAndTips() {
|
63
|
+
// const ciConfigs = this.amDisplay.getResourceTagTipConfig();
|
64
|
+
var tts = [];
|
65
|
+
var data = this.amDisplay.getData();
|
66
|
+
var ipNodes = data.filter(function (item) {
|
67
|
+
return item.bindType === "ip";
|
68
|
+
});
|
69
|
+
var topo = this.topo;
|
70
|
+
var dm = this.topo.getDataModel();
|
71
|
+
var config = topo.attributeMetricDisplay.getConfig();
|
72
|
+
console.log("getIpNodeTagsAndTips", config, ipNodes);
|
73
|
+
|
74
|
+
if (config.nodeTag && !config.nodeTag.isCustom) {
|
75
|
+
var tagDatas = config.nodeTag.data;
|
76
|
+
var hasIpv4 = tagDatas.filter(function (item) {
|
77
|
+
return item.code === "ipv4_address";
|
78
|
+
}).length > 0;
|
79
|
+
ipNodes.map(function (node) {
|
80
|
+
if (hasIpv4) {
|
81
|
+
tts.push({
|
82
|
+
type: node,
|
83
|
+
id: node.id,
|
84
|
+
tags: [{
|
85
|
+
type: "attribute",
|
86
|
+
code: "ipv4_address",
|
87
|
+
// 属性code
|
88
|
+
name: "IPv4地址",
|
89
|
+
// 属性名称
|
90
|
+
value: node.bindIp,
|
91
|
+
// 属性值
|
92
|
+
originValue: node.bindIp
|
93
|
+
}],
|
94
|
+
tips: []
|
95
|
+
});
|
96
|
+
} else {
|
97
|
+
tts.push({
|
98
|
+
type: node,
|
99
|
+
id: node.id,
|
100
|
+
tags: [],
|
101
|
+
tips: []
|
102
|
+
});
|
103
|
+
}
|
104
|
+
});
|
105
|
+
}
|
106
|
+
|
107
|
+
return tts;
|
108
|
+
};
|
109
|
+
|
110
|
+
return IpNodeTagsTipsBuilder;
|
111
|
+
}();
|
112
|
+
|
113
|
+
export { IpNodeTagsTipsBuilder as default };
|
@@ -5,15 +5,15 @@ import { getLinksBetweenNodes } from "../utils/linkUtil"; // network_link.actual
|
|
5
5
|
|
6
6
|
function calcEdgeWidth(actualBandwidth) {
|
7
7
|
if (!actualBandwidth) {
|
8
|
-
return
|
8
|
+
return 3;
|
9
9
|
} else if (actualBandwidth <= 100) {
|
10
|
-
return 2;
|
11
|
-
} else if (actualBandwidth <= 1000) {
|
12
10
|
return 3;
|
13
|
-
} else if (actualBandwidth <=
|
11
|
+
} else if (actualBandwidth <= 1000) {
|
14
12
|
return 4;
|
15
|
-
} else if (actualBandwidth
|
13
|
+
} else if (actualBandwidth <= 10000) {
|
16
14
|
return 5;
|
15
|
+
} else if (actualBandwidth > 10000) {
|
16
|
+
return 6;
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
@@ -169,11 +169,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
169
169
|
var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
|
170
170
|
|
171
171
|
if (!autoChangeEdgeWidth) {
|
172
|
-
return
|
172
|
+
return 3;
|
173
173
|
}
|
174
174
|
|
175
175
|
if (!links.length) {
|
176
|
-
return
|
176
|
+
return 3;
|
177
177
|
}
|
178
178
|
|
179
179
|
var total = 0;
|
@@ -192,7 +192,7 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
192
192
|
var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
|
193
193
|
|
194
194
|
if (!autoChangeEdgeWidth) {
|
195
|
-
return
|
195
|
+
return 3;
|
196
196
|
}
|
197
197
|
|
198
198
|
return this.calcEdgeWidth(link.attributes['network_link.actual_bandwidth']);
|
@@ -8,7 +8,8 @@ import TopoApp from "../../core/models/TopoApp";
|
|
8
8
|
import createMenuCommands from "../../contextmenu/createMenuCommands";
|
9
9
|
import getTopoData from "../getTopoData";
|
10
10
|
import customStoreModels from "../store";
|
11
|
-
import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
11
|
+
import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
12
|
+
import IpNodeTagsTipsBuilder from "./IpNodeTagsTipsBuilder";
|
12
13
|
|
13
14
|
var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
14
15
|
_inheritsLoose(TopoCenter, _TopoApp);
|
@@ -28,8 +29,8 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
28
29
|
},
|
29
30
|
getDefaultLinkTipConfig: function getDefaultLinkTipConfig() {
|
30
31
|
return DEFAULT_TIP_COMMON_CONFIG;
|
31
|
-
}
|
32
|
-
|
32
|
+
},
|
33
|
+
ExtElementTagTipBuilder: IpNodeTagsTipsBuilder
|
33
34
|
}
|
34
35
|
})) || this;
|
35
36
|
_this.resourceConfig = null;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
3
|
-
import { request } from
|
3
|
+
import { request } from "@riil-frontend/component-topology-utils";
|
4
4
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
5
5
|
export default {
|
6
6
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
4
|
-
var _excluded = ["groups", "resources"];
|
4
|
+
var _excluded = ["groups", "resources", "exportLinkIdList"];
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
6
6
|
import { request } from '@riil-frontend/component-topology-utils';
|
7
7
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
@@ -9,6 +9,7 @@ import blackList from "./blacklist";
|
|
9
9
|
import { TOPO_API_ROOT } from "./constants";
|
10
10
|
import { commonQuery } from "../cmdb";
|
11
11
|
import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
|
12
|
+
import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
|
12
13
|
var API_ROOT = TOPO_API_ROOT;
|
13
14
|
/**
|
14
15
|
* 拓扑图(看做一个容器)的“父容器”ID
|
@@ -53,10 +54,16 @@ function prepareResourceParams(conditions, query) {
|
|
53
54
|
dynamicCondition.sort = query.sortBy + " " + query.sortOrder;
|
54
55
|
}
|
55
56
|
|
56
|
-
var fixedConditionIdList = staticRes || undefined;
|
57
57
|
return {
|
58
58
|
dynamicCondition: dynamicCondition,
|
59
|
-
fixedConditionIdList:
|
59
|
+
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
60
|
+
return !ciId.startsWith('ip:');
|
61
|
+
}),
|
62
|
+
linkIps: (staticRes || []).filter(function (ciId) {
|
63
|
+
return ciId.startsWith('ip:');
|
64
|
+
}).map(function (ciId) {
|
65
|
+
return ciId.replace('ip:', '');
|
66
|
+
})
|
60
67
|
};
|
61
68
|
}
|
62
69
|
|
@@ -401,38 +408,33 @@ export default _extends({
|
|
401
408
|
*/
|
402
409
|
getTopoData: function getTopoData(id) {
|
403
410
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
404
|
-
var _result$
|
411
|
+
var _result$nodes, _result$links;
|
405
412
|
|
413
|
+
var result;
|
406
414
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
407
415
|
while (1) {
|
408
416
|
switch (_context12.prev = _context12.next) {
|
409
417
|
case 0:
|
410
|
-
_context12.
|
411
|
-
_context12.next = 3;
|
418
|
+
_context12.next = 2;
|
412
419
|
return request.get(API_ROOT + "/structure/both/" + id);
|
413
420
|
|
414
|
-
case
|
421
|
+
case 2:
|
415
422
|
result = _context12.sent;
|
416
|
-
return _context12.abrupt("return", _extends({}, result, {
|
423
|
+
return _context12.abrupt("return", processExitLink(_extends({}, result, {
|
424
|
+
nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
|
417
425
|
links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
|
418
426
|
return _extends({}, item, {
|
419
427
|
ciType: 'network_link'
|
420
428
|
});
|
421
429
|
})
|
422
|
-
}));
|
430
|
+
})));
|
423
431
|
|
424
|
-
case
|
425
|
-
_context12.prev = 7;
|
426
|
-
_context12.t0 = _context12["catch"](0);
|
427
|
-
rlog.debug('getTopoData-error', _context12.t0);
|
428
|
-
return _context12.abrupt("return", null);
|
429
|
-
|
430
|
-
case 11:
|
432
|
+
case 4:
|
431
433
|
case "end":
|
432
434
|
return _context12.stop();
|
433
435
|
}
|
434
436
|
}
|
435
|
-
}, _callee12
|
437
|
+
}, _callee12);
|
436
438
|
}))();
|
437
439
|
},
|
438
440
|
|
@@ -443,9 +445,9 @@ export default _extends({
|
|
443
445
|
* @param {Array} groups
|
444
446
|
* @returns
|
445
447
|
*/
|
446
|
-
getTopoDataByResource: function getTopoDataByResource(id, resources, groups
|
448
|
+
getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
|
447
449
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
448
|
-
var _result$links2;
|
450
|
+
var _result$nodes2, _result$links2;
|
449
451
|
|
450
452
|
var data, obj, result;
|
451
453
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
@@ -464,19 +466,18 @@ export default _extends({
|
|
464
466
|
|
465
467
|
obj = prepareGroupParams(data);
|
466
468
|
_context13.next = 5;
|
467
|
-
return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj
|
468
|
-
exportLinkIdList: exportLinkIdList
|
469
|
-
}));
|
469
|
+
return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj));
|
470
470
|
|
471
471
|
case 5:
|
472
472
|
result = _context13.sent;
|
473
|
-
return _context13.abrupt("return", _extends({}, result, {
|
473
|
+
return _context13.abrupt("return", processByConditionResult(_extends({}, result, {
|
474
|
+
nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
|
474
475
|
links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
|
475
476
|
return _extends({}, item, {
|
476
477
|
ciType: 'network_link'
|
477
478
|
});
|
478
479
|
})
|
479
|
-
}));
|
480
|
+
}), obj.groups));
|
480
481
|
|
481
482
|
case 7:
|
482
483
|
case "end":
|
@@ -496,12 +497,12 @@ export default _extends({
|
|
496
497
|
*/
|
497
498
|
bindResourceToTopo: function bindResourceToTopo(id, config) {
|
498
499
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
499
|
-
var groups, resources, otherConfig, newGroups, obj;
|
500
|
+
var groups, resources, exportLinkIdList, otherConfig, newGroups, obj;
|
500
501
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
501
502
|
while (1) {
|
502
503
|
switch (_context14.prev = _context14.next) {
|
503
504
|
case 0:
|
504
|
-
groups = config.groups, resources = config.resources, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
|
505
|
+
groups = config.groups, resources = config.resources, exportLinkIdList = config.exportLinkIdList, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
|
505
506
|
newGroups = isAvailableArray(groups) ? groups : [];
|
506
507
|
|
507
508
|
if (resources) {
|
@@ -6,9 +6,9 @@ var API_ROOT = TOPO_API_ROOT;
|
|
6
6
|
export default {
|
7
7
|
/**
|
8
8
|
* 批量查询ci类型是否可创建链路
|
9
|
-
*
|
10
|
-
* @param {*} typeCodes
|
11
|
-
* @returns
|
9
|
+
*
|
10
|
+
* @param {*} typeCodes
|
11
|
+
* @returns
|
12
12
|
*/
|
13
13
|
getCiTypesConnectable: function getCiTypesConnectable(typeCodes) {
|
14
14
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
@@ -29,5 +29,47 @@ export default {
|
|
29
29
|
}
|
30
30
|
}, _callee);
|
31
31
|
}))();
|
32
|
+
},
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 通过ip查询关联链路
|
36
|
+
*
|
37
|
+
* @param {array} ciIds
|
38
|
+
*/
|
39
|
+
queryLinksByIp: function queryLinksByIp(ids, ip) {
|
40
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
41
|
+
var stag, condition, parm, result;
|
42
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
43
|
+
while (1) {
|
44
|
+
switch (_context2.prev = _context2.next) {
|
45
|
+
case 0:
|
46
|
+
stag = "'" + ids.join("','") + "'";
|
47
|
+
condition = "type('network_link') && network_link.destination_ipv4 = '" + ip + "' && network_link.source_device_id in [" + stag + "]";
|
48
|
+
parm = {
|
49
|
+
condition: condition,
|
50
|
+
sort: "name asc",
|
51
|
+
currentPage: 1,
|
52
|
+
pageSize: 999
|
53
|
+
};
|
54
|
+
_context2.prev = 3;
|
55
|
+
_context2.next = 6;
|
56
|
+
return request.post("/mdc/v1/api/cmdb/commonQueryCiData", parm);
|
57
|
+
|
58
|
+
case 6:
|
59
|
+
result = _context2.sent;
|
60
|
+
return _context2.abrupt("return", result);
|
61
|
+
|
62
|
+
case 10:
|
63
|
+
_context2.prev = 10;
|
64
|
+
_context2.t0 = _context2["catch"](3);
|
65
|
+
rlog.error("通过ip查询关联链路", _context2.t0);
|
66
|
+
|
67
|
+
case 13:
|
68
|
+
case "end":
|
69
|
+
return _context2.stop();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}, _callee2, null, [[3, 10]]);
|
73
|
+
}))();
|
32
74
|
}
|
33
75
|
};
|