@riil-frontend/component-topology 3.5.9 → 3.5.12

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.
@@ -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.5.9" === 'string' ? "3.5.9" : null;
23
+ var version = typeof "3.5.12" === 'string' ? "3.5.12" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -461,7 +461,7 @@ export default function ResourceOverview(props) {
461
461
  case 0:
462
462
  _context5.next = 2;
463
463
  return alarmService.getAlarmByIds([id], {
464
- alertStatusList: ['toDeal', 'dealing'],
464
+ alertStatusList: ['toDeal', 'woDealing', 'dealing'],
465
465
  // toDeal: 待处理, dealing:处理中
466
466
  pageNum: 1,
467
467
  pageSize: 999,
@@ -43,12 +43,16 @@ function _queryCiMonitorMetricCodes() {
43
43
  while (1) {
44
44
  switch (_context2.prev = _context2.next) {
45
45
  case 0:
46
- arr = queryCiMonitorMetricStrategys(id);
46
+ _context2.next = 2;
47
+ return queryCiMonitorMetricStrategys(id);
48
+
49
+ case 2:
50
+ arr = _context2.sent;
47
51
  return _context2.abrupt("return", arr.map(function (item) {
48
52
  return item.code;
49
53
  }));
50
54
 
51
- case 2:
55
+ case 4:
52
56
  case "end":
53
57
  return _context2.stop();
54
58
  }
@@ -8,7 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
9
9
  import _ from "lodash";
10
10
  import { sortList } from "../utils/topoData";
11
- var showAlarmStatus = ["toDeal", "dealing", "change"];
11
+ var showAlarmStatus = ["toDeal", "dealing", "change", "woDealing"];
12
12
  export default function (topo) {
13
13
  return {
14
14
  // 定义 model 的初始 state
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
5
5
  */
6
6
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
7
  import groupBy from 'lodash/groupBy';
8
- import { getEdgeGroupByNodeTags } from "../../utils/htElementUtils";
8
+ import { getEdgeGroupByNodeTags, getEdgeGroups } from "../../utils/htElementUtils";
9
9
  import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与计算的链路指标
10
10
 
11
11
  var metrics = [// 总流速
@@ -76,40 +76,22 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
76
76
  var _this = this;
77
77
 
78
78
  var ciConfigs = this.amDisplay.getResourceTagTipConfig();
79
- var data = this.amDisplay.getData(); // 查询没有关联链路的连线组及对应子链路列表
80
-
81
- var _this$topo$dataModel$ = this.topo.dataModel.getData(),
82
- links = _this$topo$dataModel$.links,
83
- linkGroups = _this$topo$dataModel$.linkGroups;
84
-
85
- var getLinkUId = function getLinkUId(link) {
86
- return [link.source, link.target].sort().join('-');
87
- };
88
-
89
- var linkGroupUIds = linkGroups.filter(function (link) {
90
- return link.ciType === 'network_link';
91
- }).map(function (link) {
92
- return getLinkUId(link);
93
- }); // 查询没有聚合链路的物理链路/出口链路
94
-
95
- var noParentLinks = links.filter(function (link) {
96
- return link.ciType === 'network_link';
97
- }).map(function (link) {
98
- return _extends({}, link, {
99
- linkUId: getLinkUId(link)
79
+ var data = this.amDisplay.getData();
80
+ var topo = this.topo;
81
+ var dm = this.topo.getDataModel(); // 获取所有连线组,排除关联聚合链路,排除无子链路
82
+
83
+ var groups = getEdgeGroups(dm).map(getGroupInfo).filter(function (item) {
84
+ return !!item;
85
+ }); // 计算标注和指标
86
+
87
+ var edgeGroupsTagsTips = groups.map(function (_ref) {
88
+ var groupId = _ref.groupId,
89
+ linkChildren = _ref.children;
90
+ console.error(1111, {
91
+ ciConfigs: ciConfigs,
92
+ linkChildren: linkChildren,
93
+ data: data
100
94
  });
101
- }).filter(function (link) {
102
- return linkGroupUIds.indexOf(link.linkUId) === -1;
103
- });
104
- var groupMap = groupBy(noParentLinks, 'linkUId'); // 计算标注和指标
105
-
106
- var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
107
- .filter(function (groupId) {
108
- var linkChildren = groupMap[groupId];
109
- var edgeGroup = getEdgeGroupByNodeTags(_this.topo.getDataModel(), linkChildren[0].source, linkChildren[0].target);
110
- return !!edgeGroup;
111
- }).map(function (groupId) {
112
- var linkChildren = groupMap[groupId];
113
95
  var config = ciConfigs.find(function (item) {
114
96
  return item.id === linkChildren[0].id;
115
97
  });
@@ -122,26 +104,80 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
122
104
  }); // console.error({
123
105
  // noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
124
106
  // })
107
+ // 获得连线组及子链路
108
+ // 关联聚合链路、无子链路 时返回null
109
+
110
+ function getGroupInfo(group) {
111
+ var edges = group.getEdges().toArray();
112
+ var edge = edges[0];
113
+ var edgeGroupData = topo.getHtTopo().getEdgeGroupData(edge.getSource(), edge.getTarget()); // eslint-disable-next-line no-underscore-dangle
114
+
115
+ var linkId = edgeGroupData.data._attrObject.id;
116
+
117
+ if (linkId) {
118
+ return null;
119
+ }
120
+
121
+ var linkChildren = getLinkChildren(edges);
122
+
123
+ if (!linkChildren.length) {
124
+ return null;
125
+ }
126
+
127
+ return {
128
+ groupId: [edge.getSource().getId(), edge.getTarget().getId()].sort().join('-'),
129
+ children: linkChildren
130
+ };
131
+ }
132
+
133
+ function getLinkChildren(edges) {
134
+ return edges.map(function (edge) {
135
+ var edgeData = topo.getHtTopo().getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
136
+
137
+ var childLinkId = edgeData._tag;
138
+
139
+ if (childLinkId) {
140
+ return topo.dataModel.getDataById(childLinkId);
141
+ }
142
+
143
+ return null;
144
+ }).filter(function (item) {
145
+ return !!item;
146
+ }).filter(function (link) {
147
+ return link.ciType === 'network_link';
148
+ });
149
+ }
125
150
 
126
151
  return edgeGroupsTagsTips;
127
152
  };
128
153
 
129
- _proto.buildEdgeGroupTagTagsAndTips = function buildEdgeGroupTagTagsAndTips(_ref) {
154
+ _proto.buildEdgeGroupTagTagsAndTips = function buildEdgeGroupTagTagsAndTips(_ref2) {
130
155
  var _this2 = this;
131
156
 
132
- var groupId = _ref.groupId,
133
- config = _ref.config,
134
- linkChildren = _ref.linkChildren,
135
- data = _ref.data;
157
+ var groupId = _ref2.groupId,
158
+ config = _ref2.config,
159
+ linkChildren = _ref2.linkChildren,
160
+ 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
+
136
173
 
137
- // 查询配置,过滤不在范围内的属性
138
174
  var finalConfig = _extends({}, config, {
139
175
  tags: config.tags.filter(function (item) {
140
176
  return _this2.filterField(item, linkChildren);
141
- }),
177
+ }).map(replaceMetricConfigCode),
142
178
  tips: config.tips.filter(function (item) {
143
179
  return _this2.filterField(item, linkChildren);
144
- })
180
+ }).map(replaceMetricConfigCode)
145
181
  }); // 构造数据,计算指标值
146
182
 
147
183
 
@@ -194,15 +230,14 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
194
230
  ciType: 'network_link',
195
231
  metricMap: {}
196
232
  };
197
- var connectType = linkChildren[0].attributes['network_link.connect_type'];
198
233
  metrics.forEach(function (m) {
199
- var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
200
-
201
234
  try {
202
235
  var values = linkChildrenData.map(function (linkData) {
236
+ var connectType = linkData.attributeMap['network_link.connect_type'];
237
+ var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
203
238
  return linkData.metricMap[metricCode];
204
239
  });
205
- mergeData.metricMap[metricCode] = calcFnMap[m.calcType](values);
240
+ mergeData.metricMap["physical_link." + m.code] = calcFnMap[m.calcType](values);
206
241
  } catch (error) {
207
242
  rlog.warn('连线组指标计算异常', error);
208
243
  }
@@ -189,8 +189,15 @@ export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
189
189
  return getEdgeGroupByNodes(node1, node2);
190
190
  }
191
191
  export function getEdgeGroups(dataModel) {
192
- var edgeGroup = null;
193
- return [];
192
+ var edgeGroups = [];
193
+ getEdges(dataModel).forEach(function (edge) {
194
+ var group = edge.getEdgeGroup();
195
+
196
+ if (group && !edgeGroups.includes(group)) {
197
+ edgeGroups.push(group);
198
+ }
199
+ });
200
+ return edgeGroups;
194
201
  }
195
202
  export function getEdgeDatas(dataModel) {
196
203
  return getEdges(dataModel).map(function (element) {
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
48
48
  var _topoFactory = _interopRequireDefault(require("./topoFactory"));
49
49
 
50
50
  // eslint-disable-next-line no-undef
51
- var version = typeof "3.5.9" === 'string' ? "3.5.9" : null;
51
+ var version = typeof "3.5.12" === 'string' ? "3.5.12" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -493,7 +493,7 @@ function ResourceOverview(props) {
493
493
  case 0:
494
494
  _context5.next = 2;
495
495
  return _alarm["default"].getAlarmByIds([id], {
496
- alertStatusList: ['toDeal', 'dealing'],
496
+ alertStatusList: ['toDeal', 'woDealing', 'dealing'],
497
497
  // toDeal: 待处理, dealing:处理中
498
498
  pageNum: 1,
499
499
  pageSize: 999,
@@ -54,12 +54,16 @@ function _queryCiMonitorMetricCodes() {
54
54
  while (1) {
55
55
  switch (_context2.prev = _context2.next) {
56
56
  case 0:
57
- arr = queryCiMonitorMetricStrategys(id);
57
+ _context2.next = 2;
58
+ return queryCiMonitorMetricStrategys(id);
59
+
60
+ case 2:
61
+ arr = _context2.sent;
58
62
  return _context2.abrupt("return", arr.map(function (item) {
59
63
  return item.code;
60
64
  }));
61
65
 
62
- case 2:
66
+ case 4:
63
67
  case "end":
64
68
  return _context2.stop();
65
69
  }
@@ -20,7 +20,7 @@ var _topoData = require("../utils/topoData");
20
20
  /**
21
21
  * 告警
22
22
  */
23
- var showAlarmStatus = ["toDeal", "dealing", "change"];
23
+ var showAlarmStatus = ["toDeal", "dealing", "change", "woDealing"];
24
24
 
25
25
  function _default(topo) {
26
26
  return {
@@ -87,40 +87,22 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
87
87
  var _this = this;
88
88
 
89
89
  var ciConfigs = this.amDisplay.getResourceTagTipConfig();
90
- var data = this.amDisplay.getData(); // 查询没有关联链路的连线组及对应子链路列表
91
-
92
- var _this$topo$dataModel$ = this.topo.dataModel.getData(),
93
- links = _this$topo$dataModel$.links,
94
- linkGroups = _this$topo$dataModel$.linkGroups;
95
-
96
- var getLinkUId = function getLinkUId(link) {
97
- return [link.source, link.target].sort().join('-');
98
- };
99
-
100
- var linkGroupUIds = linkGroups.filter(function (link) {
101
- return link.ciType === 'network_link';
102
- }).map(function (link) {
103
- return getLinkUId(link);
104
- }); // 查询没有聚合链路的物理链路/出口链路
105
-
106
- var noParentLinks = links.filter(function (link) {
107
- return link.ciType === 'network_link';
108
- }).map(function (link) {
109
- return (0, _extends2["default"])({}, link, {
110
- linkUId: getLinkUId(link)
90
+ var data = this.amDisplay.getData();
91
+ var topo = this.topo;
92
+ var dm = this.topo.getDataModel(); // 获取所有连线组,排除关联聚合链路,排除无子链路
93
+
94
+ var groups = (0, _htElementUtils.getEdgeGroups)(dm).map(getGroupInfo).filter(function (item) {
95
+ return !!item;
96
+ }); // 计算标注和指标
97
+
98
+ var edgeGroupsTagsTips = groups.map(function (_ref) {
99
+ var groupId = _ref.groupId,
100
+ linkChildren = _ref.children;
101
+ console.error(1111, {
102
+ ciConfigs: ciConfigs,
103
+ linkChildren: linkChildren,
104
+ data: data
111
105
  });
112
- }).filter(function (link) {
113
- return linkGroupUIds.indexOf(link.linkUId) === -1;
114
- });
115
- var groupMap = (0, _groupBy["default"])(noParentLinks, 'linkUId'); // 计算标注和指标
116
-
117
- var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
118
- .filter(function (groupId) {
119
- var linkChildren = groupMap[groupId];
120
- var edgeGroup = (0, _htElementUtils.getEdgeGroupByNodeTags)(_this.topo.getDataModel(), linkChildren[0].source, linkChildren[0].target);
121
- return !!edgeGroup;
122
- }).map(function (groupId) {
123
- var linkChildren = groupMap[groupId];
124
106
  var config = ciConfigs.find(function (item) {
125
107
  return item.id === linkChildren[0].id;
126
108
  });
@@ -133,25 +115,80 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
133
115
  }); // console.error({
134
116
  // noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
135
117
  // })
118
+ // 获得连线组及子链路
119
+ // 关联聚合链路、无子链路 时返回null
120
+
121
+ function getGroupInfo(group) {
122
+ var edges = group.getEdges().toArray();
123
+ var edge = edges[0];
124
+ var edgeGroupData = topo.getHtTopo().getEdgeGroupData(edge.getSource(), edge.getTarget()); // eslint-disable-next-line no-underscore-dangle
125
+
126
+ var linkId = edgeGroupData.data._attrObject.id;
127
+
128
+ if (linkId) {
129
+ return null;
130
+ }
131
+
132
+ var linkChildren = getLinkChildren(edges);
133
+
134
+ if (!linkChildren.length) {
135
+ return null;
136
+ }
137
+
138
+ return {
139
+ groupId: [edge.getSource().getId(), edge.getTarget().getId()].sort().join('-'),
140
+ children: linkChildren
141
+ };
142
+ }
143
+
144
+ function getLinkChildren(edges) {
145
+ return edges.map(function (edge) {
146
+ var edgeData = topo.getHtTopo().getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
147
+
148
+ var childLinkId = edgeData._tag;
149
+
150
+ if (childLinkId) {
151
+ return topo.dataModel.getDataById(childLinkId);
152
+ }
153
+
154
+ return null;
155
+ }).filter(function (item) {
156
+ return !!item;
157
+ }).filter(function (link) {
158
+ return link.ciType === 'network_link';
159
+ });
160
+ }
136
161
 
137
162
  return edgeGroupsTagsTips;
138
163
  };
139
164
 
140
- _proto.buildEdgeGroupTagTagsAndTips = function buildEdgeGroupTagTagsAndTips(_ref) {
165
+ _proto.buildEdgeGroupTagTagsAndTips = function buildEdgeGroupTagTagsAndTips(_ref2) {
141
166
  var _this2 = this;
142
167
 
143
- var groupId = _ref.groupId,
144
- config = _ref.config,
145
- linkChildren = _ref.linkChildren,
146
- data = _ref.data;
147
- // 查询配置,过滤不在范围内的属性
168
+ var groupId = _ref2.groupId,
169
+ config = _ref2.config,
170
+ linkChildren = _ref2.linkChildren,
171
+ data = _ref2.data;
172
+ var connectTypes = ['physical_link.', 'export_link.'];
173
+
174
+ var replaceMetricConfigCode = function replaceMetricConfigCode(item) {
175
+ var code = item.code;
176
+ connectTypes.forEach(function (prefix) {
177
+ code = code.replace(prefix, 'physical_link.');
178
+ });
179
+ return (0, _extends2["default"])({}, item, {
180
+ code: code
181
+ });
182
+ }; // 查询配置,过滤不在范围内的属性
183
+
184
+
148
185
  var finalConfig = (0, _extends2["default"])({}, config, {
149
186
  tags: config.tags.filter(function (item) {
150
187
  return _this2.filterField(item, linkChildren);
151
- }),
188
+ }).map(replaceMetricConfigCode),
152
189
  tips: config.tips.filter(function (item) {
153
190
  return _this2.filterField(item, linkChildren);
154
- })
191
+ }).map(replaceMetricConfigCode)
155
192
  }); // 构造数据,计算指标值
156
193
 
157
194
  var mergeData = this.buildData(data, linkChildren); // 构造标注、悬浮框数据
@@ -203,15 +240,14 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
203
240
  ciType: 'network_link',
204
241
  metricMap: {}
205
242
  };
206
- var connectType = linkChildren[0].attributes['network_link.connect_type'];
207
243
  metrics.forEach(function (m) {
208
- var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
209
-
210
244
  try {
211
245
  var values = linkChildrenData.map(function (linkData) {
246
+ var connectType = linkData.attributeMap['network_link.connect_type'];
247
+ var metricCode = "" + connectTypePrefixMap[connectType] + m.code;
212
248
  return linkData.metricMap[metricCode];
213
249
  });
214
- mergeData.metricMap[metricCode] = calcFnMap[m.calcType](values);
250
+ mergeData.metricMap["physical_link." + m.code] = calcFnMap[m.calcType](values);
215
251
  } catch (error) {
216
252
  _rlog["default"].warn('连线组指标计算异常', error);
217
253
  }
@@ -247,8 +247,15 @@ function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
247
247
  }
248
248
 
249
249
  function getEdgeGroups(dataModel) {
250
- var edgeGroup = null;
251
- return [];
250
+ var edgeGroups = [];
251
+ getEdges(dataModel).forEach(function (edge) {
252
+ var group = edge.getEdgeGroup();
253
+
254
+ if (group && !edgeGroups.includes(group)) {
255
+ edgeGroups.push(group);
256
+ }
257
+ });
258
+ return edgeGroups;
252
259
  }
253
260
 
254
261
  function getEdgeDatas(dataModel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "3.5.9",
3
+ "version": "3.5.12",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -42,7 +42,7 @@
42
42
  "@alifd/biz-anchor": "^1.1.7",
43
43
  "@ice/store": "^1.4.2",
44
44
  "@riil-frontend/component-topo-icon-select": "^1.0.16",
45
- "@riil-frontend/component-topology-utils": "^2.0.20-alpha.0",
45
+ "@riil-frontend/component-topology-utils": "^2.1.0",
46
46
  "classnames": "^2.2.3",
47
47
  "prop-types": "^15.5.8",
48
48
  "react-color": "^2.19.3",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.9/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.12/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }