@riil-frontend/component-topology 11.0.35 → 11.0.38

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 (131) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.js +37 -29
  4. package/es/components/MultiResourceDrawer/index.js +8 -6
  5. package/es/components/ResourceList/ResourceSelect.js +8 -7
  6. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
  7. package/es/components/SingleResourceDrawer/SelectDrawer.js +8 -6
  8. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
  9. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
  10. package/es/core/editor/components/BackgroundView/index.js +73 -54
  11. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
  12. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -5
  13. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
  14. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
  15. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
  16. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
  17. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
  18. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
  19. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
  20. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
  21. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
  22. package/es/core/hooks/usePolling.js +21 -13
  23. package/es/core/hooks/useResourceConfig.js +37 -21
  24. package/es/core/hooks/useTopoEdit.js +215 -147
  25. package/es/core/models/Alarm.js +104 -38
  26. package/es/core/models/AttributeMetricDisplay.js +36 -14
  27. package/es/core/models/TopoApp.js +197 -75
  28. package/es/core/models/TopoGraphView.js +20 -10
  29. package/es/core/models/cache/CiCache.js +12 -6
  30. package/es/core/models/cache/CiTypeCache.js +20 -10
  31. package/es/core/models/cache/DictCache.js +10 -6
  32. package/es/core/models/graph/Background.js +9 -6
  33. package/es/core/models/plugins/resourceWebControllUrl.js +21 -8
  34. package/es/core/models/tagstips/ElementTagTipConfig.js +20 -10
  35. package/es/core/models/topoData.js +7 -5
  36. package/es/core/models/utils/linkUtils.js +8 -5
  37. package/es/core/services/cmdb/metric.js +7 -5
  38. package/es/core/services/cmdb.js +7 -5
  39. package/es/core/services/index.js +23 -9
  40. package/es/core/services/topo/tagtip.js +7 -5
  41. package/es/core/store/models/customIcon.js +11 -6
  42. package/es/core/utils/imageUtil.js +7 -5
  43. package/es/core/utils/saveSerialize.js +7 -5
  44. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
  45. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -18
  46. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
  47. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +47 -34
  48. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
  49. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +74 -34
  50. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +29 -24
  51. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
  52. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -26
  53. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +15 -7
  54. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
  55. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
  56. package/es/networkTopo/components/Link/hook.js +21 -14
  57. package/es/networkTopo/components/Link/index.js +32 -18
  58. package/es/networkTopo/components/Link/setting.js +8 -6
  59. package/es/networkTopo/getTopoData.js +23 -10
  60. package/es/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
  61. package/es/networkTopo/models/TopoCenter.js +24 -10
  62. package/es/networkTopo/services/cmdb.js +333 -233
  63. package/es/networkTopo/services/mdc.js +24 -15
  64. package/es/networkTopo/services/metric.js +16 -11
  65. package/es/networkTopo/services/model.js +412 -283
  66. package/es/networkTopo/utils/exportData.js +7 -5
  67. package/lib/components/MultiResourceDrawer/index.js +8 -6
  68. package/lib/components/ResourceList/ResourceSelect.js +8 -6
  69. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
  70. package/lib/components/SingleResourceDrawer/SelectDrawer.js +8 -6
  71. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
  72. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
  73. package/lib/core/editor/components/BackgroundView/index.js +74 -55
  74. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
  75. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -4
  76. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
  77. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
  78. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
  79. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
  80. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
  81. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
  82. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
  83. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
  84. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
  85. package/lib/core/hooks/usePolling.js +21 -13
  86. package/lib/core/hooks/useResourceConfig.js +37 -21
  87. package/lib/core/hooks/useTopoEdit.js +215 -147
  88. package/lib/core/models/Alarm.js +104 -38
  89. package/lib/core/models/AttributeMetricDisplay.js +36 -14
  90. package/lib/core/models/TopoApp.js +197 -75
  91. package/lib/core/models/TopoGraphView.js +20 -10
  92. package/lib/core/models/cache/CiCache.js +12 -6
  93. package/lib/core/models/cache/CiTypeCache.js +20 -10
  94. package/lib/core/models/cache/DictCache.js +10 -6
  95. package/lib/core/models/graph/Background.js +9 -6
  96. package/lib/core/models/plugins/resourceWebControllUrl.js +21 -8
  97. package/lib/core/models/tagstips/ElementTagTipConfig.js +20 -10
  98. package/lib/core/models/topoData.js +7 -4
  99. package/lib/core/models/utils/linkUtils.js +8 -4
  100. package/lib/core/services/cmdb/metric.js +7 -4
  101. package/lib/core/services/cmdb.js +7 -4
  102. package/lib/core/services/index.js +21 -8
  103. package/lib/core/services/topo/tagtip.js +7 -4
  104. package/lib/core/store/models/customIcon.js +11 -6
  105. package/lib/core/utils/imageUtil.js +7 -4
  106. package/lib/core/utils/saveSerialize.js +7 -4
  107. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
  108. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -19
  109. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
  110. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +49 -36
  111. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
  112. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +73 -35
  113. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +29 -24
  114. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
  115. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -25
  116. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +14 -6
  117. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
  118. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
  119. package/lib/networkTopo/components/Link/hook.js +23 -15
  120. package/lib/networkTopo/components/Link/index.js +32 -18
  121. package/lib/networkTopo/components/Link/setting.js +8 -6
  122. package/lib/networkTopo/getTopoData.js +23 -10
  123. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
  124. package/lib/networkTopo/models/TopoCenter.js +24 -10
  125. package/lib/networkTopo/services/cmdb.js +336 -235
  126. package/lib/networkTopo/services/mdc.js +24 -14
  127. package/lib/networkTopo/services/metric.js +16 -10
  128. package/lib/networkTopo/services/model.js +414 -284
  129. package/lib/networkTopo/utils/exportData.js +7 -4
  130. package/lib/utils/htElementDataUtil.js +4 -2
  131. package/package.json +3 -3
@@ -19,8 +19,6 @@ import { mergeExportLinkData } from "../models/utils/linkUtils";
19
19
  import { isUniqueIp, buildIpNode } from "../../networkTopo/utils/exitLinkUtil";
20
20
 
21
21
  var useTopoEdit = function useTopoEdit(params) {
22
- var _ref2, _ref3, _ref4, _bindGroupResources, _addGroupResources, _bindViewResources, _addLayerResources, _addResourceToFirstLayer, _ref5, _ref6, _ref8, _relateNodeIp;
23
-
24
22
  var topo = params.topo,
25
23
  topoId = params.topoId,
26
24
  isEditing = params.isEditing,
@@ -74,8 +72,8 @@ var useTopoEdit = function useTopoEdit(params) {
74
72
  setShowComboResDrawer(true);
75
73
  };
76
74
 
77
- var onLayerAdded = function onLayerAdded(_x) {
78
- return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
75
+ var onLayerAdded = /*#__PURE__*/function () {
76
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
79
77
  var target, direction, config;
80
78
  return _regeneratorRuntime.wrap(function _callee$(_context) {
81
79
  while (1) switch (_context.prev = _context.next) {
@@ -108,11 +106,15 @@ var useTopoEdit = function useTopoEdit(params) {
108
106
  return _context.stop();
109
107
  }
110
108
  }, _callee);
111
- }))).apply(this, arguments);
112
- };
109
+ }));
113
110
 
114
- var deleteLayer = function deleteLayer(_x2) {
115
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
111
+ return function onLayerAdded(_x) {
112
+ return _ref2.apply(this, arguments);
113
+ };
114
+ }();
115
+
116
+ var deleteLayer = /*#__PURE__*/function () {
117
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
116
118
  var config;
117
119
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
118
120
  while (1) switch (_context2.prev = _context2.next) {
@@ -149,12 +151,14 @@ var useTopoEdit = function useTopoEdit(params) {
149
151
  return _context2.stop();
150
152
  }
151
153
  }, _callee2);
152
- }))).apply(this, arguments);
153
- };
154
+ }));
154
155
 
155
- var handleDeleteLayer = function handleDeleteLayer(layerElement) {
156
- var _onOk;
156
+ return function deleteLayer(_x2) {
157
+ return _ref3.apply(this, arguments);
158
+ };
159
+ }();
157
160
 
161
+ var handleDeleteLayer = function handleDeleteLayer(layerElement) {
158
162
  var hasChildren = !!layerElement.getChildren().toArray().length;
159
163
 
160
164
  if (!hasChildren) {
@@ -172,8 +176,8 @@ var useTopoEdit = function useTopoEdit(params) {
172
176
  messageProps: {
173
177
  type: "warning"
174
178
  },
175
- onOk: function onOk() {
176
- return (_onOk = _onOk || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
179
+ onOk: function () {
180
+ var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
177
181
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
178
182
  while (1) switch (_context3.prev = _context3.next) {
179
183
  case 0:
@@ -184,8 +188,14 @@ var useTopoEdit = function useTopoEdit(params) {
184
188
  return _context3.stop();
185
189
  }
186
190
  }, _callee3);
187
- }))).apply(this, arguments);
188
- }
191
+ }));
192
+
193
+ function onOk() {
194
+ return _onOk.apply(this, arguments);
195
+ }
196
+
197
+ return onOk;
198
+ }()
189
199
  });
190
200
  }; // const deleteGroupFooterBtn = () => {
191
201
  // return (
@@ -335,8 +345,8 @@ var useTopoEdit = function useTopoEdit(params) {
335
345
  }; // 删除关联在节点上的出口链路
336
346
 
337
347
 
338
- var deleteExLink = function deleteExLink(_x3) {
339
- return (_ref4 = _ref4 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
348
+ var deleteExLink = /*#__PURE__*/function () {
349
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
340
350
  var _node$getEdges$toArra, _node$getEdges;
341
351
 
342
352
  var config, edges, exportLinkIdList;
@@ -370,8 +380,12 @@ var useTopoEdit = function useTopoEdit(params) {
370
380
  return _context4.stop();
371
381
  }
372
382
  }, _callee4);
373
- }))).apply(this, arguments);
374
- };
383
+ }));
384
+
385
+ return function deleteExLink(_x3) {
386
+ return _ref4.apply(this, arguments);
387
+ };
388
+ }();
375
389
 
376
390
  var onDeleteElement = function onDeleteElement(data) {
377
391
  var dtype = data.dtype;
@@ -446,25 +460,29 @@ var useTopoEdit = function useTopoEdit(params) {
446
460
 
447
461
 
448
462
  function bindGroupResources(_x4, _x5) {
449
- return (_bindGroupResources = _bindGroupResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(group, resources) {
450
- var id, tag, _yield$editDispatcher, elements, nodeElements, newLinkElements, updateElements;
463
+ return _bindGroupResources.apply(this, arguments);
464
+ }
451
465
 
452
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
453
- while (1) switch (_context5.prev = _context5.next) {
466
+ function _bindGroupResources() {
467
+ _bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(group, resources) {
468
+ var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
469
+
470
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
471
+ while (1) switch (_context10.prev = _context10.next) {
454
472
  case 0:
455
473
  id = group.id, tag = group.tag;
456
474
  rlog.debug("bindGroupResources--id, tag", id, tag);
457
475
  topo.historyManager.beginTransaction();
458
- _context5.next = 5;
476
+ _context10.next = 5;
459
477
  return resourceConfig.updateGroupResources(group, resources);
460
478
 
461
479
  case 5:
462
- _context5.next = 7;
480
+ _context10.next = 7;
463
481
  return editDispatchers.fetchDataByConfig();
464
482
 
465
483
  case 7:
466
- _yield$editDispatcher = _context5.sent;
467
- elements = _yield$editDispatcher.elements;
484
+ _yield$editDispatcher2 = _context10.sent;
485
+ elements = _yield$editDispatcher2.elements;
468
486
  // 区域里的子区域及子区域的节点、新增的链路
469
487
  nodeElements = findGroupChildren(elements, group);
470
488
  newLinkElements = findUNExistedLinkElements(elements);
@@ -482,17 +500,26 @@ var useTopoEdit = function useTopoEdit(params) {
482
500
 
483
501
  case 14:
484
502
  case "end":
485
- return _context5.stop();
503
+ return _context10.stop();
486
504
  }
487
- }, _callee5);
488
- }))).apply(this, arguments);
505
+ }, _callee10);
506
+ }));
507
+ return _bindGroupResources.apply(this, arguments);
489
508
  }
490
509
 
491
510
  function addGroupResources(_x6, _x7) {
492
- return (_addGroupResources = _addGroupResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(group, newResourceIds) {
511
+ return _addGroupResources.apply(this, arguments);
512
+ }
513
+ /**
514
+ * 关联视图的资源
515
+ */
516
+
517
+
518
+ function _addGroupResources() {
519
+ _addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, newResourceIds) {
493
520
  var groupConfig, resources, groupData;
494
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
495
- while (1) switch (_context6.prev = _context6.next) {
521
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
522
+ while (1) switch (_context11.prev = _context11.next) {
496
523
  case 0:
497
524
  groupConfig = resourceConfig.getGroupConfigByElement(group);
498
525
  resources = {
@@ -502,80 +529,90 @@ var useTopoEdit = function useTopoEdit(params) {
502
529
  id: group.getTag(),
503
530
  tag: group.a("tag")
504
531
  };
505
- _context6.next = 5;
532
+ _context11.next = 5;
506
533
  return bindGroupResources(groupData, resources);
507
534
 
508
535
  case 5:
509
536
  case "end":
510
- return _context6.stop();
537
+ return _context11.stop();
511
538
  }
512
- }, _callee6);
513
- }))).apply(this, arguments);
539
+ }, _callee11);
540
+ }));
541
+ return _addGroupResources.apply(this, arguments);
542
+ }
543
+
544
+ function bindViewResources(_x8) {
545
+ return _bindViewResources.apply(this, arguments);
514
546
  }
515
547
  /**
516
- * 关联视图的资源
548
+ * 分层添加资源
549
+ * @param group
550
+ * @param newResourceIds 新增的资源id列表
551
+ * @return {Promise<void>}
517
552
  */
518
553
 
519
554
 
520
- function bindViewResources(_x8) {
521
- return (_bindViewResources = _bindViewResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
522
- var config, _yield$editDispatcher2, elements;
555
+ function _bindViewResources() {
556
+ _bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
557
+ var config, result, _elements;
523
558
 
524
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
525
- while (1) switch (_context7.prev = _context7.next) {
559
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
560
+ while (1) switch (_context12.prev = _context12.next) {
526
561
  case 0:
527
562
  // console.log("关联视图的资源", data);
528
563
  config = resourceConfig.getConfig();
529
564
  config.resources = data;
530
- _context7.next = 4;
565
+ _context12.next = 4;
531
566
  return resourceConfig.updateConfig(config);
532
567
 
533
568
  case 4:
534
- _context7.next = 6;
569
+ _context12.next = 6;
535
570
  return editDispatchers.fetchDataByConfig();
536
571
 
537
572
  case 6:
538
- _yield$editDispatcher2 = _context7.sent;
539
- elements = _yield$editDispatcher2.elements;
540
- saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
573
+ result = _context12.sent;
574
+ console.log("fetchDataByConfig", result);
541
575
 
542
- if (topo.linkDynamicStyleExecutor) {
543
- topo.linkDynamicStyleExecutor.execute();
576
+ if (result) {
577
+ _elements = result.elements;
578
+ saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
579
+
580
+ if (topo.linkDynamicStyleExecutor) {
581
+ topo.linkDynamicStyleExecutor.execute();
582
+ }
544
583
  }
545
584
 
546
- case 10:
585
+ case 9:
547
586
  case "end":
548
- return _context7.stop();
587
+ return _context12.stop();
549
588
  }
550
- }, _callee7);
551
- }))).apply(this, arguments);
589
+ }, _callee12);
590
+ }));
591
+ return _bindViewResources.apply(this, arguments);
552
592
  }
553
- /**
554
- * 分层添加资源
555
- * @param group
556
- * @param newResourceIds 新增的资源id列表
557
- * @return {Promise<void>}
558
- */
559
-
560
593
 
561
594
  function addLayerResources(_x9, _x10) {
562
- return (_addLayerResources = _addLayerResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(group, newResourceIds) {
595
+ return _addLayerResources.apply(this, arguments);
596
+ }
597
+
598
+ function _addLayerResources() {
599
+ _addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
563
600
  var _yield$editDispatcher3, elements, newElements;
564
601
 
565
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
566
- while (1) switch (_context8.prev = _context8.next) {
602
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
603
+ while (1) switch (_context13.prev = _context13.next) {
567
604
  case 0:
568
605
  topo.historyManager.beginTransaction(); // 构造新的配置
569
606
 
570
- _context8.next = 3;
607
+ _context13.next = 3;
571
608
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
572
609
 
573
610
  case 3:
574
- _context8.next = 5;
611
+ _context13.next = 5;
575
612
  return editDispatchers.fetchDataByConfig();
576
613
 
577
614
  case 5:
578
- _yield$editDispatcher3 = _context8.sent;
615
+ _yield$editDispatcher3 = _context13.sent;
579
616
  elements = _yield$editDispatcher3.elements;
580
617
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
581
618
  newElements = findUNExistedElements(elements);
@@ -598,28 +635,34 @@ var useTopoEdit = function useTopoEdit(params) {
598
635
 
599
636
  case 14:
600
637
  case "end":
601
- return _context8.stop();
638
+ return _context13.stop();
602
639
  }
603
- }, _callee8);
604
- }))).apply(this, arguments);
640
+ }, _callee13);
641
+ }));
642
+ return _addLayerResources.apply(this, arguments);
605
643
  }
606
644
 
607
645
  function addResourceToFirstLayer(_x11) {
608
- return (_addResourceToFirstLayer = _addResourceToFirstLayer || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
646
+ return _addResourceToFirstLayer.apply(this, arguments);
647
+ }
648
+
649
+ function _addResourceToFirstLayer() {
650
+ _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
609
651
  var group;
610
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
611
- while (1) switch (_context9.prev = _context9.next) {
652
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
653
+ while (1) switch (_context14.prev = _context14.next) {
612
654
  case 0:
613
655
  group = resourceConfig.getGroups()[0];
614
- _context9.next = 3;
656
+ _context14.next = 3;
615
657
  return addLayerResources(group, data);
616
658
 
617
659
  case 3:
618
660
  case "end":
619
- return _context9.stop();
661
+ return _context14.stop();
620
662
  }
621
- }, _callee9);
622
- }))).apply(this, arguments);
663
+ }, _callee14);
664
+ }));
665
+ return _addResourceToFirstLayer.apply(this, arguments);
623
666
  }
624
667
 
625
668
  function getAddResourceType() {
@@ -648,28 +691,28 @@ var useTopoEdit = function useTopoEdit(params) {
648
691
  */
649
692
 
650
693
 
651
- var onSaveComboRes = function onSaveComboRes(_x12) {
652
- return (_ref5 = _ref5 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(data) {
653
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
654
- while (1) switch (_context10.prev = _context10.next) {
694
+ var onSaveComboRes = /*#__PURE__*/function () {
695
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
696
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
697
+ while (1) switch (_context5.prev = _context5.next) {
655
698
  case 0:
656
699
  rlog.debug("关联资源-----onSaveComboRes", data);
657
700
  topo.historyManager.beginTransaction();
658
701
 
659
702
  if (!(getAddResourceType() === "addToFirstLayer")) {
660
- _context10.next = 7;
703
+ _context5.next = 7;
661
704
  break;
662
705
  }
663
706
 
664
- _context10.next = 5;
707
+ _context5.next = 5;
665
708
  return addResourceToFirstLayer(data);
666
709
 
667
710
  case 5:
668
- _context10.next = 9;
711
+ _context5.next = 9;
669
712
  break;
670
713
 
671
714
  case 7:
672
- _context10.next = 9;
715
+ _context5.next = 9;
673
716
  return bindViewResources(data);
674
717
 
675
718
  case 9:
@@ -681,30 +724,34 @@ var useTopoEdit = function useTopoEdit(params) {
681
724
 
682
725
  case 12:
683
726
  case "end":
684
- return _context10.stop();
727
+ return _context5.stop();
685
728
  }
686
- }, _callee10);
687
- }))).apply(this, arguments);
688
- };
729
+ }, _callee5);
730
+ }));
731
+
732
+ return function onSaveComboRes(_x12) {
733
+ return _ref5.apply(this, arguments);
734
+ };
735
+ }();
689
736
 
690
- var onSaveTopo = function onSaveTopo(_x13) {
691
- return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
692
- var id, config, serialize, _config$layout, template, layout, _ref7, saveConfig;
737
+ var onSaveTopo = /*#__PURE__*/function () {
738
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
739
+ var id, config, serialize, _config$layout, template, layout, saveConfig;
693
740
 
694
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
695
- while (1) switch (_context12.prev = _context12.next) {
741
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
742
+ while (1) switch (_context7.prev = _context7.next) {
696
743
  case 0:
697
744
  id = data.id, config = data.config, serialize = data.serialize;
698
745
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
699
746
 
700
747
  if (onSave) {
701
748
  // 自定义保存
702
- saveConfig = function saveConfig() {
703
- return (_ref7 = _ref7 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
704
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
705
- while (1) switch (_context11.prev = _context11.next) {
749
+ saveConfig = /*#__PURE__*/function () {
750
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
751
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
752
+ while (1) switch (_context6.prev = _context6.next) {
706
753
  case 0:
707
- _context11.next = 2;
754
+ _context6.next = 2;
708
755
  return editDispatchers.saveTopo({
709
756
  id: id,
710
757
  layout: layout,
@@ -713,11 +760,15 @@ var useTopoEdit = function useTopoEdit(params) {
713
760
 
714
761
  case 2:
715
762
  case "end":
716
- return _context11.stop();
763
+ return _context6.stop();
717
764
  }
718
- }, _callee11);
719
- }))).apply(this, arguments);
720
- };
765
+ }, _callee6);
766
+ }));
767
+
768
+ return function saveConfig() {
769
+ return _ref7.apply(this, arguments);
770
+ };
771
+ }();
721
772
 
722
773
  onSave({
723
774
  topo: topo,
@@ -728,11 +779,15 @@ var useTopoEdit = function useTopoEdit(params) {
728
779
 
729
780
  case 3:
730
781
  case "end":
731
- return _context12.stop();
782
+ return _context7.stop();
732
783
  }
733
- }, _callee12);
734
- }))).apply(this, arguments);
735
- };
784
+ }, _callee7);
785
+ }));
786
+
787
+ return function onSaveTopo(_x13) {
788
+ return _ref6.apply(this, arguments);
789
+ };
790
+ }();
736
791
 
737
792
  var saveBind = function saveBind(type, data) {
738
793
  var eventData = {
@@ -755,14 +810,12 @@ var useTopoEdit = function useTopoEdit(params) {
755
810
  */
756
811
 
757
812
 
758
- var bindNodeResource = function bindNodeResource(_x14) {
759
- return (_ref8 = _ref8 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
760
- var _doBind;
813
+ var bindNodeResource = /*#__PURE__*/function () {
814
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(params) {
815
+ var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
761
816
 
762
- var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher4, elements, newData, doBind, replaceOrAddRes;
763
-
764
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
765
- while (1) switch (_context14.prev = _context14.next) {
817
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
818
+ while (1) switch (_context9.prev = _context9.next) {
766
819
  case 0:
767
820
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
768
821
  return _extends({}, resources, {
@@ -772,11 +825,11 @@ var useTopoEdit = function useTopoEdit(params) {
772
825
  });
773
826
  };
774
827
 
775
- doBind = function _doBind2() {
776
- return (_doBind = _doBind || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
828
+ _doBind = function _doBind3() {
829
+ _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
777
830
  var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
778
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
779
- while (1) switch (_context13.prev = _context13.next) {
831
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
832
+ while (1) switch (_context8.prev = _context8.next) {
780
833
  case 0:
781
834
  dm = htTopo.getGraphView().dm(); // 创建
782
835
 
@@ -845,7 +898,7 @@ var useTopoEdit = function useTopoEdit(params) {
845
898
  // node.a("customName", null);
846
899
  // 删除关联在节点上的出口链路
847
900
 
848
- _context13.next = 12;
901
+ _context8.next = 12;
849
902
  return deleteExLink(node);
850
903
 
851
904
  case 12:
@@ -856,10 +909,15 @@ var useTopoEdit = function useTopoEdit(params) {
856
909
 
857
910
  case 13:
858
911
  case "end":
859
- return _context13.stop();
912
+ return _context8.stop();
860
913
  }
861
- }, _callee13);
862
- }))).apply(this, arguments);
914
+ }, _callee8);
915
+ }));
916
+ return _doBind.apply(this, arguments);
917
+ };
918
+
919
+ doBind = function _doBind2() {
920
+ return _doBind.apply(this, arguments);
863
921
  };
864
922
 
865
923
  topo.historyManager.beginTransaction();
@@ -893,22 +951,22 @@ var useTopoEdit = function useTopoEdit(params) {
893
951
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
894
952
  }
895
953
 
896
- _context14.next = 12;
954
+ _context9.next = 13;
897
955
  return resourceConfig.updateConfig(config);
898
956
 
899
- case 12:
900
- _context14.next = 14;
957
+ case 13:
958
+ _context9.next = 15;
901
959
  return editDispatchers.fetchDataByConfig();
902
960
 
903
- case 14:
904
- _yield$editDispatcher4 = _context14.sent;
905
- elements = _yield$editDispatcher4.elements;
961
+ case 15:
962
+ _yield$editDispatcher = _context9.sent;
963
+ elements = _yield$editDispatcher.elements;
906
964
  newData = elements.find(function (item) {
907
965
  return item.id === newResId;
908
966
  });
909
967
 
910
968
  if (newData) {
911
- _context14.next = 22;
969
+ _context9.next = 23;
912
970
  break;
913
971
  }
914
972
 
@@ -916,30 +974,38 @@ var useTopoEdit = function useTopoEdit(params) {
916
974
 
917
975
  rlog.warn("关联资源失败");
918
976
  topo.historyManager.endTransaction();
919
- return _context14.abrupt("return", false);
977
+ return _context9.abrupt("return", false);
920
978
 
921
- case 22:
922
- _context14.next = 24;
979
+ case 23:
980
+ _context9.next = 25;
923
981
  return doBind();
924
982
 
925
- case 24:
983
+ case 25:
926
984
  topo.historyManager.endTransaction();
927
985
 
928
- case 25:
986
+ case 26:
929
987
  case "end":
930
- return _context14.stop();
988
+ return _context9.stop();
931
989
  }
932
- }, _callee14);
933
- }))).apply(this, arguments);
934
- };
990
+ }, _callee9);
991
+ }));
992
+
993
+ return function bindNodeResource(_x14) {
994
+ return _ref8.apply(this, arguments);
995
+ };
996
+ }();
935
997
  /**
936
998
  * 关联IP的图片节点
937
999
  */
938
1000
 
939
1001
 
940
1002
  function relateNodeIp(_x15, _x16) {
941
- return (_relateNodeIp = _relateNodeIp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
942
- var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1003
+ return _relateNodeIp.apply(this, arguments);
1004
+ }
1005
+
1006
+ function _relateNodeIp() {
1007
+ _relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
1008
+ var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
943
1009
 
944
1010
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
945
1011
  while (1) switch (_context15.prev = _context15.next) {
@@ -961,7 +1027,7 @@ var useTopoEdit = function useTopoEdit(params) {
961
1027
  isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
962
1028
 
963
1029
  if (!isUnique) {
964
- _context15.next = 23;
1030
+ _context15.next = 24;
965
1031
  break;
966
1032
  }
967
1033
 
@@ -985,8 +1051,8 @@ var useTopoEdit = function useTopoEdit(params) {
985
1051
  case 16:
986
1052
  configData = _context15.sent;
987
1053
  // console.log("configData",configObj, configData);
988
- _elements = configData.elements;
989
- newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
1054
+ _elements2 = configData.elements;
1055
+ newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
990
1056
 
991
1057
  newLink = newLinkElements.filter(function (item) {
992
1058
  return item.type === "link";
@@ -1001,7 +1067,8 @@ var useTopoEdit = function useTopoEdit(params) {
1001
1067
  nodes: [],
1002
1068
  links: newLink,
1003
1069
  linkGroups: newLinkGroup
1004
- }; // console.log("createElementsData", createElementsData);
1070
+ };
1071
+ console.log("createElementsData", createElementsData);
1005
1072
 
1006
1073
  if ([].concat(newLink, newLinkGroup).length > 0) {
1007
1074
  _htTopo = topo.getHtTopo();
@@ -1009,12 +1076,13 @@ var useTopoEdit = function useTopoEdit(params) {
1009
1076
  _htTopo.createElements(createElementsData);
1010
1077
  }
1011
1078
 
1012
- case 23:
1079
+ case 24:
1013
1080
  case "end":
1014
1081
  return _context15.stop();
1015
1082
  }
1016
1083
  }, _callee15);
1017
- }))).apply(this, arguments);
1084
+ }));
1085
+ return _relateNodeIp.apply(this, arguments);
1018
1086
  }
1019
1087
 
1020
1088
  var onEvent = function onEvent(e) {