@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.
Files changed (84) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +22 -22
  5. 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
  6. package/demo/API//346/250/241/345/236/213.md +29 -0
  7. package/es/components/BatchAttrMetric/constant.js +4 -0
  8. package/es/components/BatchAttrMetric/index.js +8 -10
  9. package/es/components/BatchAttrMetric/setting.js +6 -4
  10. package/es/components/BatchAttrMetric/utils.js +39 -32
  11. package/es/constants/ResourceTypeLimit.js +1 -1
  12. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
  13. package/es/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
  14. package/es/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
  15. package/es/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
  16. package/es/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
  17. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +30 -9
  18. package/es/core/components/ResourceViewAttributeSetting/Setting.js +123 -0
  19. package/es/core/editor/components/EditorPlugin.js +4 -3
  20. package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
  21. package/es/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
  22. package/es/core/models/AttributeMetricDisplay.js +181 -66
  23. package/es/core/models/TopoApp.js +18 -16
  24. package/es/core/models/attributeFormatter/index.js +33 -8
  25. package/es/core/models/common/Alarm.js +45 -31
  26. package/es/core/models/utils/linkUtils.js +14 -2
  27. package/es/core/utils/exportData.js +33 -0
  28. package/es/core/utils/linkPollingAttributesAdapter.js +3 -0
  29. package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +264 -0
  30. package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
  31. package/es/core/viewer/components/plugins/BaseInfo/index.js +127 -0
  32. package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
  33. package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -1
  34. package/es/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +5 -0
  35. package/es/getStoreModels.js +3 -1
  36. package/es/hooks/useAlarm.js +1 -1
  37. package/es/hooks/usePolling.js +2 -1
  38. package/es/models/topoAlarm.js +43 -17
  39. package/es/models/topoBaseInfoOverview.js +43 -0
  40. package/es/models/topoBizMod.js +0 -70
  41. package/es/style.js +8 -7
  42. package/es/utils/topoData.js +266 -155
  43. package/lib/components/BatchAttrMetric/constant.js +4 -0
  44. package/lib/components/BatchAttrMetric/index.js +8 -10
  45. package/lib/components/BatchAttrMetric/setting.js +8 -5
  46. package/lib/components/BatchAttrMetric/utils.js +39 -35
  47. package/lib/constants/ResourceTypeLimit.js +1 -1
  48. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
  49. package/lib/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
  50. package/lib/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
  51. package/lib/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
  52. package/lib/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
  53. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +32 -8
  54. package/lib/core/{editor/components → components}/ResourceViewAttributeSetting/Setting.js +77 -71
  55. package/lib/core/editor/components/EditorPlugin.js +3 -3
  56. package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
  57. package/lib/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
  58. package/lib/core/models/AttributeMetricDisplay.js +181 -66
  59. package/lib/core/models/TopoApp.js +18 -17
  60. package/lib/core/models/attributeFormatter/index.js +34 -8
  61. package/lib/core/models/common/Alarm.js +46 -33
  62. package/lib/core/models/utils/linkUtils.js +12 -2
  63. package/lib/core/utils/exportData.js +44 -0
  64. package/lib/core/utils/linkPollingAttributesAdapter.js +10 -0
  65. package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +284 -0
  66. package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
  67. package/lib/core/viewer/components/plugins/BaseInfo/index.js +146 -0
  68. package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
  69. package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
  70. package/lib/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +6 -0
  71. package/lib/getStoreModels.js +4 -1
  72. package/lib/hooks/useAlarm.js +1 -1
  73. package/lib/hooks/usePolling.js +2 -1
  74. package/lib/models/topoAlarm.js +43 -17
  75. package/lib/models/topoBaseInfoOverview.js +55 -0
  76. package/lib/models/topoBizMod.js +0 -70
  77. package/lib/style.js +8 -7
  78. package/lib/utils/topoData.js +267 -151
  79. package/package.json +2 -2
  80. package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -57
  81. package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +0 -114
  82. package/es/core/models/attrAndMetric.js +0 -131
  83. package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -73
  84. package/lib/core/models/attrAndMetric.js +0 -148
