@riil-frontend/component-topology 9.0.1 → 9.0.3

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.
@@ -14,47 +14,6 @@ var _attributeFormatter = _interopRequireDefault(require("../../core/models/attr
14
14
  /**
15
15
  * 连线组标注、悬浮框数据构建
16
16
  */
17
- // 参与计算的链路指标
18
- var metrics = [// 总流速
19
- {
20
- code: "interface_totalbps",
21
- calcType: "sum"
22
- }, // 带宽利用率
23
- {
24
- code: "bandwidth_utilization",
25
- calcType: "avg"
26
- }, // 发送带宽利用率
27
- {
28
- code: "out_bandwidth_utilization",
29
- calcType: "avg",
30
- showWhenSameSource: true
31
- }, // 接收带宽利用率
32
- {
33
- code: "in_bandwidth_utilization",
34
- calcType: "avg",
35
- showWhenSameSource: true
36
- }, {
37
- code: "out_rate",
38
- calcType: "sum",
39
- showWhenSameSource: true
40
- }, {
41
- code: "in_rate",
42
- calcType: "sum",
43
- showWhenSameSource: true
44
- }];
45
- var calcFnMap = {
46
- sum: function sum(values) {
47
- return values.reduce(function (total, val) {
48
- return total + parseInt(val || 0, 10);
49
- }, 0);
50
- },
51
- avg: function avg(values) {
52
- return values.reduce(function (total, val) {
53
- return total + parseFloat(val || 0, 10);
54
- }, 0) / values.length;
55
- }
56
- };
57
-
58
17
  var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
59
18
  function IpNodeTagsTipsBuilder(amDisplay) {
60
19
  this.amDisplay = void 0;
@@ -80,40 +39,91 @@ var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
80
39
  var dm = this.topo.getDataModel();
81
40
  var config = topo.attributeMetricDisplay.getConfig();
82
41
  console.log("getIpNodeTagsAndTips", config, ipNodes);
42
+ var tagDatas = config.nodeTag && !config.nodeTag.isCustom ? config.nodeTag.data : [];
43
+ var tipDatas = config.nodeTip && !config.nodeTip.isCustom ? config.nodeTip.data : [];
44
+ var tagHasIpv4 = tagDatas.filter(function (item) {
45
+ return item.code === "ipv4_address";
46
+ }).length > 0;
47
+ var tagHasName = tagDatas.filter(function (item) {
48
+ return item.code === "display_name";
49
+ }).length > 0;
50
+ var tipHasIpv4 = tipDatas.filter(function (item) {
51
+ return item.code === "ipv4_address";
52
+ }).length > 0;
53
+ var tipHasName = tipDatas.filter(function (item) {
54
+ return item.code === "display_name";
55
+ }).length > 0;
56
+ ipNodes.map(function (node) {
57
+ var tags = [];
83
58
 
84
- if (config.nodeTag && !config.nodeTag.isCustom) {
85
- var tagDatas = config.nodeTag.data;
86
- var hasIpv4 = tagDatas.filter(function (item) {
87
- return item.code === "ipv4_address";
88
- }).length > 0;
89
- ipNodes.map(function (node) {
90
- if (hasIpv4) {
91
- tts.push({
92
- type: node,
93
- id: node.id,
94
- tags: [{
95
- type: "attribute",
96
- code: "ipv4_address",
97
- // 属性code
98
- name: "IPv4地址",
99
- // 属性名称
100
- value: node.bindIp,
101
- // 属性值
102
- originValue: node.bindIp
103
- }],
104
- tips: []
105
- });
106
- } else {
107
- tts.push({
108
- type: node,
109
- id: node.id,
110
- tags: [],
111
- tips: []
112
- });
113
- }
114
- });
115
- }
59
+ if (tagHasName) {
60
+ var _element$a, _element$a2;
61
+
62
+ var element = dm.getDataByTag(node.id);
63
+ tags.push({
64
+ type: "attribute",
65
+ code: "display_name",
66
+ // 属性code
67
+ name: "显示名称",
68
+ // 属性名称
69
+ value: (_element$a = element.a("customName")) !== null && _element$a !== void 0 ? _element$a : node.name,
70
+ // 属性值
71
+ originValue: (_element$a2 = element.a("customName")) !== null && _element$a2 !== void 0 ? _element$a2 : node.name
72
+ });
73
+ }
74
+
75
+ if (tagHasIpv4) {
76
+ tags.push({
77
+ type: "attribute",
78
+ code: "ipv4_address",
79
+ // 属性code
80
+ name: "IPv4地址",
81
+ // 属性名称
82
+ value: node.bindIp,
83
+ // 属性值
84
+ originValue: node.bindIp
85
+ });
86
+ }
87
+
88
+ var tips = [];
116
89
 
90
+ if (tipHasName) {
91
+ var _element$a3, _element$a4;
92
+
93
+ var _element = dm.getDataByTag(node.id);
94
+
95
+ tips.push({
96
+ type: "attribute",
97
+ code: "display_name",
98
+ // 属性code
99
+ name: "显示名称",
100
+ // 属性名称
101
+ value: (_element$a3 = _element.a("customName")) !== null && _element$a3 !== void 0 ? _element$a3 : node.name,
102
+ // 属性值
103
+ originValue: (_element$a4 = _element.a("customName")) !== null && _element$a4 !== void 0 ? _element$a4 : node.name
104
+ });
105
+ }
106
+
107
+ if (tipHasIpv4) {
108
+ tips.push({
109
+ type: "attribute",
110
+ code: "ipv4_address",
111
+ // 属性code
112
+ name: "IPv4地址",
113
+ // 属性名称
114
+ value: node.bindIp,
115
+ // 属性值
116
+ originValue: node.bindIp
117
+ });
118
+ }
119
+
120
+ tts.push({
121
+ type: node,
122
+ id: node.id,
123
+ tags: tags,
124
+ tips: tips
125
+ });
126
+ });
117
127
  return tts;
118
128
  };
119
129
 
package/lib/style.js CHANGED
@@ -14,13 +14,13 @@ require('@riil-frontend/component-pager/lib/style');
14
14
  require('@alifd/next/lib/button/style');
15
15
  require('@alifd/next/lib/icon/style');
16
16
  require('@alifd/next/lib/loading/style');
17
- require('@alifd/next/lib/switch/style');
18
17
  require('@alifd/next/lib/divider/style');
19
18
  require('@riil-frontend/component-no-data-page/lib/style');
20
19
 
21
20
  require('@alifd/next/lib/overlay/style');
22
21
  require('@alifd/next/lib/checkbox/style');
23
22
  require('@riil-frontend/component-crucial-link-topo/lib/style');
23
+ require('@alifd/next/lib/switch/style');
24
24
  require('@alifd/next/lib/input/style');
25
25
  require('@alifd/next/lib/field/style');
26
26
  require('@alifd/next/lib/form/style');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "9.0.1",
3
+ "version": "9.0.3",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.1/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.3/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }