@riil-frontend/component-topology 11.0.30 → 11.0.31

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 (217) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +2 -4
  4. package/build/index.js +34 -49
  5. package/es/components/MultiResourceDrawer/index.js +18 -16
  6. package/es/components/ResourceList/ResourceSelect.js +50 -48
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +26 -24
  8. package/es/components/SingleResourceDrawer/SelectDrawer.js +20 -18
  9. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +25 -23
  10. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
  11. package/es/core/components/titlebar/widgets/TitleWidget.js +3 -5
  12. package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
  13. package/es/core/editor/components/BackgroundView/index.js +129 -119
  14. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -20
  15. package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
  16. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +17 -15
  17. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +9 -7
  18. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
  19. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
  20. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
  21. package/es/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
  22. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +13 -11
  23. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +23 -21
  24. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  25. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -10
  26. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +27 -21
  27. package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
  28. package/es/core/editor/hooks/useNewElementTheme.js +2 -2
  29. package/es/core/editor/store/background.js +10 -8
  30. package/es/core/editor/store/topoEdit.js +6 -4
  31. package/es/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  32. package/es/core/hooks/usePolling.js +121 -117
  33. package/es/core/hooks/useResourceConfig.js +66 -58
  34. package/es/core/hooks/useTopoEdit.js +511 -476
  35. package/es/core/models/Alarm.js +298 -281
  36. package/es/core/models/AttributeMetricDisplay.js +107 -101
  37. package/es/core/models/PluginManager.js +3 -4
  38. package/es/core/models/SelectionModel.js +5 -4
  39. package/es/core/models/TopoApp.js +240 -205
  40. package/es/core/models/TopoGraphView.js +21 -18
  41. package/es/core/models/cache/CiCache.js +27 -28
  42. package/es/core/models/cache/CiTypeCache.js +41 -37
  43. package/es/core/models/cache/DictCache.js +35 -33
  44. package/es/core/models/graph/Background.js +17 -15
  45. package/es/core/models/plugins/resourceWebControllUrl.js +82 -76
  46. package/es/core/models/tagstips/ElementTagTipConfig.js +38 -34
  47. package/es/core/models/topoData.js +70 -68
  48. package/es/core/models/utils/linkUtils.js +43 -41
  49. package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
  50. package/es/core/services/alarm.js +16 -14
  51. package/es/core/services/background.js +67 -59
  52. package/es/core/services/cmdb/metric.js +11 -9
  53. package/es/core/services/cmdb.js +20 -18
  54. package/es/core/services/index.js +45 -39
  55. package/es/core/services/overview.js +151 -131
  56. package/es/core/services/topo/basic.js +13 -11
  57. package/es/core/services/topo/tagtip.js +12 -10
  58. package/es/core/store/models/ciModel.js +62 -58
  59. package/es/core/store/models/customIcon.js +134 -120
  60. package/es/core/store/models/displayConfig.js +19 -15
  61. package/es/core/store/models/selection.js +6 -4
  62. package/es/core/store/models/topoAlarm.js +145 -162
  63. package/es/core/store/models/topoBaseInfoOverview.js +6 -4
  64. package/es/core/store/models/topoBizMod.js +32 -28
  65. package/es/core/store/models/topoConfig.js +231 -215
  66. package/es/core/store/models/topoGraphView.js +6 -4
  67. package/es/core/store/models/topoMod.js +395 -373
  68. package/es/core/utils/imageUtil.js +20 -18
  69. package/es/core/utils/saveSerialize.js +11 -9
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +357 -343
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +205 -189
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
  78. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +37 -33
  79. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
  80. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
  81. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +19 -17
  82. package/es/networkTopo/components/Link/hook.js +77 -73
  83. package/es/networkTopo/components/Link/index.js +94 -86
  84. package/es/networkTopo/components/Link/setting.js +44 -42
  85. package/es/networkTopo/getTopoData.js +69 -63
  86. package/es/networkTopo/hooks/viewer/useRelateTopo.js +32 -30
  87. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  88. package/es/networkTopo/models/TopoCenter.js +22 -18
  89. package/es/networkTopo/services/alert.js +22 -18
  90. package/es/networkTopo/services/authorization.js +55 -45
  91. package/es/networkTopo/services/cmdb.js +470 -422
  92. package/es/networkTopo/services/funcAuth.js +24 -22
  93. package/es/networkTopo/services/link.js +117 -107
  94. package/es/networkTopo/services/mdc.js +24 -18
  95. package/es/networkTopo/services/metric.js +27 -23
  96. package/es/networkTopo/services/model.js +509 -445
  97. package/es/networkTopo/services/risk.js +11 -9
  98. package/es/networkTopo/services/topo/auth.js +33 -27
  99. package/es/networkTopo/services/topo/basic.js +314 -274
  100. package/es/networkTopo/services/topo/blacklist.js +24 -20
  101. package/es/networkTopo/services/topo/ciInfo.js +31 -27
  102. package/es/networkTopo/services/topo/icon.js +59 -49
  103. package/es/networkTopo/services/topo/networkLink.js +36 -32
  104. package/es/networkTopo/services/topo/relation.js +11 -9
  105. package/es/networkTopo/services/topo/resourceWebUrl.js +42 -36
  106. package/es/networkTopo/store/functionAuth.js +37 -31
  107. package/es/networkTopo/store/topoCenter.js +152 -142
  108. package/es/networkTopo/store/topoLinkMod.js +6 -4
  109. package/es/networkTopo/store/topoTreeMod.js +182 -170
  110. package/es/networkTopo/utils/exportData.js +54 -52
  111. package/lib/components/MultiResourceDrawer/index.js +18 -16
  112. package/lib/components/ResourceList/ResourceSelect.js +50 -48
  113. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +29 -27
  114. package/lib/components/SingleResourceDrawer/SelectDrawer.js +20 -18
  115. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +32 -30
  116. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
  117. package/lib/core/components/titlebar/widgets/TitleWidget.js +3 -5
  118. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
  119. package/lib/core/editor/components/BackgroundView/index.js +128 -118
  120. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +24 -22
  121. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
  122. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +21 -19
  123. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +10 -8
  124. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
  125. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
  126. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
  127. package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
  128. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +14 -12
  129. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +28 -26
  130. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  131. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +14 -12
  132. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +31 -25
  133. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  134. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  135. package/lib/core/editor/store/background.js +10 -8
  136. package/lib/core/editor/store/topoEdit.js +6 -4
  137. package/lib/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  138. package/lib/core/hooks/usePolling.js +120 -116
  139. package/lib/core/hooks/useResourceConfig.js +66 -58
  140. package/lib/core/hooks/useTopoEdit.js +503 -468
  141. package/lib/core/models/Alarm.js +292 -275
  142. package/lib/core/models/AttributeMetricDisplay.js +110 -104
  143. package/lib/core/models/PluginManager.js +3 -4
  144. package/lib/core/models/SelectionModel.js +5 -4
  145. package/lib/core/models/TopoApp.js +240 -205
  146. package/lib/core/models/TopoGraphView.js +21 -18
  147. package/lib/core/models/cache/CiCache.js +32 -33
  148. package/lib/core/models/cache/CiTypeCache.js +42 -38
  149. package/lib/core/models/cache/DictCache.js +35 -33
  150. package/lib/core/models/graph/Background.js +18 -16
  151. package/lib/core/models/plugins/resourceWebControllUrl.js +80 -74
  152. package/lib/core/models/tagstips/ElementTagTipConfig.js +38 -34
  153. package/lib/core/models/topoData.js +71 -69
  154. package/lib/core/models/utils/linkUtils.js +43 -41
  155. package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
  156. package/lib/core/services/alarm.js +20 -18
  157. package/lib/core/services/background.js +78 -70
  158. package/lib/core/services/cmdb/metric.js +12 -10
  159. package/lib/core/services/cmdb.js +22 -20
  160. package/lib/core/services/index.js +51 -45
  161. package/lib/core/services/overview.js +151 -131
  162. package/lib/core/services/topo/basic.js +15 -13
  163. package/lib/core/services/topo/tagtip.js +14 -12
  164. package/lib/core/store/models/ciModel.js +70 -66
  165. package/lib/core/store/models/customIcon.js +134 -120
  166. package/lib/core/store/models/displayConfig.js +19 -15
  167. package/lib/core/store/models/selection.js +6 -4
  168. package/lib/core/store/models/topoAlarm.js +145 -163
  169. package/lib/core/store/models/topoBaseInfoOverview.js +6 -4
  170. package/lib/core/store/models/topoBizMod.js +38 -34
  171. package/lib/core/store/models/topoConfig.js +238 -222
  172. package/lib/core/store/models/topoGraphView.js +6 -4
  173. package/lib/core/store/models/topoMod.js +397 -375
  174. package/lib/core/utils/imageUtil.js +24 -22
  175. package/lib/core/utils/saveSerialize.js +11 -9
  176. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
  177. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
  178. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +358 -344
  179. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
  180. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
  181. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +206 -190
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
  183. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
  184. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -29
  185. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
  186. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
  187. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +20 -18
  188. package/lib/networkTopo/components/Link/hook.js +77 -73
  189. package/lib/networkTopo/components/Link/index.js +95 -87
  190. package/lib/networkTopo/components/Link/setting.js +44 -42
  191. package/lib/networkTopo/getTopoData.js +69 -63
  192. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +33 -31
  193. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  194. package/lib/networkTopo/models/TopoCenter.js +22 -18
  195. package/lib/networkTopo/services/alert.js +22 -18
  196. package/lib/networkTopo/services/authorization.js +65 -55
  197. package/lib/networkTopo/services/cmdb.js +470 -422
  198. package/lib/networkTopo/services/funcAuth.js +26 -24
  199. package/lib/networkTopo/services/link.js +118 -108
  200. package/lib/networkTopo/services/mdc.js +27 -21
  201. package/lib/networkTopo/services/metric.js +31 -27
  202. package/lib/networkTopo/services/model.js +509 -445
  203. package/lib/networkTopo/services/risk.js +13 -11
  204. package/lib/networkTopo/services/topo/auth.js +33 -27
  205. package/lib/networkTopo/services/topo/basic.js +317 -277
  206. package/lib/networkTopo/services/topo/blacklist.js +24 -20
  207. package/lib/networkTopo/services/topo/ciInfo.js +38 -34
  208. package/lib/networkTopo/services/topo/icon.js +69 -59
  209. package/lib/networkTopo/services/topo/networkLink.js +36 -32
  210. package/lib/networkTopo/services/topo/relation.js +13 -11
  211. package/lib/networkTopo/services/topo/resourceWebUrl.js +50 -44
  212. package/lib/networkTopo/store/functionAuth.js +37 -31
  213. package/lib/networkTopo/store/topoCenter.js +152 -142
  214. package/lib/networkTopo/store/topoLinkMod.js +6 -4
  215. package/lib/networkTopo/store/topoTreeMod.js +178 -166
  216. package/lib/networkTopo/utils/exportData.js +61 -59
  217. package/package.json +3 -3
@@ -106,36 +106,38 @@ var useTopoEdit = function useTopoEdit(params) {
106
106
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
107
107
  var target, direction, config;
108
108
  return _regenerator["default"].wrap(function _callee$(_context) {
109
- while (1) switch (_context.prev = _context.next) {
110
- case 0:
111
- target = _ref.target, direction = _ref.direction;
112
- topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
109
+ while (1) {
110
+ switch (_context.prev = _context.next) {
111
+ case 0:
112
+ target = _ref.target, direction = _ref.direction;
113
+ topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
113
114
 
114
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
115
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
115
116
 
116
- _rlog["default"].info("onLayerAdd", {
117
- config: config
118
- }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
117
+ _rlog["default"].info("onLayerAdd", {
118
+ config: config
119
+ }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
119
120
 
120
121
 
121
- if (!(!isLayerTopo && config.layers.length)) {
122
- _context.next = 7;
123
- break;
124
- }
125
-
126
- _context.next = 7;
127
- return topoDispatchers.setTopoType(_template.TPL_TREE);
128
-
129
- case 7:
130
- // 更新配置
131
- // resourceConfig.updateConfig(config);
132
- // 更新配置对应的资源、链路
133
- // editDispatchers.fetchDataByConfig();
134
- topo.historyManager.endTransaction();
122
+ if (!(!isLayerTopo && config.layers.length)) {
123
+ _context.next = 7;
124
+ break;
125
+ }
135
126
 
136
- case 8:
137
- case "end":
138
- return _context.stop();
127
+ _context.next = 7;
128
+ return topoDispatchers.setTopoType(_template.TPL_TREE);
129
+
130
+ case 7:
131
+ // 更新配置
132
+ // resourceConfig.updateConfig(config);
133
+ // 更新配置对应的资源、链路
134
+ // editDispatchers.fetchDataByConfig();
135
+ topo.historyManager.endTransaction();
136
+
137
+ case 8:
138
+ case "end":
139
+ return _context.stop();
140
+ }
139
141
  }
140
142
  }, _callee);
141
143
  }));
@@ -149,40 +151,42 @@ var useTopoEdit = function useTopoEdit(params) {
149
151
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(layerElement) {
150
152
  var config;
151
153
  return _regenerator["default"].wrap(function _callee2$(_context2) {
152
- while (1) switch (_context2.prev = _context2.next) {
153
- case 0:
154
- topo.historyManager.beginTransaction();
155
- emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
154
+ while (1) {
155
+ switch (_context2.prev = _context2.next) {
156
+ case 0:
157
+ topo.historyManager.beginTransaction();
158
+ emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
156
159
 
157
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
160
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
158
161
 
159
- _rlog["default"].info("deleteLayer", {
160
- config: config
161
- }); // 如果没有分层,将拓扑类型切换为空白模板
162
+ _rlog["default"].info("deleteLayer", {
163
+ config: config
164
+ }); // 如果没有分层,将拓扑类型切换为空白模板
162
165
 
163
166
 
164
- if (config.layers.length) {
165
- _context2.next = 7;
166
- break;
167
- }
167
+ if (config.layers.length) {
168
+ _context2.next = 7;
169
+ break;
170
+ }
168
171
 
169
- _context2.next = 7;
170
- return topoDispatchers.setTopoType(_template.TPL_BLANK);
172
+ _context2.next = 7;
173
+ return topoDispatchers.setTopoType(_template.TPL_BLANK);
171
174
 
172
- case 7:
173
- _context2.next = 9;
174
- return resourceConfig.updateConfig(config);
175
+ case 7:
176
+ _context2.next = 9;
177
+ return resourceConfig.updateConfig(config);
175
178
 
176
- case 9:
177
- _context2.next = 11;
178
- return editDispatchers.fetchDataByConfig();
179
+ case 9:
180
+ _context2.next = 11;
181
+ return editDispatchers.fetchDataByConfig();
179
182
 
180
- case 11:
181
- topo.historyManager.endTransaction();
183
+ case 11:
184
+ topo.historyManager.endTransaction();
182
185
 
183
- case 12:
184
- case "end":
185
- return _context2.stop();
186
+ case 12:
187
+ case "end":
188
+ return _context2.stop();
189
+ }
186
190
  }
187
191
  }, _callee2);
188
192
  }));
@@ -213,13 +217,15 @@ var useTopoEdit = function useTopoEdit(params) {
213
217
  onOk: function () {
214
218
  var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
215
219
  return _regenerator["default"].wrap(function _callee3$(_context3) {
216
- while (1) switch (_context3.prev = _context3.next) {
217
- case 0:
218
- deleteLayer(layerElement);
219
-
220
- case 1:
221
- case "end":
222
- return _context3.stop();
220
+ while (1) {
221
+ switch (_context3.prev = _context3.next) {
222
+ case 0:
223
+ deleteLayer(layerElement);
224
+
225
+ case 1:
226
+ case "end":
227
+ return _context3.stop();
228
+ }
223
229
  }
224
230
  }, _callee3);
225
231
  }));
@@ -385,33 +391,35 @@ var useTopoEdit = function useTopoEdit(params) {
385
391
 
386
392
  var config, edges, exportLinkIdList;
387
393
  return _regenerator["default"].wrap(function _callee4$(_context4) {
388
- while (1) switch (_context4.prev = _context4.next) {
389
- case 0:
390
- config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
394
+ while (1) {
395
+ switch (_context4.prev = _context4.next) {
396
+ case 0:
397
+ config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
391
398
 
392
- edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
399
+ edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
393
400
 
394
- if (!(edges.length > 0)) {
395
- _context4.next = 8;
396
- break;
397
- }
401
+ if (!(edges.length > 0)) {
402
+ _context4.next = 8;
403
+ break;
404
+ }
398
405
 
399
- exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
406
+ exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
400
407
 
401
- edges.map(function (edge) {
402
- if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
403
- // exLink.push(edge);
404
- topo.getGraphView().dm().remove(edge);
405
- exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
406
- }
407
- });
408
- config.exportLinkIdList = exportLinkIdList;
409
- _context4.next = 8;
410
- return resourceConfig.updateConfig(config);
411
-
412
- case 8:
413
- case "end":
414
- return _context4.stop();
408
+ edges.map(function (edge) {
409
+ if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
410
+ // exLink.push(edge);
411
+ topo.getGraphView().dm().remove(edge);
412
+ exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
413
+ }
414
+ });
415
+ config.exportLinkIdList = exportLinkIdList;
416
+ _context4.next = 8;
417
+ return resourceConfig.updateConfig(config);
418
+
419
+ case 8:
420
+ case "end":
421
+ return _context4.stop();
422
+ }
415
423
  }
416
424
  }, _callee4);
417
425
  }));
