@riil-frontend/component-topology 11.0.35 → 12.0.0-dev.1

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 (139) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.js +45 -29
  4. package/es/components/BatchAttrMetric/setting.js +1 -1
  5. package/es/components/MultiResourceDrawer/index.js +8 -6
  6. package/es/components/ResourceList/ResourceSelect.js +8 -7
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
  8. package/es/components/SingleResourceDrawer/SelectDrawer.js +8 -6
  9. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
  10. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
  11. package/es/core/editor/components/BackgroundView/index.js +73 -54
  12. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
  13. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -5
  14. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
  15. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
  16. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
  17. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
  18. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
  19. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
  20. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
  21. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
  22. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
  23. package/es/core/editor/hooks/useKeyboardShortcut.js +36 -32
  24. package/es/core/editor/utils/copyElementUtil.js +171 -0
  25. package/es/core/hooks/usePolling.js +21 -13
  26. package/es/core/hooks/useResourceConfig.js +37 -21
  27. package/es/core/hooks/useTopoEdit.js +202 -139
  28. package/es/core/models/Alarm.js +104 -38
  29. package/es/core/models/AttributeMetricDisplay.js +36 -14
  30. package/es/core/models/TopoApp.js +197 -75
  31. package/es/core/models/TopoGraphView.js +20 -10
  32. package/es/core/models/cache/CiCache.js +12 -6
  33. package/es/core/models/cache/CiTypeCache.js +20 -10
  34. package/es/core/models/cache/DictCache.js +10 -6
  35. package/es/core/models/graph/Background.js +9 -6
  36. package/es/core/models/plugins/resourceWebControllUrl.js +21 -8
  37. package/es/core/models/tagstips/ElementTagTipConfig.js +20 -10
  38. package/es/core/models/topoData.js +7 -5
  39. package/es/core/models/utils/linkUtils.js +8 -5
  40. package/es/core/services/cmdb/metric.js +7 -5
  41. package/es/core/services/cmdb.js +9 -5
  42. package/es/core/services/index.js +23 -9
  43. package/es/core/services/topo/tagtip.js +7 -5
  44. package/es/core/store/models/customIcon.js +11 -6
  45. package/es/core/utils/imageUtil.js +7 -5
  46. package/es/core/utils/metricUtil.js +5 -0
  47. package/es/core/utils/saveSerialize.js +7 -5
  48. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
  49. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +8 -5
  50. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
  51. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +47 -34
  52. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
  53. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +74 -34
  54. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +9 -6
  55. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
  56. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -26
  57. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +15 -7
  58. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
  59. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
  60. package/es/networkTopo/components/Link/hook.js +21 -14
  61. package/es/networkTopo/components/Link/index.js +32 -18
  62. package/es/networkTopo/components/Link/setting.js +8 -6
  63. package/es/networkTopo/getTopoData.js +23 -10
  64. package/es/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
  65. package/es/networkTopo/models/TopoCenter.js +24 -10
  66. package/es/networkTopo/services/cmdb.js +333 -233
  67. package/es/networkTopo/services/mdc.js +24 -15
  68. package/es/networkTopo/services/metric.js +16 -11
  69. package/es/networkTopo/services/model.js +412 -283
  70. package/es/networkTopo/utils/exportData.js +7 -5
  71. package/lib/components/BatchAttrMetric/setting.js +1 -1
  72. package/lib/components/MultiResourceDrawer/index.js +8 -6
  73. package/lib/components/ResourceList/ResourceSelect.js +8 -6
  74. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
  75. package/lib/components/SingleResourceDrawer/SelectDrawer.js +8 -6
  76. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
  77. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
  78. package/lib/core/editor/components/BackgroundView/index.js +74 -55
  79. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
  80. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -4
  81. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
  82. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
  83. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
  84. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
  85. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
  86. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
  87. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
  88. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
  89. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
  90. package/lib/core/editor/hooks/useKeyboardShortcut.js +37 -34
  91. package/lib/core/editor/utils/copyElementUtil.js +182 -0
  92. package/lib/core/hooks/usePolling.js +21 -13
  93. package/lib/core/hooks/useResourceConfig.js +37 -21
  94. package/lib/core/hooks/useTopoEdit.js +202 -139
  95. package/lib/core/models/Alarm.js +104 -38
  96. package/lib/core/models/AttributeMetricDisplay.js +36 -14
  97. package/lib/core/models/TopoApp.js +197 -75
  98. package/lib/core/models/TopoGraphView.js +20 -10
  99. package/lib/core/models/cache/CiCache.js +12 -6
  100. package/lib/core/models/cache/CiTypeCache.js +20 -10
  101. package/lib/core/models/cache/DictCache.js +10 -6
  102. package/lib/core/models/graph/Background.js +9 -6
  103. package/lib/core/models/plugins/resourceWebControllUrl.js +21 -8
  104. package/lib/core/models/tagstips/ElementTagTipConfig.js +20 -10
  105. package/lib/core/models/topoData.js +7 -4
  106. package/lib/core/models/utils/linkUtils.js +8 -4
  107. package/lib/core/services/cmdb/metric.js +7 -4
  108. package/lib/core/services/cmdb.js +9 -4
  109. package/lib/core/services/index.js +21 -8
  110. package/lib/core/services/topo/tagtip.js +7 -4
  111. package/lib/core/store/models/customIcon.js +11 -6
  112. package/lib/core/utils/imageUtil.js +7 -4
  113. package/lib/core/utils/metricUtil.js +5 -0
  114. package/lib/core/utils/saveSerialize.js +7 -4
  115. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
  116. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +9 -6
  117. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
  118. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +49 -36
  119. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
  120. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +73 -35
  121. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +9 -6
  122. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
  123. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -25
  124. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +14 -6
  125. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
  126. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
  127. package/lib/networkTopo/components/Link/hook.js +23 -15
  128. package/lib/networkTopo/components/Link/index.js +32 -18
  129. package/lib/networkTopo/components/Link/setting.js +8 -6
  130. package/lib/networkTopo/getTopoData.js +23 -10
  131. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
  132. package/lib/networkTopo/models/TopoCenter.js +24 -10
  133. package/lib/networkTopo/services/cmdb.js +336 -235
  134. package/lib/networkTopo/services/mdc.js +24 -14
  135. package/lib/networkTopo/services/metric.js +16 -10
  136. package/lib/networkTopo/services/model.js +414 -284
  137. package/lib/networkTopo/utils/exportData.js +7 -4
  138. package/lib/utils/htElementDataUtil.js +4 -2
  139. package/package.json +3 -2
@@ -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
+ }));
110
+
111
+ return function onLayerAdded(_x) {
112
+ return _ref2.apply(this, arguments);
113
+ };
114
+ }();
113
115
 
114
- var deleteLayer = function deleteLayer(_x2) {
115
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
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,41 +529,49 @@ 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, _yield$editDispatcher3, 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;
573
+ _yield$editDispatcher3 = _context12.sent;
574
+ elements = _yield$editDispatcher3.elements;
540
575
  saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
541
576
 
542
577
  if (topo.linkDynamicStyleExecutor) {
@@ -545,38 +580,36 @@ var useTopoEdit = function useTopoEdit(params) {
545
580
 
546
581
  case 10:
547
582
  case "end":
548
- return _context7.stop();
583
+ return _context12.stop();
549
584
  }
550
- }, _callee7);
551
- }))).apply(this, arguments);
585
+ }, _callee12);
586
+ }));
587
+ return _bindViewResources.apply(this, arguments);
552
588
  }
553
- /**
554
- * 分层添加资源
555
- * @param group
556
- * @param newResourceIds 新增的资源id列表
557
- * @return {Promise<void>}
558
- */
559
-
560
589
 
561
590
  function addLayerResources(_x9, _x10) {
562
- return (_addLayerResources = _addLayerResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(group, newResourceIds) {
563
- var _yield$editDispatcher3, elements, newElements;
591
+ return _addLayerResources.apply(this, arguments);
592
+ }
593
+
594
+ function _addLayerResources() {
595
+ _addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
596
+ var _yield$editDispatcher4, elements, newElements;
564
597
 
565
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
566
- while (1) switch (_context8.prev = _context8.next) {
598
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
599
+ while (1) switch (_context13.prev = _context13.next) {
567
600
  case 0:
568
601
  topo.historyManager.beginTransaction(); // 构造新的配置
569
602
 
570
- _context8.next = 3;
603
+ _context13.next = 3;
571
604
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
572
605
 
573
606
  case 3:
574
- _context8.next = 5;
607
+ _context13.next = 5;
575
608
  return editDispatchers.fetchDataByConfig();
576
609
 
577
610
  case 5:
578
- _yield$editDispatcher3 = _context8.sent;
579
- elements = _yield$editDispatcher3.elements;
611
+ _yield$editDispatcher4 = _context13.sent;
612
+ elements = _yield$editDispatcher4.elements;
580
613
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
581
614
  newElements = findUNExistedElements(elements);
582
615
  rlog.debug("添加分层资源", {
@@ -598,28 +631,34 @@ var useTopoEdit = function useTopoEdit(params) {
598
631
 
599
632
  case 14:
600
633
  case "end":
601
- return _context8.stop();
634
+ return _context13.stop();
602
635
  }
603
- }, _callee8);
604
- }))).apply(this, arguments);
636
+ }, _callee13);
637
+ }));
638
+ return _addLayerResources.apply(this, arguments);
605
639
  }
606
640
 
607
641
  function addResourceToFirstLayer(_x11) {
608
- return (_addResourceToFirstLayer = _addResourceToFirstLayer || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
642
+ return _addResourceToFirstLayer.apply(this, arguments);
643
+ }
644
+
645
+ function _addResourceToFirstLayer() {
646
+ _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
609
647
  var group;
610
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
611
- while (1) switch (_context9.prev = _context9.next) {
648
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
649
+ while (1) switch (_context14.prev = _context14.next) {
612
650
  case 0:
613
651
  group = resourceConfig.getGroups()[0];
614
- _context9.next = 3;
652
+ _context14.next = 3;
615
653
  return addLayerResources(group, data);
616
654
 
617
655
  case 3:
618
656
  case "end":
619
- return _context9.stop();
657
+ return _context14.stop();
620
658
  }
621
- }, _callee9);
622
- }))).apply(this, arguments);
659
+ }, _callee14);
660
+ }));
661
+ return _addResourceToFirstLayer.apply(this, arguments);
623
662
  }
624
663
 
625
664
  function getAddResourceType() {
@@ -648,28 +687,28 @@ var useTopoEdit = function useTopoEdit(params) {
648
687
  */
649
688
 
650
689
 
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) {
690
+ var onSaveComboRes = /*#__PURE__*/function () {
691
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
692
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
693
+ while (1) switch (_context5.prev = _context5.next) {
655
694
  case 0:
656
695
  rlog.debug("关联资源-----onSaveComboRes", data);
657
696
  topo.historyManager.beginTransaction();
658
697
 
659
698
  if (!(getAddResourceType() === "addToFirstLayer")) {
660
- _context10.next = 7;
699
+ _context5.next = 7;
661
700
  break;
662
701
  }
663
702
 
664
- _context10.next = 5;
703
+ _context5.next = 5;
665
704
  return addResourceToFirstLayer(data);
666
705
 
667
706
  case 5:
668
- _context10.next = 9;
707
+ _context5.next = 9;
669
708
  break;
670
709
 
671
710
  case 7:
672
- _context10.next = 9;
711
+ _context5.next = 9;
673
712
  return bindViewResources(data);
674
713
 
675
714
  case 9:
@@ -681,30 +720,34 @@ var useTopoEdit = function useTopoEdit(params) {
681
720
 
682
721
  case 12:
683
722
  case "end":
684
- return _context10.stop();
723
+ return _context5.stop();
685
724
  }
686
- }, _callee10);
687
- }))).apply(this, arguments);
688
- };
725
+ }, _callee5);
726
+ }));
689
727
 
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;
728
+ return function onSaveComboRes(_x12) {
729
+ return _ref5.apply(this, arguments);
730
+ };
731
+ }();
693
732
 
694
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
695
- while (1) switch (_context12.prev = _context12.next) {
733
+ var onSaveTopo = /*#__PURE__*/function () {
734
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
735
+ var id, config, serialize, _config$layout, template, layout, saveConfig;
736
+
737
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
738
+ while (1) switch (_context7.prev = _context7.next) {
696
739
  case 0:
697
740
  id = data.id, config = data.config, serialize = data.serialize;
698
741
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
699
742
 
700
743
  if (onSave) {
701
744
  // 自定义保存
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) {
745
+ saveConfig = /*#__PURE__*/function () {
746
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
747
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
748
+ while (1) switch (_context6.prev = _context6.next) {
706
749
  case 0:
707
- _context11.next = 2;
750
+ _context6.next = 2;
708
751
  return editDispatchers.saveTopo({
709
752
  id: id,
710
753
  layout: layout,
@@ -713,11 +756,15 @@ var useTopoEdit = function useTopoEdit(params) {
713
756
 
714
757
  case 2:
715
758
  case "end":
716
- return _context11.stop();
759
+ return _context6.stop();
717
760
  }
718
- }, _callee11);
719
- }))).apply(this, arguments);
720
- };
761
+ }, _callee6);
762
+ }));
763
+
764
+ return function saveConfig() {
765
+ return _ref7.apply(this, arguments);
766
+ };
767
+ }();
721
768
 
722
769
  onSave({
723
770
  topo: topo,
@@ -728,11 +775,15 @@ var useTopoEdit = function useTopoEdit(params) {
728
775
 
729
776
  case 3:
730
777
  case "end":
731
- return _context12.stop();
778
+ return _context7.stop();
732
779
  }
733
- }, _callee12);
734
- }))).apply(this, arguments);
735
- };
780
+ }, _callee7);
781
+ }));
782
+
783
+ return function onSaveTopo(_x13) {
784
+ return _ref6.apply(this, arguments);
785
+ };
786
+ }();
736
787
 
737
788
  var saveBind = function saveBind(type, data) {
738
789
  var eventData = {
@@ -755,14 +806,12 @@ var useTopoEdit = function useTopoEdit(params) {
755
806
  */
756
807
 
757
808
 
758
- var bindNodeResource = function bindNodeResource(_x14) {
759
- return (_ref8 = _ref8 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
760
- var _doBind;
809
+ var bindNodeResource = /*#__PURE__*/function () {
810
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(params) {
811
+ var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
761
812
 
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) {
813
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
814
+ while (1) switch (_context9.prev = _context9.next) {
766
815
  case 0:
767
816
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
768
817
  return _extends({}, resources, {
@@ -772,11 +821,11 @@ var useTopoEdit = function useTopoEdit(params) {
772
821
  });
773
822
  };
774
823
 
775
- doBind = function _doBind2() {
776
- return (_doBind = _doBind || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
824
+ _doBind = function _doBind3() {
825
+ _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
777
826
  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) {
827
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
828
+ while (1) switch (_context8.prev = _context8.next) {
780
829
  case 0:
781
830
  dm = htTopo.getGraphView().dm(); // 创建
782
831
 
@@ -845,7 +894,7 @@ var useTopoEdit = function useTopoEdit(params) {
845
894
  // node.a("customName", null);
846
895
  // 删除关联在节点上的出口链路
847
896
 
848
- _context13.next = 12;
897
+ _context8.next = 12;
849
898
  return deleteExLink(node);
850
899
 
851
900
  case 12:
@@ -856,10 +905,15 @@ var useTopoEdit = function useTopoEdit(params) {
856
905
 
857
906
  case 13:
858
907
  case "end":
859
- return _context13.stop();
908
+ return _context8.stop();
860
909
  }
861
- }, _callee13);
862
- }))).apply(this, arguments);
910
+ }, _callee8);
911
+ }));
912
+ return _doBind.apply(this, arguments);
913
+ };
914
+
915
+ doBind = function _doBind2() {
916
+ return _doBind.apply(this, arguments);
863
917
  };
864
918
 
865
919
  topo.historyManager.beginTransaction();
@@ -893,22 +947,22 @@ var useTopoEdit = function useTopoEdit(params) {
893
947
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
894
948
  }
895
949
 
896
- _context14.next = 12;
950
+ _context9.next = 13;
897
951
  return resourceConfig.updateConfig(config);
898
952
 
899
- case 12:
900
- _context14.next = 14;
953
+ case 13:
954
+ _context9.next = 15;
901
955
  return editDispatchers.fetchDataByConfig();
902
956
 
903
- case 14:
904
- _yield$editDispatcher4 = _context14.sent;
905
- elements = _yield$editDispatcher4.elements;
957
+ case 15:
958
+ _yield$editDispatcher = _context9.sent;
959
+ elements = _yield$editDispatcher.elements;
906
960
  newData = elements.find(function (item) {
907
961
  return item.id === newResId;
908
962
  });
909
963
 
910
964
  if (newData) {
911
- _context14.next = 22;
965
+ _context9.next = 23;
912
966
  break;
913
967
  }
914
968
 
@@ -916,29 +970,37 @@ var useTopoEdit = function useTopoEdit(params) {
916
970
 
917
971
  rlog.warn("关联资源失败");
918
972
  topo.historyManager.endTransaction();
919
- return _context14.abrupt("return", false);
973
+ return _context9.abrupt("return", false);
920
974
 
921
- case 22:
922
- _context14.next = 24;
975
+ case 23:
976
+ _context9.next = 25;
923
977
  return doBind();
924
978
 
925
- case 24:
979
+ case 25:
926
980
  topo.historyManager.endTransaction();
927
981
 
928
- case 25:
982
+ case 26:
929
983
  case "end":
930
- return _context14.stop();
984
+ return _context9.stop();
931
985
  }
932
- }, _callee14);
933
- }))).apply(this, arguments);
934
- };
986
+ }, _callee9);
987
+ }));
988
+
989
+ return function bindNodeResource(_x14) {
990
+ return _ref8.apply(this, arguments);
991
+ };
992
+ }();
935
993
  /**
936
994
  * 关联IP的图片节点
937
995
  */
938
996
 
939
997
 
940
998
  function relateNodeIp(_x15, _x16) {
941
- return (_relateNodeIp = _relateNodeIp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
999
+ return _relateNodeIp.apply(this, arguments);
1000
+ }
1001
+
1002
+ function _relateNodeIp() {
1003
+ _relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
942
1004
  var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
943
1005
 
944
1006
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
@@ -1014,7 +1076,8 @@ var useTopoEdit = function useTopoEdit(params) {
1014
1076
  return _context15.stop();
1015
1077
  }
1016
1078
  }, _callee15);
1017
- }))).apply(this, arguments);
1079
+ }));
1080
+ return _relateNodeIp.apply(this, arguments);
1018
1081
  }
1019
1082
 
1020
1083
  var onEvent = function onEvent(e) {