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

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 (47) 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 +17 -17
  5. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  6. package/es/core/event/topoEventListener.js +22 -0
  7. package/es/core/hooks/useAlarm.js +18 -12
  8. package/es/core/hooks/useCiAttributeChange.js +60 -0
  9. package/es/core/hooks/usePolling.js +163 -60
  10. package/es/core/hooks/useTopoEventListener.js +4 -18
  11. package/es/core/models/Alarm.js +4 -13
  12. package/es/core/models/AttributeMetricDisplay.js +44 -127
  13. package/es/core/models/TopoApp.js +4 -2
  14. package/es/core/models/attributeFormatter/index.js +5 -6
  15. package/es/core/models/cache/CiCache.d.ts +18 -0
  16. package/es/core/models/cache/CiCache.js +78 -0
  17. package/es/core/models/utils/linkUtils.js +10 -13
  18. package/es/core/store/models/topoBizMod.js +4 -0
  19. package/es/core/store/models/viewer/resourceDetail.js +7 -0
  20. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  21. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +100 -46
  22. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  23. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  24. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
  25. package/es/style.js +1 -1
  26. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +1 -1
  27. package/lib/core/event/topoEventListener.js +27 -0
  28. package/lib/core/hooks/useAlarm.js +19 -12
  29. package/lib/core/hooks/useCiAttributeChange.js +70 -0
  30. package/lib/core/hooks/usePolling.js +166 -61
  31. package/lib/core/hooks/useTopoEventListener.js +3 -17
  32. package/lib/core/models/Alarm.js +5 -16
  33. package/lib/core/models/AttributeMetricDisplay.js +44 -126
  34. package/lib/core/models/TopoApp.js +4 -1
  35. package/lib/core/models/attributeFormatter/index.js +5 -7
  36. package/lib/core/models/cache/CiCache.d.ts +18 -0
  37. package/lib/core/models/cache/CiCache.js +89 -0
  38. package/lib/core/models/utils/linkUtils.js +10 -12
  39. package/lib/core/store/models/topoBizMod.js +4 -0
  40. package/lib/core/store/models/viewer/resourceDetail.js +7 -0
  41. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +10 -9
  42. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +99 -45
  43. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  44. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +8 -26
  45. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
  46. package/lib/style.js +1 -1
  47. package/package.json +3 -3
@@ -346,107 +346,50 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
346
346
  });
347
347
  }
348
348
  /**
349
- * 查询拓扑图资源的属性指标
349
+ * 加载标注、悬浮框数据
350
350
  *
351
- * @returns {array}
351
+ * @param {array<{id, attributeMap: {}, metricMap: {}}>} data
352
352
  */
353
353
  ;
354
354
 
355
- _proto.fetchData =
355
+ _proto.loadData =
356
356
  /*#__PURE__*/
357
357
  function () {
358
- var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
359
- var topo, _topo$store$getModelS, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
360
-
358
+ var _loadData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
359
+ var topo, ciDatas, bizDispatchers;
361
360
  return _regeneratorRuntime.wrap(function _callee$(_context) {
362
361
  while (1) {
363
362
  switch (_context.prev = _context.next) {
364
363
  case 0:
365
- transformLinkData = function _transformLinkData(data) {
366
- var _topo$dataModel$getDa = topo.dataModel.getData(),
367
- links = _topo$dataModel$getDa.links,
368
- linkGroups = _topo$dataModel$getDa.linkGroups;
369
-
370
- var link = [].concat(links, linkGroups).find(function (item) {
371
- return item.id === data.id;
372
- });
373
-
374
- if (!link) {
375
- return data;
376
- }
377
-
378
- var attributeMap = data.attributeMap;
379
- attributeMap = _extends({}, link.attributes || {});
380
- return _extends({}, data, {
381
- attributeMap: attributeMap
382
- });
383
- };
364
+ // rlog.debug('AttributeMetricDisplay.loadAttributeAndMetric', data);
365
+ topo = this.topo; // 设置ciType
384
366
 
385
- topo = this.topo;
386
- _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);
387
- // 无资源,不查询
367
+ ciDatas = data.filter(function (item) {
368
+ // 过滤不存在的ci,解决编辑模式删除资源后切换到显示模式报错
369
+ return !!topo.dataModel.getDataById(item.id);
370
+ }).map(function (item) {
371
+ return _extends({
372
+ ciType: topo.dataModel.getDataById(item.id).ciType
373
+ }, item);
374
+ }); // 翻译引用属性
388
375
 
389
- if (resIdsList.length) {
390
- _context.next = 5;
391
- break;
392
- }
376
+ _context.next = 4;
377
+ return this.translateRefAttribute(ciDatas);
393
378
 
394
- return _context.abrupt("return", []);
379
+ case 4:
380
+ ciDatas = _context.sent;
381
+ bizDispatchers = topo.store.getModelDispatchers('topoBizMod');
382
+ _context.next = 8;
383
+ return bizDispatchers.setAttrsAndMetrics(ciDatas);
395
384
 
396
- case 5:
397
- _context.next = 7;
385
+ case 8:
386
+ _context.next = 10;
398
387
  return DictCache.init();
399
388
 
400
- case 7:
401
- // 需要查询的指标列表
402
- codes = this.getResourceMetricCodes();
403
- param = {
404
- ciId: nodeIdsList,
405
- codes: codes,
406
- // 过滤掉不需要查询的
407
- relationId: this.getEdges().map(function (edge) {
408
- return {
409
- ciId: edge.id,
410
- operation: edge.operation
411
- };
412
- })
413
- };
414
- /**
415
- * 链路属性适配
416
- * @param {*} data
417
- * @returns
418
- */
419
-
420
- _context.next = 11;
421
- return topoServer.ciInfo.batchQueryCiInfo(param);
389
+ case 10:
390
+ this.updateTagsTips();
422
391
 
423
392
  case 11:
424
- result = _context.sent;
425
- return _context.abrupt("return", result.map(function (data) {
426
- var list2map = function list2map(list) {
427
- var map = {};
428
- (list || []).forEach(function (item) {
429
- map[item.code] = item.value;
430
- });
431
- return map;
432
- };
433
-
434
- var resultData = _extends({}, data, {
435
- attributeMap: list2map(data.attributes),
436
- metricMap: list2map(data.metrics)
437
- });
438
-
439
- resultData = transformLinkData(resultData); // 特殊处理:ipv6 从ipv6_address_list取第一个
440
-
441
- // 特殊处理:ipv6 从ipv6_address_list取第一个
442
- if (resultData.attributeMap.ipv6_address_list && !resultData.attributeMap.ipv6_address) {
443
- resultData.attributeMap.ipv6_address = (resultData.attributeMap.ipv6_address_list || '').split(',')[0];
444
- }
445
-
446
- return resultData;
447
- }));
448
-
449
- case 13:
450
393
  case "end":
451
394
  return _context.stop();
452
395
  }
@@ -454,16 +397,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
454
397
  }, _callee, this);
455
398
  }));
456
399
 
457
- function fetchData() {
458
- return _fetchData.apply(this, arguments);
400
+ function loadData(_x) {
401
+ return _loadData.apply(this, arguments);
459
402
  }
460
403
 
461
- return fetchData;
404
+ return loadData;
462
405
  }()
463
406
  /**
464
407
  * 加载标注、悬浮框数据
408
+ * 业务拓扑使用
465
409
  *
466
- * @param {array} data
410
+ * @param {array<{id, attributes: [], attributeMap: {}, metrics: [], metricMap: {}}>} data
467
411
  */
468
412
  ;
469
413
 
@@ -471,40 +415,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
471
415
  /*#__PURE__*/
472
416
  function () {
473
417
  var _loadAttributeAndMetric = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
474
- var topo, ciDatas, bizDispatchers;
475
418
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
476
419
  while (1) {
477
420
  switch (_context2.prev = _context2.next) {
478
421
  case 0:
479
- // rlog.debug('AttributeMetricDisplay.loadAttributeAndMetric', data);
480
- topo = this.topo; // 设置ciType
481
-
482
- ciDatas = data.filter(function (item) {
483
- // 过滤不存在的ci,解决编辑模式删除资源后切换到显示模式报错
484
- return !!topo.dataModel.getDataById(item.id);
485
- }).map(function (item) {
486
- return _extends({
487
- ciType: topo.dataModel.getDataById(item.id).ciType
488
- }, item);
489
- }); // 翻译引用属性
490
-
491
- _context2.next = 4;
492
- return this.translateRefAttribute(ciDatas);
493
-
494
- case 4:
495
- ciDatas = _context2.sent;
496
- bizDispatchers = topo.store.getModelDispatchers('topoBizMod');
497
- _context2.next = 8;
498
- return bizDispatchers.setAttrsAndMetrics(ciDatas);
422
+ _context2.next = 2;
423
+ return this.loadData(data);
499
424
 
500
- case 8:
501
- _context2.next = 10;
502
- return DictCache.init();
503
-
504
- case 10:
505
- this.updateTagsTips();
506
-
507
- case 11:
425
+ case 2:
508
426
  case "end":
509
427
  return _context2.stop();
510
428
  }
@@ -512,7 +430,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
512
430
  }, _callee2, this);
513
431
  }));
514
432
 
515
- function loadAttributeAndMetric(_x) {
433
+ function loadAttributeAndMetric(_x2) {
516
434
  return _loadAttributeAndMetric.apply(this, arguments);
517
435
  }
518
436
 
@@ -520,7 +438,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
520
438
  }()
521
439
  /**
522
440
  * 临时由前端翻译引用属性名称
523
- * @param {array} ciDatas
441
+ * @param {array<{id, ciType, attributeMap: {}, ...}>} ciDatas
524
442
  * @returns
525
443
  */
526
444
  ;
@@ -531,7 +449,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
531
449
  var _translateRefAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(ciDatas) {
532
450
  var _this5 = this;
533
451
 
534
- var refIdMap, ciRefAttributeMap, refIds, refCis, refCiMap;
452
+ var refIdMap, ciRefAttributeMap, refIds, refCiMap;
535
453
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
536
454
  while (1) {
537
455
  switch (_context3.prev = _context3.next) {
@@ -577,11 +495,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
577
495
 
578
496
  case 6:
579
497
  _context3.next = 8;
580
- return queryCisByIds(refIds);
498
+ return this.topo.ciCache.load(refIds);
581
499
 
582
500
  case 8:
583
- refCis = _context3.sent;
584
- refCiMap = keyBy(refCis, 'id');
501
+ refCiMap = _context3.sent;
585
502
  rlog.debug('translateRefAttribute', {
586
503
  ciRefAttributeMap: ciRefAttributeMap,
587
504
  refIds: refIds,
@@ -607,15 +524,15 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
607
524
  });
608
525
  }));
609
526
 
610
- case 12:
527
+ case 11:
611
528
  case "end":
612
529
  return _context3.stop();
613
530
  }
614
531
  }
615
- }, _callee3);
532
+ }, _callee3, this);
616
533
  }));
617
534
 
618
- function translateRefAttribute(_x2) {
535
+ function translateRefAttribute(_x3) {
619
536
  return _translateRefAttribute.apply(this, arguments);
620
537
  }
621
538
 
@@ -636,8 +553,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
636
553
 
637
554
  var elementTagsAndTips = this.buildTagsTips() // 开锁状态下禁用悬停展示悬浮框
638
555
  .map(function (item) {
639
- var _topo$store$getModelS2 = topo.store.getModelState('lock'),
640
- lock = _topo$store$getModelS2.lock;
556
+ var _topo$store$getModelS = topo.store.getModelState('lock'),
557
+ lock = _topo$store$getModelS.lock;
641
558
 
642
559
  return lock ? item : _extends({}, item, {
643
560
  tips: []
@@ -21,9 +21,10 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
21
21
  import PluginManager from "./PluginManager";
22
22
  import topoFactory from "./topoFactory";
23
23
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
- import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
24
+ import SelectionModel from "./SelectionModel";
25
+ import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
25
26
 
26
- var version = typeof "9.0.0-a.1" === 'string' ? "9.0.0-a.1" : null;
27
+ var version = typeof "9.0.0-a.10" === 'string' ? "9.0.0-a.10" : null;
27
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
29
  /**
29
30
  * 拓扑显示和编辑
@@ -43,6 +44,7 @@ var Topo = /*#__PURE__*/function () {
43
44
  this.CiTypeCache = CiTypeCache;
44
45
  this.ciTyeCache = CiTypeCache;
45
46
  this.dictCache = DictCache;
47
+ this.ciCache = CiCache;
46
48
  this.elementTagTipConfig = new ElementTagTipConfig(this);
47
49
  this.test = void 0;
48
50
  this.uid = void 0;
@@ -1,6 +1,5 @@
1
1
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
2
2
  import { metricValueFormat } from '@riil-frontend/utils';
3
- import { findItem } from "../../../utils/topoData";
4
3
  import DictCache from "../cache/DictCache";
5
4
  /**
6
5
  * 格式化指标
@@ -54,14 +53,14 @@ var AttributeFormatter = /*#__PURE__*/function () {
54
53
  };
55
54
 
56
55
  _proto.commonTransform = function commonTransform(item, ciData, attrType) {
57
- var _findItem;
58
-
59
56
  var fieldCode = item.code;
60
57
  var fieldMeta = this.topo.ciTyeCache.getCiType(ciData.ciType)[attrType + "Map"][fieldCode];
61
- var fieldValue = ciData[attrType + "Map"][fieldCode] || ((_findItem = findItem(ciData[attrType + "s"], 'code', fieldCode)) === null || _findItem === void 0 ? void 0 : _findItem.value);
58
+ var fieldValue = (ciData[attrType + "Map"] || ciData[attrType + "s"])[fieldCode]; // 引用属性
62
59
 
63
- if (ciData[attrType + "Map"][fieldCode + "_object"]) {
64
- fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
60
+ if (attrType === 'attribute') {
61
+ if (ciData[attrType + "Map"][fieldCode + "_object"]) {
62
+ fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
63
+ }
65
64
  }
66
65
 
67
66
  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,78 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { queryCisByIds } from "../../services";
4
+ /**
5
+ * Ci缓存
6
+ */
7
+
8
+ var CiCache = /*#__PURE__*/function () {
9
+ function CiCache() {
10
+ this.ciMap = {};
11
+ }
12
+
13
+ var _proto = CiCache.prototype;
14
+
15
+ /**
16
+ *
17
+ * @param ids {string[]}
18
+ * @returns {Promise<Object>}
19
+ */
20
+ _proto.load =
21
+ /*#__PURE__*/
22
+ function () {
23
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ids) {
24
+ var _this = this;
25
+
26
+ var unloadCiIds, cis, map;
27
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ unloadCiIds = ids.filter(function (id) {
32
+ return !_this.ciMap[id];
33
+ });
34
+
35
+ if (!unloadCiIds.length) {
36
+ _context.next = 6;
37
+ break;
38
+ }
39
+
40
+ _context.next = 4;
41
+ return queryCisByIds(unloadCiIds);
42
+
43
+ case 4:
44
+ cis = _context.sent;
45
+ cis.forEach(function (ci) {
46
+ _this.ciMap[ci.id] = ci;
47
+ });
48
+
49
+ case 6:
50
+ map = {};
51
+ ids.forEach(function (id) {
52
+ map[id] = _this.ciMap[id];
53
+ });
54
+ return _context.abrupt("return", this.ciMap);
55
+
56
+ case 9:
57
+ case "end":
58
+ return _context.stop();
59
+ }
60
+ }
61
+ }, _callee, this);
62
+ }));
63
+
64
+ function load(_x) {
65
+ return _load.apply(this, arguments);
66
+ }
67
+
68
+ return load;
69
+ }();
70
+
71
+ _proto.getCi = function getCi(id) {
72
+ return this.ciMap[id];
73
+ };
74
+
75
+ return CiCache;
76
+ }();
77
+
78
+ export default new CiCache();
@@ -6,7 +6,8 @@ import _ from 'lodash';
6
6
  import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
7
7
 
8
8
  import { getEdges } from "../../../utils/htElementUtils";
9
- import CiTypeCache from "../cache/CiTypeCache"; // const interfaceTypeMap = {
9
+ import CiTypeCache from "../cache/CiTypeCache";
10
+ import CiCache from "../cache/CiCache"; // const interfaceTypeMap = {
10
11
  // "network.interface": {
11
12
  // displayName: "网络接口",
12
13
  // },
@@ -33,10 +34,10 @@ export function isCrucialLink(link) {
33
34
  export function isExitLink(link) {
34
35
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
35
36
  }
36
- export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
37
+ export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
37
38
  var linkCiMap = keyBy(links, 'id');
38
39
  return links.map(function (link) {
39
- var _interfaceCis$find, _interfaceCis$find2;
40
+ var _interfaceCiMap$attri, _interfaceCiMap$attri2;
40
41
 
41
42
  var linkCi = linkCiMap[link.id];
42
43
 
@@ -63,14 +64,10 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
63
64
  destination_type_object: interfaceDoc[attributes.destination_type],
64
65
  // 源/目的接口
65
66
  source_id_object: {
66
- displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
67
- return node.id === attributes.source_id;
68
- })) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes['display_name']
67
+ displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes['display_name']
69
68
  },
70
69
  destination_id_object: {
71
- displayName: (_interfaceCis$find2 = interfaceCis.find(function (node) {
72
- return node.id === attributes.destination_id;
73
- })) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes['display_name']
70
+ displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes['display_name']
74
71
  }
75
72
  })
