@riil-frontend/component-topology 9.0.0-a.1 → 9.0.0-a.11

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 (59) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +7 -7
  3. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  4. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  5. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  6. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  7. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  8. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  9. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  11. package/es/core/event/topoEventListener.js +22 -0
  12. package/es/core/hooks/useAlarm.js +18 -12
  13. package/es/core/hooks/useCiAttributeChange.js +60 -0
  14. package/es/core/hooks/usePolling.js +163 -60
  15. package/es/core/hooks/useTopoEventListener.js +4 -18
  16. package/es/core/models/Alarm.js +4 -13
  17. package/es/core/models/AttributeMetricDisplay.js +44 -127
  18. package/es/core/models/TopoApp.js +4 -2
  19. package/es/core/models/attributeFormatter/index.js +5 -6
  20. package/es/core/models/cache/CiCache.d.ts +18 -0
  21. package/es/core/models/cache/CiCache.js +78 -0
  22. package/es/core/models/utils/linkUtils.js +10 -13
  23. package/es/core/store/models/topoBizMod.js +4 -0
  24. package/es/core/store/models/viewer/resourceDetail.js +7 -0
  25. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  26. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +100 -46
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  28. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  29. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
  30. package/es/style.js +1 -1
  31. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  32. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  33. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  34. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  35. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  36. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  37. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  38. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  39. package/lib/core/event/topoEventListener.js +27 -0
  40. package/lib/core/hooks/useAlarm.js +19 -12
  41. package/lib/core/hooks/useCiAttributeChange.js +70 -0
  42. package/lib/core/hooks/usePolling.js +166 -61
  43. package/lib/core/hooks/useTopoEventListener.js +3 -17
  44. package/lib/core/models/Alarm.js +5 -16
  45. package/lib/core/models/AttributeMetricDisplay.js +44 -126
  46. package/lib/core/models/TopoApp.js +4 -1
  47. package/lib/core/models/attributeFormatter/index.js +5 -7
  48. package/lib/core/models/cache/CiCache.d.ts +18 -0
  49. package/lib/core/models/cache/CiCache.js +89 -0
  50. package/lib/core/models/utils/linkUtils.js +10 -12
  51. package/lib/core/store/models/topoBizMod.js +4 -0
  52. package/lib/core/store/models/viewer/resourceDetail.js +7 -0
  53. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  54. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +99 -45
  55. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  56. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  57. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
  58. package/lib/style.js +1 -1
  59. package/package.json +3 -3
@@ -364,106 +364,50 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
364
364
  });
365
365
  }
366
366
  /**
367
- * 查询拓扑图资源的属性指标
367
+ * 加载标注、悬浮框数据
368
368
  *
369
- * @returns {array}
369
+ * @param {array<{id, attributeMap: {}, metricMap: {}}>} data
370
370
  */
371
371
  ;
372
372
 
373
- _proto.fetchData =
373
+ _proto.loadData =
374
374
  /*#__PURE__*/
375
375
  function () {
376
- var _fetchData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
377
- var topo, _topo$store$getModelS, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
378
-
376
+ var _loadData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
377
+ var topo, ciDatas, bizDispatchers;
379
378
  return _regenerator["default"].wrap(function _callee$(_context) {
380
379
  while (1) {
381
380
  switch (_context.prev = _context.next) {
382
381
  case 0:
383
- transformLinkData = function _transformLinkData(data) {
384
- var _topo$dataModel$getDa = topo.dataModel.getData(),
385
- links = _topo$dataModel$getDa.links,
386
- linkGroups = _topo$dataModel$getDa.linkGroups;
387
-
388
- var link = [].concat(links, linkGroups).find(function (item) {
389
- return item.id === data.id;
390
- });
391
-
392
- if (!link) {
393
- return data;
394
- }
395
-
396
- var attributeMap = data.attributeMap;
397
- attributeMap = (0, _extends2["default"])({}, link.attributes || {});
398
- return (0, _extends2["default"])({}, data, {
399
- attributeMap: attributeMap
400
- });
401
- };
382
+ // rlog.debug('AttributeMetricDisplay.loadAttributeAndMetric', data);
383
+ topo = this.topo; // 设置ciType
402
384
 
403
- topo = this.topo;
404
- _topo$store$getModelS = topo.store.getModelState('topoBizMod').resAndMetrics, resIdsList = _topo$store$getModelS.resIdsList, nodeIdsList = _topo$store$getModelS.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
405
- // 无资源,不查询
385
+ ciDatas = data.filter(function (item) {
386
+ // 过滤不存在的ci,解决编辑模式删除资源后切换到显示模式报错
387
+ return !!topo.dataModel.getDataById(item.id);
388
+ }).map(function (item) {
389
+ return (0, _extends2["default"])({
390
+ ciType: topo.dataModel.getDataById(item.id).ciType
391
+ }, item);
392
+ }); // 翻译引用属性
406
393
 
407
- if (resIdsList.length) {
408
- _context.next = 5;
409
- break;
410
- }
394
+ _context.next = 4;
395
+ return this.translateRefAttribute(ciDatas);
411
396
 
412
- return _context.abrupt("return", []);
397
+ case 4:
398
+ ciDatas = _context.sent;
399
+ bizDispatchers = topo.store.getModelDispatchers('topoBizMod');
400
+ _context.next = 8;
401
+ return bizDispatchers.setAttrsAndMetrics(ciDatas);
413
402
 
414
- case 5:
415
- _context.next = 7;
403
+ case 8:
404
+ _context.next = 10;
416
405
  return _DictCache["default"].init();
417
406
 
418
- case 7:
419
- // 需要查询的指标列表
420
- codes = this.getResourceMetricCodes();
421
- param = {
422
- ciId: nodeIdsList,
423
- codes: codes,
424
- // 过滤掉不需要查询的
425
- relationId: this.getEdges().map(function (edge) {
426
- return {
427
- ciId: edge.id,
428
- operation: edge.operation
429
- };
430
- })
431
- };
432
- /**
433
- * 链路属性适配
434
- * @param {*} data
435
- * @returns
436
- */
437
-
438
- _context.next = 11;
439
- return _topo["default"].ciInfo.batchQueryCiInfo(param);
407
+ case 10:
408
+ this.updateTagsTips();
440
409
 
441
410
  case 11:
442
- result = _context.sent;
443
- return _context.abrupt("return", result.map(function (data) {
444
- var list2map = function list2map(list) {
445
- var map = {};
446
- (list || []).forEach(function (item) {
447
- map[item.code] = item.value;
448
- });
449
- return map;
450
- };
451
-
452
- var resultData = (0, _extends2["default"])({}, data, {
453
- attributeMap: list2map(data.attributes),
454
- metricMap: list2map(data.metrics)
455
- });
456
- resultData = transformLinkData(resultData); // 特殊处理:ipv6 从ipv6_address_list取第一个
457
-
458
- // 特殊处理:ipv6 从ipv6_address_list取第一个
459
- if (resultData.attributeMap.ipv6_address_list && !resultData.attributeMap.ipv6_address) {
460
- resultData.attributeMap.ipv6_address = (resultData.attributeMap.ipv6_address_list || '').split(',')[0];
461
- }
462
-
463
- return resultData;
464
- }));
465
-
466
- case 13:
467
411
  case "end":
468
412
  return _context.stop();
469
413
  }
@@ -471,16 +415,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
471
415
  }, _callee, this);
472
416
  }));
473
417
 
474
- function fetchData() {
475
- return _fetchData.apply(this, arguments);
418
+ function loadData(_x) {
419
+ return _loadData.apply(this, arguments);
476
420
  }
477
421
 
478
- return fetchData;
422
+ return loadData;
479
423
  }()
480
424
  /**
481
425
  * 加载标注、悬浮框数据
426
+ * 业务拓扑使用
482
427
  *
483
- * @param {array} data
428
+ * @param {array<{id, attributes: [], attributeMap: {}, metrics: [], metricMap: {}}>} data
484
429
  */
485
430
  ;
486
431
 
@@ -488,40 +433,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
488
433
  /*#__PURE__*/
489
434
  function () {
490
435
  var _loadAttributeAndMetric = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(data) {
491
- var topo, ciDatas, bizDispatchers;
492
436
  return _regenerator["default"].wrap(function _callee2$(_context2) {
493
437
  while (1) {
494
438
  switch (_context2.prev = _context2.next) {
495
439
  case 0:
496
- // rlog.debug('AttributeMetricDisplay.loadAttributeAndMetric', data);
497
- topo = this.topo; // 设置ciType
440
+ _context2.next = 2;
441
+ return this.loadData(data);
498
442
 
499
- ciDatas = data.filter(function (item) {
500
- // 过滤不存在的ci,解决编辑模式删除资源后切换到显示模式报错
501
- return !!topo.dataModel.getDataById(item.id);
502
- }).map(function (item) {
503
- return (0, _extends2["default"])({
504
- ciType: topo.dataModel.getDataById(item.id).ciType
505
- }, item);
506
- }); // 翻译引用属性
507
-
508
- _context2.next = 4;
509
- return this.translateRefAttribute(ciDatas);
510
-
511
- case 4:
512
- ciDatas = _context2.sent;
513
- bizDispatchers = topo.store.getModelDispatchers('topoBizMod');
514
- _context2.next = 8;
515
- return bizDispatchers.setAttrsAndMetrics(ciDatas);
516
-
517
- case 8:
518
- _context2.next = 10;
519
- return _DictCache["default"].init();
520
-
521
- case 10:
522
- this.updateTagsTips();
523
-
524
- case 11:
443
+ case 2:
525
444
  case "end":
526
445
  return _context2.stop();
527
446
  }
@@ -529,7 +448,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
529
448
  }, _callee2, this);
530
449
  }));
