@riil-frontend/component-topology 11.0.11 → 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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +11 -11
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +14 -5
- package/es/core/editor/components/BottomFloatTool/HelpIcon.js +2 -6
- package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +3 -0
- package/es/core/models/AttributeMetricDisplay.js +1 -5
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiTypeCache.js +50 -39
- package/es/core/models/tagstips/ElementTagTipConfig.js +198 -65
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +14 -5
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +2 -6
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +3 -0
- package/lib/core/models/AttributeMetricDisplay.js +1 -5
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiTypeCache.js +49 -39
- package/lib/core/models/tagstips/ElementTagTipConfig.js +199 -65
- package/package.json +2 -2
@@ -6,11 +6,10 @@ import { getCiTypesFromCiElements } from "../../../utils/topoData";
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
export function getNodeModels(topo) {
|
9
|
-
var data = topo.store.getModelState('topoMod').data;
|
10
|
-
var ciTypeMap = topo.ciTyeCache.ciTypes;
|
11
9
|
return getNodeModSet();
|
12
10
|
|
13
11
|
function getNodeModSet() {
|
12
|
+
var data = topo.store.getModelState('topoMod').data;
|
14
13
|
var ciTypes = getCiTypesFromCiElements(data.nodes);
|
15
14
|
return getMods(ciTypes);
|
16
15
|
}
|
@@ -22,6 +21,7 @@ export function getNodeModels(topo) {
|
|
22
21
|
|
23
22
|
|
24
23
|
function getMods(ciTypeCodes) {
|
24
|
+
var ciTypeMap = topo.ciTyeCache.ciTypes;
|
25
25
|
return Object.keys(ciTypeMap).filter(function (item) {
|
26
26
|
return ciTypeCodes.includes(item);
|
27
27
|
}).map(function (key) {
|
@@ -29,11 +29,20 @@ export function getNodeModels(topo) {
|
|
29
29
|
return {
|
30
30
|
id: ciTypeObj.code,
|
31
31
|
label: ciTypeObj.displayName,
|
32
|
-
icon: ciTypeObj.icon,
|
33
|
-
list:
|
32
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
33
|
+
list: buildModelFields(ciTypeObj, 'node')
|
34
34
|
};
|
35
35
|
});
|
36
36
|
}
|
37
|
+
|
38
|
+
function buildModels(ciTypeObj) {
|
39
|
+
return {
|
40
|
+
id: ciTypeObj.code,
|
41
|
+
label: ciTypeObj.displayName,
|
42
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
43
|
+
list: buildModelFields(ciTypeObj, 'node')
|
44
|
+
};
|
45
|
+
}
|
37
46
|
/**
|
38
47
|
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
39
48
|
* @param {} ciTypeObj
|
@@ -41,7 +50,7 @@ export function getNodeModels(topo) {
|
|
41
50
|
*/
|
42
51
|
|
43
52
|
|
44
|
-
function
|
53
|
+
function buildModelFields(ciTypeObj, type) {
|
45
54
|
var custom = [];
|
46
55
|
|
47
56
|
if (type === 'node') {
|
@@ -48,11 +48,7 @@ function HelpIcon(props) {
|
|
48
48
|
}
|
49
49
|
}, /*#__PURE__*/React.createElement("img", {
|
50
50
|
src: "/img/topo/editor/bottomFloatTool/default.svg",
|
51
|
-
alt: ""
|
52
|
-
style: {
|
53
|
-
width: '15px',
|
54
|
-
height: '15px'
|
55
|
-
}
|
51
|
+
alt: ""
|
56
52
|
})),
|
57
53
|
closable: true,
|
58
54
|
visible: helpBoxIsShow,
|
@@ -89,7 +85,7 @@ function HelpIcon(props) {
|
|
89
85
|
span: "8"
|
90
86
|
}, "ctrl/\u2318+b")), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
|
91
87
|
span: "16"
|
92
|
-
}, "\u9009\u62E9-\u62D6\
|
88
|
+
}, "\u9009\u62E9-\u62D6\u52A8"), /*#__PURE__*/React.createElement(Col, {
|
93
89
|
span: "8"
|
94
90
|
}, "\u7A7A\u683C")), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
|
95
91
|
span: "16"
|
@@ -158,11 +158,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
158
158
|
;
|
159
159
|
|
160
160
|
_proto.getModelType = function getModelType(ci) {
|
161
|
-
|
162
|
-
return ci.attributes.support_templates;
|
163
|
-
}
|
164
|
-
|
165
|
-
return ci.ciType;
|
161
|
+
return this.topo.elementTagTipConfig.getModelType(ci);
|
166
162
|
}
|
167
163
|
/**
|
168
164
|
* 按链路类型获取对应的属性、指标配置
|
@@ -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,51 +28,212 @@ 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
|
+
}
|
28
48
|
|
29
|
-
|
30
|
-
|
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'];
|
61
|
+
|
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
|
68
114
|
*/
|
115
|
+
// eslint-disable-next-line class-methods-use-this
|
69
116
|
;
|
70
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
|
190
|
+
*/
|
191
|
+
// eslint-disable-next-line
|
192
|
+
;
|
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
239
|
return this.getFiedldMapByMtCodes(mtCodes, 'node');
|
@@ -80,48 +246,15 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
80
246
|
_proto.getLinkFidldMap = function getLinkFidldMap() {
|
81
247
|
var mtCodes = getLinkMtCodes(this.topoData);
|
82
248
|
return this.getFiedldMapByMtCodes(mtCodes, 'link');
|
83
|
-
}
|
84
|
-
/**
|
85
|
-
* 获取链路标注悬浮框属性配置数据
|
86
|
-
* @returns
|
87
|
-
*/
|
88
|
-
;
|
89
|
-
|
90
|
-
_proto.getLinkConfigItems = function getLinkConfigItems() {
|
91
|
-
var mtCodes = getLinkMtCodes(this.topoData);
|
92
|
-
var linkFidldMap = this.getLinkFidldMap();
|
93
|
-
var list = [{
|
94
|
-
id: 'm.critical_link',
|
95
|
-
label: '关键链路'
|
96
|
-
}, {
|
97
|
-
id: 'm.ethernet_link',
|
98
|
-
label: '网络链路'
|
99
|
-
}] // 只拓扑图上已有资源的监控模板
|
100
|
-
.filter(function (item) {
|
101
|
-
return mtCodes.includes(item.id);
|
102
|
-
}).map(function (t) {
|
103
|
-
return _extends({}, t, {
|
104
|
-
icon: '/img/model/networkLink.svg',
|
105
|
-
list: linkFidldMap[t.id] || []
|
106
|
-
});
|
107
|
-
});
|
108
|
-
return list; // return [
|
109
|
-
// { id: 'ax1', label: '本级平台', children: list, type: 'folder', disabled: true },
|
110
|
-
// {
|
111
|
-
// id: 'bb22', label: '下级平台', type: 'folder', children: [
|
112
|
-
// { id: 'xvdafa', label: '关键链路', icon: '/img/model/networkLink.svg' },
|
113
|
-
// ]
|
114
|
-
// },
|
115
|
-
// ]
|
116
249
|
};
|
117
250
|
|
118
251
|
_proto.getFiedldMapByMtCodes = function getFiedldMapByMtCodes(mtCodes, type) {
|
119
|
-
var
|
252
|
+
var _this4 = this;
|
120
253
|
|
121
254
|
var map = {};
|
122
255
|
mtCodes.forEach(function (mtCode) {
|
123
|
-
var ciType =
|
124
|
-
map[mtCode] =
|
256
|
+
var ciType = _this4.mtCiTypeMap[mtCode];
|
257
|
+
map[mtCode] = _this4.getFiedldMapByType(ciType, type, mtCode);
|
125
258
|
});
|
126
259
|
return map;
|
127
260
|
};
|
@@ -160,12 +293,12 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
160
293
|
};
|
161
294
|
|
162
295
|
_proto.getMtMetricModels = function getMtMetricModels(mtCode) {
|
163
|
-
var
|
296
|
+
var _this5 = this;
|
164
297
|
|
165
298
|
var ciType = this.mtCiTypeMap[mtCode];
|
166
299
|
var ciTypeModel = this.topo.ciTyeCache.getCiType(ciType);
|
167
300
|
var metrics = ciTypeModel.metrics.filter(function (m) {
|
168
|
-
return
|
301
|
+
return _this5.mtMetricsMap[mtCode] && !!_this5.mtMetricsMap[mtCode][m.code];
|
169
302
|
});
|
170
303
|
return metrics;
|
171
304
|
};
|
@@ -12,11 +12,10 @@ var _topoData = require("../../../utils/topoData");
|
|
12
12
|
* @returns
|
13
13
|
*/
|
14
14
|
function getNodeModels(topo) {
|
15
|
-
var data = topo.store.getModelState('topoMod').data;
|
16
|
-
var ciTypeMap = topo.ciTyeCache.ciTypes;
|
17
15
|
return getNodeModSet();
|
18
16
|
|
19
17
|
function getNodeModSet() {
|
18
|
+
var data = topo.store.getModelState('topoMod').data;
|
20
19
|
var ciTypes = (0, _topoData.getCiTypesFromCiElements)(data.nodes);
|
21
20
|
return getMods(ciTypes);
|
22
21
|
}
|
@@ -28,6 +27,7 @@ function getNodeModels(topo) {
|
|
28
27
|
|
29
28
|
|
30
29
|
function getMods(ciTypeCodes) {
|
30
|
+
var ciTypeMap = topo.ciTyeCache.ciTypes;
|
31
31
|
return Object.keys(ciTypeMap).filter(function (item) {
|
32
32
|
return ciTypeCodes.includes(item);
|
33
33
|
}).map(function (key) {
|
@@ -35,11 +35,20 @@ function getNodeModels(topo) {
|
|
35
35
|
return {
|
36
36
|
id: ciTypeObj.code,
|
37
37
|
label: ciTypeObj.displayName,
|
38
|
-
icon: ciTypeObj.icon,
|
39
|
-
list:
|
38
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
39
|
+
list: buildModelFields(ciTypeObj, 'node')
|
40
40
|
};
|
41
41
|
});
|
42
42
|
}
|
43
|
+
|
44
|
+
function buildModels(ciTypeObj) {
|
45
|
+
return {
|
46
|
+
id: ciTypeObj.code,
|
47
|
+
label: ciTypeObj.displayName,
|
48
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
49
|
+
list: buildModelFields(ciTypeObj, 'node')
|
50
|
+
};
|
51
|
+
}
|
43
52
|
/**
|
44
53
|
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
45
54
|
* @param {} ciTypeObj
|
@@ -47,7 +56,7 @@ function getNodeModels(topo) {
|
|
47
56
|
*/
|
48
57
|
|
49
58
|
|
50
|
-
function
|
59
|
+
function buildModelFields(ciTypeObj, type) {
|
51
60
|
var custom = [];
|
52
61
|
|
53
62
|
if (type === 'node') {
|
@@ -63,11 +63,7 @@ function HelpIcon(props) {
|
|
63
63
|
}
|
64
64
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
65
65
|
src: "/img/topo/editor/bottomFloatTool/default.svg",
|
66
|
-
alt: ""
|
67
|
-
style: {
|
68
|
-
width: '15px',
|
69
|
-
height: '15px'
|
70
|
-
}
|
66
|
+
alt: ""
|
71
67
|
})),
|
72
68
|
closable: true,
|
73
69
|
visible: helpBoxIsShow,
|
@@ -104,7 +100,7 @@ function HelpIcon(props) {
|
|
104
100
|
span: "8"
|
105
101
|
}, "ctrl/\u2318+b")), /*#__PURE__*/_react["default"].createElement(Row, null, /*#__PURE__*/_react["default"].createElement(Col, {
|
106
102
|
span: "16"
|
107
|
-
}, "\u9009\u62E9-\u62D6\
|
103
|
+
}, "\u9009\u62E9-\u62D6\u52A8"), /*#__PURE__*/_react["default"].createElement(Col, {
|
108
104
|
span: "8"
|
109
105
|
}, "\u7A7A\u683C")), /*#__PURE__*/_react["default"].createElement(Row, null, /*#__PURE__*/_react["default"].createElement(Col, {
|
110
106
|
span: "16"
|
@@ -173,11 +173,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
173
173
|
;
|
174
174
|
|
175
175
|
_proto.getModelType = function getModelType(ci) {
|
176
|
-
|
177
|
-
return ci.attributes.support_templates;
|
178
|
-
}
|
179
|
-
|
180
|
-
return ci.ciType;
|
176
|
+
return this.topo.elementTagTipConfig.getModelType(ci);
|
181
177
|
}
|
182
178
|
/**
|
183
179
|
* 按链路类型获取对应的属性、指标配置
|
@@ -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
|
* 拓扑显示和编辑
|