@riil-frontend/component-topology 11.0.10 → 11.0.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.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +30 -30
- package/es/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +82 -0
- package/es/components/ModelAttrSelectDrawer/index.js +2 -2
- package/es/components/VerticalIconTab/VerticalIconTab.js +1 -1
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +6 -3
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +7 -4
- package/es/core/components/DisplaySettingDrawer/components/NodeAttrSettingDrawer.js +40 -0
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +96 -10
- package/es/core/components/TopoView/topoView.js +3 -0
- package/es/core/editor/components/BottomFloatTool/HelpIcon.js +92 -3
- package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +77 -0
- package/es/core/editor/hooks/useNewElementTheme.js +5 -1
- package/es/core/hooks/useCanvasThemeConfig.js +16 -4
- package/es/core/hooks/useTopoEdit.js +12 -8
- package/es/core/models/AttributeMetricDisplay.js +11 -63
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiTypeCache.js +50 -39
- package/es/core/models/tagstips/ElementTagTipConfig.js +234 -95
- package/es/core/models/utils/nodeNameVisibleUtil.js +116 -0
- package/es/utils/topoData.js +10 -2
- package/lib/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +97 -0
- package/lib/components/ModelAttrSelectDrawer/index.js +2 -2
- package/lib/components/VerticalIconTab/VerticalIconTab.js +2 -2
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +7 -3
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +8 -4
- package/lib/core/components/DisplaySettingDrawer/components/NodeAttrSettingDrawer.js +60 -0
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +97 -10
- package/lib/core/components/TopoView/topoView.js +4 -0
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +100 -3
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +77 -0
- package/lib/core/editor/hooks/useNewElementTheme.js +6 -1
- package/lib/core/hooks/useCanvasThemeConfig.js +16 -4
- package/lib/core/hooks/useTopoEdit.js +12 -8
- package/lib/core/models/AttributeMetricDisplay.js +12 -66
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiTypeCache.js +49 -39
- package/lib/core/models/tagstips/ElementTagTipConfig.js +235 -95
- package/lib/core/models/utils/nodeNameVisibleUtil.js +128 -0
- package/lib/utils/topoData.js +11 -2
- package/package.json +2 -2
@@ -0,0 +1,77 @@
|
|
1
|
+
.topoHelpIconBtn{
|
2
|
+
width: '100%';
|
3
|
+
height: '100%';
|
4
|
+
margin: 0;
|
5
|
+
padding: 0;
|
6
|
+
border: 0;
|
7
|
+
cursor: pointer;
|
8
|
+
margin-top: -1px;
|
9
|
+
margin-left: -1px;
|
10
|
+
}
|
11
|
+
:global{
|
12
|
+
#white.next-overlay-inner{
|
13
|
+
padding: 10px;
|
14
|
+
.next-balloon-close{
|
15
|
+
right: 10px;
|
16
|
+
top:8px
|
17
|
+
}
|
18
|
+
}
|
19
|
+
#dark.next-overlay-inner{
|
20
|
+
padding: 10px;
|
21
|
+
background-color: #063658;
|
22
|
+
border-color: #08A5F4;
|
23
|
+
.next-balloon-close{
|
24
|
+
right: 10px;
|
25
|
+
/* color:$color-text1-5; */
|
26
|
+
color:#fff;
|
27
|
+
top:8px
|
28
|
+
}
|
29
|
+
}
|
30
|
+
#dark.next-overlay-inner:after{
|
31
|
+
border-color: #08A5F4;
|
32
|
+
background: #063658;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
.topoHelpIcon{
|
36
|
+
width: 187px;
|
37
|
+
.whiteBox,.darkBox{
|
38
|
+
color:$color-text1-4;
|
39
|
+
font-size: 12px;
|
40
|
+
font-family: PingFangSC-Medium, PingFang SC;
|
41
|
+
width: 187px;
|
42
|
+
background: #FFFFFF;
|
43
|
+
.title{
|
44
|
+
line-height: 15px;
|
45
|
+
font-weight: 500;
|
46
|
+
}
|
47
|
+
.colse{
|
48
|
+
float: right;
|
49
|
+
cursor: pointer;
|
50
|
+
}
|
51
|
+
.conten{
|
52
|
+
color:$color-text1-6;
|
53
|
+
font-weight: 400;
|
54
|
+
line-height: 20px;
|
55
|
+
margin-top: 8px;
|
56
|
+
:global{
|
57
|
+
.next-row{
|
58
|
+
margin: 4px 0;
|
59
|
+
}
|
60
|
+
.next-col-8{
|
61
|
+
text-align: right;
|
62
|
+
color:$color-text1-4;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
}
|
68
|
+
.darkBox{
|
69
|
+
background: #063658;
|
70
|
+
color:$color-text1-5;
|
71
|
+
opacity: 0.85;
|
72
|
+
.conten{
|
73
|
+
color:$color-text1-5;
|
74
|
+
opacity: 0.85;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
@@ -11,6 +11,8 @@ var _themes = _interopRequireDefault(require("../config/themes"));
|
|
11
11
|
|
12
12
|
var _themeUtil = _interopRequireDefault(require("../utils/themeUtil"));
|
13
13
|
|
14
|
+
var _nodeNameVisibleUtil = require("../../models/utils/nodeNameVisibleUtil");
|
15
|
+
|
14
16
|
function useNewElementTheme(props) {
|
15
17
|
var topo = props.topo;
|
16
18
|
var topoModState = topo.store.useModelState('topoMod');
|
@@ -29,6 +31,7 @@ function useNewElementTheme(props) {
|
|
29
31
|
data = e.data;
|
30
32
|
|
31
33
|
if (kind === 'add') {
|
34
|
+
// 设置主题样式
|
32
35
|
var displayConfig = topo.store.getModelState('displayConfig');
|
33
36
|
var theme = displayConfig.canvasTheme || 'white';
|
34
37
|
|
@@ -41,7 +44,9 @@ function useNewElementTheme(props) {
|
|
41
44
|
}),
|
42
45
|
setElementTheme = _ThemeUtil.setElementTheme;
|
43
46
|
|
44
|
-
setElementTheme(data, themeConfig);
|
47
|
+
setElementTheme(data, themeConfig); // 临时放这里,新加入节点按配置显示隐藏名称
|
48
|
+
|
49
|
+
(0, _nodeNameVisibleUtil.setNewNodeNameVisible)(topo, data);
|
45
50
|
}
|
46
51
|
}
|
47
52
|
|
@@ -15,12 +15,16 @@ var themeMap = [{
|
|
15
15
|
color: '#FFFFFF',
|
16
16
|
editor: {
|
17
17
|
// 快捷帮助
|
18
|
-
helpIcon:
|
18
|
+
helpIcon: 'white'
|
19
19
|
}
|
20
20
|
}, {
|
21
21
|
name: 'lightblue',
|
22
22
|
label: '蓝色',
|
23
|
-
color: '#F9FBFF'
|
23
|
+
color: '#F9FBFF',
|
24
|
+
editor: {
|
25
|
+
// 快捷帮助
|
26
|
+
helpIcon: 'white'
|
27
|
+
}
|
24
28
|
}, // {
|
25
29
|
// name: 'yellow',
|
26
30
|
// label: '黄色',
|
@@ -34,11 +38,19 @@ var themeMap = [{
|
|
34
38
|
{
|
35
39
|
name: 'dark',
|
36
40
|
label: '深色',
|
37
|
-
color: '#031425'
|
41
|
+
color: '#031425',
|
42
|
+
editor: {
|
43
|
+
// 快捷帮助
|
44
|
+
helpIcon: 'dark'
|
45
|
+
}
|
38
46
|
}, {
|
39
47
|
name: 'poly',
|
40
48
|
label: 'Poly',
|
41
|
-
backgroundImage: '/img/topo/themes/poly.png'
|
49
|
+
backgroundImage: '/img/topo/themes/poly.png',
|
50
|
+
editor: {
|
51
|
+
// 快捷帮助
|
52
|
+
helpIcon: 'dark'
|
53
|
+
}
|
42
54
|
}].reduce(function (map, item) {
|
43
55
|
var _extends2;
|
44
56
|
|
@@ -263,7 +263,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
263
263
|
content: "是否仅删除区域或将区域包含的内容一同删除?",
|
264
264
|
//footer:()=>{return <><Button type="primary" onClick={doDeleteOnlyGroup}>仅删除区域</Button><Button type="primary" onClick={doDeleteOnlyGroup}>确定</Button></>},
|
265
265
|
okProps: {
|
266
|
-
children: "仅删除区域"
|
266
|
+
children: "仅删除区域",
|
267
|
+
type: "normal"
|
267
268
|
},
|
268
269
|
cancelProps: {
|
269
270
|
children: "全部删除"
|
@@ -318,27 +319,30 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
318
319
|
});
|
319
320
|
|
320
321
|
function doDeleteOnlyGroup() {
|
321
|
-
// console.log("仅删除区域", topo.view.topoClient, data);
|
322
|
+
topo.historyManager.beginTransaction(); // console.log("仅删除区域", topo.view.topoClient, data);
|
323
|
+
|
322
324
|
var children = (0, _htElementUtils.getGroupChildren)(group);
|
323
325
|
children.map(function (child) {
|
324
|
-
child.setParent(null);
|
325
|
-
var
|
326
|
-
|
327
|
-
|
326
|
+
child.setParent(null); // var viewRect = topo.getGraphView().getViewRect();
|
327
|
+
// var nodeRect = child.getRect();
|
328
|
+
// child.setPosition(
|
329
|
+
// viewRect.x + nodeRect.width + 2,
|
330
|
+
// viewRect.y + nodeRect.height + 4
|
331
|
+
// ); // 解决集群从区域内移出时,连线位置未更新的问题
|
328
332
|
|
329
333
|
setTimeout(function () {
|
330
334
|
child.iv();
|
331
335
|
topo.historyManager.endTransaction();
|
332
336
|
}, 50);
|
333
337
|
});
|
334
|
-
topo.view.topoClient.deleteGroup(data);
|
338
|
+
topo.view.topoClient.deleteGroup(data);
|
339
|
+
topo.historyManager.endTransaction(); // console.log("仅删除区域", children, group);
|
335
340
|
}
|
336
341
|
|
337
342
|
function doDelete() {
|
338
343
|
topo.historyManager.beginTransaction(); // FIXME 。如果命中其他的动态条件,则立即显示
|
339
344
|
|
340
345
|
topo.view.topoClient.deleteGroup(data);
|
341
|
-
topo.historyManager.endTransaction();
|
342
346
|
}
|
343
347
|
};
|
344
348
|
|
@@ -11,22 +11,18 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
13
|
|
14
|
-
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
15
|
-
|
16
14
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
17
15
|
|
18
|
-
var _lodash = require("lodash");
|
19
|
-
|
20
16
|
var _ResourceInfoDisplay = require("../../constants/ResourceInfoDisplay");
|
21
17
|
|
22
|
-
var _services = require("../services");
|
23
|
-
|
24
18
|
var _manageStatusUtil = require("../utils/manageStatusUtil");
|
25
19
|
|
26
20
|
var _attributeFormatter = _interopRequireDefault(require("./attributeFormatter"));
|
27
21
|
|
28
22
|
var _DictCache = _interopRequireDefault(require("./cache/DictCache"));
|
29
23
|
|
24
|
+
var _nodeNameVisibleUtil = require("./utils/nodeNameVisibleUtil");
|
25
|
+
|
30
26
|
function isGraphField(item) {
|
31
27
|
return item.type === 'graph';
|
32
28
|
}
|
@@ -177,11 +173,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
177
173
|
;
|
178
174
|
|
179
175
|
_proto.getModelType = function getModelType(ci) {
|
180
|
-
|
181
|
-
return ci.attributes.support_templates;
|
182
|
-
}
|
183
|
-
|
184
|
-
return ci.ciType;
|
176
|
+
return this.topo.elementTagTipConfig.getModelType(ci);
|
185
177
|
}
|
186
178
|
/**
|
187
179
|
* 按链路类型获取对应的属性、指标配置
|
@@ -310,67 +302,21 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
310
302
|
});
|
311
303
|
});
|
312
304
|
return metricCodes;
|
313
|
-
}
|
314
|
-
/**
|
315
|
-
* 从配置获得节点名称是否显示
|
316
|
-
* @param {*} node
|
317
|
-
* @returns
|
318
|
-
*/
|
319
|
-
;
|
320
|
-
|
321
|
-
_proto.getNodeNameVisible = function getNodeNameVisible(node) {
|
322
|
-
// if (!this.topo.isViewMode()) {
|
323
|
-
// return true;
|
324
|
-
// }
|
325
|
-
var _this$getConfig3 = this.getConfig(),
|
326
|
-
nodeTag = _this$getConfig3.nodeTag;
|
327
|
-
|
328
|
-
var visible = true;
|
329
|
-
|
330
|
-
if (nodeTag) {
|
331
|
-
var isCustom = nodeTag.isCustom,
|
332
|
-
data = nodeTag.data;
|
333
|
-
var items = (isCustom ? data[node.ciType] : data) || [];
|
334
|
-
visible = !!items.filter(function (item) {
|
335
|
-
return item.type === 'graph';
|
336
|
-
}).length; // ipNode逻辑
|
337
|
-
|
338
|
-
if (isCustom && node.bindType === 'ip') {
|
339
|
-
visible = true;
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
return visible;
|
344
305
|
};
|
345
306
|
|
346
307
|
_proto.getNodesNameVisible = function getNodesNameVisible() {
|
347
|
-
|
348
|
-
|
349
|
-
var nodes = this.topo.dataModel.getNodes();
|
350
|
-
return nodes.map(function (node) {
|
351
|
-
// console.log("getNodesNameVisible", node);
|
352
|
-
return {
|
353
|
-
id: node.id,
|
354
|
-
visible: _this4.getNodeNameVisible(node)
|
355
|
-
};
|
356
|
-
});
|
308
|
+
return (0, _nodeNameVisibleUtil.getNodesNameVisible)(this.topo);
|
357
309
|
}
|
358
310
|
/**
|
359
311
|
* 根据配置执行节点名称显示隐藏
|
312
|
+
* 1. 资源根据标注配置显示隐藏
|
313
|
+
* 2. 默认标注配置不勾选图片名称,图片节点名称不显示
|
314
|
+
* 3. 自定义标注配置,图片名称显示
|
360
315
|
*/
|
361
316
|
;
|
362
317
|
|
363
318
|
_proto.updateNodesNameVisible = function updateNodesNameVisible() {
|
364
|
-
|
365
|
-
this.getNodesNameVisible().forEach(function (_ref) {
|
366
|
-
var id = _ref.id,
|
367
|
-
visible = _ref.visible;
|
368
|
-
var ele = dm.getDataByTag(id); //
|
369
|
-
|
370
|
-
if (ele) {
|
371
|
-
ele.a('isShowName', visible);
|
372
|
-
}
|
373
|
-
});
|
319
|
+
(0, _nodeNameVisibleUtil.updateNodesNameVisible)(this.topo);
|
374
320
|
}
|
375
321
|
/**
|
376
322
|
* 加载标注、悬浮框数据
|
@@ -474,7 +420,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
474
420
|
/*#__PURE__*/
|
475
421
|
function () {
|
476
422
|
var _translateRefAttribute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(ciDatas) {
|
477
|
-
var
|
423
|
+
var _this4 = this;
|
478
424
|
|
479
425
|
var refIdMap, ciRefAttributeMap, refIds, refCiMap;
|
480
426
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
@@ -490,7 +436,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
490
436
|
attributeMap = ciData.attributeMap;
|
491
437
|
ciRefAttributeMap[id] = [];
|
492
438
|
|
493
|
-
var ciTypeMeta =
|
439
|
+
var ciTypeMeta = _this4.topo.ciTyeCache.getCiType(ciType);
|
494
440
|
|
495
441
|
if (ciTypeMeta) {
|
496
442
|
ciTypeMeta.attributes.filter(function (attributeMeta) {
|
@@ -667,14 +613,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
667
613
|
;
|
668
614
|
|
669
615
|
_proto.buildTagsTips = function buildTagsTips() {
|
670
|
-
var
|
616
|
+
var _this5 = this,
|
671
617
|
_this$extElementTagTi;
|
672
618
|
|
673
619
|
// 获取标注、悬浮框配置
|
674
620
|
var ciConfigs = this.getResourceTagTipConfig(); // console.log("buildTagsTips---ciConfigs", ciConfigs);
|
675
621
|
|
676
622
|
var ciTagsAndTips = ciConfigs.map(function (ciConfig) {
|
677
|
-
return
|
623
|
+
return _this5.buildElementTagsTips(ciConfig.id);
|
678
624
|
}); // console.log("ciTagsAndTips", ciTagsAndTips);
|
679
625
|
|
680
626
|
var extTagsAndTips = ((_this$extElementTagTi = this.extElementTagTipBuilder) === null || _this$extElementTagTi === void 0 ? void 0 : _this$extElementTagTi.getExtElementTagsAndTips()) || [];
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "11.0.
|
59
|
+
var version = typeof "11.0.12" === 'string' ? "11.0.12" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -22,12 +22,12 @@ var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
22
22
|
/**
|
23
23
|
* Ci类型属性、指标缓存
|
24
24
|
*/
|
25
|
-
var
|
26
|
-
function
|
25
|
+
var CiTypeCache = /*#__PURE__*/function () {
|
26
|
+
function CiTypeCache() {
|
27
27
|
this.cache = {};
|
28
28
|
}
|
29
29
|
|
30
|
-
var _proto =
|
30
|
+
var _proto = CiTypeCache.prototype;
|
31
31
|
|
32
32
|
_proto.getCiTypeMap = /*#__PURE__*/function () {
|
33
33
|
var _getCiTypeMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ciTypeIds) {
|
@@ -71,7 +71,7 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
71
71
|
var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(ciTypeIds) {
|
72
72
|
var _this = this;
|
73
73
|
|
74
|
-
var unLoadCiTypeIds, ciTypeMetas
|
74
|
+
var unLoadCiTypeIds, ciTypeMetas;
|
75
75
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
76
76
|
while (1) {
|
77
77
|
switch (_context2.prev = _context2.next) {
|
@@ -84,36 +84,10 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
84
84
|
|
85
85
|
case 3:
|
86
86
|
ciTypeMetas = _context2.sent;
|
87
|
-
|
88
|
-
ciTypeMetas.forEach(function (ciTypeMeta) {
|
89
|
-
var attributes = (ciTypeMeta.attributes || []).map(function (attr) {
|
90
|
-
if (ciTypeMeta.code !== 'network_link') {
|
91
|
-
return attr;
|
92
|
-
} // 链路属性名称转化,临时方案
|
93
|
-
|
94
|
-
|
95
|
-
var name = {
|
96
|
-
source_id: '源端口',
|
97
|
-
destination_id: '目的端口'
|
98
|
-
}[attr.code] || attr.name;
|
99
|
-
var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
|
100
|
-
return (0, _extends2["default"])({}, attr, {
|
101
|
-
name: name,
|
102
|
-
userVisible: userVisible
|
103
|
-
});
|
104
|
-
});
|
105
|
-
var metrics = ciTypeMeta.metrics || [];
|
106
|
-
cache[ciTypeMeta.code] = (0, _extends2["default"])({}, ciTypeMeta, {
|
107
|
-
attributes: attributes,
|
108
|
-
attributeMap: (0, _keyBy["default"])(attributes, 'code'),
|
109
|
-
metrics: metrics,
|
110
|
-
metricMap: (0, _keyBy["default"])(metrics, 'code')
|
111
|
-
});
|
112
|
-
});
|
113
|
-
this.cache = cache;
|
87
|
+
this.addCiTypes(ciTypeMetas);
|
114
88
|
return _context2.abrupt("return", this.cache);
|
115
89
|
|
116
|
-
case
|
90
|
+
case 6:
|
117
91
|
case "end":
|
118
92
|
return _context2.stop();
|
119
93
|
}
|
@@ -128,15 +102,32 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
128
102
|
return load;
|
129
103
|
}();
|
130
104
|
|
105
|
+
_proto.addCiTypes = function addCiTypes(ciTypeMetas) {
|
106
|
+
var _this2 = this;
|
107
|
+
|
108
|
+
ciTypeMetas.forEach(function (ciTypeMeta) {
|
109
|
+
_this2.addCiType(ciTypeMeta);
|
110
|
+
});
|
111
|
+
};
|
112
|
+
|
113
|
+
_proto.addCiType = function addCiType(ciTypeMeta) {
|
114
|
+
var cache = (0, _extends2["default"])({}, this.cache);
|
115
|
+
var attributes = adapterNetworkLinkAttributes(ciTypeMeta, ciTypeMeta.attributes || []);
|
116
|
+
var metrics = ciTypeMeta.metrics || [];
|
117
|
+
cache[ciTypeMeta.code] = (0, _extends2["default"])({}, ciTypeMeta, {
|
118
|
+
attributes: attributes,
|
119
|
+
attributeMap: (0, _keyBy["default"])(attributes, 'code'),
|
120
|
+
metrics: metrics,
|
121
|
+
metricMap: (0, _keyBy["default"])(metrics, 'code')
|
122
|
+
});
|
123
|
+
this.cache = cache;
|
124
|
+
};
|
125
|
+
|
131
126
|
_proto.getCiType = function getCiType(typeCode) {
|
132
127
|
return this.cache[typeCode];
|
133
128
|
};
|
134
129
|
|
135
130
|
_proto.getCiTypeByCi = function getCiTypeByCi(ci) {
|
136
|
-
// if (ci.ciType === 'network_link') {
|
137
|
-
// const supportTemplates = link.attributes.support_templates;
|
138
|
-
// } else {
|
139
|
-
// }
|
140
131
|
return this.getCiType(ci.ciType);
|
141
132
|
};
|
142
133
|
|
@@ -150,15 +141,34 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
150
141
|
return ciType === null || ciType === void 0 ? void 0 : ciType.metricMap[metricCode];
|
151
142
|
};
|
152
143
|
|
153
|
-
(0, _createClass2["default"])(
|
144
|
+
(0, _createClass2["default"])(CiTypeCache, [{
|
154
145
|
key: "ciTypes",
|
155
146
|
get: function get() {
|
156
147
|
return this.cache;
|
157
148
|
}
|
158
149
|
}]);
|
159
|
-
return
|
150
|
+
return CiTypeCache;
|
160
151
|
}();
|
161
152
|
|
162
|
-
|
153
|
+
function adapterNetworkLinkAttributes(ciTypeMeta, attributes) {
|
154
|
+
return attributes.map(function (attr) {
|
155
|
+
if (ciTypeMeta.code !== 'network_link') {
|
156
|
+
return attr;
|
157
|
+
} // 链路属性名称转化,临时方案
|
158
|
+
|
159
|
+
|
160
|
+
var name = {
|
161
|
+
source_id: '源端口',
|
162
|
+
destination_id: '目的端口'
|
163
|
+
}[attr.code] || attr.name;
|
164
|
+
var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
|
165
|
+
return (0, _extends2["default"])({}, attr, {
|
166
|
+
name: name,
|
167
|
+
userVisible: userVisible
|
168
|
+
});
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
var _default = new CiTypeCache();
|
163
173
|
|
164
174
|
exports["default"] = _default;
|