@riil-frontend/component-topology 3.5.12 → 3.16.0
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 +13 -13
- package/es/constants/ResourceInfoDisplay.js +1 -1
- package/es/core/components/DisplaySettingDrawer/LinkTag.js +1 -1
- package/es/core/components/DisplaySettingDrawer/LinkTip.js +1 -1
- package/es/core/editor/components/settings/common/LineType/AlignSetting.module.scss +36 -0
- package/es/core/editor/components/settings/common/LineType/index.js +86 -0
- package/es/core/editor/components/settings/common/LineType/lineTypeUtil.js +0 -0
- package/es/core/editor/components/settings/common/SizeInput/NodeSizeNumberPicker.js +1 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +60 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +20 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +7 -3
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/attributeFormatter/index.js +10 -15
- package/es/core/models/cache/CiTyeCache.js +2 -2
- package/es/hooks/useManageStatus.js +5 -3
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +7 -5
- package/es/topoCenter/models/LinkTagsTipsBuilder.js +18 -36
- package/es/utils/ResourceConfigUtil.js +12 -8
- package/es/utils/clusterUtil.js +39 -0
- package/es/utils/topoData.js +9 -2
- package/lib/constants/ResourceInfoDisplay.js +1 -1
- package/lib/core/components/DisplaySettingDrawer/LinkTag.js +1 -1
- package/lib/core/components/DisplaySettingDrawer/LinkTip.js +1 -1
- package/lib/core/editor/components/settings/common/LineType/AlignSetting.module.scss +36 -0
- package/lib/core/editor/components/settings/common/LineType/index.js +103 -0
- package/lib/core/editor/components/settings/common/LineType/lineTypeUtil.js +1 -0
- package/lib/core/editor/components/settings/common/SizeInput/NodeSizeNumberPicker.js +1 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/{BatchSetNodeSize.js → BatchSetNodeSize/BatchSetNodeSize.js} +54 -2
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +29 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +8 -4
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/attributeFormatter/index.js +10 -15
- package/lib/core/models/cache/CiTyeCache.js +2 -2
- package/lib/hooks/useManageStatus.js +5 -3
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +8 -5
- package/lib/topoCenter/models/LinkTagsTipsBuilder.js +19 -37
- package/lib/utils/ResourceConfigUtil.js +15 -8
- package/lib/utils/clusterUtil.js +50 -0
- package/lib/utils/topoData.js +10 -2
- package/package.json +2 -2
- package/es/core/editor/components/settings/common/LineType.js +0 -15
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize.js +0 -8
- package/lib/core/editor/components/settings/common/LineType.js +0 -30
|
@@ -5,7 +5,7 @@ import ResourceDiplayInfoSetting from "../ResourceViewAttributeSetting/Setting";
|
|
|
5
5
|
import BasicConfig from "./ResourceDisplay/BasicConfig"; // 默认中可配置内容包括总速率、带宽利用率、发送速率、发送带宽利用率、接收速率、接收带宽利用率
|
|
6
6
|
|
|
7
7
|
var CommonOptions = [{
|
|
8
|
-
value: 'metric:
|
|
8
|
+
value: 'metric:interface_totalbps',
|
|
9
9
|
label: '总流速'
|
|
10
10
|
}, {
|
|
11
11
|
value: 'metric:bandwidth_utilization',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import "@alifd/next/variables";
|
|
2
|
+
|
|
3
|
+
.AlignSetting {
|
|
4
|
+
:global {
|
|
5
|
+
.#{$css-prefix}divider-ver {
|
|
6
|
+
background: #EBECF0;
|
|
7
|
+
margin-right: 3px;
|
|
8
|
+
height: 16px;
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.redioBtn {
|
|
14
|
+
width: 24px;
|
|
15
|
+
height: 24px;
|
|
16
|
+
border-radius: 4px;
|
|
17
|
+
border: none !important;
|
|
18
|
+
color: #4D6277;
|
|
19
|
+
padding-left: 6px;
|
|
20
|
+
margin-right: 3px;
|
|
21
|
+
|
|
22
|
+
&:active {
|
|
23
|
+
background: #F2F7FD !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
background: #F2F7FD !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.selectedTag {
|
|
33
|
+
background: #F2F7FD;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _Button from "@alifd/next/es/button";
|
|
2
|
+
import _Icon from "@alifd/next/es/icon";
|
|
3
|
+
import _Divider from "@alifd/next/es/divider";
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import styles from "./AlignSetting.module.scss";
|
|
6
|
+
var TREE_LAYOUT_OPTIONS = [{
|
|
7
|
+
value: "left",
|
|
8
|
+
label: "左侧",
|
|
9
|
+
icon: "tuopu_zuoceduiqi"
|
|
10
|
+
}, {
|
|
11
|
+
value: "center",
|
|
12
|
+
label: "居中",
|
|
13
|
+
icon: "tuopu_shuipingjuzhongduiqi"
|
|
14
|
+
}, {
|
|
15
|
+
value: "right",
|
|
16
|
+
label: "右侧",
|
|
17
|
+
icon: "tuopu_youceduiqi"
|
|
18
|
+
}, {
|
|
19
|
+
value: "top",
|
|
20
|
+
label: "顶部",
|
|
21
|
+
icon: "tuopu_dingbuduiqi"
|
|
22
|
+
}, {
|
|
23
|
+
value: "middle",
|
|
24
|
+
label: "中部",
|
|
25
|
+
icon: "tuopu_chuizhijuzhongduiqi"
|
|
26
|
+
}, {
|
|
27
|
+
value: "bottom",
|
|
28
|
+
label: "底部",
|
|
29
|
+
icon: "tuopu_dibuduiqi"
|
|
30
|
+
}, {
|
|
31
|
+
value: "divide"
|
|
32
|
+
}, {
|
|
33
|
+
value: "distributeHorizontal",
|
|
34
|
+
label: "水平",
|
|
35
|
+
icon: "tuopu_shuipingdengjianjuduiqi"
|
|
36
|
+
}, {
|
|
37
|
+
value: "distributeVertical",
|
|
38
|
+
label: "垂直",
|
|
39
|
+
icon: "tuopu_chuizhidengjianjuduiqi"
|
|
40
|
+
}];
|
|
41
|
+
|
|
42
|
+
var AlignSetting = function AlignSetting(props) {
|
|
43
|
+
var getEdges = props.getEdges,
|
|
44
|
+
selected = props.selected,
|
|
45
|
+
onChange = props.onChange;
|
|
46
|
+
|
|
47
|
+
var _useState = useState(selected),
|
|
48
|
+
value = _useState[0],
|
|
49
|
+
setValue = _useState[1];
|
|
50
|
+
|
|
51
|
+
var setLineType = function setLineType(type) {
|
|
52
|
+
var edges = getEdges();
|
|
53
|
+
edges.forEach(function (edge) {
|
|
54
|
+
edge.s('edge.type', 'v.h');
|
|
55
|
+
edge.s('edge.gap', 5);
|
|
56
|
+
edge.s('edge.center', true);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var handleChange = function handleChange(data) {
|
|
61
|
+
console.log("handleChange", data);
|
|
62
|
+
onChange && onChange(data.value);
|
|
63
|
+
setValue(data.value);
|
|
64
|
+
setLineType(data.value);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return null;
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: styles.AlignSetting
|
|
70
|
+
}, TREE_LAYOUT_OPTIONS.map(function (item, index, array) {
|
|
71
|
+
return item.value === "divide" ? /*#__PURE__*/React.createElement(_Divider, {
|
|
72
|
+
key: index,
|
|
73
|
+
direction: "ver"
|
|
74
|
+
}) : /*#__PURE__*/React.createElement(_Button, {
|
|
75
|
+
key: index,
|
|
76
|
+
className: "" + styles.redioBtn,
|
|
77
|
+
onClick: function onClick() {
|
|
78
|
+
handleChange(item);
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
81
|
+
type: item.icon
|
|
82
|
+
}));
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default AlignSetting;
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
+
import SizeInput from "../../../common/SizeInput";
|
|
3
|
+
export default function BatchSetNodeSize(props) {
|
|
4
|
+
var topo = props.topo;
|
|
5
|
+
|
|
6
|
+
var _useState = useState(undefined),
|
|
7
|
+
width = _useState[0],
|
|
8
|
+
setWidth = _useState[1];
|
|
9
|
+
|
|
10
|
+
var _useState2 = useState(undefined),
|
|
11
|
+
height = _useState2[0],
|
|
12
|
+
setHeight = _useState2[1];
|
|
13
|
+
|
|
14
|
+
var _useState3 = useState(true),
|
|
15
|
+
lock = _useState3[0],
|
|
16
|
+
setLock = _useState3[1];
|
|
17
|
+
|
|
18
|
+
var handleChange = function handleChange(name, value) {
|
|
19
|
+
var selection = topo.getSelectionModel().getSelection().toArray();
|
|
20
|
+
var nodes = selection.filter(function (element) {
|
|
21
|
+
return element instanceof ht.Node;
|
|
22
|
+
});
|
|
23
|
+
console.error('变化了', nodes, name, value); //
|
|
24
|
+
|
|
25
|
+
if (lock) {
|
|
26
|
+
console.error('锁定', value);
|
|
27
|
+
|
|
28
|
+
if (name === 'width') {
|
|
29
|
+
setHeight(undefined);
|
|
30
|
+
} else {
|
|
31
|
+
setWidth(undefined);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
nodes.forEach(function (node) {
|
|
36
|
+
if (name === 'width') {
|
|
37
|
+
node.setWidth(value);
|
|
38
|
+
} else {
|
|
39
|
+
node.setHeight(value);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var onLockChange = function onLockChange(isLock) {
|
|
45
|
+
setLock(isLock);
|
|
46
|
+
setWidth(undefined);
|
|
47
|
+
setHeight(undefined);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement(SizeInput, {
|
|
51
|
+
value: {
|
|
52
|
+
width: width,
|
|
53
|
+
height: height
|
|
54
|
+
},
|
|
55
|
+
lock: lock,
|
|
56
|
+
onChange: handleChange,
|
|
57
|
+
onLockChange: onLockChange
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
;
|
package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LineType from "../../common/LineType";
|
|
3
|
+
export default function MultipleElementLineType(props) {
|
|
4
|
+
var topo = props.topo;
|
|
5
|
+
|
|
6
|
+
var setLineType = function setLineType(type) {};
|
|
7
|
+
|
|
8
|
+
var getEdges = function getEdges() {
|
|
9
|
+
var selection = topo.getSelectionModel().getSelection().toArray();
|
|
10
|
+
var edges = selection.filter(function (element) {
|
|
11
|
+
return element instanceof ht.Edge;
|
|
12
|
+
});
|
|
13
|
+
return edges;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return /*#__PURE__*/React.createElement(LineType, {
|
|
17
|
+
getEdges: getEdges,
|
|
18
|
+
onChange: setLineType
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -3,10 +3,10 @@ import _Field from "@alifd/next/es/field";
|
|
|
3
3
|
import _Collapse from "@alifd/next/es/collapse";
|
|
4
4
|
import React, { useState, useEffect } from 'react';
|
|
5
5
|
import AlignSetting from "../../common/AlignSetting";
|
|
6
|
-
import
|
|
7
|
-
import BatchSetNodeSize from "./BatchSetNodeSize";
|
|
6
|
+
import BatchSetNodeSize from "./BatchSetNodeSize/BatchSetNodeSize";
|
|
8
7
|
import { TPL_TREE } from "../../../../../../utils/template";
|
|
9
8
|
import ViewPropertyView from "../view/ViewPropertyView";
|
|
9
|
+
import MultipleElementLineType from "./MultipleElementLineType";
|
|
10
10
|
var CollapsePanel = _Collapse.Panel;
|
|
11
11
|
/**
|
|
12
12
|
* 多选元素属性面板
|
|
@@ -48,6 +48,10 @@ export default function MultipleElementPropertyView(props) {
|
|
|
48
48
|
return /*#__PURE__*/React.createElement(ViewPropertyView, props);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
var getSelectedElements = function getSelectedElements() {
|
|
52
|
+
return topo.getSelectionModel().getSelection().toArray();
|
|
53
|
+
};
|
|
54
|
+
|
|
51
55
|
return /*#__PURE__*/React.createElement(_Form, {
|
|
52
56
|
field: field,
|
|
53
57
|
labelAlign: "top"
|
|
@@ -61,6 +65,6 @@ export default function MultipleElementPropertyView(props) {
|
|
|
61
65
|
title: "\u5BF9\u9F50\u65B9\u5F0F"
|
|
62
66
|
}, /*#__PURE__*/React.createElement(AlignSetting, {
|
|
63
67
|
onChange: alignOnChange,
|
|
64
|
-
selected:
|
|
68
|
+
selected: "left"
|
|
65
69
|
})))));
|
|
66
70
|
}
|
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.
|
|
23
|
+
var version = typeof "3.16.0" === 'string' ? "3.16.0" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -29,25 +29,20 @@ export function formatMetric(val, metricInfo) {
|
|
|
29
29
|
function addLinkMetricUnderlineArrow(metricCode) {
|
|
30
30
|
var map = {
|
|
31
31
|
// 总流速和总带宽利用率:双向箭头
|
|
32
|
-
'
|
|
33
|
-
'
|
|
32
|
+
'interface_totalbps': 'both',
|
|
33
|
+
'bandwidth_utilization': 'both',
|
|
34
34
|
// 发送速率和发送带宽利用率:背向取值端口的箭头 指向目的
|
|
35
|
-
'
|
|
36
|
-
'
|
|
35
|
+
'out_rate': 'to',
|
|
36
|
+
'out_bandwidth_utilization': 'to',
|
|
37
37
|
// 接收速率和接收带宽利用率:指向取值端口的箭头 指向源
|
|
38
|
-
'
|
|
39
|
-
'
|
|
38
|
+
'in_rate': 'from',
|
|
39
|
+
'in_bandwidth_utilization': 'from'
|
|
40
40
|
};
|
|
41
|
-
var codes = Object.keys(map);
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
underlineArrow: map[code]
|
|
49
|
-
};
|
|
50
|
-
}
|
|
42
|
+
if (map[metricCode]) {
|
|
43
|
+
return {
|
|
44
|
+
underlineArrow: map[metricCode]
|
|
45
|
+
};
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
return {};
|
|
@@ -146,13 +146,13 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
|
146
146
|
var model = null;
|
|
147
147
|
types.forEach(function (type) {
|
|
148
148
|
if (type.id === connectType) {
|
|
149
|
-
var metrics = ciType.metrics //
|
|
149
|
+
var metrics = ciType.metrics // 仅出口链路有:ping状态、专线连通状态
|
|
150
150
|
.filter(function (metric) {
|
|
151
151
|
if (connectType === 'exit') {
|
|
152
152
|
return true;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return ['
|
|
155
|
+
return ['icmp_discards_rate', 'ping_status'].indexOf(metric.code) === -1;
|
|
156
156
|
}) // 按链路类型过滤对应指标
|
|
157
157
|
.filter(function (metric) {
|
|
158
158
|
return !excludeMetricPprefixs.filter(function (excludeMetricPprefix) {
|
|
@@ -33,7 +33,9 @@ export default function useManageStatus(props) {
|
|
|
33
33
|
topoState = _topo$store$useModel[0],
|
|
34
34
|
topoDispatchers = _topo$store$useModel[1];
|
|
35
35
|
|
|
36
|
-
var graphLoaded = topoState.graphLoaded
|
|
36
|
+
var graphLoaded = topoState.graphLoaded,
|
|
37
|
+
viewState = topoState.viewState;
|
|
38
|
+
var isEditMode = viewState === 'edit';
|
|
37
39
|
var resources = topo.dataModel.useCis();
|
|
38
40
|
useTopoEventListener({
|
|
39
41
|
type: 'manageStatus',
|
|
@@ -55,7 +57,7 @@ export default function useManageStatus(props) {
|
|
|
55
57
|
});
|
|
56
58
|
useEffect(function () {
|
|
57
59
|
// 首次加载和监控状态变化后,更新节点和连线置灰状态
|
|
58
|
-
if (graphLoaded) {
|
|
60
|
+
if (!isEditMode && graphLoaded) {
|
|
59
61
|
resources.forEach(function (resource) {
|
|
60
62
|
var type = resource.type,
|
|
61
63
|
id = resource.id,
|
|
@@ -74,5 +76,5 @@ export default function useManageStatus(props) {
|
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
|
-
}, [graphLoaded, resources]);
|
|
79
|
+
}, [isEditMode, graphLoaded, resources]);
|
|
78
80
|
}
|
package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _Field from "@alifd/next/es/field";
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _Collapse from "@alifd/next/es/collapse";
|
|
5
5
|
import React, { useEffect } from "react";
|
|
6
|
-
|
|
6
|
+
import LineType from "../../../../../../../core/editor/components/settings/common/LineType";
|
|
7
7
|
var CollapsePanel = _Collapse.Panel;
|
|
8
8
|
|
|
9
9
|
function parseValues(values) {
|
|
@@ -33,12 +33,14 @@ export default function LinkSetting(props) {
|
|
|
33
33
|
field: field,
|
|
34
34
|
labelAlign: "top"
|
|
35
35
|
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
|
|
36
|
-
defaultExpandedKeys: ["
|
|
36
|
+
defaultExpandedKeys: ["线形"],
|
|
37
37
|
style: {
|
|
38
38
|
border: "none"
|
|
39
39
|
}
|
|
40
40
|
}, /*#__PURE__*/React.createElement(CollapsePanel, {
|
|
41
|
-
key: "\
|
|
42
|
-
title: "\
|
|
43
|
-
}
|
|
41
|
+
key: "\u7EBF\u5F62",
|
|
42
|
+
title: "\u7EBF\u5F62"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(LineType, {
|
|
44
|
+
topo: topo
|
|
45
|
+
})))));
|
|
44
46
|
}
|
|
@@ -4,13 +4,12 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* 连线组标注、悬浮框数据构建
|
|
5
5
|
*/
|
|
6
6
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
7
|
-
import
|
|
8
|
-
import { getEdgeGroupByNodeTags, getEdgeGroups } from "../../utils/htElementUtils";
|
|
7
|
+
import { getEdgeGroups } from "../../utils/htElementUtils";
|
|
9
8
|
import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与计算的链路指标
|
|
10
9
|
|
|
11
10
|
var metrics = [// 总流速
|
|
12
11
|
{
|
|
13
|
-
code: '
|
|
12
|
+
code: 'interface_totalbps',
|
|
14
13
|
calcType: 'sum'
|
|
15
14
|
}, // 带宽利用率
|
|
16
15
|
{
|
|
@@ -35,10 +34,6 @@ var metrics = [// 总流速
|
|
|
35
34
|
calcType: 'sum',
|
|
36
35
|
showWhenSameSource: true
|
|
37
36
|
}];
|
|
38
|
-
var connectTypePrefixMap = {
|
|
39
|
-
phy: 'physical_link.',
|
|
40
|
-
exit: 'export_link.'
|
|
41
|
-
};
|
|
42
37
|
var calcFnMap = {
|
|
43
38
|
sum: function sum(values) {
|
|
44
39
|
return values.reduce(function (total, val) {
|
|
@@ -87,11 +82,6 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
87
82
|
var edgeGroupsTagsTips = groups.map(function (_ref) {
|
|
88
83
|
var groupId = _ref.groupId,
|
|
89
84
|
linkChildren = _ref.children;
|
|
90
|
-
console.error(1111, {
|
|
91
|
-
ciConfigs: ciConfigs,
|
|
92
|
-
linkChildren: linkChildren,
|
|
93
|
-
data: data
|
|
94
|
-
});
|
|
95
85
|
var config = ciConfigs.find(function (item) {
|
|
96
86
|
return item.id === linkChildren[0].id;
|
|
97
87
|
});
|
|
@@ -101,10 +91,7 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
101
91
|
linkChildren: linkChildren,
|
|
102
92
|
data: data
|
|
103
93
|
});
|
|
104
|
-
}); //
|
|
105
|
-
// noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
|
|
106
|
-
// })
|
|
107
|
-
// 获得连线组及子链路
|
|
94
|
+
}); // 获得连线组及子链路
|
|
108
95
|
// 关联聚合链路、无子链路 时返回null
|
|
109
96
|
|
|
110
97
|
function getGroupInfo(group) {
|
|
@@ -158,30 +145,27 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
158
145
|
config = _ref2.config,
|
|
159
146
|
linkChildren = _ref2.linkChildren,
|
|
160
147
|
data = _ref2.data;
|
|
161
|
-
var connectTypes = ['physical_link.', 'export_link.'];
|
|
162
|
-
|
|
163
|
-
var replaceMetricConfigCode = function replaceMetricConfigCode(item) {
|
|
164
|
-
var code = item.code;
|
|
165
|
-
connectTypes.forEach(function (prefix) {
|
|
166
|
-
code = code.replace(prefix, 'physical_link.');
|
|
167
|
-
});
|
|
168
|
-
return _extends({}, item, {
|
|
169
|
-
code: code
|
|
170
|
-
});
|
|
171
|
-
}; // 查询配置,过滤不在范围内的属性
|
|
172
|
-
|
|
173
148
|
|
|
149
|
+
// 查询配置,过滤不在范围内的属性
|
|
174
150
|
var finalConfig = _extends({}, config, {
|
|
175
151
|
tags: config.tags.filter(function (item) {
|
|
176
152
|
return _this2.filterField(item, linkChildren);
|
|
177
|
-
})
|
|
153
|
+
}),
|
|
178
154
|
tips: config.tips.filter(function (item) {
|
|
179
155
|
return _this2.filterField(item, linkChildren);
|
|
180
|
-
})
|
|
156
|
+
})
|
|
181
157
|
}); // 构造数据,计算指标值
|
|
182
158
|
|
|
183
159
|
|
|
184
|
-
var mergeData = this.buildData(data, linkChildren);
|
|
160
|
+
var mergeData = this.buildData(data, linkChildren);
|
|
161
|
+
rlog.debug('buildEdgeGroupTagTagsAndTips', {
|
|
162
|
+
groupId: groupId,
|
|
163
|
+
config: config,
|
|
164
|
+
linkChildren: linkChildren,
|
|
165
|
+
data: data,
|
|
166
|
+
finalConfig: finalConfig,
|
|
167
|
+
mergeData: mergeData
|
|
168
|
+
}); // 构造标注、悬浮框数据
|
|
185
169
|
|
|
186
170
|
var formatter = new AttributeFormatter(this.topo);
|
|
187
171
|
return {
|
|
@@ -195,7 +179,7 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
195
179
|
|
|
196
180
|
_proto.filterField = function filterField(item, linkChildren) {
|
|
197
181
|
var fieldConfig = metrics.find(function (m) {
|
|
198
|
-
return item.code
|
|
182
|
+
return item.code === m.code;
|
|
199
183
|
});
|
|
200
184
|
|
|
201
185
|
if (item.type !== 'metric' || !fieldConfig) {
|
|
@@ -233,11 +217,9 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
233
217
|
metrics.forEach(function (m) {
|
|
234
218
|
try {
|
|
235
219
|
var values = linkChildrenData.map(function (linkData) {
|
|
236
|
-
|
|
237
|
-
var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
|
|
238
|
-
return linkData.metricMap[metricCode];
|
|
220
|
+
return linkData.metricMap[m.code];
|
|
239
221
|
});
|
|
240
|
-
mergeData.metricMap[
|
|
222
|
+
mergeData.metricMap[m.code] = calcFnMap[m.calcType](values);
|
|
241
223
|
} catch (error) {
|
|
242
224
|
rlog.warn('连线组指标计算异常', error);
|
|
243
225
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
1
2
|
import sortBy from "lodash/sortBy";
|
|
2
3
|
import { getEdges, getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
|
|
3
4
|
/**
|
|
@@ -49,18 +50,21 @@ function getResourceConfigFromHt(topo) {
|
|
|
49
50
|
|
|
50
51
|
var exportLinkIdList = [];
|
|
51
52
|
var edges = getEdges(dataModel);
|
|
52
|
-
|
|
53
|
+
rlog.debug(" 查询出口链路列表-edges", edges, dataModel);
|
|
53
54
|
edges.forEach(function (edge) {
|
|
54
|
-
var edgeData = htTopo.getEdgeData(edge); //
|
|
55
|
+
var edgeData = htTopo.getEdgeData(edge); // 有组无子连线返回null
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
if (edgeData) {
|
|
58
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
59
|
+
var id = edgeData._attrObject.id;
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
if (id) {
|
|
62
|
+
var linkData = topo.dataModel.getDataById(id);
|
|
63
|
+
var connectType = linkData !== null && linkData !== void 0 && linkData.attributes ? linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"] : undefined;
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (connectType === "exit" && !exportLinkIdList.includes(id)) {
|
|
66
|
+
exportLinkIdList.push(id);
|
|
67
|
+
}
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 集群处理工具类
|
|
5
|
+
*/
|
|
6
|
+
export function isCluster(node) {
|
|
7
|
+
return !!node.cluster;
|
|
8
|
+
}
|
|
9
|
+
export function buildClusterGroups(nodes) {
|
|
10
|
+
return nodes.filter(isCluster).map(function (g) {
|
|
11
|
+
return _extends({
|
|
12
|
+
tag: null,
|
|
13
|
+
parentId: g.groupId,
|
|
14
|
+
parentTag: g.groupTag
|
|
15
|
+
}, g);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 集群的节点 groupId 设置为所在集群id、groupTag设为空。所属集群不存在不处理
|
|
20
|
+
*
|
|
21
|
+
* @param {*} node
|
|
22
|
+
* @param {*} groups
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export function processClusterChildNode(node, groups) {
|
|
26
|
+
var ownerId = node.ownerId;
|
|
27
|
+
var ownerExisted = ownerId && groups.find(function (group) {
|
|
28
|
+
return group.id === ownerId;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!ownerId || !ownerExisted) {
|
|
32
|
+
return node;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return _extends({}, node, {
|
|
36
|
+
groupId: ownerId,
|
|
37
|
+
groupTag: null
|
|
38
|
+
});
|
|
39
|
+
}
|
package/es/utils/topoData.js
CHANGED
|
@@ -10,6 +10,7 @@ import buildEditorContextMenu from "../core/editor/contextmenu/buildContextmenu"
|
|
|
10
10
|
import mergeContextmenu from "../core/common/contextmenu/mergeContextmenu";
|
|
11
11
|
import { getEditorIcons } from "../core/common/icons/icon";
|
|
12
12
|
import { getBackgroundImageUrl } from "../core/utils/backgroundUtil";
|
|
13
|
+
import { buildClusterGroups, isCluster, processClusterChildNode } from "./clusterUtil";
|
|
13
14
|
/**
|
|
14
15
|
* 查找数组中对应key的值为value的元素并返回,只查找第一个符合的元素
|
|
15
16
|
* @param {Array} arr 数组
|
|
@@ -362,9 +363,15 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
362
363
|
engine: engine
|
|
363
364
|
}); // group
|
|
364
365
|
|
|
365
|
-
var groups = formatGroups((_result$groups = result.groups) !== null && _result$groups !== void 0 ? _result$groups : []); // nodes
|
|
366
|
+
var groups = formatGroups([].concat((_result$groups = result.groups) !== null && _result$groups !== void 0 ? _result$groups : [], buildClusterGroups(result.nodes))); // nodes
|
|
366
367
|
|
|
367
|
-
var nodes = result.nodes
|
|
368
|
+
var nodes = result.nodes // 过滤集群
|
|
369
|
+
.filter(function (node) {
|
|
370
|
+
return !isCluster(node);
|
|
371
|
+
}) // 修正集群节点数据
|
|
372
|
+
.map(function (node) {
|
|
373
|
+
return processClusterChildNode(node, groups);
|
|
374
|
+
}).map(function (node) {
|
|
368
375
|
return tfNode(engine, node);
|
|
369
376
|
}); // links
|
|
370
377
|
|
|
@@ -17,7 +17,7 @@ var _BasicConfig = _interopRequireDefault(require("./ResourceDisplay/BasicConfig
|
|
|
17
17
|
|
|
18
18
|
// 默认中可配置内容包括总速率、带宽利用率、发送速率、发送带宽利用率、接收速率、接收带宽利用率
|
|
19
19
|
var CommonOptions = [{
|
|
20
|
-
value: 'metric:
|
|
20
|
+
value: 'metric:interface_totalbps',
|
|
21
21
|
label: '总流速'
|
|
22
22
|
}, {
|
|
23
23
|
value: 'metric:bandwidth_utilization',
|