@riil-frontend/component-topology 11.0.38 → 11.0.39

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 (218) 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/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +13 -11
  22. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +23 -21
  23. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  24. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -10
  25. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +27 -21
  26. package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
  27. package/es/core/editor/hooks/useNewElementTheme.js +2 -2
  28. package/es/core/editor/store/background.js +10 -8
  29. package/es/core/editor/store/topoEdit.js +6 -4
  30. package/es/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  31. package/es/core/hooks/usePolling.js +121 -117
  32. package/es/core/hooks/useResourceConfig.js +66 -58
  33. package/es/core/hooks/useTopoEdit.js +507 -477
  34. package/es/core/models/Alarm.js +298 -281
  35. package/es/core/models/AttributeMetricDisplay.js +107 -101
  36. package/es/core/models/PluginManager.js +3 -4
  37. package/es/core/models/SelectionModel.js +5 -4
  38. package/es/core/models/TopoApp.js +240 -205
  39. package/es/core/models/TopoGraphView.js +21 -18
  40. package/es/core/models/cache/CiCache.js +27 -28
  41. package/es/core/models/cache/CiTypeCache.js +41 -37
  42. package/es/core/models/cache/DictCache.js +35 -33
  43. package/es/core/models/graph/Background.js +17 -15
  44. package/es/core/models/plugins/resourceWebControllUrl.js +82 -76
  45. package/es/core/models/tagstips/ElementTagTipConfig.js +38 -34
  46. package/es/core/models/topoData.js +70 -68
  47. package/es/core/models/utils/linkUtils.js +43 -41
  48. package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
  49. package/es/core/services/alarm.js +16 -14
  50. package/es/core/services/background.js +67 -59
  51. package/es/core/services/cmdb/metric.js +11 -9
  52. package/es/core/services/cmdb.js +20 -18
  53. package/es/core/services/index.js +45 -39
  54. package/es/core/services/overview.js +151 -131
  55. package/es/core/services/topo/basic.js +41 -37
  56. package/es/core/services/topo/tagtip.js +12 -10
  57. package/es/core/store/models/ciModel.js +62 -58
  58. package/es/core/store/models/customIcon.js +134 -120
  59. package/es/core/store/models/displayConfig.js +19 -15
  60. package/es/core/store/models/selection.js +6 -4
  61. package/es/core/store/models/topoAlarm.js +145 -162
  62. package/es/core/store/models/topoBaseInfoOverview.js +6 -4
  63. package/es/core/store/models/topoBizMod.js +11 -9
  64. package/es/core/store/models/topoConfig.js +231 -215
  65. package/es/core/store/models/topoGraphView.js +6 -4
  66. package/es/core/store/models/topoMod.js +395 -373
  67. package/es/core/utils/edgeUtil.js +2 -1
  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 +111 -109
  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 +289 -251
  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/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +14 -12
  128. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +28 -26
  129. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  130. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +14 -12
  131. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +31 -25
  132. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  133. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  134. package/lib/core/editor/store/background.js +10 -8
  135. package/lib/core/editor/store/topoEdit.js +6 -4
  136. package/lib/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  137. package/lib/core/hooks/usePolling.js +120 -116
  138. package/lib/core/hooks/useResourceConfig.js +66 -58
  139. package/lib/core/hooks/useTopoEdit.js +499 -469
  140. package/lib/core/models/Alarm.js +292 -275
  141. package/lib/core/models/AttributeMetricDisplay.js +110 -104
  142. package/lib/core/models/PluginManager.js +3 -4
  143. package/lib/core/models/SelectionModel.js +5 -4
  144. package/lib/core/models/TopoApp.js +240 -205
  145. package/lib/core/models/TopoGraphView.js +21 -18
  146. package/lib/core/models/cache/CiCache.js +32 -33
  147. package/lib/core/models/cache/CiTypeCache.js +42 -38
  148. package/lib/core/models/cache/DictCache.js +35 -33
  149. package/lib/core/models/graph/Background.js +18 -16
  150. package/lib/core/models/plugins/resourceWebControllUrl.js +80 -74
  151. package/lib/core/models/tagstips/ElementTagTipConfig.js +38 -34
  152. package/lib/core/models/topoData.js +71 -69
  153. package/lib/core/models/utils/linkUtils.js +43 -41
  154. package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
  155. package/lib/core/services/alarm.js +20 -18
  156. package/lib/core/services/background.js +78 -70
  157. package/lib/core/services/cmdb/metric.js +12 -10
  158. package/lib/core/services/cmdb.js +22 -20
  159. package/lib/core/services/index.js +51 -45
  160. package/lib/core/services/overview.js +151 -131
  161. package/lib/core/services/topo/basic.js +41 -37
  162. package/lib/core/services/topo/tagtip.js +14 -12
  163. package/lib/core/store/models/ciModel.js +70 -66
  164. package/lib/core/store/models/customIcon.js +134 -120
  165. package/lib/core/store/models/displayConfig.js +19 -15
  166. package/lib/core/store/models/selection.js +6 -4
  167. package/lib/core/store/models/topoAlarm.js +145 -163
  168. package/lib/core/store/models/topoBaseInfoOverview.js +6 -4
  169. package/lib/core/store/models/topoBizMod.js +11 -9
  170. package/lib/core/store/models/topoConfig.js +238 -222
  171. package/lib/core/store/models/topoGraphView.js +6 -4
  172. package/lib/core/store/models/topoMod.js +397 -375
  173. package/lib/core/utils/edgeUtil.js +2 -1
  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 +111 -109
  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 +290 -252
  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/lib/utils/htElementDataUtil.js +2 -4
  218. package/package.json +2 -2
@@ -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
  }));
@@ -594,34 +606,36 @@ var useTopoEdit = function useTopoEdit(params) {
594
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
- result = _context12.sent;
611
- console.log("fetchDataByConfig", result);
612
-
613
- if (result) {
614
- _elements = result.elements;
615
- saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
616
-
617
- if (topo.linkDynamicStyleExecutor) {
618
- topo.linkDynamicStyleExecutor.execute();
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
+ }
619
633
  }
620
- }
621
634
 
622
- case 9:
623
- case "end":
624
- return _context12.stop();
635
+ case 9:
636
+ case "end":
637
+ return _context12.stop();
638
+ }
625
639
  }
626
640
  }, _callee12);
627
641
  }));
@@ -637,44 +651,46 @@ var useTopoEdit = function useTopoEdit(params) {
637
651
  var _yield$editDispatcher3, elements, newElements;
638
652
 
639
653
  return _regenerator["default"].wrap(function _callee13$(_context13) {
640
- while (1) switch (_context13.prev = _context13.next) {
641
- case 0:
642
- topo.historyManager.beginTransaction(); // 构造新的配置
643
-
644
- _context13.next = 3;
645
- return resourceConfig.addLayerStaticResources(group, newResourceIds);
646
-
647
- case 3:
648
- _context13.next = 5;
649
- return editDispatchers.fetchDataByConfig();
650
-
651
- case 5:
652
- _yield$editDispatcher3 = _context13.sent;
653
- elements = _yield$editDispatcher3.elements;
654
- // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
655
- newElements = findUNExistedElements(elements);
656
-
657
- _rlog["default"].debug("添加分层资源", {
658
- layer: group,
659
- newElements: newElements
660
- });
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
+ });
661
676
 
662
- topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
677
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
663
678
 
664
- if (topo.linkDynamicStyleExecutor) {
665
- topo.linkDynamicStyleExecutor.execute();
666
- }
679
+ if (topo.linkDynamicStyleExecutor) {
680
+ topo.linkDynamicStyleExecutor.execute();
681
+ }
667
682
 
668
- topo.historyManager.endTransaction();
669
- topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
683
+ topo.historyManager.endTransaction();
684
+ topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
670
685
 
671
- topoEditDispatchers.update({
672
- resourceTabActiveKey: null
673
- });
686
+ topoEditDispatchers.update({
687
+ resourceTabActiveKey: null
688
+ });
674
689
 
675
- case 14:
676
- case "end":
677
- return _context13.stop();
690
+ case 14:
691
+ case "end":
692
+ return _context13.stop();
693
+ }
678
694
  }
679
695
  }, _callee13);
680
696
  }));
@@ -689,15 +705,17 @@ var useTopoEdit = function useTopoEdit(params) {
689
705
  _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
690
706
  var group;
691
707
  return _regenerator["default"].wrap(function _callee14$(_context14) {
692
- while (1) switch (_context14.prev = _context14.next) {
693
- case 0:
694
- group = resourceConfig.getGroups()[0];
695
- _context14.next = 3;
696
- return addLayerResources(group, data);
697
-
698
- case 3:
699
- case "end":
700
- 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
+ }
701
719
  }
702
720
  }, _callee14);
703
721
  }));
@@ -733,38 +751,40 @@ var useTopoEdit = function useTopoEdit(params) {
733
751
  var onSaveComboRes = /*#__PURE__*/function () {
734
752
  var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
735
753
  return _regenerator["default"].wrap(function _callee5$(_context5) {
736
- while (1) switch (_context5.prev = _context5.next) {
737
- case 0:
738
- _rlog["default"].debug("关联资源-----onSaveComboRes", data);
754
+ while (1) {
755
+ switch (_context5.prev = _context5.next) {
756
+ case 0:
757
+ _rlog["default"].debug("关联资源-----onSaveComboRes", data);
739
758
 
740
- topo.historyManager.beginTransaction();
759
+ topo.historyManager.beginTransaction();
741
760
 
742
- if (!(getAddResourceType() === "addToFirstLayer")) {
743
- _context5.next = 7;
744
- break;
745
- }
761
+ if (!(getAddResourceType() === "addToFirstLayer")) {
762
+ _context5.next = 7;
763
+ break;
764
+ }
746
765
 
747
- _context5.next = 5;
748
- return addResourceToFirstLayer(data);
766
+ _context5.next = 5;
767
+ return addResourceToFirstLayer(data);
749
768
 
750
- case 5:
751
- _context5.next = 9;
752
- break;
769
+ case 5:
770
+ _context5.next = 9;
771
+ break;
753
772
 
754
- case 7:
755
- _context5.next = 9;
756
- return bindViewResources(data);
773
+ case 7:
774
+ _context5.next = 9;
775
+ return bindViewResources(data);
757
776
 
758
- case 9:
759
- topo.historyManager.endTransaction();
760
- topo.getHtTopo().fitContent();
761
- topoEditDispatchers.update({
762
- resourceTabActiveKey: null
763
- });
777
+ case 9:
778
+ topo.historyManager.endTransaction();
779
+ topo.getHtTopo().fitContent();
780
+ topoEditDispatchers.update({
781
+ resourceTabActiveKey: null
782
+ });
764
783
 
765
- case 12:
766
- case "end":
767
- return _context5.stop();
784
+ case 12:
785
+ case "end":
786
+ return _context5.stop();
787
+ }
768
788
  }
769
789
  }, _callee5);
770
790
  }));
@@ -779,47 +799,51 @@ var useTopoEdit = function useTopoEdit(params) {
779
799
  var id, config, serialize, _config$layout, template, layout, saveConfig;
780
800
 
781
801
  return _regenerator["default"].wrap(function _callee7$(_context7) {
782
- while (1) switch (_context7.prev = _context7.next) {
783
- case 0:
784
- id = data.id, config = data.config, serialize = data.serialize;
785
- _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
786
-
787
- if (onSave) {
788
- // 自定义保存
789
- saveConfig = /*#__PURE__*/function () {
790
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
791
- return _regenerator["default"].wrap(function _callee6$(_context6) {
792
- while (1) switch (_context6.prev = _context6.next) {
793
- case 0:
794
- _context6.next = 2;
795
- return editDispatchers.saveTopo({
796
- id: id,
797
- layout: layout,
798
- serialize: serialize
799
- });
800
-
801
- case 2:
802
- case "end":
803
- return _context6.stop();
804
- }
805
- }, _callee6);
806
- }));
807
-
808
- return function saveConfig() {
809
- return _ref7.apply(this, arguments);
810
- };
811
- }();
812
-
813
- onSave({
814
- topo: topo,
815
- data: data,
816
- saveConfig: saveConfig
817
- });
818
- }
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
+ }
819
842
 