@@ -503,41 +511,43 @@ var useTopoEdit = function useTopoEdit(params) {
503
511
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
504
512
 
505
513
  return _regenerator["default"].wrap(function _callee10$(_context10) {
506
- while (1) switch (_context10.prev = _context10.next) {
507
- case 0:
508
- id = group.id, tag = group.tag;
509
-
510
- _rlog["default"].debug("bindGroupResources--id, tag", id, tag);
511
-
512
- topo.historyManager.beginTransaction();
513
- _context10.next = 5;
514
- return resourceConfig.updateGroupResources(group, resources);
515
-
516
- case 5:
517
- _context10.next = 7;
518
- return editDispatchers.fetchDataByConfig();
519
-
520
- case 7:
521
- _yield$editDispatcher2 = _context10.sent;
522
- elements = _yield$editDispatcher2.elements;
523
- // 区域里的子区域及子区域的节点、新增的链路
524
- nodeElements = (0, _topoData.findGroupChildren)(elements, group);
525
- newLinkElements = findUNExistedLinkElements(elements);
526
- updateElements = [].concat(nodeElements, newLinkElements);
527
-
528
- if (updateElements.length) {
529
- saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
530
-
531
- if (topo.linkDynamicStyleExecutor) {
532
- topo.linkDynamicStyleExecutor.execute();
514
+ while (1) {
515
+ switch (_context10.prev = _context10.next) {
516
+ case 0:
517
+ id = group.id, tag = group.tag;
518
+
519
+ _rlog["default"].debug("bindGroupResources--id, tag", id, tag);
520
+
521
+ topo.historyManager.beginTransaction();
522
+ _context10.next = 5;
523
+ return resourceConfig.updateGroupResources(group, resources);
524
+
525
+ case 5:
526
+ _context10.next = 7;
527
+ return editDispatchers.fetchDataByConfig();
528
+
529
+ case 7:
530
+ _yield$editDispatcher2 = _context10.sent;
531
+ elements = _yield$editDispatcher2.elements;
532
+ // 区域里的子区域及子区域的节点、新增的链路
533
+ nodeElements = (0, _topoData.findGroupChildren)(elements, group);
534
+ newLinkElements = findUNExistedLinkElements(elements);
535
+ updateElements = [].concat(nodeElements, newLinkElements);
536
+
537
+ if (updateElements.length) {
538
+ saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
539
+
540
+ if (topo.linkDynamicStyleExecutor) {
541
+ topo.linkDynamicStyleExecutor.execute();
542
+ }
533
543
  }
534
- }
535
544
 
536
- topo.historyManager.endTransaction();
545
+ topo.historyManager.endTransaction();
537
546
 
538
- case 14:
539
- case "end":
540
- return _context10.stop();
547
+ case 14:
548
+ case "end":
549
+ return _context10.stop();
550
+ }
541
551
  }
542
552
  }, _callee10);
543
553
  }));
