@riil-frontend/component-topology 3.5.13 → 3.16.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 +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +20 -20
- 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/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.js +4 -0
- 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 +16 -25
- 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/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.js +4 -0
- 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 +18 -26
- 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',
|
|
@@ -9,6 +9,10 @@ export default function CommonCheckboxGroup(props) {
|
|
|
9
9
|
onChange = props.onChange;
|
|
10
10
|
var selected = value.map(function (item) {
|
|
11
11
|
return item.type + ":" + item.code;
|
|
12
|
+
}).filter(function (code) {
|
|
13
|
+
return !!dataSource.find(function (item) {
|
|
14
|
+
return item.value === code;
|
|
15
|
+
});
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
var handleChange = function handleChange(newSelected) {
|
|
@@ -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.1" === 'string' ? "3.16.1" : 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
|
}
|
|
@@ -9,7 +9,7 @@ import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与
|
|
|
9
9
|
|
|
10
10
|
var metrics = [// 总流速
|
|
11
11
|
{
|
|
12
|
-
code: '
|
|
12
|
+
code: 'interface_totalbps',
|
|
13
13
|
calcType: 'sum'
|
|
14
14
|
}, // 带宽利用率
|
|
15
15
|
{
|
|
@@ -34,10 +34,6 @@ var metrics = [// 总流速
|
|
|
34
34
|
calcType: 'sum',
|
|
35
35
|
showWhenSameSource: true
|
|
36
36
|
}];
|
|
37
|
-
var connectTypePrefixMap = {
|
|
38
|
-
phy: 'physical_link.',
|
|
39
|
-
exit: 'export_link.'
|
|
40
|
-
};
|
|
41
37
|
var calcFnMap = {
|
|
42
38
|
sum: function sum(values) {
|
|
43
39
|
return values.reduce(function (total, val) {
|
|
@@ -149,30 +145,27 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
149
145
|
config = _ref2.config,
|
|
150
146
|
linkChildren = _ref2.linkChildren,
|
|
151
147
|
data = _ref2.data;
|
|
152
|
-
var connectTypes = ['physical_link.', 'export_link.'];
|
|
153
|
-
|
|
154
|
-
var replaceMetricConfigCode = function replaceMetricConfigCode(item) {
|
|
155
|
-
var code = item.code;
|
|
156
|
-
connectTypes.forEach(function (prefix) {
|
|
157
|
-
code = code.replace(prefix, 'physical_link.');
|
|
158
|
-
});
|
|
159
|
-
return _extends({}, item, {
|
|
160
|
-
code: code
|
|
161
|
-
});
|
|
162
|
-
}; // 查询配置,过滤不在范围内的属性
|
|
163
|
-
|
|
164
148
|
|
|
149
|
+
// 查询配置,过滤不在范围内的属性
|
|
165
150
|
var finalConfig = _extends({}, config, {
|
|
166
151
|
tags: config.tags.filter(function (item) {
|
|
167
152
|
return _this2.filterField(item, linkChildren);
|
|
168
|
-
})
|
|
153
|
+
}),
|
|
169
154
|
tips: config.tips.filter(function (item) {
|
|
170
155
|
return _this2.filterField(item, linkChildren);
|
|
171
|
-
})
|
|
156
|
+
})
|
|
172
157
|
}); // 构造数据,计算指标值
|
|
173
158
|
|
|
174
159
|
|
|
175
|
-
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
|
+
}); // 构造标注、悬浮框数据
|
|
176
169
|
|
|
177
170
|
var formatter = new AttributeFormatter(this.topo);
|
|
178
171
|
return {
|
|
@@ -186,7 +179,7 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
186
179
|
|
|
187
180
|
_proto.filterField = function filterField(item, linkChildren) {
|
|
188
181
|
var fieldConfig = metrics.find(function (m) {
|
|
189
|
-
return item.code
|
|
182
|
+
return item.code === m.code;
|
|
190
183
|
});
|
|
191
184
|
|
|
192
185
|
if (item.type !== 'metric' || !fieldConfig) {
|
|
@@ -224,11 +217,9 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
|
224
217
|
metrics.forEach(function (m) {
|
|
225
218
|
try {
|
|
226
219
|
var values = linkChildrenData.map(function (linkData) {
|
|
227
|
-
|
|
228
|
-
var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
|
|
229
|
-
return linkData.metricMap[metricCode];
|
|
220
|
+
return linkData.metricMap[m.code];
|
|
230
221
|
});
|
|
231
|
-
mergeData.metricMap[
|
|
222
|
+
mergeData.metricMap[m.code] = calcFnMap[m.calcType](values);
|
|
232
223
|
} catch (error) {
|
|
233
224
|
rlog.warn('连线组指标计算异常', error);
|
|
234
225
|
}
|
|
@@ -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',
|
|
@@ -20,6 +20,10 @@ function CommonCheckboxGroup(props) {
|
|
|
20
20
|
onChange = props.onChange;
|
|
21
21
|
var selected = value.map(function (item) {
|
|
22
22
|
return item.type + ":" + item.code;
|
|
23
|
+
}).filter(function (code) {
|
|
24
|
+
return !!dataSource.find(function (item) {
|
|
25
|
+
return item.value === code;
|
|
26
|
+
});
|
|
23
27
|
});
|
|
24
28
|
|
|
25
29
|
var handleChange = function handleChange(newSelected) {
|
|
@@ -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
|
+
}
|