76
73
  });
@@ -82,7 +79,7 @@ export function getLinksDetail(_x, _x2) {
82
79
 
83
80
  function _getLinksDetail() {
84
81
  _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
85
- var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
82
+ var linkCis, interfaceIds, interfaceTypes, interfaceCiMap, interfaceDoc;
86
83
  return _regeneratorRuntime.wrap(function _callee$(_context) {
87
84
  while (1) {
88
85
  switch (_context.prev = _context.next) {
@@ -112,16 +109,16 @@ function _getLinksDetail() {
112
109
  return item !== 'ip';
113
110
  });
114
111
  _context.next = 7;
115
- return queryCisByIds(interfaceIds);
112
+ return CiCache.load(interfaceIds);
116
113
 
117
114
  case 7:
118
- interfaceCis = _context.sent;
115
+ interfaceCiMap = _context.sent;
119
116
  _context.next = 10;
120
117
  return CiTypeCache.getCiTypeMap(interfaceTypes);
121
118
 
122
119
  case 10:
123
120
  interfaceDoc = _context.sent;
124
- return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
121
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc));
125
122
 
126
123
  case 12:
127
124
  case "end":
@@ -6,6 +6,10 @@ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
6
  export default function (engine) {
7
7
  return {
8
8
  state: {
9
+ /**
10
+ * 格式:{id1: {attributes: {}}}
11
+ */
12
+ ciMap: {},
9
13
  // 指标默认设置
10
14
  resAndMetrics: {},
11
15
  metricDoc: {},
@@ -21,6 +21,13 @@ export default {
21
21
  visible: false,
22
22
  id: null // 资源id
23
23
 
24
+ };
25
+ },
26
+ close: function close() {
27
+ return {
28
+ visible: false,
29
+ id: null // 资源id
30
+
24
31
  };
25
32
  }
26
33
  },
@@ -76,9 +76,7 @@ function ResourceDetailDrawer(props) {
76
76
  }, []); // 解决切换拓扑图隐藏概览
77
77
 
78
78
  useEffect(function () {
79
- resourceDetailDispatchers.update({
80
- visible: false
81
- }); // TODO 其他数据重置
79
+ close(); // TODO 其他数据重置
82
80
  }, [topoId]);
83
81
 
84
82
  function getUser() {
@@ -154,6 +152,12 @@ function ResourceDetailDrawer(props) {
154
152
  }
155
153
  }
156
154
 
155
+ function close() {
156
+ resourceDetailDispatchers.update({
157
+ visible: false
158
+ });
159
+ }
160
+
157
161
  function init(data, targetType) {
158
162
  // console.log('初始化基本信息', data, targetType);
159
163
  var id = data.id,
@@ -214,7 +218,8 @@ function ResourceDetailDrawer(props) {
214
218
  topo: topo,
215
219
  userId: userId,
216
220
  activeData: activeData,
217
- resourceData: resourceData
221
+ resourceData: resourceData,
222
+ onClose: close
218
223
  }));
219
224
  };
220
225
 
@@ -228,11 +233,7 @@ function ResourceDetailDrawer(props) {
228
233
  })),
229
234
  width: 580,
230
235
  hasMask: false,
231
- onClose: function onClose() {
232
- return resourceDetailDispatchers.update({
233
- visible: false
234
- });
235
- }
236
+ onClose: close
236
237
  }, visible && resourceData && renderContent()));
237
238
  }
238
239