@@ -556,22 +566,24 @@ var useTopoEdit = function useTopoEdit(params) {
556
566
  _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
557
567
  var groupConfig, resources, groupData;
558
568
  return _regenerator["default"].wrap(function _callee11$(_context11) {
559
- while (1) switch (_context11.prev = _context11.next) {
560
- case 0:
561
- groupConfig = resourceConfig.getGroupConfigByElement(group);
562
- resources = {
563
- "static": [].concat(groupConfig.resources["static"], newResourceIds)
564
- };
565
- groupData = {
566
- id: group.getTag(),
567
- tag: group.a("tag")
568
- };
569
- _context11.next = 5;
570
- return bindGroupResources(groupData, resources);
571
-
572
- case 5:
573
- case "end":
574
- return _context11.stop();
569
+ while (1) {
570
+ switch (_context11.prev = _context11.next) {
571
+ case 0:
572
+ groupConfig = resourceConfig.getGroupConfigByElement(group);
573
+ resources = {
574
+ "static": [].concat(groupConfig.resources["static"], newResourceIds)
575
+ };
576
+ groupData = {
577
+ id: group.getTag(),
578
+ tag: group.a("tag")
579
+ };
580
+ _context11.next = 5;
581
+ return bindGroupResources(groupData, resources);
582
+
583
+ case 5:
584
+ case "end":
585
+ return _context11.stop();
586
+ }
575
587
  }
576
588
  }, _callee11);
577
589
  }));
@@ -591,33 +603,39 @@ var useTopoEdit = function useTopoEdit(params) {
591
603
 
592
604
  function _bindViewResources() {
593
605
  _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
594
- var config, _yield$editDispatcher3, elements;
606
+ var config, result, _elements;
595
607
 
596
608
  return _regenerator["default"].wrap(function _callee12$(_context12) {
597
- while (1) switch (_context12.prev = _context12.next) {
598
- case 0:
599
- // console.log("关联视图的资源", data);
600
- config = resourceConfig.getConfig();
601
- config.resources = data;
602
- _context12.next = 4;
603
- return resourceConfig.updateConfig(config);
604
-
605
- case 4:
606
- _context12.next = 6;
607
- return editDispatchers.fetchDataByConfig();
608
-
609
- case 6:
610
- _yield$editDispatcher3 = _context12.sent;
611
- elements = _yield$editDispatcher3.elements;
612
- saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
613
-
614
- if (topo.linkDynamicStyleExecutor) {
615
- topo.linkDynamicStyleExecutor.execute();
616
- }
609
+ while (1) {
610
+ switch (_context12.prev = _context12.next) {
611
+ case 0:
612
+ // console.log("关联视图的资源", data);
613
+ config = resourceConfig.getConfig();
614
+ config.resources = data;
615
+ _context12.next = 4;
616
+ return resourceConfig.updateConfig(config);
617
+
618
+ case 4:
619
+ _context12.next = 6;
620
+ return editDispatchers.fetchDataByConfig();
621
+
622
+ case 6:
623
+ result = _context12.sent;
624
+ console.log("fetchDataByConfig", result);
625
+
626
+ if (result) {
627
+ _elements = result.elements;
628
+ saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
629
+
630
+ if (topo.linkDynamicStyleExecutor) {
631
+ topo.linkDynamicStyleExecutor.execute();
632
+ }
633
+ }
617
634
 
618
- case 10:
619
- case "end":
620
- return _context12.stop();
635
+ case 9:
636
+ case "end":
637
+ return _context12.stop();
638
+ }
621
639
  }
622
640
  }, _callee12);
623
641
  }));