531
450
 
532
- function loadAttributeAndMetric(_x) {
451
+ function loadAttributeAndMetric(_x2) {
533
452
  return _loadAttributeAndMetric.apply(this, arguments);
534
453
  }
535
454
 
@@ -537,7 +456,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
537
456
  }()
538
457
  /**
539
458
  * 临时由前端翻译引用属性名称
540
- * @param {array} ciDatas
459
+ * @param {array<{id, ciType, attributeMap: {}, ...}>} ciDatas
541
460
  * @returns
542
461
  */
543
462
  ;
@@ -548,7 +467,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
548
467
  var _translateRefAttribute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(ciDatas) {
549
468
  var _this5 = this;
550
469
 
551
- var refIdMap, ciRefAttributeMap, refIds, refCis, refCiMap;
470
+ var refIdMap, ciRefAttributeMap, refIds, refCiMap;
552
471
  return _regenerator["default"].wrap(function _callee3$(_context3) {
553
472
  while (1) {
554
473
  switch (_context3.prev = _context3.next) {
@@ -594,11 +513,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
594
513
 
595
514
  case 6:
596
515
  _context3.next = 8;
597
- return (0, _services.queryCisByIds)(refIds);
516
+ return this.topo.ciCache.load(refIds);
598
517
 
599
518
  case 8:
600
- refCis = _context3.sent;
601
- refCiMap = (0, _lodash.keyBy)(refCis, 'id');
519
+ refCiMap = _context3.sent;
602
520
 
603
521
  _rlog["default"].debug('translateRefAttribute', {
604
522
  ciRefAttributeMap: ciRefAttributeMap,
@@ -624,15 +542,15 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
624
542
  });
625
543
  }));
626
544
 
627
- case 12:
545
+ case 11:
628
546
  case "end":
629
547
  return _context3.stop();
630
548
  }
631
549
  }
632
- }, _callee3);
550
+ }, _callee3, this);
633
551
  }));
634
552
 