@@ -28,6 +28,11 @@ var _mergeContextmenu = _interopRequireDefault(require("../core/common/contextme
28
28
 
29
29
  var _icon = require("../core/common/icons/icon");
30
30
 
31
+ /**
32
+ * 链路code集合
33
+ * @returns
34
+ */
35
+ var LINK_CI_CODE_ARR = ["network_link"];
31
36
  /**
32
37
  * 查找数组中对应key的值为value的元素并返回,只查找第一个符合的元素
33
38
  * @param {Array} arr 数组
@@ -35,6 +40,7 @@ var _icon = require("../core/common/icons/icon");
35
40
  * @param {*} value 值
36
41
  * @returns {*}
37
42
  */
43
+
38
44
  var findItem = function findItem(arr, key, value) {
39
45
  if ((0, _utils.isAvailableArray)(arr)) {
40
46
  var result;
@@ -102,10 +108,10 @@ function formatGroup(group) {
102
108
  // 是否显示容器标题
103
109
  showBorder: true,
104
110
  // 是否显示容器边框
105
- borderType: 'dot',
111
+ borderType: "dot",
106
112
  // 容器边框线性
107
113
  showExpanded: true
108
- }, typeof group.styles === 'string' ? JSON.parse(group.styles) : group.styles || {})
114
+ }, typeof group.styles === "string" ? JSON.parse(group.styles) : group.styles || {})
109
115
  });
110
116
  } // 格式化容器
111
117
 