820
- case 3:
821
- case "end":
822
- return _context7.stop();
843
+ case 3:
844
+ case "end":
845
+ return _context7.stop();
846
+ }
823
847
  }
824
848
  }, _callee7);
825
849
  }));
@@ -857,181 +881,185 @@ var useTopoEdit = function useTopoEdit(params) {
857
881
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
858
882
 
859
883
  return _regenerator["default"].wrap(function _callee9$(_context9) {
860
- while (1) switch (_context9.prev = _context9.next) {
861
- case 0:
862
- replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
863
- return (0, _extends2["default"])({}, resources, {
864
- "static": [].concat(resources["static"].filter(function (item) {
865
- return item !== oldResId;
866
- }), [newResId])
867
- });
868
- };
869
-
870
- _doBind = function _doBind3() {
871
- _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
872
- var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
873
- return _regenerator["default"].wrap(function _callee8$(_context8) {
874
- while (1) switch (_context8.prev = _context8.next) {
875
- case 0:
876
- dm = htTopo.getGraphView().dm(); // 创建
877
-
878
- newLinkElements = findUNExistedLinkElements(elements);
879
- createElementsData = null;
880
-
881
- if (newData.type === "group") {
882
- groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
883
- newGroupChildren = [];
884
- existedGroupChildren = [];
885
- groupChildren.forEach(function (groupChildData) {
886
- var ele = dm.getDataByTag(groupChildData.id);
887
-
888
- if (ele) {
889
- 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
+ });
890
937
  } else {
891
- 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);
892
949
  }
893
- });
894
- createElementsData = {
895
- groups: [newData],
896
- nodes: newGroupChildren,
897
- links: newLinkElements.filter(function (item) {
898
- return item.type === "link";
899
- }),
900
- linkGroups: newLinkElements.filter(function (item) {
901
- return item.type === "linkGroup";
902
- })
903
- };
904
- htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
905
-
906
- groupElement = dm.getDataByTag(newData.id);
907
- existedGroupChildren.forEach(function (groupChildData) {
908
- var nodeElement = dm.getDataByTag(groupChildData.id);
909
- nodeElement.setParent(groupElement);
910
- });
911
- } else {
912
- createElementsData = {
913
- groups: [],
914
- nodes: [newData],
915
- links: newLinkElements.filter(function (item) {
916
- return item.type === "link";
917
- }),
918
- linkGroups: newLinkElements.filter(function (item) {
919
- return item.type === "linkGroup";
920
- })
921
- };
922
- htTopo.createElements(createElementsData);
923
- }
924
950
 
925
- _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
951
+ _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
926
952
 
927
953
 
928
- newElement = dm.getDataByTag(newData.id);
954
+ newElement = dm.getDataByTag(newData.id);
929
955
 
930
- if (newElement) {
931
- newElement.setSize(node.getSize());
932
- newElement.setPosition(node.getPosition());
933
- newElement.setImage(node.getImage());
934
- } // 选中
956
+ if (newElement) {
957
+ newElement.setSize(node.getSize());
958
+ newElement.setPosition(node.getPosition());
959
+ newElement.setImage(node.getImage());
960
+ } // 选中
935
961
 
936
962
 
937
- sm = htTopo.getGraphView().sm();
938
- sm.setSelection([newElement]); // 移除旧节点
963
+ sm = htTopo.getGraphView().sm();
964
+ sm.setSelection([newElement]); // 移除旧节点
939
965
 
940
- dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
941
- // node.a("customName", null);
942
- // 删除关联在节点上的出口链路
966
+ dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
967
+ // node.a("customName", null);
968
+ // 删除关联在节点上的出口链路
943
969
 
944
- _context8.next = 12;
945
- return deleteExLink(node);
970
+ _context8.next = 12;
971
+ return deleteExLink(node);
946
972
 
947
- case 12:
948
- // 临时放这里,仅拓扑中心有
949
- if (topo.linkDynamicStyleExecutor) {
950
- topo.linkDynamicStyleExecutor.execute();
951
- }
973
+ case 12:
974
+ // 临时放这里,仅拓扑中心有
975
+ if (topo.linkDynamicStyleExecutor) {
976
+ topo.linkDynamicStyleExecutor.execute();
977
+ }
952
978
 
953
- case 13:
954
- case "end":
955
- return _context8.stop();
956
- }
957
- }, _callee8);
958
- }));
959
- return _doBind.apply(this, arguments);
960
- };
979
+ case 13:
980
+ case "end":
981
+ return _context8.stop();
982
+ }
983
+ }
984
+ }, _callee8);
985
+ }));
986
+ return _doBind.apply(this, arguments);
987
+ };
961
988
 
