@riil-frontend/component-topology 2.15.38 → 2.15.41
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 +22 -22
- package/es/components/Drawer/index.js +11 -11
- package/es/components/Drawer/index.module.scss +15 -6
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.module.scss +2 -11
- package/es/core/components/AlarmListPanel/index.module.scss +4 -0
- package/es/core/models/AttributeMetricDisplay.js +3 -169
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/link/LinkTagsTipsBuilder.js +210 -0
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
- package/lib/components/Drawer/index.js +12 -11
- package/lib/components/Drawer/index.module.scss +15 -6
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.module.scss +2 -11
- package/lib/core/components/AlarmListPanel/index.module.scss +4 -0
- package/lib/core/models/AttributeMetricDisplay.js +4 -171
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/link/LinkTagsTipsBuilder.js +220 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
- package/package.json +2 -2
|
@@ -2,26 +2,24 @@ import _Drawer from "@alifd/next/es/drawer";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _Button from "@alifd/next/es/button";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import classnames from 'classnames';
|
|
5
6
|
import styles from "./index.module.scss";
|
|
6
7
|
var headerStyle = {
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
top: 0,
|
|
9
|
-
left: 0,
|
|
10
|
-
width: '100%',
|
|
11
8
|
zIndex: 1000
|
|
12
9
|
};
|
|
13
|
-
var bodyStyle = {
|
|
14
|
-
margin: '46px auto',
|
|
15
|
-
padding: '16px 24px'
|
|
16
|
-
};
|
|
10
|
+
var bodyStyle = {};
|
|
17
11
|
|
|
18
12
|
var Drawer = function Drawer(props) {
|
|
19
13
|
var visible = props.visible,
|
|
20
14
|
disabled = props.disabled,
|
|
21
15
|
loading = props.loading,
|
|
22
16
|
title = props.title,
|
|
17
|
+
_props$footer = props.footer,
|
|
18
|
+
footer = _props$footer === void 0 ? true : _props$footer,
|
|
23
19
|
_props$buttons = props.buttons,
|
|
24
20
|
buttons = _props$buttons === void 0 ? props.buttons || ['保存', '取消'] : _props$buttons,
|
|
21
|
+
_props$footerActions = props.footerActions,
|
|
22
|
+
footerActions = _props$footerActions === void 0 ? ['确定', '取消'] : _props$footerActions,
|
|
25
23
|
onClose = props.onClose,
|
|
26
24
|
onSave = props.onSave,
|
|
27
25
|
drawerProps = props.drawerProps,
|
|
@@ -32,12 +30,14 @@ var Drawer = function Drawer(props) {
|
|
|
32
30
|
width: "40%",
|
|
33
31
|
headerStyle: headerStyle,
|
|
34
32
|
bodyStyle: bodyStyle,
|
|
35
|
-
closeMode: ['close', 'esc']
|
|
36
|
-
className: styles.drawer
|
|
33
|
+
closeMode: ['close', 'esc']
|
|
37
34
|
}, drawerProps, {
|
|
35
|
+
className: classnames(styles.drawer, drawerProps.className),
|
|
38
36
|
visible: visible,
|
|
39
37
|
onClose: onClose
|
|
40
|
-
}),
|
|
38
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: classnames(styles.content, drawerProps.bodyClassName)
|
|
40
|
+
}, children), footer && /*#__PURE__*/React.createElement("div", {
|
|
41
41
|
className: styles.footer
|
|
42
42
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
43
43
|
className: styles.button,
|
|
@@ -3,26 +3,35 @@
|
|
|
3
3
|
.drawer {
|
|
4
4
|
& > div {
|
|
5
5
|
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
:global {
|
|
10
|
+
.#{$css-prefix}drawer-header {
|
|
11
|
+
}
|
|
9
12
|
.#{$css-prefix}drawer-body {
|
|
10
13
|
flex: 1;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: 0;
|
|
17
|
+
overflow: auto;
|
|
11
18
|
}
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
|
|
22
|
+
.content {
|
|
23
|
+
flex: 1;
|
|
24
|
+
padding: 16px 24px;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
|
|
27
|
+
}
|
|
15
28
|
|
|
16
29
|
.footer {
|
|
17
|
-
|
|
18
|
-
bottom: 0;
|
|
19
|
-
width: 100%;
|
|
30
|
+
background: #fff;
|
|
20
31
|
border-top: 1px solid #e8e8e8;
|
|
32
|
+
border-radius: 0 0 4px 4px;
|
|
21
33
|
padding: 10px 16px;
|
|
22
34
|
text-align: right;
|
|
23
|
-
left: 0;
|
|
24
|
-
background: #fff;
|
|
25
|
-
border-radius: 0 0 4px 4px;
|
|
26
35
|
|
|
27
36
|
& .button {
|
|
28
37
|
&:not(:first-child) {
|
|
@@ -4,13 +4,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
6
|
import { keyBy } from 'lodash';
|
|
7
|
-
import groupBy from 'lodash/groupBy';
|
|
8
7
|
import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
|
9
|
-
import { getEdgeGroupByNodeTags } from "../../utils/htElementUtils";
|
|
10
8
|
import { findItem } from "../../utils/topoData";
|
|
11
9
|
import { queryCisByIds } from "../services";
|
|
12
10
|
import AttributeFormatter from "./attributeFormatter";
|
|
13
11
|
import DictCache from "./cache/DictCache";
|
|
12
|
+
import LinkTagsTipsBuilder from "./link/LinkTagsTipsBuilder";
|
|
14
13
|
|
|
15
14
|
function isGraphField(item) {
|
|
16
15
|
return item.type === 'graph';
|
|
@@ -38,6 +37,7 @@ var filterByPermission = function filterByPermission(resource, items) {
|
|
|
38
37
|
var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
39
38
|
function AttributeMetricDisplay(topo) {
|
|
40
39
|
this.topo = topo;
|
|
40
|
+
this.edgeTagsTipsBuilder = new LinkTagsTipsBuilder(this);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
var _proto = AttributeMetricDisplay.prototype;
|
|
@@ -668,176 +668,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
668
668
|
tips: formatter.formatAttrs(ciConfig.tips, ciData)
|
|
669
669
|
};
|
|
670
670
|
});
|
|
671
|
-
var elementTagsAndTips = [].concat(ciTagsAndTips, this.getEdgeGroupTagsAndTips(data, ciConfigs)); // 刷新标注、浮层
|
|
671
|
+
var elementTagsAndTips = [].concat(ciTagsAndTips, this.edgeTagsTipsBuilder.getEdgeGroupTagsAndTips(data, ciConfigs)); // 刷新标注、浮层
|
|
672
672
|
// rlog.debug('AttributeMetricDisplay.buildTagsTips', {tagsAndTips: elementTagsAndTips, ciConfigs});
|
|
673
673
|
|
|
674
674
|
return elementTagsAndTips;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* 获得未关联聚合链路的连线组标注和悬浮框数据
|
|
678
|
-
* @param {*} ciTagsAndTips
|
|
679
|
-
* @param {*} data
|
|
680
|
-
* @param {*} ciConfigs
|
|
681
|
-
* @returns
|
|
682
|
-
*/
|
|
683
|
-
;
|
|
684
|
-
|
|
685
|
-
_proto.getEdgeGroupTagsAndTips = function getEdgeGroupTagsAndTips(data, ciConfigs) {
|
|
686
|
-
var _this5 = this;
|
|
687
|
-
|
|
688
|
-
// 查询没有关联链路的连线组及对应子链路列表
|
|
689
|
-
var _this$topo$dataModel$ = this.topo.dataModel.getData(),
|
|
690
|
-
links = _this$topo$dataModel$.links,
|
|
691
|
-
linkGroups = _this$topo$dataModel$.linkGroups;
|
|
692
|
-
|
|
693
|
-
var getLinkUId = function getLinkUId(link) {
|
|
694
|
-
return [link.source, link.target].sort().join('-');
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
var linkGroupUIds = linkGroups.filter(function (link) {
|
|
698
|
-
return link.ciType === 'network_link';
|
|
699
|
-
}).map(function (link) {
|
|
700
|
-
return getLinkUId(link);
|
|
701
|
-
}); // 查询没有聚合链路的物理链路/出口链路
|
|
702
|
-
|
|
703
|
-
var noParentLinks = links.filter(function (link) {
|
|
704
|
-
return link.ciType === 'network_link';
|
|
705
|
-
}).map(function (link) {
|
|
706
|
-
return _extends({}, link, {
|
|
707
|
-
linkUId: getLinkUId(link)
|
|
708
|
-
});
|
|
709
|
-
}).filter(function (link) {
|
|
710
|
-
return linkGroupUIds.indexOf(link.linkUId) === -1;
|
|
711
|
-
});
|
|
712
|
-
var groupMap = groupBy(noParentLinks, 'linkUId'); // 参与计算的链路指标
|
|
713
|
-
|
|
714
|
-
var metrics = [// 总流速
|
|
715
|
-
{
|
|
716
|
-
code: 'total_flow_rate',
|
|
717
|
-
calcType: 'sum'
|
|
718
|
-
}, // 带宽利用率
|
|
719
|
-
{
|
|
720
|
-
code: 'bandwidth_utilization',
|
|
721
|
-
calcType: 'avg'
|
|
722
|
-
}, // 发送带宽利用率
|
|
723
|
-
{
|
|
724
|
-
code: 'out_bandwidth_utilization',
|
|
725
|
-
calcType: 'avg',
|
|
726
|
-
showWhenSameSource: true
|
|
727
|
-
}, // 接收带宽利用率
|
|
728
|
-
{
|
|
729
|
-
code: 'in_bandwidth_utilization',
|
|
730
|
-
calcType: 'avg',
|
|
731
|
-
showWhenSameSource: true
|
|
732
|
-
}, {
|
|
733
|
-
code: 'out_rate',
|
|
734
|
-
calcType: 'sum',
|
|
735
|
-
showWhenSameSource: true
|
|
736
|
-
}, {
|
|
737
|
-
code: 'in_rate',
|
|
738
|
-
calcType: 'sum',
|
|
739
|
-
showWhenSameSource: true
|
|
740
|
-
}];
|
|
741
|
-
var connectTypePrefixMap = {
|
|
742
|
-
phy: 'physical_link.',
|
|
743
|
-
exit: 'export_link.'
|
|
744
|
-
};
|
|
745
|
-
var calcFnMap = {
|
|
746
|
-
sum: function sum(values) {
|
|
747
|
-
return values.reduce(function (total, val) {
|
|
748
|
-
return total + parseInt(val || 0, 10);
|
|
749
|
-
}, 0);
|
|
750
|
-
},
|
|
751
|
-
avg: function avg(values) {
|
|
752
|
-
return values.reduce(function (total, val) {
|
|
753
|
-
return total + parseFloat(val || 0, 10);
|
|
754
|
-
}, 0) / values.length;
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
var filterField = function filterField(item, linkChildren) {
|
|
759
|
-
var fieldConfig = metrics.find(function (m) {
|
|
760
|
-
return item.code.endsWith(m.code);
|
|
761
|
-
});
|
|
762
|
-
|
|
763
|
-
if (item.type !== 'metric' || !fieldConfig) {
|
|
764
|
-
return false;
|
|
765
|
-
} // 如果需要校验取值接口,如果取值接口为不同设备的接口,则不显示这四个指标
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (fieldConfig.showWhenSameSource) {
|
|
769
|
-
var sources = [];
|
|
770
|
-
linkChildren.forEach(function (link) {
|
|
771
|
-
if (sources.indexOf(link.source) === -1) {
|
|
772
|
-
sources.push(link.source);
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
if (sources.length > 1) {
|
|
777
|
-
return false;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
return true;
|
|
782
|
-
}; // 计算标注和指标
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
|
|
786
|
-
.filter(function (groupId) {
|
|
787
|
-
var linkChildren = groupMap[groupId];
|
|
788
|
-
var edgeGroup = getEdgeGroupByNodeTags(_this5.topo.getDataModel(), linkChildren[0].source, linkChildren[0].target);
|
|
789
|
-
return !!edgeGroup;
|
|
790
|
-
}).map(function (groupId) {
|
|
791
|
-
var linkChildren = groupMap[groupId]; // 查询配置,过滤不在范围内的属性
|
|
792
|
-
|
|
793
|
-
var config = ciConfigs.find(function (item) {
|
|
794
|
-
return item.id === linkChildren[0].id;
|
|
795
|
-
});
|
|
796
|
-
config = _extends({}, config, {
|
|
797
|
-
tags: config.tags.filter(function (item) {
|
|
798
|
-
return filterField(item, linkChildren);
|
|
799
|
-
}),
|
|
800
|
-
tips: config.tips.filter(function (item) {
|
|
801
|
-
return filterField(item, linkChildren);
|
|
802
|
-
})
|
|
803
|
-
}); // 构造数据,计算指标值
|
|
804
|
-
|
|
805
|
-
var linkChildrenData = linkChildren.map(function (link) {
|
|
806
|
-
return data.find(function (item) {
|
|
807
|
-
return item.id === link.id;
|
|
808
|
-
});
|
|
809
|
-
});
|
|
810
|
-
var mergeData = {
|
|
811
|
-
ciType: 'network_link',
|
|
812
|
-
metricMap: {}
|
|
813
|
-
};
|
|
814
|
-
var connectType = linkChildren[0].attributes['network_link.connect_type'];
|
|
815
|
-
metrics.forEach(function (m) {
|
|
816
|
-
var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
|
|
817
|
-
|
|
818
|
-
try {
|
|
819
|
-
var values = linkChildrenData.map(function (linkData) {
|
|
820
|
-
return linkData.metricMap[metricCode];
|
|
821
|
-
});
|
|
822
|
-
mergeData.metricMap[metricCode] = calcFnMap[m.calcType](values);
|
|
823
|
-
} catch (error) {
|
|
824
|
-
rlog.warn('连线组指标计算异常', error);
|
|
825
|
-
}
|
|
826
|
-
}); // console.error(groupId, {config, linkChildrenData, mergeData})
|
|
827
|
-
// 构造标注、悬浮框数据
|
|
828
|
-
|
|
829
|
-
var formatter = new AttributeFormatter(_this5.topo);
|
|
830
|
-
return {
|
|
831
|
-
type: 'edgeGroup',
|
|
832
|
-
edgeGroupId: groupId,
|
|
833
|
-
tags: formatter.formatAttrs(config.tags, mergeData),
|
|
834
|
-
tips: formatter.formatAttrs(config.tips, mergeData)
|
|
835
|
-
};
|
|
836
|
-
}); // console.error({
|
|
837
|
-
// noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
|
|
838
|
-
// })
|
|
839
|
-
|
|
840
|
-
return edgeGroupsTagsTips;
|
|
841
675
|
};
|
|
842
676
|
|
|
843
677
|
return AttributeMetricDisplay;
|
|
@@ -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 "2.15.
|
|
23
|
+
var version = typeof "2.15.41" === 'string' ? "2.15.41" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
3
|
+
import groupBy from 'lodash/groupBy';
|
|
4
|
+
import { getEdgeGroupByNodeTags } from "../../../utils/htElementUtils";
|
|
5
|
+
import AttributeFormatter from "../attributeFormatter"; // 参与计算的链路指标
|
|
6
|
+
|
|
7
|
+
var metrics = [// 总流速
|
|
8
|
+
{
|
|
9
|
+
code: 'total_flow_rate',
|
|
10
|
+
calcType: 'sum'
|
|
11
|
+
}, // 带宽利用率
|
|
12
|
+
{
|
|
13
|
+
code: 'bandwidth_utilization',
|
|
14
|
+
calcType: 'avg'
|
|
15
|
+
}, // 发送带宽利用率
|
|
16
|
+
{
|
|
17
|
+
code: 'out_bandwidth_utilization',
|
|
18
|
+
calcType: 'avg',
|
|
19
|
+
showWhenSameSource: true
|
|
20
|
+
}, // 接收带宽利用率
|
|
21
|
+
{
|
|
22
|
+
code: 'in_bandwidth_utilization',
|
|
23
|
+
calcType: 'avg',
|
|
24
|
+
showWhenSameSource: true
|
|
25
|
+
}, {
|
|
26
|
+
code: 'out_rate',
|
|
27
|
+
calcType: 'sum',
|
|
28
|
+
showWhenSameSource: true
|
|
29
|
+
}, {
|
|
30
|
+
code: 'in_rate',
|
|
31
|
+
calcType: 'sum',
|
|
32
|
+
showWhenSameSource: true
|
|
33
|
+
}];
|
|
34
|
+
var connectTypePrefixMap = {
|
|
35
|
+
phy: 'physical_link.',
|
|
36
|
+
exit: 'export_link.'
|
|
37
|
+
};
|
|
38
|
+
var calcFnMap = {
|
|
39
|
+
sum: function sum(values) {
|
|
40
|
+
return values.reduce(function (total, val) {
|
|
41
|
+
return total + parseInt(val || 0, 10);
|
|
42
|
+
}, 0);
|
|
43
|
+
},
|
|
44
|
+
avg: function avg(values) {
|
|
45
|
+
return values.reduce(function (total, val) {
|
|
46
|
+
return total + parseFloat(val || 0, 10);
|
|
47
|
+
}, 0) / values.length;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var LinkTagsTipsBuilder = /*#__PURE__*/function () {
|
|
52
|
+
function LinkTagsTipsBuilder(amDisplay) {
|
|
53
|
+
this.amDisplay = void 0;
|
|
54
|
+
this.topo = void 0;
|
|
55
|
+
this.amDisplay = amDisplay;
|
|
56
|
+
this.topo = amDisplay.topo;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 获得未关联聚合链路的连线组标注和悬浮框数据
|
|
60
|
+
* @param {*} ciTagsAndTips
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
var _proto = LinkTagsTipsBuilder.prototype;
|
|
66
|
+
|
|
67
|
+
_proto.getEdgeGroupTagsAndTips = function getEdgeGroupTagsAndTips() {
|
|
68
|
+
var _this = this;
|
|
69
|
+
|
|
70
|
+
var ciConfigs = this.amDisplay.getResourceTagTipConfig();
|
|
71
|
+
var data = this.amDisplay.getData(); // 查询没有关联链路的连线组及对应子链路列表
|
|
72
|
+
|
|
73
|
+
var _this$topo$dataModel$ = this.topo.dataModel.getData(),
|
|
74
|
+
links = _this$topo$dataModel$.links,
|
|
75
|
+
linkGroups = _this$topo$dataModel$.linkGroups;
|
|
76
|
+
|
|
77
|
+
var getLinkUId = function getLinkUId(link) {
|
|
78
|
+
return [link.source, link.target].sort().join('-');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var linkGroupUIds = linkGroups.filter(function (link) {
|
|
82
|
+
return link.ciType === 'network_link';
|
|
83
|
+
}).map(function (link) {
|
|
84
|
+
return getLinkUId(link);
|
|
85
|
+
}); // 查询没有聚合链路的物理链路/出口链路
|
|
86
|
+
|
|
87
|
+
var noParentLinks = links.filter(function (link) {
|
|
88
|
+
return link.ciType === 'network_link';
|
|
89
|
+
}).map(function (link) {
|
|
90
|
+
return _extends({}, link, {
|
|
91
|
+
linkUId: getLinkUId(link)
|
|
92
|
+
});
|
|
93
|
+
}).filter(function (link) {
|
|
94
|
+
return linkGroupUIds.indexOf(link.linkUId) === -1;
|
|
95
|
+
});
|
|
96
|
+
var groupMap = groupBy(noParentLinks, 'linkUId'); // 计算标注和指标
|
|
97
|
+
|
|
98
|
+
var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
|
|
99
|
+
.filter(function (groupId) {
|
|
100
|
+
var linkChildren = groupMap[groupId];
|
|
101
|
+
var edgeGroup = getEdgeGroupByNodeTags(_this.topo.getDataModel(), linkChildren[0].source, linkChildren[0].target);
|
|
102
|
+
return !!edgeGroup;
|
|
103
|
+
}).map(function (groupId) {
|
|
104
|
+
var linkChildren = groupMap[groupId];
|
|
105
|
+
var config = ciConfigs.find(function (item) {
|
|
106
|
+
return item.id === linkChildren[0].id;
|
|
107
|
+
});
|
|
108
|
+
return _this.buildEdgeGroupTagTagsAndTips({
|
|
109
|
+
groupId: groupId,
|
|
110
|
+
config: config,
|
|
111
|
+
linkChildren: linkChildren,
|
|
112
|
+
data: data
|
|
113
|
+
});
|
|
114
|
+
}); // console.error({
|
|
115
|
+
// noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
|
|
116
|
+
// })
|
|
117
|
+
|
|
118
|
+
return edgeGroupsTagsTips;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
_proto.buildEdgeGroupTagTagsAndTips = function buildEdgeGroupTagTagsAndTips(_ref) {
|
|
122
|
+
var _this2 = this;
|
|
123
|
+
|
|
124
|
+
var groupId = _ref.groupId,
|
|
125
|
+
config = _ref.config,
|
|
126
|
+
linkChildren = _ref.linkChildren,
|
|
127
|
+
data = _ref.data;
|
|
128
|
+
|
|
129
|
+
// 查询配置,过滤不在范围内的属性
|
|
130
|
+
var finalConfig = _extends({}, config, {
|
|
131
|
+
tags: config.tags.filter(function (item) {
|
|
132
|
+
return _this2.filterField(item, linkChildren);
|
|
133
|
+
}),
|
|
134
|
+
tips: config.tips.filter(function (item) {
|
|
135
|
+
return _this2.filterField(item, linkChildren);
|
|
136
|
+
})
|
|
137
|
+
}); // 构造数据,计算指标值
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var mergeData = this.buildData(data, linkChildren); // 构造标注、悬浮框数据
|
|
141
|
+
|
|
142
|
+
var formatter = new AttributeFormatter(this.topo);
|
|
143
|
+
return {
|
|
144
|
+
type: 'edgeGroup',
|
|
145
|
+
edgeGroupId: groupId,
|
|
146
|
+
tags: formatter.formatAttrs(finalConfig.tags, mergeData),
|
|
147
|
+
tips: formatter.formatAttrs(finalConfig.tips, mergeData)
|
|
148
|
+
};
|
|
149
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
150
|
+
;
|
|
151
|
+
|
|
152
|
+
_proto.filterField = function filterField(item, linkChildren) {
|
|
153
|
+
var fieldConfig = metrics.find(function (m) {
|
|
154
|
+
return item.code.endsWith("." + m.code);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (item.type !== 'metric' || !fieldConfig) {
|
|
158
|
+
return false;
|
|
159
|
+
} // 如果需要校验取值接口,如果取值接口为不同设备的接口,则不显示这四个指标
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
if (fieldConfig.showWhenSameSource) {
|
|
163
|
+
var sources = [];
|
|
164
|
+
linkChildren.forEach(function (link) {
|
|
165
|
+
if (sources.indexOf(link.source) === -1) {
|
|
166
|
+
sources.push(link.source);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (sources.length > 1) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return true;
|
|
176
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
177
|
+
;
|
|
178
|
+
|
|
179
|
+
_proto.buildData = function buildData(data, linkChildren) {
|
|
180
|
+
var linkChildrenData = linkChildren.map(function (link) {
|
|
181
|
+
return data.find(function (item) {
|
|
182
|
+
return item.id === link.id;
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
var mergeData = {
|
|
186
|
+
ciType: 'network_link',
|
|
187
|
+
metricMap: {}
|
|
188
|
+
};
|
|
189
|
+
var connectType = linkChildren[0].attributes['network_link.connect_type'];
|
|
190
|
+
metrics.forEach(function (m) {
|
|
191
|
+
var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
var values = linkChildrenData.map(function (linkData) {
|
|
195
|
+
return linkData.metricMap[metricCode];
|
|
196
|
+
});
|
|
197
|
+
mergeData.metricMap[metricCode] = calcFnMap[m.calcType](values);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
rlog.warn('连线组指标计算异常', error);
|
|
200
|
+
}
|
|
201
|
+
}); // console.error(groupId, {config, linkChildrenData, mergeData})
|
|
202
|
+
|
|
203
|
+
return mergeData;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
return LinkTagsTipsBuilder;
|
|
207
|
+
}();
|
|
208
|
+
|
|
209
|
+
export { LinkTagsTipsBuilder as default };
|
|
210
|
+
;
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -353,7 +353,7 @@ export default function EditLinkInfo(props) {
|
|
|
353
353
|
type: "primary",
|
|
354
354
|
loading: loading,
|
|
355
355
|
onClick: saveHandleChange
|
|
356
|
-
}, "
|
|
356
|
+
}, isAdd ? "确定" : "保存"), /*#__PURE__*/React.createElement(_Button, {
|
|
357
357
|
className: styles.button,
|
|
358
358
|
onClick: onClose
|
|
359
359
|
}, "\u53D6\u6D88")));
|
|
@@ -13,27 +13,26 @@ var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
16
18
|
var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
|
17
19
|
|
|
18
20
|
var headerStyle = {
|
|
19
|
-
position: 'absolute',
|
|
20
|
-
top: 0,
|
|
21
|
-
left: 0,
|
|
22
|
-
width: '100%',
|
|
23
21
|
zIndex: 1000
|
|
24
22
|
};
|
|
25
|
-
var bodyStyle = {
|
|
26
|
-
margin: '46px auto',
|
|
27
|
-
padding: '16px 24px'
|
|
28
|
-
};
|
|
23
|
+
var bodyStyle = {};
|
|
29
24
|
|
|
30
25
|
var Drawer = function Drawer(props) {
|
|
31
26
|
var visible = props.visible,
|
|
32
27
|
disabled = props.disabled,
|
|
33
28
|
loading = props.loading,
|
|
34
29
|
title = props.title,
|
|
30
|
+
_props$footer = props.footer,
|
|
31
|
+
footer = _props$footer === void 0 ? true : _props$footer,
|
|
35
32
|
_props$buttons = props.buttons,
|
|
36
33
|
buttons = _props$buttons === void 0 ? props.buttons || ['保存', '取消'] : _props$buttons,
|
|
34
|
+
_props$footerActions = props.footerActions,
|
|
35
|
+
footerActions = _props$footerActions === void 0 ? ['确定', '取消'] : _props$footerActions,
|
|
37
36
|
onClose = props.onClose,
|
|
38
37
|
onSave = props.onSave,
|
|
39
38
|
drawerProps = props.drawerProps,
|
|
@@ -44,12 +43,14 @@ var Drawer = function Drawer(props) {
|
|
|
44
43
|
width: "40%",
|
|
45
44
|
headerStyle: headerStyle,
|
|
46
45
|
bodyStyle: bodyStyle,
|
|
47
|
-
closeMode: ['close', 'esc']
|
|
48
|
-
className: _indexModule["default"].drawer
|
|
46
|
+
closeMode: ['close', 'esc']
|
|
49
47
|
}, drawerProps, {
|
|
48
|
+
className: (0, _classnames["default"])(_indexModule["default"].drawer, drawerProps.className),
|
|
50
49
|
visible: visible,
|
|
51
50
|
onClose: onClose
|
|
52
|
-
}),
|
|
51
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
52
|
+
className: (0, _classnames["default"])(_indexModule["default"].content, drawerProps.bodyClassName)
|
|
53
|
+
}, children), footer && /*#__PURE__*/_react["default"].createElement("div", {
|
|
53
54
|
className: _indexModule["default"].footer
|
|
54
55
|
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
55
56
|
className: _indexModule["default"].button,
|
|
@@ -3,26 +3,35 @@
|
|
|
3
3
|
.drawer {
|
|
4
4
|
& > div {
|
|
5
5
|
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
:global {
|
|
10
|
+
.#{$css-prefix}drawer-header {
|
|
11
|
+
}
|
|
9
12
|
.#{$css-prefix}drawer-body {
|
|
10
13
|
flex: 1;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: 0;
|
|
17
|
+
overflow: auto;
|
|
11
18
|
}
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
|
|
22
|
+
.content {
|
|
23
|
+
flex: 1;
|
|
24
|
+
padding: 16px 24px;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
|
|
27
|
+
}
|
|
15
28
|
|
|
16
29
|
.footer {
|
|
17
|
-
|
|
18
|
-
bottom: 0;
|
|
19
|
-
width: 100%;
|
|
30
|
+
background: #fff;
|
|
20
31
|
border-top: 1px solid #e8e8e8;
|
|
32
|
+
border-radius: 0 0 4px 4px;
|
|
21
33
|
padding: 10px 16px;
|
|
22
34
|
text-align: right;
|
|
23
|
-
left: 0;
|
|
24
|
-
background: #fff;
|
|
25
|
-
border-radius: 0 0 4px 4px;
|
|
26
35
|
|
|
27
36
|
& .button {
|
|
28
37
|
&:not(:first-child) {
|
|
@@ -108,7 +108,7 @@ function ResourceSelectDrawer(props) {
|
|
|
108
108
|
onClose: onClose,
|
|
109
109
|
drawerProps: {
|
|
110
110
|
width: '616px',
|
|
111
|
-
|
|
111
|
+
bodyClassName: _ResourceSelectDrawerModule["default"].body
|
|
112
112
|
},
|
|
113
113
|
buttons: ['确定', '取消']
|
|
114
114
|
}, visible && /*#__PURE__*/_react["default"].createElement(_ResourceSelectList["default"], {
|