@riil-frontend/component-topology 2.14.2-alpha.2 → 2.14.2-alpha.6
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 +22 -22
- package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/345/261/236/346/200/247/345/222/214/346/214/207/346/240/207.md +1 -1
- package/demo/API//346/250/241/345/236/213.md +29 -0
- package/es/components/BatchAttrMetric/constant.js +4 -0
- package/es/components/BatchAttrMetric/index.js +8 -10
- package/es/components/BatchAttrMetric/setting.js +6 -4
- package/es/components/BatchAttrMetric/utils.js +39 -32
- package/es/constants/ResourceTypeLimit.js +1 -1
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
- package/es/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
- package/es/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +30 -9
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +123 -0
- package/es/core/editor/components/EditorPlugin.js +4 -3
- package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
- package/es/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
- package/es/core/models/AttributeMetricDisplay.js +181 -66
- package/es/core/models/TopoApp.js +18 -16
- package/es/core/models/attributeFormatter/index.js +33 -8
- package/es/core/models/common/Alarm.js +45 -31
- package/es/core/models/utils/linkUtils.js +14 -2
- package/es/core/utils/exportData.js +33 -0
- package/es/core/utils/linkPollingAttributesAdapter.js +3 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +264 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
- package/es/core/viewer/components/plugins/BaseInfo/index.js +127 -0
- package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
- package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -1
- package/es/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +5 -0
- package/es/getStoreModels.js +3 -1
- package/es/hooks/useAlarm.js +1 -1
- package/es/hooks/usePolling.js +2 -1
- package/es/models/topoAlarm.js +43 -17
- package/es/models/topoBaseInfoOverview.js +43 -0
- package/es/models/topoBizMod.js +0 -70
- package/es/style.js +8 -7
- package/es/utils/topoData.js +266 -155
- package/lib/components/BatchAttrMetric/constant.js +4 -0
- package/lib/components/BatchAttrMetric/index.js +8 -10
- package/lib/components/BatchAttrMetric/setting.js +8 -5
- package/lib/components/BatchAttrMetric/utils.js +39 -35
- package/lib/constants/ResourceTypeLimit.js +1 -1
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
- package/lib/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +32 -8
- package/lib/core/{editor/components → components}/ResourceViewAttributeSetting/Setting.js +77 -71
- package/lib/core/editor/components/EditorPlugin.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
- package/lib/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
- package/lib/core/models/AttributeMetricDisplay.js +181 -66
- package/lib/core/models/TopoApp.js +18 -17
- package/lib/core/models/attributeFormatter/index.js +34 -8
- package/lib/core/models/common/Alarm.js +46 -33
- package/lib/core/models/utils/linkUtils.js +12 -2
- package/lib/core/utils/exportData.js +44 -0
- package/lib/core/utils/linkPollingAttributesAdapter.js +10 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +284 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +146 -0
- package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
- package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
- package/lib/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +6 -0
- package/lib/getStoreModels.js +4 -1
- package/lib/hooks/useAlarm.js +1 -1
- package/lib/hooks/usePolling.js +2 -1
- package/lib/models/topoAlarm.js +43 -17
- package/lib/models/topoBaseInfoOverview.js +55 -0
- package/lib/models/topoBizMod.js +0 -70
- package/lib/style.js +8 -7
- package/lib/utils/topoData.js +267 -151
- package/package.json +2 -2
- package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -57
- package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +0 -114
- package/es/core/models/attrAndMetric.js +0 -131
- package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -73
- package/lib/core/models/attrAndMetric.js +0 -148
package/es/utils/topoData.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import rlog from
|
|
3
|
-
import { isAvailableArray } from
|
|
4
|
-
import _ from
|
|
2
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
3
|
+
import { isAvailableArray } from "@riil-frontend/utils";
|
|
4
|
+
import _ from "lodash";
|
|
5
5
|
import topoPermissionUtil from "./topoPermissionUtil";
|
|
6
6
|
import buildViewerContextMenu from "../core/viewer/contextmenu/buildContextmenu";
|
|
7
7
|
import buildEditorContextMenu from "../core/editor/contextmenu/buildContextmenu";
|
|
8
8
|
import mergeContextmenu from "../core/common/contextmenu/mergeContextmenu";
|
|
9
9
|
import { getEditorIcons } from "../core/common/icons/icon";
|
|
10
|
+
/**
|
|
11
|
+
* 链路code集合
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var LINK_CI_CODE_ARR = ["network_link"];
|
|
10
16
|
/**
|
|
11
17
|
* 查找数组中对应key的值为value的元素并返回,只查找第一个符合的元素
|
|
12
18
|
* @param {Array} arr 数组
|
|
@@ -73,10 +79,10 @@ export function formatGroup(group) {
|
|
|
73
79
|
// 是否显示容器标题
|
|
74
80
|
showBorder: true,
|
|
75
81
|
// 是否显示容器边框
|
|
76
|
-
borderType:
|
|
82
|
+
borderType: "dot",
|
|
77
83
|
// 容器边框线性
|
|
78
84
|
showExpanded: true
|
|
79
|
-
}, typeof group.styles ===
|
|
85
|
+
}, typeof group.styles === "string" ? JSON.parse(group.styles) : group.styles || {})
|
|
80
86
|
});
|
|
81
87
|
} // 格式化容器
|
|
82
88
|
|
|
@@ -106,12 +112,12 @@ var tfNode = function tfNode(engine, node) {
|
|
|
106
112
|
var attributes = nodeAttributesAdapter(node.attributes); // rlog.debug('tfNode---------',node);
|
|
107
113
|
|
|
108
114
|
var result = _extends({
|
|
109
|
-
ipAddress: attributes.ipAddress || null
|
|
110
|
-
macAddress: attributes.macAddress || null
|
|
115
|
+
ipAddress: attributes.ipAddress || null
|
|
111
116
|
}, node, {
|
|
112
|
-
operation: node.hasOwnProperty(
|
|
117
|
+
operation: node.hasOwnProperty("operation") ? node.operation : null,
|
|
113
118
|
metrics: [],
|
|
114
|
-
attributes: []
|
|
119
|
+
attributes: [],
|
|
120
|
+
isShowName: engine.attributeMetricDisplay.getNodeNameVisible(node)
|
|
115
121
|
}); // TODO 设置名称显示隐藏
|
|
116
122
|
|
|
117
123
|
|
|
@@ -128,7 +134,7 @@ var tfLink = function tfLink(engine, link, nodes) {
|
|
|
128
134
|
|
|
129
135
|
var operation = null;
|
|
130
136
|
|
|
131
|
-
if (link.hasOwnProperty(
|
|
137
|
+
if (link.hasOwnProperty("operation")) {
|
|
132
138
|
operation = link.operation;
|
|
133
139
|
}
|
|
134
140
|
|
|
@@ -147,7 +153,7 @@ var tfLink = function tfLink(engine, link, nodes) {
|
|
|
147
153
|
return _extends({
|
|
148
154
|
originalLink: link
|
|
149
155
|
}, link, {
|
|
150
|
-
name: operation ? link.name :
|
|
156
|
+
name: operation ? link.name : "未知",
|
|
151
157
|
ciId: (_link$detail = link.detail) === null || _link$detail === void 0 ? void 0 : _link$detail.id,
|
|
152
158
|
sourceObj: sourceObj,
|
|
153
159
|
targetObj: targetObj,
|
|
@@ -156,13 +162,13 @@ var tfLink = function tfLink(engine, link, nodes) {
|
|
|
156
162
|
interfaceSourceObj: {
|
|
157
163
|
id: (_link$detail2 = link.detail) === null || _link$detail2 === void 0 ? void 0 : _link$detail2.attributes.srcUnique,
|
|
158
164
|
attributes: {
|
|
159
|
-
displayName: operation ? (_link$detail3 = link.detail) === null || _link$detail3 === void 0 ? void 0 : _link$detail3.attributes.srcName :
|
|
165
|
+
displayName: operation ? (_link$detail3 = link.detail) === null || _link$detail3 === void 0 ? void 0 : _link$detail3.attributes.srcName : "未知"
|
|
160
166
|
}
|
|
161
167
|
},
|
|
162
168
|
interfaceTargetObj: {
|
|
163
169
|
id: (_link$detail4 = link.detail) === null || _link$detail4 === void 0 ? void 0 : _link$detail4.attributes.dstUnique,
|
|
164
170
|
attributes: {
|
|
165
|
-
displayName: operation ? (_link$detail5 = link.detail) === null || _link$detail5 === void 0 ? void 0 : _link$detail5.attributes.dstName :
|
|
171
|
+
displayName: operation ? (_link$detail5 = link.detail) === null || _link$detail5 === void 0 ? void 0 : _link$detail5.attributes.dstName : "未知"
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
174
|
});
|
|
@@ -170,7 +176,7 @@ var tfLink = function tfLink(engine, link, nodes) {
|
|
|
170
176
|
|
|
171
177
|
export function getCiTypes(topoData) {
|
|
172
178
|
var allCi = [].concat(topoData.nodes || [], topoData.links || []);
|
|
173
|
-
var ciTypes = [
|
|
179
|
+
var ciTypes = ["network_link", "networkAggLink"];
|
|
174
180
|
allCi.forEach(function (element) {
|
|
175
181
|
if (element.ciType && ciTypes.indexOf(element.ciType) < 0) {
|
|
176
182
|
ciTypes.push(element.ciType);
|
|
@@ -193,12 +199,40 @@ export function getAlarmSwitch(topoData) {
|
|
|
193
199
|
|
|
194
200
|
return alarmSwitch;
|
|
195
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
|
204
|
+
* @param {} ciTypeObj
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
var ciModfilter = function ciModfilter(ciTypeObj) {
|
|
209
|
+
var attributes = ciTypeObj.attributes.map(function (item) {
|
|
210
|
+
return {
|
|
211
|
+
id: item.code + "-attribute",
|
|
212
|
+
code: item.code,
|
|
213
|
+
name: item.name,
|
|
214
|
+
type: "attribute",
|
|
215
|
+
selected: false
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
var metrics = ciTypeObj.metrics.map(function (item) {
|
|
219
|
+
return {
|
|
220
|
+
id: item.code + "-metric",
|
|
221
|
+
code: item.code,
|
|
222
|
+
name: item.name,
|
|
223
|
+
type: "metric",
|
|
224
|
+
selected: false
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
return [].concat(attributes, metrics);
|
|
228
|
+
};
|
|
196
229
|
/**
|
|
197
230
|
* 将从后端接收的数据转化为topo组件中需要的数据
|
|
198
231
|
* 具体格式内容参考
|
|
199
232
|
* https://shimo.im/docs/yphCqyk9yqXWdp3Q/ 《拓扑数据结构》
|
|
200
233
|
*/
|
|
201
234
|
|
|
235
|
+
|
|
202
236
|
export var combTopoData = function combTopoData(_ref3) {
|
|
203
237
|
var _result$config, _result$global, _alarmSwitch, _engine$options$viewe, _engine$options$edito, _engine$options$edito2, _result$groups;
|
|
204
238
|
|
|
@@ -208,7 +242,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
208
242
|
globalSetting = _ref3.globalSetting,
|
|
209
243
|
ciTypeMap = _ref3.ciTypeMap,
|
|
210
244
|
engine = _ref3.engine;
|
|
211
|
-
|
|
245
|
+
rlog.debug("combTopoData-接收到数据", result, engine, globalSetting);
|
|
212
246
|
var metricsDoc = {};
|
|
213
247
|
var attrsDoc = {}; // 保存所有资源的id
|
|
214
248
|
|
|
@@ -227,7 +261,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
227
261
|
var globalConfig = globalSetting;
|
|
228
262
|
|
|
229
263
|
var config = _extends({
|
|
230
|
-
type:
|
|
264
|
+
type: "auto"
|
|
231
265
|
}, result.config); // global
|
|
232
266
|
|
|
233
267
|
|
|
@@ -237,7 +271,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
237
271
|
// 是否可编辑----控制[编辑]按钮
|
|
238
272
|
moveable: true,
|
|
239
273
|
// 节点是否可移动
|
|
240
|
-
enableLineFlow: ((_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.enableLineFlow) || globalConfig.lineFlow ===
|
|
274
|
+
enableLineFlow: ((_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.enableLineFlow) || globalConfig.lineFlow === "1"
|
|
241
275
|
}, (result === null || result === void 0 ? void 0 : (_result$global = result.global) === null || _result$global === void 0 ? void 0 : _result$global.control) || {}),
|
|
242
276
|
topoDisplayConfig: _extends({
|
|
243
277
|
alarmSwitch: (_alarmSwitch = (result.global || {}).alarmSwitch) !== null && _alarmSwitch !== void 0 ? _alarmSwitch : true,
|
|
@@ -298,6 +332,94 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
298
332
|
}); // 所有资源
|
|
299
333
|
|
|
300
334
|
var allCis = [].concat(nodes, links);
|
|
335
|
+
var allCiModSet = {};
|
|
336
|
+
var allLinkModSet = {};
|
|
337
|
+
Object.keys(ciTypeMap).map(function (key) {
|
|
338
|
+
var ciTypeObj = {};
|
|
339
|
+
var linkKeyArr = [{
|
|
340
|
+
code: "phy",
|
|
341
|
+
key: "phy",
|
|
342
|
+
name: "物理链路"
|
|
343
|
+
}, {
|
|
344
|
+
code: "agg",
|
|
345
|
+
key: "agg",
|
|
346
|
+
name: "聚合链路"
|
|
347
|
+
}, {
|
|
348
|
+
code: "export_link",
|
|
349
|
+
key: "exp",
|
|
350
|
+
name: "出口链路"
|
|
351
|
+
}];
|
|
352
|
+
|
|
353
|
+
if (key === "network_link") {
|
|
354
|
+
linkKeyArr.map(function (link, index) {
|
|
355
|
+
ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType(link.key);
|
|
356
|
+
|
|
357
|
+
if (ciTypeObj) {
|
|
358
|
+
allLinkModSet[link.code] = {
|
|
359
|
+
name: link.name,
|
|
360
|
+
code: ciTypeObj.code,
|
|
361
|
+
icon: ciTypeObj.icon,
|
|
362
|
+
list: ciModfilter(ciTypeObj)
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return link.code;
|
|
367
|
+
}); // //物理链路 physical_link
|
|
368
|
+
// ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("phy");
|
|
369
|
+
// if (ciTypeObj) {
|
|
370
|
+
// allLinkModSet["physical_link"] = {
|
|
371
|
+
// name: ciTypeObj.displayName,
|
|
372
|
+
// code: ciTypeObj.code,
|
|
373
|
+
// icon: ciTypeObj.icon,
|
|
374
|
+
// list: ciModfilter(ciTypeObj),
|
|
375
|
+
// };
|
|
376
|
+
// }
|
|
377
|
+
// //聚合链路 agg_link
|
|
378
|
+
// ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("agg");
|
|
379
|
+
// allLinkModSet["agg_link"] = {
|
|
380
|
+
// name: ciTypeObj.displayName,
|
|
381
|
+
// code: ciTypeObj.code,
|
|
382
|
+
// icon: ciTypeObj.icon,
|
|
383
|
+
// list: ciModfilter(ciTypeObj),
|
|
384
|
+
// };
|
|
385
|
+
// //出口链路 export_link
|
|
386
|
+
// ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("export");
|
|
387
|
+
// allLinkModSet["export_link"] = {
|
|
388
|
+
// name: ciTypeObj.displayName,
|
|
389
|
+
// code: ciTypeObj.code,
|
|
390
|
+
// icon: ciTypeObj.icon,
|
|
391
|
+
// list: ciModfilter(ciTypeObj),
|
|
392
|
+
// };
|
|
393
|
+
} else {
|
|
394
|
+
ciTypeObj = ciTypeMap[key];
|
|
395
|
+
allCiModSet[key] = {
|
|
396
|
+
name: ciTypeObj.displayName,
|
|
397
|
+
code: ciTypeObj.code,
|
|
398
|
+
icon: ciTypeObj.icon,
|
|
399
|
+
list: ciModfilter(ciTypeObj)
|
|
400
|
+
};
|
|
401
|
+
} // const attributes = ciTypeObj.attributes.map((item) => {
|
|
402
|
+
// return {
|
|
403
|
+
// id: `${item.code}-attribute`,
|
|
404
|
+
// code: item.code,
|
|
405
|
+
// name: item.name,
|
|
406
|
+
// type: "attribute",
|
|
407
|
+
// selected: false,
|
|
408
|
+
// };
|
|
409
|
+
// });
|
|
410
|
+
// const metrics = ciTypeObj.metrics.map((item) => {
|
|
411
|
+
// return {
|
|
412
|
+
// id: `${item.code}-metric`,
|
|
413
|
+
// code: item.code,
|
|
414
|
+
// name: item.name,
|
|
415
|
+
// type: "metric",
|
|
416
|
+
// selected: false,
|
|
417
|
+
// };
|
|
418
|
+
// });
|
|
419
|
+
// if (LINK_CI_CODE_ARR.indexOf(key) < 0) {
|
|
420
|
+
|
|
421
|
+
});
|
|
422
|
+
rlog.debug("ciTypeMap-topo.ciTyeCache.getNetworkLinkCiType", engine.ciTyeCache.getNetworkLinkCiType("phy"));
|
|
301
423
|
|
|
302
424
|
if (allCis.length > 0) {
|
|
303
425
|
allCis.forEach(function (element, index) {
|
|
@@ -321,114 +443,98 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
321
443
|
|
|
322
444
|
ciTypesDoc[element.ciType].push({
|
|
323
445
|
ciId: element.id
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
type: 'metric'
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
bindingCiSet[element.ciType][item.code] = {
|
|
421
|
-
name: item.name,
|
|
422
|
-
tagNum: item.tags ? 1 : 0,
|
|
423
|
-
tipNum: item.tips ? 1 : 0,
|
|
424
|
-
tagCis: item.tags ? [element.name] : [],
|
|
425
|
-
tipCis: item.tips ? [element.name] : []
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return item.code;
|
|
430
|
-
});
|
|
431
|
-
}
|
|
446
|
+
}); // if (element.attributes) {
|
|
447
|
+
// attrsDoc[element.id] = element.attributes.map((ait, index) => {
|
|
448
|
+
// // rlog.debug(
|
|
449
|
+
// // 'xxxxxx-element-attributes-xxxxx',
|
|
450
|
+
// // ait,
|
|
451
|
+
// // bindingCiSet,
|
|
452
|
+
// // ciDoc
|
|
453
|
+
// // );
|
|
454
|
+
// if (bindingCiSet[element.ciType].hasOwnProperty(ait.code)) {
|
|
455
|
+
// if (
|
|
456
|
+
// ait.tags &&
|
|
457
|
+
// bindingCiSet[element.ciType][ait.code].tagCis.indexOf(
|
|
458
|
+
// element.name
|
|
459
|
+
// ) < 0
|
|
460
|
+
// ) {
|
|
461
|
+
// bindingCiSet[element.ciType][ait.code].tagNum += 1;
|
|
462
|
+
// bindingCiSet[element.ciType][ait.code].tagCis.push(element.name);
|
|
463
|
+
// ciDoc[element.id].tag.push({ code: ait.code, type: "attribute" });
|
|
464
|
+
// }
|
|
465
|
+
// if (
|
|
466
|
+
// ait.tips &&
|
|
467
|
+
// bindingCiSet[element.ciType][ait.code].tipCis.indexOf(
|
|
468
|
+
// element.name
|
|
469
|
+
// ) < 0
|
|
470
|
+
// ) {
|
|
471
|
+
// bindingCiSet[element.ciType][ait.code].tipNum += 1;
|
|
472
|
+
// bindingCiSet[element.ciType][ait.code].tipCis.push(element.name);
|
|
473
|
+
// ciDoc[element.id].tip.push({ code: ait.code, type: "attribute" });
|
|
474
|
+
// }
|
|
475
|
+
// } else {
|
|
476
|
+
// if (ait.tags) {
|
|
477
|
+
// ciDoc[element.id].tag.push({ code: ait.code, type: "attribute" });
|
|
478
|
+
// }
|
|
479
|
+
// if (ait.tips) {
|
|
480
|
+
// ciDoc[element.id].tip.push({ code: ait.code, type: "attribute" });
|
|
481
|
+
// }
|
|
482
|
+
// bindingCiSet[element.ciType][ait.code] = {
|
|
483
|
+
// name: ait.name,
|
|
484
|
+
// tagNum: ait.tags ? 1 : 0,
|
|
485
|
+
// tipNum: ait.tips ? 1 : 0,
|
|
486
|
+
// tagCis: ait.tags ? [element.name] : [],
|
|
487
|
+
// tipCis: ait.tips ? [element.name] : [],
|
|
488
|
+
// };
|
|
489
|
+
// }
|
|
490
|
+
// return ait.code;
|
|
491
|
+
// });
|
|
492
|
+
// }
|
|
493
|
+
// if (element.metrics) {
|
|
494
|
+
// metricsDoc[element.id] = element.metrics.map((item, index) => {
|
|
495
|
+
// if (metrics.indexOf(item.code) < 0) {
|
|
496
|
+
// metrics.push(item.code);
|
|
497
|
+
// }
|
|
498
|
+
// // rlog.debug('xxxxxx-element-metrics-xxxxx', item, bindingCiSet);
|
|
499
|
+
// if (bindingCiSet[element.ciType].hasOwnProperty(item.code)) {
|
|
500
|
+
// if (
|
|
501
|
+
// item.tags &&
|
|
502
|
+
// bindingCiSet[element.ciType][item.code].tagCis.indexOf(
|
|
503
|
+
// element.name
|
|
504
|
+
// ) < 0
|
|
505
|
+
// ) {
|
|
506
|
+
// bindingCiSet[element.ciType][item.code].tagNum += 1;
|
|
507
|
+
// bindingCiSet[element.ciType][item.code].tagCis.push(element.name);
|
|
508
|
+
// ciDoc[element.id].tag.push({ code: item.code, type: "metric" });
|
|
509
|
+
// }
|
|
510
|
+
// if (
|
|
511
|
+
// item.tips &&
|
|
512
|
+
// bindingCiSet[element.ciType][item.code].tipCis.indexOf(
|
|
513
|
+
// element.name
|
|
514
|
+
// ) < 0
|
|
515
|
+
// ) {
|
|
516
|
+
// bindingCiSet[element.ciType][item.code].tipNum += 1;
|
|
517
|
+
// bindingCiSet[element.ciType][item.code].tipCis.push(element.name);
|
|
518
|
+
// ciDoc[element.id].tip.push({ code: item.code, type: "metric" });
|
|
519
|
+
// }
|
|
520
|
+
// } else {
|
|
521
|
+
// if (item.tags) {
|
|
522
|
+
// ciDoc[element.id].tag.push({ code: item.code, type: "metric" });
|
|
523
|
+
// }
|
|
524
|
+
// if (item.tips) {
|
|
525
|
+
// ciDoc[element.id].tip.push({ code: item.code, type: "metric" });
|
|
526
|
+
// }
|
|
527
|
+
// bindingCiSet[element.ciType][item.code] = {
|
|
528
|
+
// name: item.name,
|
|
529
|
+
// tagNum: item.tags ? 1 : 0,
|
|
530
|
+
// tipNum: item.tips ? 1 : 0,
|
|
531
|
+
// tagCis: item.tags ? [element.name] : [],
|
|
532
|
+
// tipCis: item.tips ? [element.name] : [],
|
|
533
|
+
// };
|
|
534
|
+
// }
|
|
535
|
+
// return item.code;
|
|
536
|
+
// });
|
|
537
|
+
// }
|
|
432
538
|
});
|
|
433
539
|
}
|
|
434
540
|
|
|
@@ -447,12 +553,17 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
447
553
|
// 每种ci含有的ci
|
|
448
554
|
ciTypeMap: ciTypeMap,
|
|
449
555
|
// ci类型模型map
|
|
556
|
+
allCiModSet: allCiModSet,
|
|
557
|
+
// 资源类型含有属性和指标集合
|
|
558
|
+
allLinkModSet: allLinkModSet,
|
|
559
|
+
// 链路类型含有属性和指标集合
|
|
450
560
|
metrics: metrics,
|
|
451
561
|
// 所有指标
|
|
452
562
|
metricsDoc: metricsDoc,
|
|
453
563
|
//
|
|
454
564
|
attrsDoc: attrsDoc,
|
|
455
565
|
bindingCiSet: bindingCiSet,
|
|
566
|
+
// 可能没用了
|
|
456
567
|
allMetrics: Object.values(ciTypeMap),
|
|
457
568
|
allAttrs: Object.values(ciTypeMap),
|
|
458
569
|
globalConfig: globalConfig
|
|
@@ -465,7 +576,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
465
576
|
links: links,
|
|
466
577
|
serialize: result.serialize
|
|
467
578
|
};
|
|
468
|
-
rlog.debug(
|
|
579
|
+
rlog.debug("combTopoData-格式化后数据", topoData, resAndMetrics);
|
|
469
580
|
return {
|
|
470
581
|
topoData: topoData,
|
|
471
582
|
resAndMetrics: resAndMetrics
|
|
@@ -473,7 +584,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
473
584
|
}; // 批量更新指标状态
|
|
474
585
|
|
|
475
586
|
export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
|
|
476
|
-
rlog.debug(
|
|
587
|
+
rlog.debug("updateAllCiDoc", dataType, doc, ciDoc);
|
|
477
588
|
|
|
478
589
|
var cidoc = _.cloneDeep(ciDoc);
|
|
479
590
|
|
|
@@ -481,12 +592,12 @@ export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiS
|
|
|
481
592
|
|
|
482
593
|
var ciArr = Object.keys(cidoc);
|
|
483
594
|
ciArr.map(function (key) {
|
|
484
|
-
rlog.debug(
|
|
595
|
+
rlog.debug("Object.keys", allciset, cidoc, key);
|
|
485
596
|
var arr = [];
|
|
486
597
|
var list = cidoc[key].list.map(function (d) {
|
|
487
598
|
var ciType = cidoc[key].code; // rlog.debug('Object.keys---list-item', cidoc[key], ciType, d);
|
|
488
599
|
|
|
489
|
-
var item = findItem(doc[ciType],
|
|
600
|
+
var item = findItem(doc[ciType], "code", d.code); // rlog.debug('Object.keys---list-findItem', doc[ciType], item);
|
|
490
601
|
|
|
491
602
|
var r = _extends({}, d);
|
|
492
603
|
|
|
@@ -504,14 +615,14 @@ export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiS
|
|
|
504
615
|
nameArr.push(ciItem.name);
|
|
505
616
|
}
|
|
506
617
|
|
|
507
|
-
return
|
|
618
|
+
return "";
|
|
508
619
|
});
|
|
509
|
-
rlog.debug(
|
|
620
|
+
rlog.debug("Object.keys---nameArr", num, nameArr);
|
|
510
621
|
|
|
511
|
-
if (dataType ===
|
|
622
|
+
if (dataType === "tip") {
|
|
512
623
|
r.ciTipNum = num;
|
|
513
624
|
r.ciTipArr = nameArr;
|
|
514
|
-
} else if (dataType ===
|
|
625
|
+
} else if (dataType === "tag") {
|
|
515
626
|
r.ciTagNum = num;
|
|
516
627
|
r.ciTagArr = nameArr;
|
|
517
628
|
}
|
|
@@ -520,10 +631,10 @@ export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiS
|
|
|
520
631
|
} else {
|
|
521
632
|
r[dataType] = false;
|
|
522
633
|
|
|
523
|
-
if (dataType ===
|
|
634
|
+
if (dataType === "tip") {
|
|
524
635
|
r.ciTipNum = 0;
|
|
525
636
|
r.ciTipArr = [];
|
|
526
|
-
} else if (dataType ===
|
|
637
|
+
} else if (dataType === "tag") {
|
|
527
638
|
r.ciTagNum = 0;
|
|
528
639
|
r.ciTagArr = [];
|
|
529
640
|
}
|
|
@@ -534,13 +645,13 @@ export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiS
|
|
|
534
645
|
|
|
535
646
|
var uniqArr = _.uniqWith(arr, _.isEqual);
|
|
536
647
|
|
|
537
|
-
rlog.debug(
|
|
648
|
+
rlog.debug("Object.keys---list-result-arr,list", arr, uniqArr, list);
|
|
538
649
|
allciset[cidoc[key].code].list = list;
|
|
539
650
|
cidoc[key][dataType] = uniqArr;
|
|
540
651
|
cidoc[key].list = list;
|
|
541
|
-
return
|
|
542
|
-
});
|
|
543
|
-
|
|
652
|
+
return "";
|
|
653
|
+
});
|
|
654
|
+
rlog.debug("updateAllCiDoc-result", cidoc);
|
|
544
655
|
return {
|
|
545
656
|
cidoc: cidoc,
|
|
546
657
|
allciset: allciset
|
|
@@ -548,10 +659,10 @@ export var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiS
|
|
|
548
659
|
}; // 更新指标状态
|
|
549
660
|
|
|
550
661
|
export var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
|
|
551
|
-
rlog.debug(
|
|
662
|
+
rlog.debug("updateCiDoc", dataType, doc, ciDoc, allCiSet);
|
|
552
663
|
var dt = {
|
|
553
|
-
attribute:
|
|
554
|
-
metric:
|
|
664
|
+
attribute: "attributes",
|
|
665
|
+
metric: "metrics"
|
|
555
666
|
};
|
|
556
667
|
|
|
557
668
|
var cidoc = _.cloneDeep(ciDoc);
|
|
@@ -567,25 +678,25 @@ export var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
|
|
|
567
678
|
|
|
568
679
|
var ciname = cidoc[key].name;
|
|
569
680
|
|
|
570
|
-
if (findItemIndex(arr,
|
|
681
|
+
if (findItemIndex(arr, "code", d.code) < 0) {
|
|
571
682
|
r[dataType] = false;
|
|
572
683
|
|
|
573
|
-
if (dataType ===
|
|
684
|
+
if (dataType === "tip") {
|
|
574
685
|
r.ciTipNum = r.ciTipNum > 1 ? r.ciTipNum - 1 : 0;
|
|
575
686
|
r.ciTipArr = r.ciTipArr.length > 1 ? r.ciTipArr.splice(r.ciTipArr.indexOf(ciname), 1) : [];
|
|
576
|
-
} else if (dataType ===
|
|
687
|
+
} else if (dataType === "tag") {
|
|
577
688
|
r.ciTagNum = r.ciTagNum > 1 ? r.ciTagNum - 1 : 0;
|
|
578
689
|
r.ciTagArr = r.ciTagArr.length > 1 ? r.ciTagArr.splice(r.ciTagArr.indexOf(ciname), 1) : [];
|
|
579
690
|
}
|
|
580
691
|
} else {
|
|
581
692
|
r[dataType] = true;
|
|
582
693
|
|
|
583
|
-
if (dataType ===
|
|
694
|
+
if (dataType === "tip") {
|
|
584
695
|
if (r.ciTipArr.indexOf(ciname) < 0) {
|
|
585
696
|
r.ciTipNum += 1;
|
|
586
697
|
r.ciTipArr.push(ciname);
|
|
587
698
|
}
|
|
588
|
-
} else if (dataType ===
|
|
699
|
+
} else if (dataType === "tag") {
|
|
589
700
|
if (r.ciTagArr.indexOf(ciname) < 0) {
|
|
590
701
|
r.ciTagNum += 1;
|
|
591
702
|
r.ciTagArr.push(ciname);
|
|
@@ -600,20 +711,20 @@ export var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
|
|
|
600
711
|
|
|
601
712
|
var ciname = cidoc[key].name;
|
|
602
713
|
|
|
603
|
-
if (findItemIndex(arr,
|
|
604
|
-
if (dataType ===
|
|
714
|
+
if (findItemIndex(arr, "code", d.code) < 0) {
|
|
715
|
+
if (dataType === "tip") {
|
|
605
716
|
r.ciTipNum = r.ciTipNum > 1 ? r.ciTipNum - 1 : 0;
|
|
606
717
|
r.ciTipArr = r.ciTipArr.length > 1 ? r.ciTipArr.splice(r.ciTipArr.indexOf(ciname), 1) : [];
|
|
607
|
-
} else if (dataType ===
|
|
718
|
+
} else if (dataType === "tag") {
|
|
608
719
|
r.ciTagNum = r.ciTagNum > 1 ? r.ciTagNum - 1 : 0;
|
|
609
720
|
r.ciTagArr = r.ciTagArr.length > 1 ? r.ciTagArr.splice(r.ciTagArr.indexOf(ciname), 1) : [];
|
|
610
721
|
}
|
|
611
|
-
} else if (dataType ===
|
|
722
|
+
} else if (dataType === "tip") {
|
|
612
723
|
if (r.ciTipArr.indexOf(ciname) < 0) {
|
|
613
724
|
r.ciTipNum += 1;
|
|
614
725
|
r.ciTipArr.push(ciname);
|
|
615
726
|
}
|
|
616
|
-
} else if (dataType ===
|
|
727
|
+
} else if (dataType === "tag") {
|
|
617
728
|
if (r.ciTagArr.indexOf(ciname) < 0) {
|
|
618
729
|
r.ciTagNum += 1;
|
|
619
730
|
r.ciTagArr.push(ciname);
|
|
@@ -622,11 +733,11 @@ export var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
|
|
|
622
733
|
|
|
623
734
|
return r;
|
|
624
735
|
});
|
|
625
|
-
rlog.debug(
|
|
736
|
+
rlog.debug("updateCiDoc-result-----list", list, list2);
|
|
626
737
|
allciset[cidoc[key].code].list = list2;
|
|
627
738
|
cidoc[key][dataType] = arr;
|
|
628
739
|
cidoc[key].list = list;
|
|
629
|
-
return
|
|
740
|
+
return "";
|
|
630
741
|
}); // rlog.debug('updateCiDoc-result', cidoc);
|
|
631
742
|
|
|
632
743
|
return {
|
|
@@ -645,7 +756,7 @@ export var combSaveTopoData = function combSaveTopoData(_ref4) {
|
|
|
645
756
|
var global = _ref4.global,
|
|
646
757
|
linkDynamicStyleConfig = _ref4.linkDynamicStyleConfig;
|
|
647
758
|
var topoDisplayConfig = global.topoDisplayConfig;
|
|
648
|
-
rlog.debug(
|
|
759
|
+
rlog.debug("combSaveTopoData", global);
|
|
649
760
|
var extraConfig = JSON.stringify({
|
|
650
761
|
topoDisplayConfig: topoDisplayConfig // linkDynamicStyle: linkDynamicStyleConfig,
|
|
651
762
|
|
|
@@ -21,11 +21,15 @@ var DATA_TYPE = {
|
|
|
21
21
|
tag: {
|
|
22
22
|
drawerTitle: '选择图数据',
|
|
23
23
|
maxSelect: 4,
|
|
24
|
+
label: '图',
|
|
25
|
+
poslabel: '拓扑图上',
|
|
24
26
|
message: "\u56FE\u6570\u636E\uFF1A\u9009\u62E9\u7684\u6307\u6807\u548C\u5C5E\u6027\u5C06\u4F1A\u663E\u793A\u5728\u62D3\u6251\u56FE\u4E0A\uFF0C\u6700\u591A\u652F\u6301\u52FE\u9009 4 \u9879\u3002"
|
|
25
27
|
},
|
|
26
28
|
tip: {
|
|
27
29
|
drawerTitle: '选择Tooltips显示数据',
|
|
28
30
|
maxSelect: 10,
|
|
31
|
+
label: 'Tootip',
|
|
32
|
+
poslabel: 'Tooltip中',
|
|
29
33
|
message: "Tootip\u6570\u636E\uFF1A\u9009\u62E9\u7684\u6307\u6807\u548C\u5C5E\u6027\u5C06\u4F1A\u663E\u793A\u5728Tooltip\u4E2D\uFF0C\u6700\u591A\u652F\u6301\u52FE\u9009 10 \u9879\u3002"
|
|
30
34
|
}
|
|
31
35
|
};
|