@@ -630,47 +648,49 @@ var useTopoEdit = function useTopoEdit(params) {
630
648
 
631
649
  function _addLayerResources() {
632
650
  _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
633
- var _yield$editDispatcher4, elements, newElements;
651
+ var _yield$editDispatcher3, elements, newElements;
634
652
 
635
653
  return _regenerator["default"].wrap(function _callee13$(_context13) {
636
- while (1) switch (_context13.prev = _context13.next) {
637
- case 0:
638
- topo.historyManager.beginTransaction(); // 构造新的配置
639
-
640
- _context13.next = 3;
641
- return resourceConfig.addLayerStaticResources(group, newResourceIds);
642
-
643
- case 3:
644
- _context13.next = 5;
645
- return editDispatchers.fetchDataByConfig();
646
-
647
- case 5:
648
- _yield$editDispatcher4 = _context13.sent;
649
- elements = _yield$editDispatcher4.elements;
650
- // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
651
- newElements = findUNExistedElements(elements);
652
-
653
- _rlog["default"].debug("添加分层资源", {
654
- layer: group,
655
- newElements: newElements
656
- });
654
+ while (1) {
655
+ switch (_context13.prev = _context13.next) {
656
+ case 0:
657
+ topo.historyManager.beginTransaction(); // 构造新的配置
658
+
659
+ _context13.next = 3;
660
+ return resourceConfig.addLayerStaticResources(group, newResourceIds);
661
+
662
+ case 3:
663
+ _context13.next = 5;
664
+ return editDispatchers.fetchDataByConfig();
665
+
666
+ case 5:
667
+ _yield$editDispatcher3 = _context13.sent;
668
+ elements = _yield$editDispatcher3.elements;
669
+ // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
670
+ newElements = findUNExistedElements(elements);
671
+
672
+ _rlog["default"].debug("添加分层资源", {
673
+ layer: group,
674
+ newElements: newElements
675
+ });
657
676
 
658
- topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
677
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
659
678
 
660
- if (topo.linkDynamicStyleExecutor) {
661
- topo.linkDynamicStyleExecutor.execute();
662
- }
679
+ if (topo.linkDynamicStyleExecutor) {
680
+ topo.linkDynamicStyleExecutor.execute();
681
+ }
663
682
 
664
- topo.historyManager.endTransaction();
665
- topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
683
+ topo.historyManager.endTransaction();
684
+ topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
666
685
 
667
- topoEditDispatchers.update({
668
- resourceTabActiveKey: null
669
- });
686
+ topoEditDispatchers.update({
687
+ resourceTabActiveKey: null
688
+ });
670
689
 
671
- case 14:
672
- case "end":
673
- return _context13.stop();
690
+ case 14:
691
+ case "end":
692
+ return _context13.stop();
693
+ }
674
694
  }
675
695
  }, _callee13);
676
696
  }));
@@ -685,15 +705,17 @@ var useTopoEdit = function useTopoEdit(params) {
685
705
  _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
686
706
  var group;
687
707
  return _regenerator["default"].wrap(function _callee14$(_context14) {
688
- while (1) switch (_context14.prev = _context14.next) {
689
- case 0:
690
- group = resourceConfig.getGroups()[0];
691
- _context14.next = 3;
692
- return addLayerResources(group, data);
693
-
694
- case 3:
695
- case "end":
696
- return _context14.stop();
708
+ while (1) {
709
+ switch (_context14.prev = _context14.next) {
710
+ case 0:
711
+ group = resourceConfig.getGroups()[0];
712
+ _context14.next = 3;
713
+ return addLayerResources(group, data);
714
+
715
+ case 3:
716
+ case "end":
717
+ return _context14.stop();
718
+ }
697
719
  }
698
720
  }, _callee14);
699
721
  }));
@@ -729,38 +751,40 @@ var useTopoEdit = function useTopoEdit(params) {
729
751
  var onSaveComboRes = /*#__PURE__*/function () {
730
752
  var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
731
753
  return _regenerator["default"].wrap(function _callee5$(_context5) {
732
- while (1) switch (_context5.prev = _context5.next) {
733
- case 0:
734
- _rlog["default"].debug("关联资源-----onSaveComboRes", data);
754
+ while (1) {
755
+ switch (_context5.prev = _context5.next) {
756
+ case 0:
757
+ _rlog["default"].debug("关联资源-----onSaveComboRes", data);
735
758
 
736
- topo.historyManager.beginTransaction();
759
+ topo.historyManager.beginTransaction();
737
760
 
738
- if (!(getAddResourceType() === "addToFirstLayer")) {
739
- _context5.next = 7;
740
- break;
741
- }
761
+ if (!(getAddResourceType() === "addToFirstLayer")) {
762
+ _context5.next = 7;
763
+ break;
764
+ }
742
765
 
743
- _context5.next = 5;
744
- return addResourceToFirstLayer(data);
766
+ _context5.next = 5;
767
+ return addResourceToFirstLayer(data);
745
768
 
746
- case 5:
747
- _context5.next = 9;
748
- break;
769
+ case 5:
770
+ _context5.next = 9;
771
+ break;
749
772
 
750
- case 7:
751
- _context5.next = 9;
752
- return bindViewResources(data);
773
+ case 7:
774
+ _context5.next = 9;
775
+ return bindViewResources(data);
753
776
 
754
- case 9:
755
- topo.historyManager.endTransaction();
756
- topo.getHtTopo().fitContent();
757
- topoEditDispatchers.update({
758
- resourceTabActiveKey: null
759
- });
777
+ case 9:
778
+ topo.historyManager.endTransaction();
779
+ topo.getHtTopo().fitContent();
780
+ topoEditDispatchers.update({
781
+ resourceTabActiveKey: null
782
+ });
760
783
 
761
- case 12:
762
- case "end":
763
- return _context5.stop();
784
+ case 12:
785
+ case "end":
786
+ return _context5.stop();
787
+ }
764
788
  }
765
789
  }, _callee5);
766
790
  }));
@@ -775,47 +799,51 @@ var useTopoEdit = function useTopoEdit(params) {
775
799
  var id, config, serialize, _config$layout, template, layout, saveConfig;
776
800
 
777
801
  return _regenerator["default"].wrap(function _callee7$(_context7) {
778
- while (1) switch (_context7.prev = _context7.next) {
779
- case 0:
780
- id = data.id, config = data.config, serialize = data.serialize;
781
- _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
782
-
783
- if (onSave) {
784
- // 自定义保存
785
- saveConfig = /*#__PURE__*/function () {
786
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
787
- return _regenerator["default"].wrap(function _callee6$(_context6) {
788
- while (1) switch (_context6.prev = _context6.next) {
789
- case 0:
790
- _context6.next = 2;
791
- return editDispatchers.saveTopo({
792
- id: id,
793
- layout: layout,
794
- serialize: serialize
795
- });
796
-
797
- case 2:
798
- case "end":
799
- return _context6.stop();
800
- }
801
- }, _callee6);
802
- }));
803
-
804
- return function saveConfig() {
805
- return _ref7.apply(this, arguments);
806
- };
807
- }();
808
-
809
- onSave({
810
- topo: topo,
811
- data: data,
812
- saveConfig: saveConfig
813
- });
814
- }
802
+ while (1) {
803
+ switch (_context7.prev = _context7.next) {
804
+ case 0:
805
+ id = data.id, config = data.config, serialize = data.serialize;
806
+ _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
807
+
808
+ if (onSave) {
809
+ // 自定义保存
810
+ saveConfig = /*#__PURE__*/function () {
811
+ var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
812
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
813
+ while (1) {
814
+ switch (_context6.prev = _context6.next) {
815
+ case 0:
816
+ _context6.next = 2;
817
+ return editDispatchers.saveTopo({
818
+ id: id,
819
+ layout: layout,
820
+ serialize: serialize
821
+ });
822
+
823
+ case 2:
824
+ case "end":
825
+ return _context6.stop();
826
+ }
827
+ }
828
+ }, _callee6);
829
+ }));
830
+
831
+ return function saveConfig() {
832
+ return _ref7.apply(this, arguments);
833
+ };
834
+ }();
835
+
836
+ onSave({
837
+ topo: topo,
838
+ data: data,
839
+ saveConfig: saveConfig
840
+ });
841
+ }
815
842
 
816
- case 3:
817
- case "end":
818
- return _context7.stop();
843
+ case 3:
844
+ case "end":
845
+ return _context7.stop();
846
+ }
819
847
  }
820
848
  }, _callee7);
821
849
  }));
@@ -853,181 +881,185 @@ var useTopoEdit = function useTopoEdit(params) {
853
881
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
854
882
 
855
883
  return _regenerator["default"].wrap(function _callee9$(_context9) {
856
- while (1) switch (_context9.prev = _context9.next) {
857
- case 0:
858
- replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
859
- return (0, _extends2["default"])({}, resources, {
860
- "static": [].concat(resources["static"].filter(function (item) {
861
- return item !== oldResId;
862
- }), [newResId])
863
- });
864
- };
865
-
866
- _doBind = function _doBind3() {
867
- _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
868
- var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
869
- return _regenerator["default"].wrap(function _callee8$(_context8) {
870
- while (1) switch (_context8.prev = _context8.next) {
871
- case 0:
872
- dm = htTopo.getGraphView().dm(); // 创建
873
-
874
- newLinkElements = findUNExistedLinkElements(elements);
875
- createElementsData = null;
876
-
877
- if (newData.type === "group") {
878
- groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
879
- newGroupChildren = [];
880
- existedGroupChildren = [];
881
- groupChildren.forEach(function (groupChildData) {
882
- var ele = dm.getDataByTag(groupChildData.id);
883
-
884
- if (ele) {
885
- existedGroupChildren.push(groupChildData);
884
+ while (1) {
885
+ switch (_context9.prev = _context9.next) {
886
+ case 0:
887
+ replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
888
+ return (0, _extends2["default"])({}, resources, {
889
+ "static": [].concat(resources["static"].filter(function (item) {
890
+ return item !== oldResId;
891
+ }), [newResId])
892
+ });
893
+ };
894
+
895
+ _doBind = function _doBind3() {
896
+ _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
897
+ var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
898
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
899
+ while (1) {
900
+ switch (_context8.prev = _context8.next) {
901
+ case 0:
902
+ dm = htTopo.getGraphView().dm(); // 创建
903
+
904
+ newLinkElements = findUNExistedLinkElements(elements);
905
+ createElementsData = null;
906
+
907
+ if (newData.type === "group") {
908
+ groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
909
+ newGroupChildren = [];
910
+ existedGroupChildren = [];
911
+ groupChildren.forEach(function (groupChildData) {
912
+ var ele = dm.getDataByTag(groupChildData.id);
913
+
914
+ if (ele) {
915
+ existedGroupChildren.push(groupChildData);
916
+ } else {
917
+ newGroupChildren.push(groupChildData);
918
+ }
919
+ });
920
+ createElementsData = {
921
+ groups: [newData],
922
+ nodes: newGroupChildren,
923
+ links: newLinkElements.filter(function (item) {
924
+ return item.type === "link";
925
+ }),
926
+ linkGroups: newLinkElements.filter(function (item) {
927
+ return item.type === "linkGroup";
928
+ })
929
+ };
930
+ htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
931
+
932
+ groupElement = dm.getDataByTag(newData.id);
933
+ existedGroupChildren.forEach(function (groupChildData) {
934
+ var nodeElement = dm.getDataByTag(groupChildData.id);
935
+ nodeElement.setParent(groupElement);
936
+ });
886
937
  } else {
887
- newGroupChildren.push(groupChildData);
938
+ createElementsData = {
939
+ groups: [],
940
+ nodes: [newData],
941
+ links: newLinkElements.filter(function (item) {
942
+ return item.type === "link";
943
+ }),
944
+ linkGroups: newLinkElements.filter(function (item) {
945
+ return item.type === "linkGroup";
946
+ })
947
+ };
948
+ htTopo.createElements(createElementsData);
888
949
  }
889
- });
890
- createElementsData = {
891
- groups: [newData],
892
- nodes: newGroupChildren,
893
- links: newLinkElements.filter(function (item) {
894
- return item.type === "link";
895
- }),
896
- linkGroups: newLinkElements.filter(function (item) {
897
- return item.type === "linkGroup";
898
- })
899
- };
900
- htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
901
-
902
- groupElement = dm.getDataByTag(newData.id);
903
- existedGroupChildren.forEach(function (groupChildData) {
904
- var nodeElement = dm.getDataByTag(groupChildData.id);
905
- nodeElement.setParent(groupElement);
906
- });
907
- } else {
908
- createElementsData = {
909
- groups: [],
910
- nodes: [newData],
911
- links: newLinkElements.filter(function (item) {
912
- return item.type === "link";
913
- }),
914
- linkGroups: newLinkElements.filter(function (item) {
915
- return item.type === "linkGroup";
916
- })
917
- };
918
- htTopo.createElements(createElementsData);
919
- }
920
950
 
921
- _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
951
+ _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
922
952
 
923
953
 
924
- newElement = dm.getDataByTag(newData.id);
954
+ newElement = dm.getDataByTag(newData.id);
925
955
 
926
- if (newElement) {
927
- newElement.setSize(node.getSize());
928
- newElement.setPosition(node.getPosition());
929
- newElement.setImage(node.getImage());
930
- } // 选中
956
+ if (newElement) {
957
+ newElement.setSize(node.getSize());
958
+ newElement.setPosition(node.getPosition());
959
+ newElement.setImage(node.getImage());
960
+ } // 选中
931
961
 
932
962
 
933
- sm = htTopo.getGraphView().sm();
934
- sm.setSelection([newElement]); // 移除旧节点
963
+ sm = htTopo.getGraphView().sm();
964
+ sm.setSelection([newElement]); // 移除旧节点
935
965
 
936
- dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
937
- // node.a("customName", null);
938
- // 删除关联在节点上的出口链路
966
+ dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
967
+ // node.a("customName", null);
968
+ // 删除关联在节点上的出口链路
939
969
 
940
- _context8.next = 12;
941
- return deleteExLink(node);
970
+ _context8.next = 12;
971
+ return deleteExLink(node);
942
972
 
943
- case 12:
944
- // 临时放这里,仅拓扑中心有
945
- if (topo.linkDynamicStyleExecutor) {
946
- topo.linkDynamicStyleExecutor.execute();
947
- }
973
+ case 12:
974
+ // 临时放这里,仅拓扑中心有
975
+ if (topo.linkDynamicStyleExecutor) {
976
+ topo.linkDynamicStyleExecutor.execute();
977
+ }
948
978
 
949
- case 13:
950
- case "end":
951
- return _context8.stop();
952
- }
953
- }, _callee8);
954
- }));
955
- return _doBind.apply(this, arguments);
956
- };
979
+ case 13:
980
+ case "end":
981
+ return _context8.stop();
982
+ }
983
+ }
984
+ }, _callee8);
985
+ }));
986
+ return _doBind.apply(this, arguments);
987
+ };
957
988
 
