@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
@@ -11,15 +11,21 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
11
11
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
13
|
|
14
|
+
var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
15
|
+
|
16
|
+
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/lib/rlog"));
|
17
|
+
|
14
18
|
var _utils = require("./utils");
|
15
19
|
|
16
20
|
var _tagtip = require("../../services/topo/tagtip");
|
17
21
|
|
18
|
-
|
19
|
-
|
22
|
+
/**
|
23
|
+
* 标注、悬浮框字段模型
|
24
|
+
*/
|
20
25
|
var ElementTagTipConfig = /*#__PURE__*/function () {
|
21
26
|
function ElementTagTipConfig(topo) {
|
22
27
|
this.topoData = void 0;
|
28
|
+
this.modelMap = {};
|
23
29
|
this.mtCodes = void 0;
|
24
30
|
this.mtMetricsMap = {};
|
25
31
|
this.mtCiTypeMap = void 0;
|
@@ -35,55 +41,216 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
35
41
|
switch (_context.prev = _context.next) {
|
36
42
|
case 0:
|
37
43
|
this.topoData = topoData;
|
38
|
-
|
39
|
-
|
44
|
+
_context.next = 3;
|
45
|
+
return this.initNetworkLinkModel();
|
46
|
+
|
47
|
+
case 3:
|
48
|
+
this.mtCiTypeMap = (0, _utils.getMtCodeCiTypeMap)(topoData);
|
49
|
+
|
50
|
+
case 4:
|
51
|
+
case "end":
|
52
|
+
return _context.stop();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}, _callee, this);
|
56
|
+
}));
|
40
57
|
|
41
|
-
|
42
|
-
|
58
|
+
function init(_x) {
|
59
|
+
return _init.apply(this, arguments);
|
60
|
+
}
|
61
|
+
|
62
|
+
return init;
|
63
|
+
}();
|
64
|
+
|
65
|
+
_proto.initNetworkLinkModel = /*#__PURE__*/function () {
|
66
|
+
var _initNetworkLinkModel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
67
|
+
var mtCodes;
|
68
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
69
|
+
while (1) {
|
70
|
+
switch (_context2.prev = _context2.next) {
|
71
|
+
case 0:
|
72
|
+
_context2.prev = 0;
|
73
|
+
mtCodes = ['m.critical_link', 'm.ethernet_link'];
|
74
|
+
|
75
|
+
if (!mtCodes.length) {
|
76
|
+
_context2.next = 6;
|
43
77
|
break;
|
44
78
|
}
|
45
79
|
|
46
|
-
|
47
|
-
return (0, _tagtip.getMetricsByMonitorTemplateCodes)(
|
80
|
+
_context2.next = 5;
|
81
|
+
return (0, _tagtip.getMetricsByMonitorTemplateCodes)(mtCodes);
|
48
82
|
|
49
|
-
case
|
50
|
-
this.mtMetricsMap =
|
83
|
+
case 5:
|
84
|
+
this.mtMetricsMap = _context2.sent;
|
51
85
|
|
52
|
-
case
|
53
|
-
|
86
|
+
case 6:
|
87
|
+
_context2.next = 11;
|
54
88
|
break;
|
55
89
|
|
56
|
-
case
|
57
|
-
|
58
|
-
|
90
|
+
case 8:
|
91
|
+
_context2.prev = 8;
|
92
|
+
_context2.t0 = _context2["catch"](0);
|
59
93
|
|
60
|
-
_rlog["default"].error('查询监控模板指标失败',
|
94
|
+
_rlog["default"].error('查询监控模板指标失败', _context2.t0);
|
61
95
|
|
62
|
-
case
|
63
|
-
this.mtCiTypeMap = (0, _utils.getMtCodeCiTypeMap)(topoData);
|
64
|
-
|
65
|
-
case 13:
|
96
|
+
case 11:
|
66
97
|
case "end":
|
67
|
-
return
|
98
|
+
return _context2.stop();
|
68
99
|
}
|
69
100
|
}
|
70
|
-
},
|
101
|
+
}, _callee2, this, [[0, 8]]);
|
71
102
|
}));
|
72
103
|
|
73
|
-
function
|
74
|
-
return
|
104
|
+
function initNetworkLinkModel() {
|
105
|
+
return _initNetworkLinkModel.apply(this, arguments);
|
75
106
|
}
|
76
107
|
|
77
|
-
return
|
78
|
-
}()
|
108
|
+
return initNetworkLinkModel;
|
109
|
+
}();
|
110
|
+
|
111
|
+
_proto.getModelTypes = function getModelTypes(cis) {
|
112
|
+
var _this = this;
|
113
|
+
|
114
|
+
var modelTypes = [];
|
115
|
+
cis.forEach(function (ci) {
|
116
|
+
var modelType = _this.getModelType(ci);
|
117
|
+
|
118
|
+
if (modelType && modelTypes.indexOf(modelType) < 0) {
|
119
|
+
modelTypes.push(modelType);
|
120
|
+
}
|
121
|
+
});
|
122
|
+
return modelTypes;
|
123
|
+
}
|
79
124
|
/**
|
80
|
-
*
|
125
|
+
* 查询模型
|
126
|
+
* @param {*} ci
|
127
|
+
* @returns
|
81
128
|
*/
|
129
|
+
// eslint-disable-next-line class-methods-use-this
|
82
130
|
;
|
83
131
|
|
132
|
+
_proto.getModelType = function getModelType(ci) {
|
133
|
+
if (ci.ciType === 'network_link') {
|
134
|
+
return ci.attributes.support_templates;
|
135
|
+
}
|
136
|
+
|
137
|
+
return ci.ciType;
|
138
|
+
};
|
139
|
+
|
140
|
+
_proto.getModelByType = function getModelByType(type) {
|
141
|
+
return this.getNetworkLinkModel(type) || this.topo.ciTyeCache.getCiType(type);
|
142
|
+
};
|
143
|
+
|
144
|
+
_proto.getNetworkLinkModel = function getNetworkLinkModel(type) {
|
145
|
+
var _this2 = this;
|
146
|
+
|
147
|
+
var baseInfo = [{
|
148
|
+
code: 'm.critical_link',
|
149
|
+
displayName: '关键链路',
|
150
|
+
typeCode: 'network_link'
|
151
|
+
}, {
|
152
|
+
code: 'm.ethernet_link',
|
153
|
+
displayName: '网络链路',
|
154
|
+
typeCode: 'network_link'
|
155
|
+
}].find(function (item) {
|
156
|
+
return item.code === type;
|
157
|
+
});
|
158
|
+
|
159
|
+
if (!baseInfo) {
|
160
|
+
return null;
|
161
|
+
}
|
162
|
+
|
163
|
+
var ciTypeModel = this.topo.ciTyeCache.getCiType('network_link');
|
164
|
+
var metrics = ciTypeModel.metrics.filter(function (m) {
|
165
|
+
return _this2.mtMetricsMap[type] && !!_this2.mtMetricsMap[type][m.code];
|
166
|
+
});
|
167
|
+
return (0, _extends2["default"])({}, this.topo.ciTyeCache.getCiType('network_link'), baseInfo, {
|
168
|
+
metrics: metrics,
|
169
|
+
metricMap: (0, _keyBy["default"])(metrics, 'code')
|
170
|
+
});
|
171
|
+
}
|
172
|
+
/**
|
173
|
+
* 获取链路标注悬浮框属性配置数据
|
174
|
+
* @returns
|
175
|
+
*/
|
176
|
+
;
|
177
|
+
|
178
|
+
_proto.getLinkConfigItems = function getLinkConfigItems() {
|
179
|
+
var _this3 = this;
|
180
|
+
|
181
|
+
var _this$topo$dataModel$ = this.topo.dataModel.getData(),
|
182
|
+
links = _this$topo$dataModel$.links;
|
183
|
+
|
184
|
+
var modelTypes = this.getModelTypes(links);
|
185
|
+
var list = modelTypes.map(this.getModelByType.bind(this)).map(function (item) {
|
186
|
+
return _this3.buildModels(item, 'link');
|
187
|
+
});
|
188
|
+
return list;
|
189
|
+
} // eslint-disable-next-line
|
190
|
+
;
|
191
|
+
|
192
|
+
_proto.buildModels = function buildModels(ciTypeObj, type) {
|
193
|
+
return {
|
194
|
+
id: ciTypeObj.code,
|
195
|
+
label: ciTypeObj.displayName,
|
196
|
+
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
197
|
+
list: this.buildModelFields(ciTypeObj, type)
|
198
|
+
};
|
199
|
+
}
|
200
|
+
/**
|
201
|
+
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
202
|
+
* @param {} ciTypeObj
|
203
|
+
* @returns
|
204
|
+
*/
|
205
|
+
// eslint-disable-next-line
|
206
|
+
;
|
207
|
+
|
208
|
+
_proto.buildModelFields = function buildModelFields(ciTypeObj, type) {
|
209
|
+
var custom = [];
|
210
|
+
|
211
|
+
if (type === 'node') {
|
212
|
+
custom.push.apply(custom, [{
|
213
|
+
id: 'graph:name',
|
214
|
+
code: 'name',
|
215
|
+
name: '图片名称',
|
216
|
+
type: 'custom'
|
217
|
+
}, {
|
218
|
+
id: 'ciType:display_name',
|
219
|
+
code: 'ciType',
|
220
|
+
name: '资源类型',
|
221
|
+
type: 'custom'
|
222
|
+
}]);
|
223
|
+
}
|
224
|
+
|
225
|
+
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
226
|
+
return !!attr.userVisible;
|
227
|
+
}).map(function (item) {
|
228
|
+
return {
|
229
|
+
type: 'attribute',
|
230
|
+
id: "attribute:" + item.code,
|
231
|
+
code: "attribute:" + item.code,
|
232
|
+
name: item.name,
|
233
|
+
typeName: '属性'
|
234
|
+
};
|
235
|
+
});
|
236
|
+
var metrics = ciTypeObj.metrics.map(function (item) {
|
237
|
+
return {
|
238
|
+
type: 'metric',
|
239
|
+
id: "metric:" + item.code,
|
240
|
+
code: "metric:" + item.code,
|
241
|
+
name: item.name,
|
242
|
+
typeName: '指标'
|
243
|
+
};
|
244
|
+
});
|
245
|
+
return [].concat(custom, attributes, metrics);
|
246
|
+
};
|
247
|
+
|
248
|
+
/**
|
249
|
+
* 获得节点字段配置项map
|
250
|
+
*/
|
84
251
|
_proto.getNodeFiedldMap = function getNodeFiedldMap() {
|
85
252
|
var mtCodes = (0, _utils.getNodeMtCodes)(this.topoData);
|
86
|
-
return this.
|
253
|
+
return this.getFiedldMapByMtCodes(mtCodes, 'node');
|
87
254
|
}
|
88
255
|
/**
|
89
256
|
* 获得节点字段配置项map
|
@@ -92,87 +259,60 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
92
259
|
|
93
260
|
_proto.getLinkFidldMap = function getLinkFidldMap() {
|
94
261
|
var mtCodes = (0, _utils.getLinkMtCodes)(this.topoData);
|
95
|
-
return this.
|
96
|
-
};
|
97
|
-
|
98
|
-
_proto.getLinkConfigItems = function getLinkConfigItems() {
|
99
|
-
var mtCodes = (0, _utils.getLinkMtCodes)(this.topoData);
|
100
|
-
var linkFidldMap = this.getLinkFidldMap();
|
101
|
-
var list = [{
|
102
|
-
id: 'm.critical_link',
|
103
|
-
label: '关键链路'
|
104
|
-
}, {
|
105
|
-
id: 'm.ethernet_link',
|
106
|
-
label: '网络链路'
|
107
|
-
}] // 只拓扑图上已有资源的监控模板
|
108
|
-
.filter(function (item) {
|
109
|
-
return mtCodes.includes(item.id);
|
110
|
-
}).map(function (t) {
|
111
|
-
return (0, _extends2["default"])({}, t, {
|
112
|
-
icon: '/img/model/networkLink.svg',
|
113
|
-
list: linkFidldMap[t.id] || []
|
114
|
-
});
|
115
|
-
});
|
116
|
-
return list; // return [
|
117
|
-
// { id: 'ax1', label: '本级平台', children: list, type: 'folder', disabled: true },
|
118
|
-
// {
|
119
|
-
// id: 'bb22', label: '下级平台', type: 'folder', children: [
|
120
|
-
// { id: 'xvdafa', label: '关键链路', icon: '/img/model/networkLink.svg' },
|
121
|
-
// ]
|
122
|
-
// },
|
123
|
-
// ]
|
262
|
+
return this.getFiedldMapByMtCodes(mtCodes, 'link');
|
124
263
|
};
|
125
264
|
|
126
|
-
_proto.
|
127
|
-
var
|
265
|
+
_proto.getFiedldMapByMtCodes = function getFiedldMapByMtCodes(mtCodes, type) {
|
266
|
+
var _this4 = this;
|
128
267
|
|
129
268
|
var map = {};
|
130
269
|
mtCodes.forEach(function (mtCode) {
|
131
|
-
var ciType =
|
132
|
-
|
133
|
-
var attributes = _this.topo.ciTyeCache.getCiType(ciType).attributes.filter(function (attr) {
|
134
|
-
return !!attr.userVisible;
|
135
|
-
});
|
136
|
-
|
137
|
-
var metrics = _this.getMtMetricModels(mtCode);
|
138
|
-
|
139
|
-
var extItems = type === 'node' ? [{
|
140
|
-
lavel: '图片名称',
|
141
|
-
value: 'graph:name',
|
142
|
-
typeName: null
|
143
|
-
}, {
|
144
|
-
lavel: '资源类型',
|
145
|
-
value: 'ciType:name',
|
146
|
-
typeName: null
|
147
|
-
}] : [];
|
148
|
-
map[mtCode] = [].concat(extItems, attributes.map(function (item) {
|
149
|
-
return {
|
150
|
-
type: 'attribute',
|
151
|
-
id: "attribute:" + item.code,
|
152
|
-
code: "attribute:" + item.code,
|
153
|
-
name: item.name,
|
154
|
-
typeName: '属性'
|
155
|
-
};
|
156
|
-
}), metrics.map(function (item) {
|
157
|
-
return {
|
158
|
-
type: 'metric',
|
159
|
-
id: "metric:" + item.code,
|
160
|
-
code: "metric:" + item.code,
|
161
|
-
name: item.name,
|
162
|
-
typeName: '指标'
|
163
|
-
};
|
164
|
-
}));
|
270
|
+
var ciType = _this4.mtCiTypeMap[mtCode];
|
271
|
+
map[mtCode] = _this4.getFiedldMapByType(ciType, type, mtCode);
|
165
272
|
});
|
166
273
|
return map;
|
167
274
|
};
|
168
275
|
|
276
|
+
_proto.getFiedldMapByType = function getFiedldMapByType(ciType, type, mtCode) {
|
277
|
+
var attributes = this.topo.ciTyeCache.getCiType(ciType).attributes.filter(function (attr) {
|
278
|
+
return !!attr.userVisible;
|
279
|
+
});
|
280
|
+
var metrics = this.getMtMetricModels(mtCode);
|
281
|
+
var extItems = type === 'node' ? [{
|
282
|
+
lavel: '图片名称',
|
283
|
+
value: 'graph:name',
|
284
|
+
typeName: null
|
285
|
+
}, {
|
286
|
+
lavel: '资源类型',
|
287
|
+
value: 'ciType:name',
|
288
|
+
typeName: null
|
289
|
+
}] : [];
|
290
|
+
return [].concat(extItems, attributes.map(function (item) {
|
291
|
+
return {
|
292
|
+
type: 'attribute',
|
293
|
+
id: "attribute:" + item.code,
|
294
|
+
code: "attribute:" + item.code,
|
295
|
+
name: item.name,
|
296
|
+
typeName: '属性'
|
297
|
+
};
|
298
|
+
}), metrics.map(function (item) {
|
299
|
+
return {
|
300
|
+
type: 'metric',
|
301
|
+
id: "metric:" + item.code,
|
302
|
+
code: "metric:" + item.code,
|
303
|
+
name: item.name,
|
304
|
+
typeName: '指标'
|
305
|
+
};
|
306
|
+
}));
|
307
|
+
};
|
308
|
+
|
169
309
|
_proto.getMtMetricModels = function getMtMetricModels(mtCode) {
|
170
|
-
var
|
310
|
+
var _this5 = this;
|
171
311
|
|
172
312
|
var ciType = this.mtCiTypeMap[mtCode];
|
173
313
|
var ciTypeModel = this.topo.ciTyeCache.getCiType(ciType);
|
174
314
|
var metrics = ciTypeModel.metrics.filter(function (m) {
|
175
|
-
return
|
315
|
+
return _this5.mtMetricsMap[mtCode] && !!_this5.mtMetricsMap[mtCode][m.code];
|
176
316
|
});
|
177
317
|
return metrics;
|
178
318
|
};
|
@@ -0,0 +1,128 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.getNodeNameVisible = getNodeNameVisible;
|
5
|
+
exports.getNodesNameVisible = getNodesNameVisible;
|
6
|
+
exports.setNewNodeNameVisible = setNewNodeNameVisible;
|
7
|
+
exports.updateNodesNameVisible = updateNodesNameVisible;
|
8
|
+
|
9
|
+
var _htElementUtils = require("../../../utils/htElementUtils");
|
10
|
+
|
11
|
+
/**
|
12
|
+
* 根据配置执行节点名称显示隐藏
|
13
|
+
* 1. 资源根据标注配置显示隐藏
|
14
|
+
* 2. 默认标注配置不勾选图片名称,图片节点名称不显示
|
15
|
+
* 3. 自定义标注配置,图片名称显示
|
16
|
+
*/
|
17
|
+
function updateNodesNameVisible(topo) {
|
18
|
+
getNodesNameVisible(topo).forEach(function (_ref) {
|
19
|
+
var htNode = _ref.htNode,
|
20
|
+
visible = _ref.visible;
|
21
|
+
var prevVisible = htNode.a('isShowName');
|
22
|
+
|
23
|
+
if (prevVisible !== visible) {
|
24
|
+
htNode.a('isShowName', visible);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* 新加入节点按配置显示隐藏名称
|
30
|
+
* @param {*} topo
|
31
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
function setNewNodeNameVisible(topo, element) {
|
35
|
+
if ((0, _htElementUtils.isNode)(element)) {
|
36
|
+
var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
|
37
|
+
nodeTag = _topo$store$getModelS.nodeTag;
|
38
|
+
|
39
|
+
var nameVisible = getNodeNameVisible({
|
40
|
+
node: element,
|
41
|
+
topo: topo,
|
42
|
+
nodeTag: nodeTag
|
43
|
+
});
|
44
|
+
element.a('isShowName', nameVisible);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function getNodesNameVisible(topo) {
|
49
|
+
var _topo$store$getModelS2 = topo.store.getModelState('displayConfig'),
|
50
|
+
nodeTag = _topo$store$getModelS2.nodeTag;
|
51
|
+
|
52
|
+
var dm = topo.getDataModel();
|
53
|
+
var htNodes = (0, _htElementUtils.getNodes)(dm);
|
54
|
+
return htNodes.map(function (htNode) {
|
55
|
+
var node = topo.dataModel.getDataById(htNode.getTag());
|
56
|
+
return {
|
57
|
+
htNode: htNode,
|
58
|
+
node: node,
|
59
|
+
visible: getNodeNameVisible({
|
60
|
+
node: node,
|
61
|
+
topo: topo,
|
62
|
+
nodeTag: nodeTag
|
63
|
+
})
|
64
|
+
};
|
65
|
+
});
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* 从配置获得资源节点名称是否显示
|
69
|
+
* @param {*} node
|
70
|
+
* @returns
|
71
|
+
*/
|
72
|
+
|
73
|
+
|
74
|
+
function getNodeNameVisible(_ref2) {
|
75
|
+
var node = _ref2.node,
|
76
|
+
topo = _ref2.topo,
|
77
|
+
nodeTag = _ref2.nodeTag;
|
78
|
+
|
79
|
+
if (node !== null && node !== void 0 && node.ciType) {
|
80
|
+
return getCiNodeNameVisible({
|
81
|
+
node: node,
|
82
|
+
nodeTag: nodeTag
|
83
|
+
});
|
84
|
+
} else {
|
85
|
+
return getCommonNodeNameVisible({
|
86
|
+
node: node,
|
87
|
+
nodeTag: nodeTag
|
88
|
+
});
|
89
|
+
}
|
90
|
+
} // 非CI节点
|
91
|
+
|
92
|
+
|
93
|
+
function getCommonNodeNameVisible(_ref3) {
|
94
|
+
var node = _ref3.node,
|
95
|
+
nodeTag = _ref3.nodeTag;
|
96
|
+
var visible = true;
|
97
|
+
|
98
|
+
if (nodeTag) {
|
99
|
+
var isCustom = nodeTag.isCustom,
|
100
|
+
data = nodeTag.data;
|
101
|
+
|
102
|
+
if (!isCustom) {
|
103
|
+
var items = data || [];
|
104
|
+
visible = !!items.filter(function (item) {
|
105
|
+
return item.type === 'graph';
|
106
|
+
}).length;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
return visible;
|
111
|
+
}
|
112
|
+
|
113
|
+
function getCiNodeNameVisible(_ref4) {
|
114
|
+
var node = _ref4.node,
|
115
|
+
nodeTag = _ref4.nodeTag;
|
116
|
+
var visible = true;
|
117
|
+
|
118
|
+
if (nodeTag) {
|
119
|
+
var isCustom = nodeTag.isCustom,
|
120
|
+
data = nodeTag.data;
|
121
|
+
var items = (isCustom ? data[node.ciType] : data) || [];
|
122
|
+
visible = !!items.filter(function (item) {
|
123
|
+
return item.type === 'graph';
|
124
|
+
}).length;
|
125
|
+
}
|
126
|
+
|
127
|
+
return visible;
|
128
|
+
}
|
package/lib/utils/topoData.js
CHANGED
@@ -40,6 +40,8 @@ var _htElementUtils = require("./htElementUtils");
|
|
40
40
|
|
41
41
|
var _v140UpgradeSerializeNodeImageSize = _interopRequireDefault(require("../core/upgrade/v140UpgradeSerializeNodeImageSize"));
|
42
42
|
|
43
|
+
var _nodeNameVisibleUtil = require("../core/models/utils/nodeNameVisibleUtil");
|
44
|
+
|
43
45
|
var _excluded = ["extraConfig"];
|
44
46
|
|
45
47
|
/**
|
@@ -101,13 +103,20 @@ var tfNode = function tfNode(topoEngine, node) {
|
|
101
103
|
*/
|
102
104
|
|
103
105
|
|
104
|
-
function updateNodeInfo(
|
106
|
+
function updateNodeInfo(topo, topoData) {
|
107
|
+
var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
|
108
|
+
nodeTag = _topo$store$getModelS.nodeTag;
|
109
|
+
|
105
110
|
return (0, _extends2["default"])({}, topoData, {
|
106
111
|
nodes: topoData.nodes.map(function (node) {
|
107
112
|
var attributes = node.attributes;
|
108
113
|
return (0, _extends2["default"])({}, node, {
|
109
114
|
ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.ipv4_address) || null,
|
110
|
-
isShowName:
|
115
|
+
isShowName: (0, _nodeNameVisibleUtil.getNodeNameVisible)({
|
116
|
+
node: node,
|
117
|
+
topo: topo,
|
118
|
+
nodeTag: nodeTag
|
119
|
+
})
|
111
120
|
});
|
112
121
|
})
|
113
122
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "11.0.
|
3
|
+
"version": "11.0.12",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -118,6 +118,6 @@
|
|
118
118
|
"access": "public"
|
119
119
|
},
|
120
120
|
"license": "MIT",
|
121
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.
|
121
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.12/build/index.html",
|
122
122
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
123
123
|
}
|