@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
@@ -1,14 +1,12 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
5
4
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
6
|
-
import { keyBy } from 'lodash';
|
7
5
|
import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
8
|
-
import { queryCisByIds } from "../services";
|
9
6
|
import { isMonitoring } from "../utils/manageStatusUtil";
|
10
7
|
import AttributeFormatter from "./attributeFormatter";
|
11
8
|
import DictCache from "./cache/DictCache";
|
9
|
+
import { getNodesNameVisible as _getNodesNameVisible, updateNodesNameVisible as _updateNodesNameVisible } from "./utils/nodeNameVisibleUtil";
|
12
10
|
|
13
11
|
function isGraphField(item) {
|
14
12
|
return item.type === 'graph';
|
@@ -160,11 +158,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
160
158
|
;
|
161
159
|
|
162
160
|
_proto.getModelType = function getModelType(ci) {
|
163
|
-
|
164
|
-
return ci.attributes.support_templates;
|
165
|
-
}
|
166
|
-
|
167
|
-
return ci.ciType;
|
161
|
+
return this.topo.elementTagTipConfig.getModelType(ci);
|
168
162
|
}
|
169
163
|
/**
|
170
164
|
* 按链路类型获取对应的属性、指标配置
|
@@ -293,67 +287,21 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
293
287
|
});
|
294
288
|
});
|
295
289
|
return metricCodes;
|
296
|
-
}
|
297
|
-
/**
|
298
|
-
* 从配置获得节点名称是否显示
|
299
|
-
* @param {*} node
|
300
|
-
* @returns
|
301
|
-
*/
|
302
|
-
;
|
303
|
-
|
304
|
-
_proto.getNodeNameVisible = function getNodeNameVisible(node) {
|
305
|
-
// if (!this.topo.isViewMode()) {
|
306
|
-
// return true;
|
307
|
-
// }
|
308
|
-
var _this$getConfig3 = this.getConfig(),
|
309
|
-
nodeTag = _this$getConfig3.nodeTag;
|
310
|
-
|
311
|
-
var visible = true;
|
312
|
-
|
313
|
-
if (nodeTag) {
|
314
|
-
var isCustom = nodeTag.isCustom,
|
315
|
-
data = nodeTag.data;
|
316
|
-
var items = (isCustom ? data[node.ciType] : data) || [];
|
317
|
-
visible = !!items.filter(function (item) {
|
318
|
-
return item.type === 'graph';
|
319
|
-
}).length; // ipNode逻辑
|
320
|
-
|
321
|
-
if (isCustom && node.bindType === 'ip') {
|
322
|
-
visible = true;
|
323
|
-
}
|
324
|
-
}
|
325
|
-
|
326
|
-
return visible;
|
327
290
|
};
|
328
291
|
|
329
292
|
_proto.getNodesNameVisible = function getNodesNameVisible() {
|
330
|
-
|
331
|
-
|
332
|
-
var nodes = this.topo.dataModel.getNodes();
|
333
|
-
return nodes.map(function (node) {
|
334
|
-
// console.log("getNodesNameVisible", node);
|
335
|
-
return {
|
336
|
-
id: node.id,
|
337
|
-
visible: _this4.getNodeNameVisible(node)
|
338
|
-
};
|
339
|
-
});
|
293
|
+
return _getNodesNameVisible(this.topo);
|
340
294
|
}
|
341
295
|
/**
|
342
296
|
* 根据配置执行节点名称显示隐藏
|
297
|
+
* 1. 资源根据标注配置显示隐藏
|
298
|
+
* 2. 默认标注配置不勾选图片名称,图片节点名称不显示
|
299
|
+
* 3. 自定义标注配置,图片名称显示
|
343
300
|
*/
|
344
301
|
;
|
345
302
|
|
346
303
|
_proto.updateNodesNameVisible = function updateNodesNameVisible() {
|
347
|
-
|
348
|
-
this.getNodesNameVisible().forEach(function (_ref) {
|
349
|
-
var id = _ref.id,
|
350
|
-
visible = _ref.visible;
|
351
|
-
var ele = dm.getDataByTag(id); //
|
352
|
-
|
353
|
-
if (ele) {
|
354
|
-
ele.a('isShowName', visible);
|
355
|
-
}
|
356
|
-
});
|
304
|
+
_updateNodesNameVisible(this.topo);
|
357
305
|
}
|
358
306
|
/**
|
359
307
|
* 加载标注、悬浮框数据
|
@@ -457,7 +405,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
457
405
|
/*#__PURE__*/
|
458
406
|
function () {
|
459
407
|
var _translateRefAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(ciDatas) {
|
460
|
-
var
|
408
|
+
var _this4 = this;
|
461
409
|
|
462
410
|
var refIdMap, ciRefAttributeMap, refIds, refCiMap;
|
463
411
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
@@ -473,7 +421,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
473
421
|
attributeMap = ciData.attributeMap;
|
474
422
|
ciRefAttributeMap[id] = [];
|
475
423
|
|
476
|
-
var ciTypeMeta =
|
424
|
+
var ciTypeMeta = _this4.topo.ciTyeCache.getCiType(ciType);
|
477
425
|
|
478
426
|
if (ciTypeMeta) {
|
479
427
|
ciTypeMeta.attributes.filter(function (attributeMeta) {
|
@@ -653,14 +601,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
653
601
|
;
|
654
602
|
|
655
603
|
_proto.buildTagsTips = function buildTagsTips() {
|
656
|
-
var
|
604
|
+
var _this5 = this,
|
657
605
|
_this$extElementTagTi;
|
658
606
|
|
659
607
|
// 获取标注、悬浮框配置
|
660
608
|
var ciConfigs = this.getResourceTagTipConfig(); // console.log("buildTagsTips---ciConfigs", ciConfigs);
|
661
609
|
|
662
610
|
var ciTagsAndTips = ciConfigs.map(function (ciConfig) {
|
663
|
-
return
|
611
|
+
return _this5.buildElementTagsTips(ciConfig.id);
|
664
612
|
}); // console.log("ciTagsAndTips", ciTagsAndTips);
|
665
613
|
|
666
614
|
var extTagsAndTips = ((_this$extElementTagTi = this.extElementTagTipBuilder) === null || _this$extElementTagTi === void 0 ? void 0 : _this$extElementTagTi.getExtElementTagsAndTips()) || [];
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "11.0.
|
27
|
+
var version = typeof "11.0.12" === 'string' ? "11.0.12" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -9,12 +9,12 @@ import keyBy from 'lodash/keyBy';
|
|
9
9
|
* Ci类型属性、指标缓存
|
10
10
|
*/
|
11
11
|
|
12
|
-
var
|
13
|
-
function
|
12
|
+
var CiTypeCache = /*#__PURE__*/function () {
|
13
|
+
function CiTypeCache() {
|
14
14
|
this.cache = {};
|
15
15
|
}
|
16
16
|
|
17
|
-
var _proto =
|
17
|
+
var _proto = CiTypeCache.prototype;
|
18
18
|
|
19
19
|
_proto.getCiTypeMap = /*#__PURE__*/function () {
|
20
20
|
var _getCiTypeMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ciTypeIds) {
|
@@ -57,7 +57,7 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
57
57
|
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(ciTypeIds) {
|
58
58
|
var _this = this;
|
59
59
|
|
60
|
-
var unLoadCiTypeIds, ciTypeMetas
|
60
|
+
var unLoadCiTypeIds, ciTypeMetas;
|
61
61
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
62
62
|
while (1) {
|
63
63
|
switch (_context2.prev = _context2.next) {
|
@@ -70,36 +70,10 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
70
70
|
|
71
71
|
case 3:
|
72
72
|
ciTypeMetas = _context2.sent;
|
73
|
-
|
74
|
-
ciTypeMetas.forEach(function (ciTypeMeta) {
|
75
|
-
var attributes = (ciTypeMeta.attributes || []).map(function (attr) {
|
76
|
-
if (ciTypeMeta.code !== 'network_link') {
|
77
|
-
return attr;
|
78
|
-
} // 链路属性名称转化,临时方案
|
79
|
-
|
80
|
-
|
81
|
-
var name = {
|
82
|
-
source_id: '源端口',
|
83
|
-
destination_id: '目的端口'
|
84
|
-
}[attr.code] || attr.name;
|
85
|
-
var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
|
86
|
-
return _extends({}, attr, {
|
87
|
-
name: name,
|
88
|
-
userVisible: userVisible
|
89
|
-
});
|
90
|
-
});
|
91
|
-
var metrics = ciTypeMeta.metrics || [];
|
92
|
-
cache[ciTypeMeta.code] = _extends({}, ciTypeMeta, {
|
93
|
-
attributes: attributes,
|
94
|
-
attributeMap: keyBy(attributes, 'code'),
|
95
|
-
metrics: metrics,
|
96
|
-
metricMap: keyBy(metrics, 'code')
|
97
|
-
});
|
98
|
-
});
|
99
|
-
this.cache = cache;
|
73
|
+
this.addCiTypes(ciTypeMetas);
|
100
74
|
return _context2.abrupt("return", this.cache);
|
101
75
|
|
102
|
-
case
|
76
|
+
case 6:
|
103
77
|
case "end":
|
104
78
|
return _context2.stop();
|
105
79
|
}
|
@@ -114,15 +88,33 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
114
88
|
return load;
|
115
89
|
}();
|
116
90
|
|
91
|
+
_proto.addCiTypes = function addCiTypes(ciTypeMetas) {
|
92
|
+
var _this2 = this;
|
93
|
+
|
94
|
+
ciTypeMetas.forEach(function (ciTypeMeta) {
|
95
|
+
_this2.addCiType(ciTypeMeta);
|
96
|
+
});
|
97
|
+
};
|
98
|
+
|
99
|
+
_proto.addCiType = function addCiType(ciTypeMeta) {
|
100
|
+
var cache = _extends({}, this.cache);
|
101
|
+
|
102
|
+
var attributes = adapterNetworkLinkAttributes(ciTypeMeta, ciTypeMeta.attributes || []);
|
103
|
+
var metrics = ciTypeMeta.metrics || [];
|
104
|
+
cache[ciTypeMeta.code] = _extends({}, ciTypeMeta, {
|
105
|
+
attributes: attributes,
|
106
|
+
attributeMap: keyBy(attributes, 'code'),
|
107
|
+
metrics: metrics,
|
108
|
+
metricMap: keyBy(metrics, 'code')
|
109
|
+
});
|
110
|
+
this.cache = cache;
|
111
|
+
};
|
112
|
+
|
117
113
|
_proto.getCiType = function getCiType(typeCode) {
|
118
114
|
return this.cache[typeCode];
|
119
115
|
};
|
120
116
|
|
121
117
|
_proto.getCiTypeByCi = function getCiTypeByCi(ci) {
|
122
|
-
// if (ci.ciType === 'network_link') {
|
123
|
-
// const supportTemplates = link.attributes.support_templates;
|
124
|
-
// } else {
|
125
|
-
// }
|
126
118
|
return this.getCiType(ci.ciType);
|
127
119
|
};
|
128
120
|
|
@@ -136,14 +128,33 @@ var CiTyeCache = /*#__PURE__*/function () {
|
|
136
128
|
return ciType === null || ciType === void 0 ? void 0 : ciType.metricMap[metricCode];
|
137
129
|
};
|
138
130
|
|
139
|
-
_createClass(
|
131
|
+
_createClass(CiTypeCache, [{
|
140
132
|
key: "ciTypes",
|
141
133
|
get: function get() {
|
142
134
|
return this.cache;
|
143
135
|
}
|
144
136
|
}]);
|
145
137
|
|
146
|
-
return
|
138
|
+
return CiTypeCache;
|
147
139
|
}();
|
148
140
|
|
149
|
-
|
141
|
+
function adapterNetworkLinkAttributes(ciTypeMeta, attributes) {
|
142
|
+
return attributes.map(function (attr) {
|
143
|
+
if (ciTypeMeta.code !== 'network_link') {
|
144
|
+
return attr;
|
145
|
+
} // 链路属性名称转化,临时方案
|
146
|
+
|
147
|
+
|
148
|
+
var name = {
|
149
|
+
source_id: '源端口',
|
150
|
+
destination_id: '目的端口'
|
151
|
+
}[attr.code] || attr.name;
|
152
|
+
var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
|
153
|
+
return _extends({}, attr, {
|
154
|
+
name: name,
|
155
|
+
userVisible: userVisible
|
156
|
+
});
|
157
|
+
});
|
158
|
+
}
|
159
|
+
|
160
|
+
export default new CiTypeCache();
|
@@ -1,13 +1,18 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import
|
5
|
-
import { getMetricsByMonitorTemplateCodes } from "../../services/topo/tagtip";
|
4
|
+
import keyBy from 'lodash/keyBy';
|
6
5
|
import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
|
6
|
+
import { getLinkMtCodes, getMtCodeCiTypeMap, getNodeMtCodes } from "./utils";
|
7
|
+
import { getMetricsByMonitorTemplateCodes } from "../../services/topo/tagtip";
|
8
|
+
/**
|
9
|
+
* 标注、悬浮框字段模型
|
10
|
+
*/
|
7
11
|
|
8
12
|
var ElementTagTipConfig = /*#__PURE__*/function () {
|
9
13
|
function ElementTagTipConfig(topo) {
|
10
14
|
this.topoData = void 0;
|
15
|
+
this.modelMap = {};
|
11
16
|
this.mtCodes = void 0;
|
12
17
|
this.mtMetricsMap = {};
|
13
18
|
this.mtCiTypeMap = void 0;
|
@@ -23,54 +28,215 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
23
28
|
switch (_context.prev = _context.next) {
|
24
29
|
case 0:
|
25
30
|
this.topoData = topoData;
|
26
|
-
|
27
|
-
|
31
|
+
_context.next = 3;
|
32
|
+
return this.initNetworkLinkModel();
|
33
|
+
|
34
|
+
case 3:
|
35
|
+
this.mtCiTypeMap = getMtCodeCiTypeMap(topoData);
|
36
|
+
|
37
|
+
case 4:
|
38
|
+
case "end":
|
39
|
+
return _context.stop();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}, _callee, this);
|
43
|
+
}));
|
44
|
+
|
45
|
+
function init(_x) {
|
46
|
+
return _init.apply(this, arguments);
|
47
|
+
}
|
48
|
+
|
49
|
+
return init;
|
50
|
+
}();
|
51
|
+
|
52
|
+
_proto.initNetworkLinkModel = /*#__PURE__*/function () {
|
53
|
+
var _initNetworkLinkModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
54
|
+
var mtCodes;
|
55
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
56
|
+
while (1) {
|
57
|
+
switch (_context2.prev = _context2.next) {
|
58
|
+
case 0:
|
59
|
+
_context2.prev = 0;
|
60
|
+
mtCodes = ['m.critical_link', 'm.ethernet_link'];
|
28
61
|
|
29
|
-
if (!
|
30
|
-
|
62
|
+
if (!mtCodes.length) {
|
63
|
+
_context2.next = 6;
|
31
64
|
break;
|
32
65
|
}
|
33
66
|
|
34
|
-
|
35
|
-
return getMetricsByMonitorTemplateCodes(
|
67
|
+
_context2.next = 5;
|
68
|
+
return getMetricsByMonitorTemplateCodes(mtCodes);
|
36
69
|
|
37
|
-
case
|
38
|
-
this.mtMetricsMap =
|
70
|
+
case 5:
|
71
|
+
this.mtMetricsMap = _context2.sent;
|
39
72
|
|
40
|
-
case
|
41
|
-
|
73
|
+
case 6:
|
74
|
+
_context2.next = 11;
|
42
75
|
break;
|
43
76
|
|
44
|
-
case
|
45
|
-
|
46
|
-
|
47
|
-
rlog.error('查询监控模板指标失败',
|
77
|
+
case 8:
|
78
|
+
_context2.prev = 8;
|
79
|
+
_context2.t0 = _context2["catch"](0);
|
80
|
+
rlog.error('查询监控模板指标失败', _context2.t0);
|
48
81
|
|
49
|
-
case
|
50
|
-
this.mtCiTypeMap = getMtCodeCiTypeMap(topoData);
|
51
|
-
|
52
|
-
case 13:
|
82
|
+
case 11:
|
53
83
|
case "end":
|
54
|
-
return
|
84
|
+
return _context2.stop();
|
55
85
|
}
|
56
86
|
}
|
57
|
-
},
|
87
|
+
}, _callee2, this, [[0, 8]]);
|
58
88
|
}));
|
59
89
|
|
60
|
-
function
|
61
|
-
return
|
90
|
+
function initNetworkLinkModel() {
|
91
|
+
return _initNetworkLinkModel.apply(this, arguments);
|
62
92
|
}
|
63
93
|
|
64
|
-
return
|
65
|
-
}()
|
94
|
+
return initNetworkLinkModel;
|
95
|
+
}();
|
96
|
+
|
97
|
+
_proto.getModelTypes = function getModelTypes(cis) {
|
98
|
+
var _this = this;
|
99
|
+
|
100
|
+
var modelTypes = [];
|
101
|
+
cis.forEach(function (ci) {
|
102
|
+
var modelType = _this.getModelType(ci);
|
103
|
+
|
104
|
+
if (modelType && modelTypes.indexOf(modelType) < 0) {
|
105
|
+
modelTypes.push(modelType);
|
106
|
+
}
|
107
|
+
});
|
108
|
+
return modelTypes;
|
109
|
+
}
|
66
110
|
/**
|
67
|
-
*
|
111
|
+
* 查询模型
|
112
|
+
* @param {*} ci
|
113
|
+
* @returns
|
114
|
+
*/
|
115
|
+
// eslint-disable-next-line class-methods-use-this
|
116
|
+
;
|
117
|
+
|
118
|
+
_proto.getModelType = function getModelType(ci) {
|
119
|
+
if (ci.ciType === 'network_link') {
|
120
|
+
return ci.attributes.support_templates;
|
121
|
+
}
|
122
|
+
|
123
|
+
return ci.ciType;
|
124
|
+
};
|
125
|
+
|
126
|
+
_proto.getModelByType = function getModelByType(type) {
|
127
|
+
return this.getNetworkLinkModel(type) || this.topo.ciTyeCache.getCiType(type);
|
128
|
+
};
|
129
|
+
|
130
|
+
_proto.getNetworkLinkModel = function getNetworkLinkModel(type) {
|
131
|
+
var _this2 = this;
|
132
|
+
|
133
|
+
var baseInfo = [{
|
134
|
+
code: 'm.critical_link',
|
135
|
+
displayName: '关键链路',
|
136
|
+
typeCode: 'network_link'
|
137
|
+
}, {
|
138
|
+
code: 'm.ethernet_link',
|
139
|
+
displayName: '网络链路',
|
140
|
+
typeCode: 'network_link'
|
141
|
+
}].find(function (item) {
|
142
|
+
return item.code === type;
|
143
|
+
});
|
144
|
+
|
145
|
+
if (!baseInfo) {
|
146
|
+
return null;
|
147
|
+
}
|
148
|
+
|
149
|
+
var ciTypeModel = this.topo.ciTyeCache.getCiType('network_link');
|
150
|
+
var metrics = ciTypeModel.metrics.filter(function (m) {
|
151
|
+
return _this2.mtMetricsMap[type] && !!_this2.mtMetricsMap[type][m.code];
|
152
|
+
});
|
153
|
+
return _extends({}, this.topo.ciTyeCache.getCiType('network_link'), baseInfo, {
|
154
|
+
metrics: metrics,
|
155
|
+
metricMap: keyBy(metrics, 'code')
|
156
|
+
});
|
157
|
+
}
|
158
|
+
/**
|
159
|
+
* 获取链路标注悬浮框属性配置数据
|
160
|
+
* @returns
|
161
|
+
*/
|
162
|
+
;
|
163
|
+
|
164
|
+
_proto.getLinkConfigItems = function getLinkConfigItems() {
|
165
|
+
var _this3 = this;
|
166
|
+
|
167
|
+
var _this$topo$dataModel$ = this.topo.dataModel.getData(),
|
168
|
+
links = _this$topo$dataModel$.links;
|
169
|
+
|
170
|
+
var modelTypes = this.getModelTypes(links);
|
171
|
+
var list = modelTypes.map(this.getModelByType.bind(this)).map(function (item) {
|
172
|
+
return _this3.buildModels(item, 'link');
|
173
|
+
});
|
174
|
+
return list;
|
175
|
+
} // eslint-disable-next-line
|
176
|
+
;
|
177
|
+
|
178
|
+
_proto.buildModels = function buildModels(ciTypeObj, type) {
|
179
|
+
return {
|
180
|
+
id: ciTypeObj.code,
|
181
|
+
label: ciTypeObj.displayName,
|
182
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
183
|
+
list: this.buildModelFields(ciTypeObj, type)
|
184
|
+
};
|
185
|
+
}
|
186
|
+
/**
|
187
|
+
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
188
|
+
* @param {} ciTypeObj
|
189
|
+
* @returns
|
68
190
|
*/
|
191
|
+
// eslint-disable-next-line
|
69
192
|
;
|
70
193
|
|
194
|
+
_proto.buildModelFields = function buildModelFields(ciTypeObj, type) {
|
195
|
+
var custom = [];
|
196
|
+
|
197
|
+
if (type === 'node') {
|
198
|
+
custom.push.apply(custom, [{
|
199
|
+
id: 'graph:name',
|
200
|
+
code: 'name',
|
201
|
+
name: '图片名称',
|
202
|
+
type: 'custom'
|
203
|
+
}, {
|
204
|
+
id: 'ciType:display_name',
|
205
|
+
code: 'ciType',
|
206
|
+
name: '资源类型',
|
207
|
+
type: 'custom'
|
208
|
+
}]);
|
209
|
+
}
|
210
|
+
|
211
|
+
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
212
|
+
return !!attr.userVisible;
|
213
|
+
}).map(function (item) {
|
214
|
+
return {
|
215
|
+
type: 'attribute',
|
216
|
+
id: "attribute:" + item.code,
|
217
|
+
code: "attribute:" + item.code,
|
218
|
+
name: item.name,
|
219
|
+
typeName: '属性'
|
220
|
+
};
|
221
|
+
});
|
222
|
+
var metrics = ciTypeObj.metrics.map(function (item) {
|
223
|
+
return {
|
224
|
+
type: 'metric',
|
225
|
+
id: "metric:" + item.code,
|
226
|
+
code: "metric:" + item.code,
|
227
|
+
name: item.name,
|
228
|
+
typeName: '指标'
|
229
|
+
};
|
230
|
+
});
|
231
|
+
return [].concat(custom, attributes, metrics);
|
232
|
+
};
|
233
|
+
|
234
|
+
/**
|
235
|
+
* 获得节点字段配置项map
|
236
|
+
*/
|
71
237
|
_proto.getNodeFiedldMap = function getNodeFiedldMap() {
|
72
238
|
var mtCodes = getNodeMtCodes(this.topoData);
|
73
|
-
return this.
|
239
|
+
return this.getFiedldMapByMtCodes(mtCodes, 'node');
|
74
240
|
}
|
75
241
|
/**
|
76
242
|
* 获得节点字段配置项map
|
@@ -79,87 +245,60 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
79
245
|
|
80
246
|
_proto.getLinkFidldMap = function getLinkFidldMap() {
|
81
247
|
var mtCodes = getLinkMtCodes(this.topoData);
|
82
|
-
return this.
|
248
|
+
return this.getFiedldMapByMtCodes(mtCodes, 'link');
|
83
249
|
};
|
84
250
|
|
85
|
-
_proto.
|
86
|
-
var
|
87
|
-
var linkFidldMap = this.getLinkFidldMap();
|
88
|
-
var list = [{
|
89
|
-
id: 'm.critical_link',
|
90
|
-
label: '关键链路'
|
91
|
-
}, {
|
92
|
-
id: 'm.ethernet_link',
|
93
|
-
label: '网络链路'
|
94
|
-
}] // 只拓扑图上已有资源的监控模板
|
95
|
-
.filter(function (item) {
|
96
|
-
return mtCodes.includes(item.id);
|
97
|
-
}).map(function (t) {
|
98
|
-
return _extends({}, t, {
|
99
|
-
icon: '/img/model/networkLink.svg',
|
100
|
-
list: linkFidldMap[t.id] || []
|
101
|
-
});
|
102
|
-
});
|
103
|
-
return list; // return [
|
104
|
-
// { id: 'ax1', label: '本级平台', children: list, type: 'folder', disabled: true },
|
105
|
-
// {
|
106
|
-
// id: 'bb22', label: '下级平台', type: 'folder', children: [
|
107
|
-
// { id: 'xvdafa', label: '关键链路', icon: '/img/model/networkLink.svg' },
|
108
|
-
// ]
|
109
|
-
// },
|
110
|
-
// ]
|
111
|
-
};
|
112
|
-
|
113
|
-
_proto.getFiedldMapByType = function getFiedldMapByType(mtCodes, type) {
|
114
|
-
var _this = this;
|
251
|
+
_proto.getFiedldMapByMtCodes = function getFiedldMapByMtCodes(mtCodes, type) {
|
252
|
+
var _this4 = this;
|
115
253
|
|
116
254
|
var map = {};
|
117
255
|
mtCodes.forEach(function (mtCode) {
|
118
|
-
var ciType =
|
119
|
-
|
120
|
-
var attributes = _this.topo.ciTyeCache.getCiType(ciType).attributes.filter(function (attr) {
|
121
|
-
return !!attr.userVisible;
|
122
|
-
});
|
123
|
-
|
124
|
-
var metrics = _this.getMtMetricModels(mtCode);
|
125
|
-
|
126
|
-
var extItems = type === 'node' ? [{
|
127
|
-
lavel: '图片名称',
|
128
|
-
value: 'graph:name',
|
129
|
-
typeName: null
|
130
|
-
}, {
|
131
|
-
lavel: '资源类型',
|
132
|
-
value: 'ciType:name',
|
133
|
-
typeName: null
|
134
|
-
}] : [];
|
135
|
-
map[mtCode] = [].concat(extItems, attributes.map(function (item) {
|
136
|
-
return {
|
137
|
-
type: 'attribute',
|
138
|
-
id: "attribute:" + item.code,
|
139
|
-
code: "attribute:" + item.code,
|
140
|
-
name: item.name,
|
141
|
-
typeName: '属性'
|
142
|
-
};
|
143
|
-
}), metrics.map(function (item) {
|
144
|
-
return {
|
145
|
-
type: 'metric',
|
146
|
-
id: "metric:" + item.code,
|
147
|
-
code: "metric:" + item.code,
|
148
|
-
name: item.name,
|
149
|
-
typeName: '指标'
|
150
|
-
};
|
151
|
-
}));
|
256
|
+
var ciType = _this4.mtCiTypeMap[mtCode];
|
257
|
+
map[mtCode] = _this4.getFiedldMapByType(ciType, type, mtCode);
|
152
258
|
});
|
153
259
|
return map;
|
154
260
|
};
|
155
261
|
|
262
|
+
_proto.getFiedldMapByType = function getFiedldMapByType(ciType, type, mtCode) {
|
263
|
+
var attributes = this.topo.ciTyeCache.getCiType(ciType).attributes.filter(function (attr) {
|
264
|
+
return !!attr.userVisible;
|
265
|
+
});
|
266
|
+
var metrics = this.getMtMetricModels(mtCode);
|
267
|
+
var extItems = type === 'node' ? [{
|
268
|
+
lavel: '图片名称',
|
269
|
+
value: 'graph:name',
|
270
|
+
typeName: null
|
271
|
+
}, {
|
272
|
+
lavel: '资源类型',
|
273
|
+
value: 'ciType:name',
|
274
|
+
typeName: null
|
275
|
+
}] : [];
|
276
|
+
return [].concat(extItems, attributes.map(function (item) {
|
277
|
+
return {
|
278
|
+
type: 'attribute',
|
279
|
+
id: "attribute:" + item.code,
|
280
|
+
code: "attribute:" + item.code,
|
281
|
+
name: item.name,
|
282
|
+
typeName: '属性'
|
283
|
+
};
|
284
|
+
}), metrics.map(function (item) {
|
285
|
+
return {
|
286
|
+
type: 'metric',
|
287
|
+
id: "metric:" + item.code,
|
288
|
+
code: "metric:" + item.code,
|
289
|
+
name: item.name,
|
290
|
+
typeName: '指标'
|
291
|
+
};
|
292
|
+
}));
|
293
|
+
};
|
294
|
+
|
156
295
|
_proto.getMtMetricModels = function getMtMetricModels(mtCode) {
|
157
|
-
var
|
296
|
+
var _this5 = this;
|
158
297
|
|
159
298
|
var ciType = this.mtCiTypeMap[mtCode];
|
160
299
|
var ciTypeModel = this.topo.ciTyeCache.getCiType(ciType);
|
161
300
|
var metrics = ciTypeModel.metrics.filter(function (m) {
|
162
|
-
return
|
301
|
+
return _this5.mtMetricsMap[mtCode] && !!_this5.mtMetricsMap[mtCode][m.code];
|
163
302
|
});
|
164
303
|
return metrics;
|
165
304
|
};
|