958
- doBind = function _doBind2() {
959
- return _doBind.apply(this, arguments);
960
- };
989
+ doBind = function _doBind2() {
990
+ return _doBind.apply(this, arguments);
991
+ };
961
992
 
962
- topo.historyManager.beginTransaction();
963
- id = params.id, oldResId = params.oldResId, newResId = params.newResId;
993
+ topo.historyManager.beginTransaction();
994
+ id = params.id, oldResId = params.oldResId, newResId = params.newResId;
964
995
 
965
- _rlog["default"].debug("bindNodeResource", params);
996
+ _rlog["default"].debug("bindNodeResource", params);
966
997
 
967
- node = topo.getDataModel().getDataById(id); // 节点所属容器
998
+ node = topo.getDataModel().getDataById(id); // 节点所属容器
968
999
 
969
- parentGroupElement = node.getParent();
970
- htTopo = topo.getHtTopo();
971
- config = resourceConfig.getConfig();
1000
+ parentGroupElement = node.getParent();
1001
+ htTopo = topo.getHtTopo();
1002
+ config = resourceConfig.getConfig();
972
1003
 
973
- if (parentGroupElement) {
974
- // 在容器中
975
- groupId = parentGroupElement.getTag(); // 容器业务id
1004
+ if (parentGroupElement) {
1005
+ // 在容器中
1006
+ groupId = parentGroupElement.getTag(); // 容器业务id
976
1007
 
977
- groupTag = parentGroupElement.a("tag"); // 容器临时id
1008
+ groupTag = parentGroupElement.a("tag"); // 容器临时id
978
1009
 
979
- config.groups = config.groups.map(function (g) {
980
- // 匹配到容器,替换资源或增加
981
- if (g.id === groupId || g.tag === groupTag) {
982
- return (0, _extends2["default"])({}, g, {
983
- resources: replaceOrAddRes(g.resources, oldResId, newResId)
984
- });
985
- } // 未匹配到容器
1010
+ config.groups = config.groups.map(function (g) {
1011
+ // 匹配到容器,替换资源或增加
1012
+ if (g.id === groupId || g.tag === groupTag) {
1013
+ return (0, _extends2["default"])({}, g, {
1014
+ resources: replaceOrAddRes(g.resources, oldResId, newResId)
1015
+ });
1016
+ } // 未匹配到容器
986
1017
 
987
1018
 
988
- return g;
989
- });
990
- } else {
991
- // 在画布上
992
- config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
993
- }
1019
+ return g;
1020
+ });
1021
+ } else {
1022
+ // 在画布上
1023
+ config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
1024
+ }
994
1025
 
995
- _context9.next = 13;
996
- return resourceConfig.updateConfig(config);
1026
+ _context9.next = 13;
1027
+ return resourceConfig.updateConfig(config);
997
1028
 
998
- case 13:
999
- _context9.next = 15;
1000
- return editDispatchers.fetchDataByConfig();
1029
+ case 13:
1030
+ _context9.next = 15;
1031
+ return editDispatchers.fetchDataByConfig();
1001
1032
 
1002
- case 15:
1003
- _yield$editDispatcher = _context9.sent;
1004
- elements = _yield$editDispatcher.elements;
1005
- newData = elements.find(function (item) {
1006
- return item.id === newResId;
1007
- });
1033
+ case 15:
1034
+ _yield$editDispatcher = _context9.sent;
1035
+ elements = _yield$editDispatcher.elements;
1036
+ newData = elements.find(function (item) {
1037
+ return item.id === newResId;
1038
+ });
1008
1039
 
1009
- if (newData) {
1010
- _context9.next = 23;
1011
- break;
1012
- }
1040
+ if (newData) {
1041
+ _context9.next = 23;
1042
+ break;
1043
+ }
1013
1044
 