962
- doBind = function _doBind2() {
963
- return _doBind.apply(this, arguments);
964
- };
989
+ doBind = function _doBind2() {
990
+ return _doBind.apply(this, arguments);
991
+ };
965
992
 
966
- topo.historyManager.beginTransaction();
967
- id = params.id, oldResId = params.oldResId, newResId = params.newResId;
993
+ topo.historyManager.beginTransaction();
994
+ id = params.id, oldResId = params.oldResId, newResId = params.newResId;
968
995
 
969
- _rlog["default"].debug("bindNodeResource", params);
996
+ _rlog["default"].debug("bindNodeResource", params);
970
997
 
971
- node = topo.getDataModel().getDataById(id); // 节点所属容器
998
+ node = topo.getDataModel().getDataById(id); // 节点所属容器
972
999
 
973
- parentGroupElement = node.getParent();
974
- htTopo = topo.getHtTopo();
975
- config = resourceConfig.getConfig();
1000
+ parentGroupElement = node.getParent();
1001
+ htTopo = topo.getHtTopo();
1002
+ config = resourceConfig.getConfig();
976
1003
 
977
- if (parentGroupElement) {
978
- // 在容器中
979
- groupId = parentGroupElement.getTag(); // 容器业务id
1004
+ if (parentGroupElement) {
1005
+ // 在容器中
1006
+ groupId = parentGroupElement.getTag(); // 容器业务id
980
1007
 
981
- groupTag = parentGroupElement.a("tag"); // 容器临时id
1008
+ groupTag = parentGroupElement.a("tag"); // 容器临时id
982
1009
 
983
- config.groups = config.groups.map(function (g) {
984
- // 匹配到容器,替换资源或增加
985
- if (g.id === groupId || g.tag === groupTag) {
986
- return (0, _extends2["default"])({}, g, {
987
- resources: replaceOrAddRes(g.resources, oldResId, newResId)
988
- });
989
- } // 未匹配到容器
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
+ } // 未匹配到容器
990
1017
 
991
1018
 
992
- return g;
993
- });
994
- } else {
995
- // 在画布上
996
- config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
997
- }
1019
+ return g;
1020
+ });
1021
+ } else {
1022
+ // 在画布上
1023
+ config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
1024
+ }
998
1025
 
999
- _context9.next = 13;
1000
- return resourceConfig.updateConfig(config);
1026
+ _context9.next = 13;
1027
+ return resourceConfig.updateConfig(config);
1001
1028
 
1002
- case 13:
1003
- _context9.next = 15;
1004
- return editDispatchers.fetchDataByConfig();
1029
+ case 13:
1030
+ _context9.next = 15;
1031
+ return editDispatchers.fetchDataByConfig();
1005
1032
 
1006
- case 15:
1007
- _yield$editDispatcher = _context9.sent;
1008
- elements = _yield$editDispatcher.elements;
1009
- newData = elements.find(function (item) {
1010
- return item.id === newResId;
1011
- });
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
+ });
1012
1039
 
1013
- if (newData) {
1014
- _context9.next = 23;
1015
- break;
1016
- }
1040
+ if (newData) {
1041
+ _context9.next = 23;
1042
+ break;
1043
+ }
1017
1044
 
1018
- _message["default"].error("关联资源失败");
1045
+ _message["default"].error("关联资源失败");
1019
1046
 
1020
- _rlog["default"].warn("关联资源失败");
1047
+ _rlog["default"].warn("关联资源失败");
1021
1048
 
