@riil-frontend/component-topology 2.15.23 → 2.15.26
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/core/components/AlarmListPanel/index.module.scss +18 -12
- package/es/core/editor/components/settings/Settings.module.scss +3 -1
- package/es/core/models/AttributeMetricDisplay.js +104 -64
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +2 -0
- package/es/topoCenter/models/LinkDynamicStyleExecutor.js +5 -3
- package/lib/core/components/AlarmListPanel/index.module.scss +18 -12
- package/lib/core/editor/components/settings/Settings.module.scss +3 -1
- package/lib/core/models/AttributeMetricDisplay.js +104 -64
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +2 -0
- package/lib/topoCenter/models/LinkDynamicStyleExecutor.js +5 -3
- package/package.json +2 -2
|
@@ -43,7 +43,12 @@ function filterUnExistedFields(fields, ciTypeMeta) {
|
|
|
43
43
|
return fields.filter(function (item) {
|
|
44
44
|
return isFieldExisted(item, ciTypeMeta);
|
|
45
45
|
});
|
|
46
|
-
}
|
|
46
|
+
} // 无权限不显示标注、悬浮框
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var filterByPermission = function filterByPermission(resource, items) {
|
|
50
|
+
return resource.operation ? items : [];
|
|
51
|
+
};
|
|
47
52
|
/**
|
|
48
53
|
* 资源标注、悬浮框数据
|
|
49
54
|
*/
|
|
@@ -171,6 +176,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
171
176
|
tips: []
|
|
172
177
|
};
|
|
173
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* 查询需要查询数据的连线
|
|
181
|
+
* @param {*} data
|
|
182
|
+
* @returns
|
|
183
|
+
*/
|
|
184
|
+
;
|
|
185
|
+
|
|
186
|
+
_proto.getEdges = function getEdges(data) {
|
|
187
|
+
// 获得图上业务节点、业务连线
|
|
188
|
+
var _ref2 = data || this.topo.dataModel.getData(),
|
|
189
|
+
links = _ref2.links,
|
|
190
|
+
linkGroups = _ref2.linkGroups;
|
|
191
|
+
|
|
192
|
+
return [].concat(links.map(function (link) {
|
|
193
|
+
return (0, _extends2["default"])({}, link, {
|
|
194
|
+
type: 'edge'
|
|
195
|
+
});
|
|
196
|
+
}), linkGroups.map(function (link) {
|
|
197
|
+
return (0, _extends2["default"])({}, link, {
|
|
198
|
+
type: 'edgeGroup'
|
|
199
|
+
});
|
|
200
|
+
})).filter(function (link) {
|
|
201
|
+
return link.ciType === 'network_link';
|
|
202
|
+
});
|
|
203
|
+
}
|
|
174
204
|
/**
|
|
175
205
|
* 获取资源的标注、悬浮框配置,只包含属性和指标字段。无权限的资源无配置
|
|
176
206
|
*
|
|
@@ -184,15 +214,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
184
214
|
var _this = this;
|
|
185
215
|
|
|
186
216
|
// 获得图上业务节点、业务连线
|
|
187
|
-
var
|
|
188
|
-
nodes =
|
|
189
|
-
links = _ref2.links,
|
|
190
|
-
linkGroups = _ref2.linkGroups; // 无权限不显示标注、悬浮框
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var filterByPermission = function filterByPermission(resource, items) {
|
|
194
|
-
return resource.operation ? items : [];
|
|
195
|
-
};
|
|
217
|
+
var _ref3 = data || this.topo.dataModel.getData(),
|
|
218
|
+
nodes = _ref3.nodes;
|
|
196
219
|
|
|
197
220
|
return [].concat(nodes.filter(function (node) {
|
|
198
221
|
return !!node.ciType;
|
|
@@ -208,29 +231,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
208
231
|
tags: filterByPermission(node, ciTypeConfig.tags),
|
|
209
232
|
tips: filterByPermission(node, ciTypeConfig.tips)
|
|
210
233
|
};
|
|
211
|
-
}),
|
|
212
|
-
return link.ciType === 'network_link';
|
|
213
|
-
}).map(function (link) {
|
|
214
|
-
var ciType = link.ciType;
|
|
215
|
-
|
|
216
|
-
var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
|
|
217
|
-
|
|
218
|
-
return {
|
|
219
|
-
type: 'edge',
|
|
220
|
-
id: link.id,
|
|
221
|
-
ciType: ciType,
|
|
222
|
-
tags: filterByPermission(link, ciTypeConfig.tags),
|
|
223
|
-
tips: filterByPermission(link, ciTypeConfig.tips)
|
|
224
|
-
};
|
|
225
|
-
}), linkGroups.filter(function (link) {
|
|
226
|
-
return link.ciType === 'network_link';
|
|
227
|
-
}).map(function (link) {
|
|
234
|
+
}), this.getEdges().map(function (link) {
|
|
228
235
|
var ciType = link.ciType;
|
|
229
236
|
|
|
230
237
|
var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
|
|
231
238
|
|
|
232
239
|
return {
|
|
233
|
-
type:
|
|
240
|
+
type: link.type,
|
|
234
241
|
id: link.id,
|
|
235
242
|
ciType: ciType,
|
|
236
243
|
tags: filterByPermission(link, ciTypeConfig.tags),
|
|
@@ -245,6 +252,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
245
252
|
|
|
246
253
|
return this.getResourceTagTipConfig().map(function (ciConfig) {
|
|
247
254
|
var fields = {
|
|
255
|
+
ciType: ciConfig.ciType,
|
|
256
|
+
type: ciConfig.type,
|
|
248
257
|
id: ciConfig.id,
|
|
249
258
|
attributes: [],
|
|
250
259
|
metrics: []
|
|
@@ -318,7 +327,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
318
327
|
_proto.getNodesNameVisible = function getNodesNameVisible() {
|
|
319
328
|
var _this3 = this;
|
|
320
329
|
|
|
321
|
-
var nodes = this.topo.
|
|
330
|
+
var nodes = this.topo.dataModel.getNodes();
|
|
322
331
|
return nodes.map(function (node) {
|
|
323
332
|
return {
|
|
324
333
|
id: node.id,
|
|
@@ -333,9 +342,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
333
342
|
|
|
334
343
|
_proto.updateNodesNameVisible = function updateNodesNameVisible() {
|
|
335
344
|
var dm = this.topo.getDataModel();
|
|
336
|
-
this.getNodesNameVisible().forEach(function (
|
|
337
|
-
var id =
|
|
338
|
-
visible =
|
|
345
|
+
this.getNodesNameVisible().forEach(function (_ref4) {
|
|
346
|
+
var id = _ref4.id,
|
|
347
|
+
visible = _ref4.visible;
|
|
339
348
|
dm.getDataByTag(id).a('isShowName', visible);
|
|
340
349
|
});
|
|
341
350
|
}
|
|
@@ -352,14 +361,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
352
361
|
var _fetchData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
353
362
|
var _this4 = this;
|
|
354
363
|
|
|
355
|
-
var
|
|
364
|
+
var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, linkAdapter, result;
|
|
356
365
|
|
|
357
366
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
358
367
|
while (1) {
|
|
359
368
|
switch (_context.prev = _context.next) {
|
|
360
369
|
case 0:
|
|
361
370
|
linkAdapter = function _linkAdapter(data) {
|
|
362
|
-
var link =
|
|
371
|
+
var link = topo.dataModel.getDataById(data.id);
|
|
363
372
|
|
|
364
373
|
if (!link) {
|
|
365
374
|
return data;
|
|
@@ -372,9 +381,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
372
381
|
});
|
|
373
382
|
};
|
|
374
383
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
384
|
+
topo = this.topo;
|
|
385
|
+
_topo$store$getState$ = topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _topo$store$getState$.resIdsList, nodeIdsList = _topo$store$getState$.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
|
|
386
|
+
// 无资源,不查询
|
|
378
387
|
|
|
379
388
|
if (resIdsList.length) {
|
|
380
389
|
_context.next = 5;
|
|
@@ -389,14 +398,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
389
398
|
|
|
390
399
|
case 7:
|
|
391
400
|
// 需要查询的指标列表
|
|
392
|
-
codes = this.getResourceMetricCodes();
|
|
393
|
-
// return [];
|
|
394
|
-
// }
|
|
395
|
-
|
|
401
|
+
codes = this.getResourceMetricCodes();
|
|
396
402
|
param = {
|
|
397
403
|
ciId: nodeIdsList,
|
|
398
404
|
codes: codes,
|
|
399
|
-
|
|
405
|
+
// 过滤掉不需要查询的
|
|
406
|
+
relationId: this.getEdges().map(function (edge) {
|
|
407
|
+
return {
|
|
408
|
+
ciId: edge.id,
|
|
409
|
+
operation: edge.operation
|
|
410
|
+
};
|
|
411
|
+
})
|
|
400
412
|
};
|
|
401
413
|
/**
|
|
402
414
|
* 链路属性适配
|
|
@@ -688,9 +700,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
688
700
|
var _this6 = this;
|
|
689
701
|
|
|
690
702
|
// 查询没有关联链路的连线组及对应子链路列表
|
|
691
|
-
var _this$topo$
|
|
692
|
-
links = _this$topo$
|
|
693
|
-
linkGroups = _this$topo$
|
|
703
|
+
var _this$topo$dataModel$ = this.topo.dataModel.getData(),
|
|
704
|
+
links = _this$topo$dataModel$.links,
|
|
705
|
+
linkGroups = _this$topo$dataModel$.linkGroups;
|
|
694
706
|
|
|
695
707
|
var getLinkUId = function getLinkUId(link) {
|
|
696
708
|
return [link.source, link.target].sort().join('-');
|
|
@@ -718,19 +730,24 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
718
730
|
calcType: 'sum'
|
|
719
731
|
}, {
|
|
720
732
|
code: 'bandwidth_utilization',
|
|
721
|
-
calcType: 'avg'
|
|
722
|
-
|
|
723
|
-
code: 'out_rate',
|
|
724
|
-
calcType: 'avg'
|
|
733
|
+
calcType: 'avg',
|
|
734
|
+
showWhenSameSource: true
|
|
725
735
|
}, {
|
|
726
736
|
code: 'out_bandwidth_utilization',
|
|
727
|
-
calcType: 'avg'
|
|
728
|
-
|
|
729
|
-
code: 'in_rate',
|
|
730
|
-
calcType: 'avg'
|
|
737
|
+
calcType: 'avg',
|
|
738
|
+
showWhenSameSource: true
|
|
731
739
|
}, {
|
|
732
740
|
code: 'in_bandwidth_utilization',
|
|
733
|
-
calcType: 'avg'
|
|
741
|
+
calcType: 'avg',
|
|
742
|
+
showWhenSameSource: true
|
|
743
|
+
}, {
|
|
744
|
+
code: 'out_rate',
|
|
745
|
+
calcType: 'avg',
|
|
746
|
+
showWhenSameSource: true
|
|
747
|
+
}, {
|
|
748
|
+
code: 'in_rate',
|
|
749
|
+
calcType: 'avg',
|
|
750
|
+
showWhenSameSource: true
|
|
734
751
|
}];
|
|
735
752
|
var connectTypePrefixMap = {
|
|
736
753
|
phy: 'physical_link.',
|
|
@@ -738,17 +755,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
738
755
|
};
|
|
739
756
|
var calcFnMap = {
|
|
740
757
|
sum: function sum(values) {
|
|
741
|
-
return values.reduce(function (
|
|
742
|
-
return total + parseInt(val, 10);
|
|
758
|
+
return values.reduce(function (total, val) {
|
|
759
|
+
return total + parseInt(val || 0, 10);
|
|
743
760
|
}, 0);
|
|
744
761
|
},
|
|
745
762
|
avg: function avg(values) {
|
|
746
|
-
return values.reduce(function (
|
|
747
|
-
return total + parseFloat(val, 10);
|
|
763
|
+
return values.reduce(function (total, val) {
|
|
764
|
+
return total + parseFloat(val || 0, 10);
|
|
748
765
|
}, 0) / values.length;
|
|
749
766
|
}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
var filterField = function filterField(item, linkChildren) {
|
|
770
|
+
var fieldConfig = metrics.find(function (m) {
|
|
771
|
+
return item.code.endsWith(m.code);
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
if (item.type !== 'metric' || !fieldConfig) {
|
|
775
|
+
return false;
|
|
776
|
+
} // 如果需要校验取值接口,如果取值接口为不同设备的接口,则不显示这四个指标
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
if (fieldConfig.showWhenSameSource) {
|
|
780
|
+
var sources = [];
|
|
781
|
+
linkChildren.forEach(function (link) {
|
|
782
|
+
if (sources.indexOf(link.source) !== -1) {
|
|
783
|
+
sources.push(link.source);
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
if (sources.length > 1) {
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return true;
|
|
750
793
|
}; // 计算标注和指标
|
|
751
794
|
|
|
795
|
+
|
|
752
796
|
var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
|
|
753
797
|
.filter(function (groupId) {
|
|
754
798
|
var linkChildren = groupMap[groupId];
|
|
@@ -762,14 +806,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
762
806
|
});
|
|
763
807
|
config = (0, _extends2["default"])({}, config, {
|
|
764
808
|
tags: config.tags.filter(function (item) {
|
|
765
|
-
return item
|
|
766
|
-
return item.code.endsWith(m.code);
|
|
767
|
-
});
|
|
809
|
+
return filterField(item, linkChildren);
|
|
768
810
|
}),
|
|
769
811
|
tips: config.tips.filter(function (item) {
|
|
770
|
-
return item
|
|
771
|
-
return item.code.endsWith(m.code);
|
|
772
|
-
});
|
|
812
|
+
return filterField(item, linkChildren);
|
|
773
813
|
})
|
|
774
814
|
}); // 构造数据,计算指标值
|
|
775
815
|
|
|
@@ -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 "2.15.
|
|
51
|
+
var version = typeof "2.15.26" === 'string' ? "2.15.26" : null;
|
|
52
52
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
53
53
|
/**
|
|
54
54
|
* 拓扑显示和编辑
|
|
@@ -43,9 +43,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
|
43
43
|
var _this = this;
|
|
44
44
|
|
|
45
45
|
var topo = this.topo;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
|
|
47
|
+
var _topo$dataModel$getDa = topo.dataModel.getData(),
|
|
48
|
+
links = _topo$dataModel$getDa.links,
|
|
49
|
+
linkGroups = _topo$dataModel$getDa.linkGroups;
|
|
50
|
+
|
|
49
51
|
var dataModel = this.topo.getDataModel(); // 1、如果连线可见,设置线宽
|
|
50
52
|
|
|
51
53
|
links.forEach(function (link) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riil-frontend/component-topology",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.26",
|
|
4
4
|
"description": "拓扑",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "build-scripts start",
|
|
@@ -110,6 +110,6 @@
|
|
|
110
110
|
"access": "public"
|
|
111
111
|
},
|
|
112
112
|
"license": "MIT",
|
|
113
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.
|
|
113
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.26/build/index.html",
|
|
114
114
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
|
115
115
|
}
|