635
- function translateRefAttribute(_x2) {
553
+ function translateRefAttribute(_x3) {
636
554
  return _translateRefAttribute.apply(this, arguments);
637
555
  }
638
556
 
@@ -653,8 +571,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
653
571
 
654
572
  var elementTagsAndTips = this.buildTagsTips() // 开锁状态下禁用悬停展示悬浮框
655
573
  .map(function (item) {
656
- var _topo$store$getModelS2 = topo.store.getModelState('lock'),
657
- lock = _topo$store$getModelS2.lock;
574
+ var _topo$store$getModelS = topo.store.getModelState('lock'),
575
+ lock = _topo$store$getModelS.lock;
658
576
 
659
577
  return lock ? item : (0, _extends2["default"])({}, item, {
660
578
  tips: []
@@ -53,8 +53,10 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
53
53
 
54
54
  var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
55
55
 
56
+ var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
57
+
56
58
  // eslint-disable-next-line no-undef
57
- var version = typeof "9.0.0-a.1" === 'string' ? "9.0.0-a.1" : null;
59
+ var version = typeof "9.0.0-a.11" === 'string' ? "9.0.0-a.11" : null;
58
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
59
61
  /**
60
62
  * 拓扑显示和编辑
@@ -74,6 +76,7 @@ var Topo = /*#__PURE__*/function () {
74
76
  this.CiTypeCache = _CiTypeCache["default"];
75
77
  this.ciTyeCache = _CiTypeCache["default"];
76
78
  this.dictCache = _DictCache["default"];
79
+ this.ciCache = _CiCache["default"];
77
80
  this.elementTagTipConfig = new _ElementTagTipConfig["default"](this);
78
81
  this.test = void 0;
79
82
  this.uid = void 0;
@@ -10,8 +10,6 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
10
10
 
11
11
  var _utils = require("@riil-frontend/utils");
12
12
 
13
- var _topoData = require("../../../utils/topoData");
14
-
15
13
  var _DictCache = _interopRequireDefault(require("../cache/DictCache"));
16
14
 
17
15
  /**
@@ -66,14 +64,14 @@ var AttributeFormatter = /*#__PURE__*/function () {
66
64
  };
67
65
 
68
66
  _proto.commonTransform = function commonTransform(item, ciData, attrType) {
69
- var _findItem;
70
-
71
67
  var fieldCode = item.code;
72
68
  var fieldMeta = this.topo.ciTyeCache.getCiType(ciData.ciType)[attrType + "Map"][fieldCode];
73
- var fieldValue = ciData[attrType + "Map"][fieldCode] || ((_findItem = (0, _topoData.findItem)(ciData[attrType + "s"], 'code', fieldCode)) === null || _findItem === void 0 ? void 0 : _findItem.value);
69
+ var fieldValue = (ciData[attrType + "Map"] || ciData[attrType + "s"])[fieldCode]; // 引用属性
74
70
 
75
- if (ciData[attrType + "Map"][fieldCode + "_object"]) {
76
- fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
71
+ if (attrType === 'attribute') {
72
+ if (ciData[attrType + "Map"][fieldCode + "_object"]) {
73
+ fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
74
+ }
77
75
  }
78
76
 
79
77
  return {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Ci缓存
3
+ */
4
+ declare class CiCache {
5
+ /**
6
+ * @param {object<string, object>}
7
+ */
8
+ ciMap: {};
9
+ /**
10
+ *
11
+ * @param ids {string[]}
12
+ * @returns {Promise<Object>}
13
+ */
14
+ load(ids: string[]): Promise<Object>;
15
+ getCi(id: string): Object;
16
+ }
17
+ declare const _default: CiCache;
18
+ export default _default;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports["default"] = void 0;
7
+
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
+ var _services = require("../../services");
13
+
14
+ /**
15
+ * Ci缓存
16
+ */
17
+ var CiCache = /*#__PURE__*/function () {
18
+ function CiCache() {
19
+ this.ciMap = {};
20
+ }
21
+
22
+ var _proto = CiCache.prototype;
23
+
24
+ /**
25
+ *
26
+ * @param ids {string[]}
27
+ * @returns {Promise<Object>}
28
+ */
29
+ _proto.load =
30
+ /*#__PURE__*/
31
+ function () {
32
+ var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ids) {
33
+ var _this = this;
34
+
35
+ var unloadCiIds, cis, map;
36
+ return _regenerator["default"].wrap(function _callee$(_context) {
37
+ while (1) {
38
+ switch (_context.prev = _context.next) {
39
+ case 0:
40
+ unloadCiIds = ids.filter(function (id) {
41
+ return !_this.ciMap[id];
42
+ });
43
+
44
+ if (!unloadCiIds.length) {
45
+ _context.next = 6;
46
+ break;
47
+ }
48
+
49
+ _context.next = 4;
50
+ return (0, _services.queryCisByIds)(unloadCiIds);
51
+
52
+ case 4:
53
+ cis = _context.sent;
54
+ cis.forEach(function (ci) {
55
+ _this.ciMap[ci.id] = ci;
56
+ });
57
+
58
+ case 6:
59
+ map = {};
60
+ ids.forEach(function (id) {
61
+ map[id] = _this.ciMap[id];
62
+ });
63
+ return _context.abrupt("return", this.ciMap);
64
+
65
+ case 9:
66
+ case "end":
67
+ return _context.stop();
68
+ }
69
+ }
70
+ }, _callee, this);
71
+ }));
72
+
73
+ function load(_x) {
74
+ return _load.apply(this, arguments);
75
+ }
76
+
77
+ return load;
78
+ }();
79
+
80
+ _proto.getCi = function getCi(id) {
81
+ return this.ciMap[id];
82
+ };
83
+
84
+ return CiCache;
85
+ }();
86
+
87
+ var _default = new CiCache();
88
+
89
+ exports["default"] = _default;
@@ -27,6 +27,8 @@ var _htElementUtils = require("../../../utils/htElementUtils");
27
27
 
28
28
  var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
29
29
 
30
+ var _CiCache = _interopRequireDefault(require("../cache/CiCache"));
31
+
30
32
  // 查询所有连线
31
33
  // const interfaceTypeMap = {
32
34
  // "network.interface": {
@@ -56,10 +58,10 @@ function isExitLink(link) {
56
58
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
57
59
  }
58
60
 
59
- function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
61
+ function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
60
62
  var linkCiMap = (0, _keyBy["default"])(links, 'id');
61
63
  return links.map(function (link) {
62
- var _interfaceCis$find, _interfaceCis$find2;
64
+ var _interfaceCiMap$attri, _interfaceCiMap$attri2;
63
65
 
64
66
  var linkCi = linkCiMap[link.id];
65
67
  var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
@@ -84,14 +86,10 @@ function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
84
86
  destination_type_object: interfaceDoc[attributes.destination_type],
85
87
  // 源/目的接口
86
88
  source_id_object: {
87
- displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
88
- return node.id === attributes.source_id;
89
- })) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes['display_name']
89
+ displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes['display_name']
90
90
  },
91
91
  destination_id_object: {
92
- displayName: (_interfaceCis$find2 = interfaceCis.find(function (node) {
93
- return node.id === attributes.destination_id;
94
- })) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes['display_name']
92
+ displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes['display_name']
95
93
  }
96
94
  })
97
95
  });
@@ -104,7 +102,7 @@ function getLinksDetail(_x, _x2) {
104
102
 
105
103
  function _getLinksDetail() {
106
104
  _getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(links, nodes) {
107
- var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
105
+ var linkCis, interfaceIds, interfaceTypes, interfaceCiMap, interfaceDoc;
108
106
  return _regenerator["default"].wrap(function _callee$(_context) {
109
107
  while (1) {
110
108
  switch (_context.prev = _context.next) {
@@ -134,16 +132,16 @@ function _getLinksDetail() {
134
132
  return item !== 'ip';
135
133
  });
136
134
  _context.next = 7;
137
- return (0, _services.queryCisByIds)(interfaceIds);
135
+ return _CiCache["default"].load(interfaceIds);
138
136
 
139
137
  case 7:
140
- interfaceCis = _context.sent;
138
+ interfaceCiMap = _context.sent;
141
139
  _context.next = 10;
142
140
  return _CiTypeCache["default"].getCiTypeMap(interfaceTypes);
143
141
 
144
142
  case 10:
145
143
  interfaceDoc = _context.sent;
146
- return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
144
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc));
147
145
 
148
146
  case 12:
149
147
  case "end":
@@ -18,6 +18,10 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
18
18
  function _default(engine) {
19
19
  return {
20
20
  state: {
21
+ /**
22
+ * 格式:{id1: {attributes: {}}}
23
+ */
24
+ ciMap: {},
21
25
  // 指标默认设置
22
26
  resAndMetrics: {},
23
27
  metricDoc: {},
@@ -29,6 +29,13 @@ var _default = {
29
29
  visible: false,
30
30
  id: null // 资源id
31
31
 
32
+ };
33
+ },
34
+ close: function close() {
35
+ return {
36
+ visible: false,
37
+ id: null // 资源id
38
+
32
39
  };
33
40
  }
34
41
  },
@@ -98,9 +98,7 @@ function ResourceDetailDrawer(props) {
98
98
  }, []); // 解决切换拓扑图隐藏概览
99
99
 
100
100
  (0, _react.useEffect)(function () {
101
- resourceDetailDispatchers.update({
102
- visible: false
103
- }); // TODO 其他数据重置
101
+ close(); // TODO 其他数据重置
104
102
  }, [topoId]);
105
103
 
106
104
  function getUser() {
@@ -176,6 +174,12 @@ function ResourceDetailDrawer(props) {
176
174
  }
177
175
  }
178
176
 
177
+ function close() {
178
+ resourceDetailDispatchers.update({
179
+ visible: false
180
+ });
181
+ }
182
+
179
183
  function init(data, targetType) {
180
184
  // console.log('初始化基本信息', data, targetType);
181
185
  var id = data.id,
@@ -236,7 +240,8 @@ function ResourceDetailDrawer(props) {
236
240
  topo: topo,
237
241
  userId: userId,
238
242
  activeData: activeData,
239
- resourceData: resourceData
243
+ resourceData: resourceData,
244
+ onClose: close
240
245
  }));
241
246
  };
242
247
 
@@ -250,11 +255,7 @@ function ResourceDetailDrawer(props) {
250
255
  })),
251
256
  width: 580,
252
257
  hasMask: false,
253
- onClose: function onClose() {
254
- return resourceDetailDispatchers.update({
255
- visible: false
256
- });
257
- }
258
+ onClose: close
258
259
  }, visible && resourceData && renderContent()));
259
260
  }
260
261