@@ -137,12 +143,12 @@ var tfNode = function tfNode(engine, node) {
137
143
  var attributes = nodeAttributesAdapter(node.attributes); // rlog.debug('tfNode---------',node);
138
144
 
139
145
  var result = (0, _extends2["default"])({
140
- ipAddress: attributes.ipAddress || null,
141
- macAddress: attributes.macAddress || null
146
+ ipAddress: attributes.ipAddress || null
142
147
  }, node, {
143
- operation: node.hasOwnProperty('operation') ? node.operation : null,
148
+ operation: node.hasOwnProperty("operation") ? node.operation : null,
144
149
  metrics: [],
145
- attributes: []
150
+ attributes: [],
151
+ isShowName: engine.attributeMetricDisplay.getNodeNameVisible(node)
146
152
  }); // TODO 设置名称显示隐藏
147
153
 
148
154
  var defaultSet = engine.attributeMetricDisplay.getConfig();
@@ -158,7 +164,7 @@ var tfLink = function tfLink(engine, link, nodes) {
158
164
 
159
165
  var operation = null;
160
166
 
161
- if (link.hasOwnProperty('operation')) {
167
+ if (link.hasOwnProperty("operation")) {
162
168
  operation = link.operation;
163
169
  }
164
170
 
@@ -177,7 +183,7 @@ var tfLink = function tfLink(engine, link, nodes) {
177
183
  return (0, _extends2["default"])({
178
184
  originalLink: link
179
185
  }, link, {
180
- name: operation ? link.name : '未知',
186
+ name: operation ? link.name : "未知",
181
187
  ciId: (_link$detail = link.detail) === null || _link$detail === void 0 ? void 0 : _link$detail.id,
182
188
  sourceObj: sourceObj,
183
189
  targetObj: targetObj,
@@ -186,13 +192,13 @@ var tfLink = function tfLink(engine, link, nodes) {
186
192
  interfaceSourceObj: {
187
193
  id: (_link$detail2 = link.detail) === null || _link$detail2 === void 0 ? void 0 : _link$detail2.attributes.srcUnique,
188
194
  attributes: {
189
- displayName: operation ? (_link$detail3 = link.detail) === null || _link$detail3 === void 0 ? void 0 : _link$detail3.attributes.srcName : '未知'
195
+ displayName: operation ? (_link$detail3 = link.detail) === null || _link$detail3 === void 0 ? void 0 : _link$detail3.attributes.srcName : "未知"
190
196
  }
191
197
  },
192
198
  interfaceTargetObj: {
193
199
  id: (_link$detail4 = link.detail) === null || _link$detail4 === void 0 ? void 0 : _link$detail4.attributes.dstUnique,
194
200
  attributes: {
195
- displayName: operation ? (_link$detail5 = link.detail) === null || _link$detail5 === void 0 ? void 0 : _link$detail5.attributes.dstName : '未知'
201
+ displayName: operation ? (_link$detail5 = link.detail) === null || _link$detail5 === void 0 ? void 0 : _link$detail5.attributes.dstName : "未知"
196
202
  }
197
203
  }
198
204
  });
@@ -200,7 +206,7 @@ var tfLink = function tfLink(engine, link, nodes) {
200
206
 
201
207
  function getCiTypes(topoData) {
202
208
  var allCi = [].concat(topoData.nodes || [], topoData.links || []);
203
- var ciTypes = ['network_link', 'networkAggLink'];
209
+ var ciTypes = ["network_link", "networkAggLink"];
204
210
  allCi.forEach(function (element) {
205
211
  if (element.ciType && ciTypes.indexOf(element.ciType) < 0) {
206
212
  ciTypes.push(element.ciType);
@@ -224,6 +230,34 @@ function getAlarmSwitch(topoData) {
224
230
 
225
231
  return alarmSwitch;
226
232
  }
233
+ /**
234
+ * 过滤ci元数据中的属性和指标,用于属性和指标显示设置
235
+ * @param {} ciTypeObj
236
+ * @returns
237
+ */
238
+
239
+
240
+ var ciModfilter = function ciModfilter(ciTypeObj) {
241
+ var attributes = ciTypeObj.attributes.map(function (item) {
242
+ return {
243
+ id: item.code + "-attribute",
244
+ code: item.code,
245
+ name: item.name,
246
+ type: "attribute",
247
+ selected: false
248
+ };
249
+ });
250
+ var metrics = ciTypeObj.metrics.map(function (item) {
251
+ return {
252
+ id: item.code + "-metric",
253
+ code: item.code,
254
+ name: item.name,
255
+ type: "metric",
256
+ selected: false
257
+ };
258
+ });
259
+ return [].concat(attributes, metrics);
260
+ };
227
261
  /**
228
262
  * 将从后端接收的数据转化为topo组件中需要的数据
229
263
  * 具体格式内容参考
@@ -240,7 +274,9 @@ var combTopoData = function combTopoData(_ref3) {
240
274
  globalSetting = _ref3.globalSetting,
241
275
  ciTypeMap = _ref3.ciTypeMap,
242
276
  engine = _ref3.engine;
243
- // rlog.debug('combTopoData-接收到数据', result, allMetrics, allAttrs);
277
+
278
+ _rlog["default"].debug("combTopoData-接收到数据", result, engine, globalSetting);
279
+
244
280
  var metricsDoc = {};
245
281
  var attrsDoc = {}; // 保存所有资源的id
246
282
 
@@ -258,7 +294,7 @@ var combTopoData = function combTopoData(_ref3) {
258
294
  var bindingCiSet = {};
259
295
  var globalConfig = globalSetting;
260
296
  var config = (0, _extends2["default"])({
261
- type: 'auto'
297
+ type: "auto"
262
298
  }, result.config); // global
263
299
 
264
300
  var global = (0, _extends2["default"])({
@@ -267,7 +303,7 @@ var combTopoData = function combTopoData(_ref3) {
267
303
  // 是否可编辑----控制[编辑]按钮
268
304
  moveable: true,
269
305
  // 节点是否可移动
270
- enableLineFlow: ((_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.enableLineFlow) || globalConfig.lineFlow === '1'
306
+ enableLineFlow: ((_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.enableLineFlow) || globalConfig.lineFlow === "1"
271
307
  }, (result === null || result === void 0 ? void 0 : (_result$global = result.global) === null || _result$global === void 0 ? void 0 : _result$global.control) || {}),
272
308
  topoDisplayConfig: (0, _extends2["default"])({
273
309
  alarmSwitch: (_alarmSwitch = (result.global || {}).alarmSwitch) !== null && _alarmSwitch !== void 0 ? _alarmSwitch : true,
@@ -327,6 +363,95 @@ var combTopoData = function combTopoData(_ref3) {
327
363
  }); // 所有资源
328
364
 
329
365
  var allCis = [].concat(nodes, links);
366
+ var allCiModSet = {};
367
+ var allLinkModSet = {};
368
+ Object.keys(ciTypeMap).map(function (key) {
369
+ var ciTypeObj = {};
370
+ var linkKeyArr = [{
371
+ code: "phy",
372
+ key: "phy",
373
+ name: "物理链路"
374
+ }, {
375
+ code: "agg",
376
+ key: "agg",
377
+ name: "聚合链路"
378
+ }, {
379
+ code: "export_link",
380
+ key: "exp",
381
+ name: "出口链路"
382
+ }];
383
+
384
+ if (key === "network_link") {
385
+ linkKeyArr.map(function (link, index) {
386
+ ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType(link.key);
387
+
388
+ if (ciTypeObj) {
389
+ allLinkModSet[link.code] = {
390
+ name: link.name,
391
+ code: ciTypeObj.code,
392
+ icon: ciTypeObj.icon,
393
+ list: ciModfilter(ciTypeObj)
394
+ };
395
+ }
396
+
397
+ return link.code;
398
+ }); // //物理链路 physical_link
399
+ // ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("phy");
400
+ // if (ciTypeObj) {
401
+ // allLinkModSet["physical_link"] = {
402
+ // name: ciTypeObj.displayName,
403
+ // code: ciTypeObj.code,
404
+ // icon: ciTypeObj.icon,
405
+ // list: ciModfilter(ciTypeObj),
406
+ // };
407
+ // }
408
+ // //聚合链路 agg_link
409
+ // ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("agg");
410
+ // allLinkModSet["agg_link"] = {
411
+ // name: ciTypeObj.displayName,
412
+ // code: ciTypeObj.code,
413
+ // icon: ciTypeObj.icon,
414
+ // list: ciModfilter(ciTypeObj),
415
+ // };
416
+ // //出口链路 export_link
417
+ // ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType("export");
418
+ // allLinkModSet["export_link"] = {
419
+ // name: ciTypeObj.displayName,
420
+ // code: ciTypeObj.code,
421
+ // icon: ciTypeObj.icon,
422
+ // list: ciModfilter(ciTypeObj),
423
+ // };
424
+ } else {
425
+ ciTypeObj = ciTypeMap[key];
426
+ allCiModSet[key] = {
427
+ name: ciTypeObj.displayName,
428
+ code: ciTypeObj.code,
429
+ icon: ciTypeObj.icon,
430
+ list: ciModfilter(ciTypeObj)
431
+ };
432
+ } // const attributes = ciTypeObj.attributes.map((item) => {
433
+ // return {
434
+ // id: `${item.code}-attribute`,
435
+ // code: item.code,
436
+ // name: item.name,
437
+ // type: "attribute",
438
+ // selected: false,
439
+ // };
440
+ // });
441
+ // const metrics = ciTypeObj.metrics.map((item) => {
442
+ // return {
443
+ // id: `${item.code}-metric`,
444
+ // code: item.code,
445
+ // name: item.name,
446
+ // type: "metric",
447
+ // selected: false,
448
+ // };
449
+ // });
450
+ // if (LINK_CI_CODE_ARR.indexOf(key) < 0) {
451
+
452
+ });
453
+
454
+ _rlog["default"].debug("ciTypeMap-topo.ciTyeCache.getNetworkLinkCiType", engine.ciTyeCache.getNetworkLinkCiType("phy"));
330
455
 
331
456
  if (allCis.length > 0) {
332
457
  allCis.forEach(function (element, index) {
@@ -350,114 +475,98 @@ var combTopoData = function combTopoData(_ref3) {
350
475
 
351
476
  ciTypesDoc[element.ciType].push({
352
477
  ciId: element.id
353
- });
354
-
355
- if (element.attributes) {
356
- attrsDoc[element.id] = element.attributes.map(function (ait, index) {
357
- // rlog.debug(
358
- // 'xxxxxx-element-attributes-xxxxx',
359
- // ait,
360
- // bindingCiSet,
361
- // ciDoc
362
- // );
363
- if (bindingCiSet[element.ciType].hasOwnProperty(ait.code)) {
364
- if (ait.tags && bindingCiSet[element.ciType][ait.code].tagCis.indexOf(element.name) < 0) {
365
- bindingCiSet[element.ciType][ait.code].tagNum += 1;
366
- bindingCiSet[element.ciType][ait.code].tagCis.push(element.name);
367
- ciDoc[element.id].tag.push({
368
- code: ait.code,
369
- type: 'attribute'
370
- });
371
- }
372
-
373
- if (ait.tips && bindingCiSet[element.ciType][ait.code].tipCis.indexOf(element.name) < 0) {
374
- bindingCiSet[element.ciType][ait.code].tipNum += 1;
375
- bindingCiSet[element.ciType][ait.code].tipCis.push(element.name);
376
- ciDoc[element.id].tip.push({
377
- code: ait.code,
378
- type: 'attribute'
379
- });
380
- }
381
- } else {
382
- if (ait.tags) {
383
- ciDoc[element.id].tag.push({
384
- code: ait.code,
385
- type: 'attribute'
386
- });
387
- }
388
-
389
- if (ait.tips) {
390
- ciDoc[element.id].tip.push({
391
- code: ait.code,
392
- type: 'attribute'
393
- });
394
- }
395
-
396
- bindingCiSet[element.ciType][ait.code] = {
397
- name: ait.name,
398
- tagNum: ait.tags ? 1 : 0,
399
- tipNum: ait.tips ? 1 : 0,
400
- tagCis: ait.tags ? [element.name] : [],
401
- tipCis: ait.tips ? [element.name] : []
402
- };
403
- }
404
-
405
- return ait.code;
406
- });
407
- }
408
-
409
- if (element.metrics) {
410
- metricsDoc[element.id] = element.metrics.map(function (item, index) {
411
- if (metrics.indexOf(item.code) < 0) {
412
- metrics.push(item.code);
413
- } // rlog.debug('xxxxxx-element-metrics-xxxxx', item, bindingCiSet);
414
-
415
-
416
- if (bindingCiSet[element.ciType].hasOwnProperty(item.code)) {
417
- if (item.tags && bindingCiSet[element.ciType][item.code].tagCis.indexOf(element.name) < 0) {
418
- bindingCiSet[element.ciType][item.code].tagNum += 1;
419
- bindingCiSet[element.ciType][item.code].tagCis.push(element.name);
420
- ciDoc[element.id].tag.push({
421
- code: item.code,
422
- type: 'metric'
423
- });
424
- }
425
-
426
- if (item.tips && bindingCiSet[element.ciType][item.code].tipCis.indexOf(element.name) < 0) {
427
- bindingCiSet[element.ciType][item.code].tipNum += 1;
428
- bindingCiSet[element.ciType][item.code].tipCis.push(element.name);
429
- ciDoc[element.id].tip.push({
430
- code: item.code,
431
- type: 'metric'
432
- });
433
- }
434
- } else {
435
- if (item.tags) {
436
- ciDoc[element.id].tag.push({
437
- code: item.code,
438
- type: 'metric'
439
- });
440
- }
441
-
442
- if (item.tips) {
443
- ciDoc[element.id].tip.push({
444
- code: item.code,
445
- type: 'metric'
446
- });
447
- }
448
-
449
- bindingCiSet[element.ciType][item.code] = {
450
- name: item.name,
451
- tagNum: item.tags ? 1 : 0,
452
- tipNum: item.tips ? 1 : 0,
453
- tagCis: item.tags ? [element.name] : [],
454
- tipCis: item.tips ? [element.name] : []
455
- };
456
- }
457
-
458
- return item.code;
459
- });
460
- }
478
+ }); // if (element.attributes) {
479
+ // attrsDoc[element.id] = element.attributes.map((ait, index) => {
480
+ // // rlog.debug(
481
+ // // 'xxxxxx-element-attributes-xxxxx',
482
+ // // ait,
483
+ // // bindingCiSet,
484
+ // // ciDoc
485
+ // // );
486
+ // if (bindingCiSet[element.ciType].hasOwnProperty(ait.code)) {
487
+ // if (
488
+ // ait.tags &&
489
+ // bindingCiSet[element.ciType][ait.code].tagCis.indexOf(
490
+ // element.name
491
+ // ) < 0
492
+ // ) {
493
+ // bindingCiSet[element.ciType][ait.code].tagNum += 1;
494
+ // bindingCiSet[element.ciType][ait.code].tagCis.push(element.name);
495
+ // ciDoc[element.id].tag.push({ code: ait.code, type: "attribute" });
496
+ // }
497
+ // if (
498
+ // ait.tips &&
499
+ // bindingCiSet[element.ciType][ait.code].tipCis.indexOf(
500
+ // element.name
501
+ // ) < 0
502
+ // ) {
503
+ // bindingCiSet[element.ciType][ait.code].tipNum += 1;
504
+ // bindingCiSet[element.ciType][ait.code].tipCis.push(element.name);
505
+ // ciDoc[element.id].tip.push({ code: ait.code, type: "attribute" });
506
+ // }
507
+ // } else {
508
+ // if (ait.tags) {
509
+ // ciDoc[element.id].tag.push({ code: ait.code, type: "attribute" });
510
+ // }
511
+ // if (ait.tips) {
512
+ // ciDoc[element.id].tip.push({ code: ait.code, type: "attribute" });
513
+ // }
514
+ // bindingCiSet[element.ciType][ait.code] = {
515
+ // name: ait.name,
516
+ // tagNum: ait.tags ? 1 : 0,
517
+ // tipNum: ait.tips ? 1 : 0,
518
+ // tagCis: ait.tags ? [element.name] : [],
519
+ // tipCis: ait.tips ? [element.name] : [],
520
+ // };
521
+ // }
522
+ // return ait.code;
523
+ // });
524
+ // }
525
+ // if (element.metrics) {
526
+ // metricsDoc[element.id] = element.metrics.map((item, index) => {
527
+ // if (metrics.indexOf(item.code) < 0) {
528
+ // metrics.push(item.code);
529
+ // }
530
+ // // rlog.debug('xxxxxx-element-metrics-xxxxx', item, bindingCiSet);
531
+ // if (bindingCiSet[element.ciType].hasOwnProperty(item.code)) {
532
+ // if (
533
+ // item.tags &&
534
+ // bindingCiSet[element.ciType][item.code].tagCis.indexOf(
535
+ // element.name
536
+ // ) < 0
537
+ // ) {
538
+ // bindingCiSet[element.ciType][item.code].tagNum += 1;
539
+ // bindingCiSet[element.ciType][item.code].tagCis.push(element.name);
540
+ // ciDoc[element.id].tag.push({ code: item.code, type: "metric" });
541
+ // }
542
+ // if (
543
+ // item.tips &&
544
+ // bindingCiSet[element.ciType][item.code].tipCis.indexOf(
545
+ // element.name
546
+ // ) < 0
547
+ // ) {
548
+ // bindingCiSet[element.ciType][item.code].tipNum += 1;
549
+ // bindingCiSet[element.ciType][item.code].tipCis.push(element.name);
550
+ // ciDoc[element.id].tip.push({ code: item.code, type: "metric" });
551
+ // }
552
+ // } else {
553
+ // if (item.tags) {
554
+ // ciDoc[element.id].tag.push({ code: item.code, type: "metric" });
555
+ // }
556
+ // if (item.tips) {
557
+ // ciDoc[element.id].tip.push({ code: item.code, type: "metric" });
558
+ // }
559
+ // bindingCiSet[element.ciType][item.code] = {
560
+ // name: item.name,
561
+ // tagNum: item.tags ? 1 : 0,
562
+ // tipNum: item.tips ? 1 : 0,
563
+ // tagCis: item.tags ? [element.name] : [],
564
+ // tipCis: item.tips ? [element.name] : [],
565
+ // };
566
+ // }
567
+ // return item.code;
568
+ // });
569
+ // }
461
570
  });
462
571
  }
463
572
 
@@ -476,12 +585,17 @@ var combTopoData = function combTopoData(_ref3) {
476
585
  // 每种ci含有的ci
477
586
  ciTypeMap: ciTypeMap,
478
587
  // ci类型模型map
588
+ allCiModSet: allCiModSet,
589
+ // 资源类型含有属性和指标集合
590
+ allLinkModSet: allLinkModSet,
591
+ // 链路类型含有属性和指标集合
479
592
  metrics: metrics,
480
593
  // 所有指标
481
594
  metricsDoc: metricsDoc,
482
595
  //
483
596
  attrsDoc: attrsDoc,
484
597
  bindingCiSet: bindingCiSet,
598
+ // 可能没用了
485
599
  allMetrics: Object.values(ciTypeMap),
486
600
  allAttrs: Object.values(ciTypeMap),
487
601
  globalConfig: globalConfig
@@ -495,7 +609,7 @@ var combTopoData = function combTopoData(_ref3) {
495
609
  serialize: result.serialize
496
610
  };
497
611
 
498
- _rlog["default"].debug('combTopoData-格式化后数据', topoData, resAndMetrics);
612
+ _rlog["default"].debug("combTopoData-格式化后数据", topoData, resAndMetrics);
499
613
 
500
614
  return {
501
615
  topoData: topoData,
@@ -507,7 +621,7 @@ var combTopoData = function combTopoData(_ref3) {
507
621
  exports.combTopoData = combTopoData;
508
622
 
509
623
  var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
510
- _rlog["default"].debug('updateAllCiDoc', dataType, doc, ciDoc);
624
+ _rlog["default"].debug("updateAllCiDoc", dataType, doc, ciDoc);
511
625
 
512
626
  var cidoc = _lodash["default"].cloneDeep(ciDoc);
513
627
 
@@ -515,13 +629,13 @@ var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
515
629
 
516
630
  var ciArr = Object.keys(cidoc);
517
631
  ciArr.map(function (key) {
518
- _rlog["default"].debug('Object.keys', allciset, cidoc, key);
632
+ _rlog["default"].debug("Object.keys", allciset, cidoc, key);
519
633
 
520
634
  var arr = [];
521
635
  var list = cidoc[key].list.map(function (d) {
522
636
  var ciType = cidoc[key].code; // rlog.debug('Object.keys---list-item', cidoc[key], ciType, d);
523
637
 
524
- var item = findItem(doc[ciType], 'code', d.code); // rlog.debug('Object.keys---list-findItem', doc[ciType], item);
638
+ var item = findItem(doc[ciType], "code", d.code); // rlog.debug('Object.keys---list-findItem', doc[ciType], item);
525
639
 
526
640
  var r = (0, _extends2["default"])({}, d);
527
641
  var name = cidoc[key].name; // rlog.debug('Object.keys---r', r);
@@ -538,15 +652,15 @@ var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
538
652
  nameArr.push(ciItem.name);
539
653
  }
540
654
 
541
- return '';
655
+ return "";
542
656
  });
543
657
 
544
- _rlog["default"].debug('Object.keys---nameArr', num, nameArr);
658
+ _rlog["default"].debug("Object.keys---nameArr", num, nameArr);
545
659
 
546
- if (dataType === 'tip') {
660
+ if (dataType === "tip") {
547
661
  r.ciTipNum = num;
548
662
  r.ciTipArr = nameArr;
549
- } else if (dataType === 'tag') {
663
+ } else if (dataType === "tag") {
550
664
  r.ciTagNum = num;
551
665
  r.ciTagArr = nameArr;
552
666
  }
@@ -555,10 +669,10 @@ var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
555
669
  } else {
556
670
  r[dataType] = false;
557
671
 
558
- if (dataType === 'tip') {
672
+ if (dataType === "tip") {
559
673
  r.ciTipNum = 0;
560
674
  r.ciTipArr = [];
561
- } else if (dataType === 'tag') {
675
+ } else if (dataType === "tag") {
562
676
  r.ciTagNum = 0;
563
677
  r.ciTagArr = [];
564
678
  }
@@ -569,13 +683,15 @@ var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
569
683
 
570
684
  var uniqArr = _lodash["default"].uniqWith(arr, _lodash["default"].isEqual);
571
685
 
572
- _rlog["default"].debug('Object.keys---list-result-arr,list', arr, uniqArr, list);
686
+ _rlog["default"].debug("Object.keys---list-result-arr,list", arr, uniqArr, list);
573
687
 
574
688
  allciset[cidoc[key].code].list = list;
575
689
  cidoc[key][dataType] = uniqArr;
576
690
  cidoc[key].list = list;
577
- return '';
578
- }); // rlog.debug('updateAllCiDoc-result', cidoc);
691
+ return "";
692
+ });
693
+
694
+ _rlog["default"].debug("updateAllCiDoc-result", cidoc);
579
695
 
580
696
  return {
581
697
  cidoc: cidoc,
@@ -587,11 +703,11 @@ var updateAllCiDoc = function updateAllCiDoc(dataType, doc, ciDoc, allCiSet) {
587
703
  exports.updateAllCiDoc = updateAllCiDoc;
588
704
 
589
705
  var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
590
- _rlog["default"].debug('updateCiDoc', dataType, doc, ciDoc, allCiSet);
706
+ _rlog["default"].debug("updateCiDoc", dataType, doc, ciDoc, allCiSet);
591
707
 
592
708
  var dt = {
593
- attribute: 'attributes',
594
- metric: 'metrics'
709
+ attribute: "attributes",
710
+ metric: "metrics"
595
711
  };
596
712
 
597
713
  var cidoc = _lodash["default"].cloneDeep(ciDoc);
@@ -606,25 +722,25 @@ var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
606
722
  var r = (0, _extends2["default"])({}, d);
607
723
  var ciname = cidoc[key].name;
608
724
 
609
- if (findItemIndex(arr, 'code', d.code) < 0) {
725
+ if (findItemIndex(arr, "code", d.code) < 0) {
610
726
  r[dataType] = false;
611
727
 
612
- if (dataType === 'tip') {
728
+ if (dataType === "tip") {
613
729
  r.ciTipNum = r.ciTipNum > 1 ? r.ciTipNum - 1 : 0;
614
730
  r.ciTipArr = r.ciTipArr.length > 1 ? r.ciTipArr.splice(r.ciTipArr.indexOf(ciname), 1) : [];
615
- } else if (dataType === 'tag') {
731
+ } else if (dataType === "tag") {
616
732
  r.ciTagNum = r.ciTagNum > 1 ? r.ciTagNum - 1 : 0;
617
733
  r.ciTagArr = r.ciTagArr.length > 1 ? r.ciTagArr.splice(r.ciTagArr.indexOf(ciname), 1) : [];
618
734
  }
619
735
  } else {
620
736
  r[dataType] = true;
621
737
 
622
- if (dataType === 'tip') {
738
+ if (dataType === "tip") {
623
739
  if (r.ciTipArr.indexOf(ciname) < 0) {
624
740
  r.ciTipNum += 1;
625
741
  r.ciTipArr.push(ciname);
626
742
  }
627
- } else if (dataType === 'tag') {
743
+ } else if (dataType === "tag") {
628
744
  if (r.ciTagArr.indexOf(ciname) < 0) {
629
745
  r.ciTagNum += 1;
630
746
  r.ciTagArr.push(ciname);
@@ -638,20 +754,20 @@ var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
638
754
  var r = (0, _extends2["default"])({}, d);
639
755
  var ciname = cidoc[key].name;
640
756
 
641
- if (findItemIndex(arr, 'code', d.code) < 0) {
642
- if (dataType === 'tip') {
757
+ if (findItemIndex(arr, "code", d.code) < 0) {
758
+ if (dataType === "tip") {
643
759
  r.ciTipNum = r.ciTipNum > 1 ? r.ciTipNum - 1 : 0;
644
760
  r.ciTipArr = r.ciTipArr.length > 1 ? r.ciTipArr.splice(r.ciTipArr.indexOf(ciname), 1) : [];
645
- } else if (dataType === 'tag') {
761
+ } else if (dataType === "tag") {
646
762
  r.ciTagNum = r.ciTagNum > 1 ? r.ciTagNum - 1 : 0;
647
763
  r.ciTagArr = r.ciTagArr.length > 1 ? r.ciTagArr.splice(r.ciTagArr.indexOf(ciname), 1) : [];
648
764
  }
649
- } else if (dataType === 'tip') {
765
+ } else if (dataType === "tip") {
650
766
  if (r.ciTipArr.indexOf(ciname) < 0) {
651
767
  r.ciTipNum += 1;
652
768
  r.ciTipArr.push(ciname);
653
769
  }
654
- } else if (dataType === 'tag') {
770
+ } else if (dataType === "tag") {
655
771
  if (r.ciTagArr.indexOf(ciname) < 0) {
656
772
  r.ciTagNum += 1;
657
773
  r.ciTagArr.push(ciname);
@@ -661,12 +777,12 @@ var updateCiDoc = function updateCiDoc(dataType, doc, ciDoc, allCiSet) {
661
777
  return r;
662
778
  });
663
779
 
664
- _rlog["default"].debug('updateCiDoc-result-----list', list, list2);
780
+ _rlog["default"].debug("updateCiDoc-result-----list", list, list2);
665
781
 
666
782
  allciset[cidoc[key].code].list = list2;
667
783
  cidoc[key][dataType] = arr;
668
784
  cidoc[key].list = list;
669
- return '';
785
+ return "";
670
786
  }); // rlog.debug('updateCiDoc-result', cidoc);
671
787
 
672
788
  return {
@@ -689,7 +805,7 @@ var combSaveTopoData = function combSaveTopoData(_ref4) {
689
805
  linkDynamicStyleConfig = _ref4.linkDynamicStyleConfig;
690
806
  var topoDisplayConfig = global.topoDisplayConfig;
691
807
 
692
- _rlog["default"].debug('combSaveTopoData', global);
808
+ _rlog["default"].debug("combSaveTopoData", global);
693
809
 
694
810
  var extraConfig = JSON.stringify({
695
811
  topoDisplayConfig: topoDisplayConfig // linkDynamicStyle: linkDynamicStyleConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.14.2-alpha.2",
3
+ "version": "2.14.2-alpha.6",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -111,6 +111,6 @@
111
111
  "access": "public"
112
112
  },
113
113
  "license": "MIT",
114
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.14.2-alpha.2/build/index.html",
114
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.14.2-alpha.6/build/index.html",
115
115
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
116
116
  }