1014
- _message["default"].error("关联资源失败");
1045
+ _message["default"].error("关联资源失败");
1015
1046
 
1016
- _rlog["default"].warn("关联资源失败");
1047
+ _rlog["default"].warn("关联资源失败");
1017
1048
 
1018
- topo.historyManager.endTransaction();
1019
- return _context9.abrupt("return", false);
1049
+ topo.historyManager.endTransaction();
1050
+ return _context9.abrupt("return", false);
1020
1051
 
1021
- case 23:
1022
- _context9.next = 25;
1023
- return doBind();
1052
+ case 23:
1053
+ _context9.next = 25;
1054
+ return doBind();
1024
1055
 
1025
- case 25:
1026
- topo.historyManager.endTransaction();
1056
+ case 25:
1057
+ topo.historyManager.endTransaction();
1027
1058
 
1028
- case 26:
1029
- case "end":
1030
- return _context9.stop();
1059
+ case 26:
1060
+ case "end":
1061
+ return _context9.stop();
1062
+ }
1031
1063
  }
1032
1064
  }, _callee9);
1033
1065
  }));
@@ -1047,79 +1079,82 @@ var useTopoEdit = function useTopoEdit(params) {
1047
1079
 
1048
1080
  function _relateNodeIp() {
1049
1081
  _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
1050
- var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1082
+ var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1051
1083
 
1052
1084
  return _regenerator["default"].wrap(function _callee15$(_context15) {
1053
- while (1) switch (_context15.prev = _context15.next) {
1054
- case 0:
1055
- if (txtValue) {
1056
- _context15.next = 2;
1057
- break;
1058
- }
1085
+ while (1) {
1086
+ switch (_context15.prev = _context15.next) {
1087
+ case 0:
1088
+ if (txtValue) {
1089
+ _context15.next = 2;
1090
+ break;
1091
+ }
1059
1092
 
1060
- return _context15.abrupt("return");
1093
+ return _context15.abrupt("return");
1061
1094
 
1062
- case 2:
1063
- // if (txtValue === nodeElement.a('bindIp')) {
1064
- // return;
1065
- // }
1066
- // 根据配置查询拓扑数据
1067
- dm = topo.getDataModel(); // 执行唯一性验证
1095
+ case 2:
1096
+ // if (txtValue === nodeElement.a('bindIp')) {
1097
+ // return;
1098
+ // }
1099
+ // 根据配置查询拓扑数据
1100
+ dm = topo.getDataModel(); // 执行唯一性验证
1068
1101
 
1069
- isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1102
+ isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1070
1103
 
1071
- if (!isUnique) {
1072
- _context15.next = 23;
1073
- break;
1074
- }
1104
+ if (!isUnique) {
1105
+ _context15.next = 24;
1106
+ break;
1107
+ }
1075
1108
 
1076
- ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
1077
- _context15.next = 8;
1078
- return deleteExLink(nodeElement);
1079
-
1080
- case 8:
1081
- nodeElement.a(ip);
1082
- nodeElement.setName(txtValue);
1083
- nodeElement.setTag("ip:" + txtValue); // 获取配置
1084
-
1085
- configObj = topo.resourceConfig.getConfig();
1086
- _context15.next = 14;
1087
- return resourceConfig.updateConfig(configObj);
1088
-
1089
- case 14:
1090
- _context15.next = 16;
1091
- return editDispatchers.fetchDataByConfig();
1092
-
1093
- case 16:
1094
- configData = _context15.sent;
1095
- // console.log("configData",configObj, configData);
1096
- _elements = configData.elements;
1097
- newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
1098
-
1099
- newLink = newLinkElements.filter(function (item) {
1100
- return item.type === "link";
1101
- });
1102
- newLinkGroup = newLinkElements.filter(function (item) {
1103
- return item.type === "linkGroup";
1104
- }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1105
- // console.log("newData",newLinkElements, newLink);
1106
-
1107
- createElementsData = {
1108
- groups: [],
1109
- nodes: [],
1110
- links: newLink,
1111
- linkGroups: newLinkGroup
1112
- }; // console.log("createElementsData", createElementsData);
1113
-
1114
- if ([].concat(newLink, newLinkGroup).length > 0) {
1115
- _htTopo = topo.getHtTopo();
1116
-
1117
- _htTopo.createElements(createElementsData);
1118
- }
1109
+ ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
1110
+ _context15.next = 8;
1111
+ return deleteExLink(nodeElement);
1112
+
1113
+ case 8:
1114
+ nodeElement.a(ip);
1115
+ nodeElement.setName(txtValue);
1116
+ nodeElement.setTag("ip:" + txtValue); // 获取配置
1117
+
1118
+ configObj = topo.resourceConfig.getConfig();
1119
+ _context15.next = 14;
1120
+ return resourceConfig.updateConfig(configObj);
1119
1121
 
1120
- case 23:
1121
- case "end":
1122
- return _context15.stop();
1122
+ case 14:
1123
+ _context15.next = 16;
1124
+ return editDispatchers.fetchDataByConfig();
1125
+
1126
+ case 16:
1127
+ configData = _context15.sent;
1128
+ // console.log("configData",configObj, configData);
1129
+ _elements2 = configData.elements;
1130
+ newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
1131
+
1132
+ newLink = newLinkElements.filter(function (item) {
1133
+ return item.type === "link";
1134
+ });
1135
+ newLinkGroup = newLinkElements.filter(function (item) {
1136
+ return item.type === "linkGroup";
1137
+ }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1138
+ // console.log("newData",newLinkElements, newLink);
1139
+
1140
+ createElementsData = {
1141
+ groups: [],
1142
+ nodes: [],
1143
+ links: newLink,
1144
+ linkGroups: newLinkGroup
1145
+ };
1146
+ console.log("createElementsData", createElementsData);
1147
+
1148
+ if ([].concat(newLink, newLinkGroup).length > 0) {
1149
+ _htTopo = topo.getHtTopo();
1150
+
1151
+ _htTopo.createElements(createElementsData);
1152
+ }
1153
+
1154
+ case 24:
1155
+ case "end":
1156
+ return _context15.stop();
1157
+ }
1123
1158
  }
1124
1159
  }, _callee15);
1125
1160
  }));