1022
- topo.historyManager.endTransaction();
1023
- return _context9.abrupt("return", false);
1049
+ topo.historyManager.endTransaction();
1050
+ return _context9.abrupt("return", false);
1024
1051
 
1025
- case 23:
1026
- _context9.next = 25;
1027
- return doBind();
1052
+ case 23:
1053
+ _context9.next = 25;
1054
+ return doBind();
1028
1055
 
1029
- case 25:
1030
- topo.historyManager.endTransaction();
1056
+ case 25:
1057
+ topo.historyManager.endTransaction();
1031
1058
 
1032
- case 26:
1033
- case "end":
1034
- return _context9.stop();
1059
+ case 26:
1060
+ case "end":
1061
+ return _context9.stop();
1062
+ }
1035
1063
  }
1036
1064
  }, _callee9);
1037
1065
  }));
@@ -1054,77 +1082,79 @@ var useTopoEdit = function useTopoEdit(params) {
1054
1082
  var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1055
1083
 
1056
1084
  return _regenerator["default"].wrap(function _callee15$(_context15) {
1057
- while (1) switch (_context15.prev = _context15.next) {
1058
- case 0:
1059
- if (txtValue) {
1060
- _context15.next = 2;
1061
- break;
1062
- }
1085
+ while (1) {
1086
+ switch (_context15.prev = _context15.next) {
1087
+ case 0:
1088
+ if (txtValue) {
1089
+ _context15.next = 2;
1090
+ break;
1091
+ }
1063
1092
 
1064
- return _context15.abrupt("return");
1093
+ return _context15.abrupt("return");
1065
1094
 
1066
- case 2:
1067
- // if (txtValue === nodeElement.a('bindIp')) {
1068
- // return;
1069
- // }
1070
- // 根据配置查询拓扑数据
1071
- dm = topo.getDataModel(); // 执行唯一性验证
1095
+ case 2:
1096
+ // if (txtValue === nodeElement.a('bindIp')) {
1097
+ // return;
1098
+ // }
1099
+ // 根据配置查询拓扑数据
1100
+ dm = topo.getDataModel(); // 执行唯一性验证
1072
1101
 
1073
- isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1102
+ isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1074
1103
 
1075
- if (!isUnique) {
1076
- _context15.next = 24;
1077
- break;
1078
- }
1104
+ if (!isUnique) {
1105
+ _context15.next = 24;
1106
+ break;
1107
+ }
1079
1108
 
1080
- ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
1081
- _context15.next = 8;
1082
- return deleteExLink(nodeElement);
1083
-
1084
- case 8:
1085
- nodeElement.a(ip);
1086
- nodeElement.setName(txtValue);
1087
- nodeElement.setTag("ip:" + txtValue); // 获取配置
1088
-
1089
- configObj = topo.resourceConfig.getConfig();
1090
- _context15.next = 14;
1091
- return resourceConfig.updateConfig(configObj);
1092
-
1093
- case 14:
1094
- _context15.next = 16;
1095
- return editDispatchers.fetchDataByConfig();
1096
-
1097
- case 16:
1098
- configData = _context15.sent;
1099
- // console.log("configData",configObj, configData);
1100
- _elements2 = configData.elements;
1101
- newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
1102
-
1103
- newLink = newLinkElements.filter(function (item) {
1104
- return item.type === "link";
1105
- });
1106
- newLinkGroup = newLinkElements.filter(function (item) {
1107
- return item.type === "linkGroup";
1108
- }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1109
- // console.log("newData",newLinkElements, newLink);
1110
-
1111
- createElementsData = {
1112
- groups: [],
1113
- nodes: [],
1114
- links: newLink,
1115
- linkGroups: newLinkGroup
1116
- };
1117
- console.log("createElementsData", createElementsData);
1118
-
1119
- if ([].concat(newLink, newLinkGroup).length > 0) {
1120
- _htTopo = topo.getHtTopo();
1121
-
1122
- _htTopo.createElements(createElementsData);
1123
- }
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);
1124
1121
 
1125
- case 24:
1126
- case "end":
1127
- 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
+ }
1128
1158
  }
1129
1159
  }, _callee15);
1130
1160
  }));