@riil-frontend/component-topology 11.0.39 → 11.0.40

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 (216) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +4 -2
  4. package/build/index.js +49 -34
  5. package/es/components/MultiResourceDrawer/index.js +16 -18
  6. package/es/components/ResourceList/ResourceSelect.js +48 -50
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +24 -26
  8. package/es/components/SingleResourceDrawer/SelectDrawer.js +18 -20
  9. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +23 -25
  10. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
  11. package/es/core/components/titlebar/widgets/TitleWidget.js +5 -3
  12. package/es/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
  13. package/es/core/editor/components/BackgroundView/index.js +119 -129
  14. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +20 -22
  15. package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
  16. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +15 -17
  17. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +7 -9
  18. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
  19. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
  20. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
  21. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +11 -13
  22. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +21 -23
  23. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
  24. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +10 -12
  25. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +21 -27
  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 +8 -10
  29. package/es/core/editor/store/topoEdit.js +4 -6
  30. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  31. package/es/core/hooks/usePolling.js +117 -121
  32. package/es/core/hooks/useResourceConfig.js +58 -66
  33. package/es/core/hooks/useTopoEdit.js +477 -507
  34. package/es/core/models/Alarm.js +281 -298
  35. package/es/core/models/AttributeMetricDisplay.js +101 -107
  36. package/es/core/models/PluginManager.js +4 -3
  37. package/es/core/models/SelectionModel.js +4 -5
  38. package/es/core/models/TopoApp.js +205 -240
  39. package/es/core/models/TopoGraphView.js +18 -21
  40. package/es/core/models/cache/CiCache.js +28 -27
  41. package/es/core/models/cache/CiTypeCache.js +37 -41
  42. package/es/core/models/cache/DictCache.js +33 -35
  43. package/es/core/models/graph/Background.js +15 -17
  44. package/es/core/models/plugins/resourceWebControllUrl.js +76 -82
  45. package/es/core/models/tagstips/ElementTagTipConfig.js +34 -38
  46. package/es/core/models/topoData.js +68 -70
  47. package/es/core/models/utils/linkUtils.js +41 -43
  48. package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
  49. package/es/core/services/alarm.js +14 -16
  50. package/es/core/services/background.js +59 -67
  51. package/es/core/services/cmdb/metric.js +9 -11
  52. package/es/core/services/cmdb.js +18 -20
  53. package/es/core/services/index.js +39 -45
  54. package/es/core/services/overview.js +131 -151
  55. package/es/core/services/topo/basic.js +37 -41
  56. package/es/core/services/topo/tagtip.js +10 -12
  57. package/es/core/store/models/ciModel.js +58 -62
  58. package/es/core/store/models/customIcon.js +120 -134
  59. package/es/core/store/models/displayConfig.js +15 -19
  60. package/es/core/store/models/selection.js +4 -6
  61. package/es/core/store/models/topoAlarm.js +162 -145
  62. package/es/core/store/models/topoBaseInfoOverview.js +4 -6
  63. package/es/core/store/models/topoBizMod.js +9 -11
  64. package/es/core/store/models/topoConfig.js +215 -231
  65. package/es/core/store/models/topoGraphView.js +4 -6
  66. package/es/core/store/models/topoMod.js +373 -395
  67. package/es/core/utils/imageUtil.js +18 -20
  68. package/es/core/utils/saveSerialize.js +9 -11
  69. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +343 -357
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +189 -205
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -37
  78. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
  79. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
  80. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +17 -19
  81. package/es/networkTopo/components/Link/hook.js +73 -77
  82. package/es/networkTopo/components/Link/index.js +86 -94
  83. package/es/networkTopo/components/Link/setting.js +42 -44
  84. package/es/networkTopo/getTopoData.js +63 -69
  85. package/es/networkTopo/hooks/viewer/useRelateTopo.js +30 -32
  86. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  87. package/es/networkTopo/models/TopoCenter.js +18 -22
  88. package/es/networkTopo/services/alert.js +18 -22
  89. package/es/networkTopo/services/authorization.js +45 -55
  90. package/es/networkTopo/services/cmdb.js +422 -470
  91. package/es/networkTopo/services/funcAuth.js +22 -24
  92. package/es/networkTopo/services/link.js +107 -117
  93. package/es/networkTopo/services/mdc.js +18 -24
  94. package/es/networkTopo/services/metric.js +23 -27
  95. package/es/networkTopo/services/model.js +445 -509
  96. package/es/networkTopo/services/risk.js +9 -11
  97. package/es/networkTopo/services/topo/auth.js +27 -33
  98. package/es/networkTopo/services/topo/basic.js +251 -289
  99. package/es/networkTopo/services/topo/blacklist.js +20 -24
  100. package/es/networkTopo/services/topo/ciInfo.js +27 -31
  101. package/es/networkTopo/services/topo/icon.js +49 -59
  102. package/es/networkTopo/services/topo/networkLink.js +32 -36
  103. package/es/networkTopo/services/topo/relation.js +9 -11
  104. package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
  105. package/es/networkTopo/store/functionAuth.js +31 -37
  106. package/es/networkTopo/store/topoCenter.js +142 -152
  107. package/es/networkTopo/store/topoLinkMod.js +4 -6
  108. package/es/networkTopo/store/topoTreeMod.js +170 -182
  109. package/es/networkTopo/utils/exportData.js +52 -54
  110. package/lib/components/MultiResourceDrawer/index.js +16 -18
  111. package/lib/components/ResourceList/ResourceSelect.js +48 -50
  112. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +27 -29
  113. package/lib/components/SingleResourceDrawer/SelectDrawer.js +18 -20
  114. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +30 -32
  115. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
  116. package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -3
  117. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
  118. package/lib/core/editor/components/BackgroundView/index.js +118 -128
  119. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -24
  120. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
  121. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +19 -21
  122. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -10
  123. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
  124. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
  125. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
  126. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +12 -14
  127. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +26 -28
  128. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
  129. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -14
  130. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +25 -31
  131. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  132. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  133. package/lib/core/editor/store/background.js +8 -10
  134. package/lib/core/editor/store/topoEdit.js +4 -6
  135. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  136. package/lib/core/hooks/usePolling.js +116 -120
  137. package/lib/core/hooks/useResourceConfig.js +58 -66
  138. package/lib/core/hooks/useTopoEdit.js +469 -499
  139. package/lib/core/models/Alarm.js +275 -292
  140. package/lib/core/models/AttributeMetricDisplay.js +104 -110
  141. package/lib/core/models/PluginManager.js +4 -3
  142. package/lib/core/models/SelectionModel.js +4 -5
  143. package/lib/core/models/TopoApp.js +205 -240
  144. package/lib/core/models/TopoGraphView.js +18 -21
  145. package/lib/core/models/cache/CiCache.js +33 -32
  146. package/lib/core/models/cache/CiTypeCache.js +38 -42
  147. package/lib/core/models/cache/DictCache.js +33 -35
  148. package/lib/core/models/graph/Background.js +16 -18
  149. package/lib/core/models/plugins/resourceWebControllUrl.js +74 -80
  150. package/lib/core/models/tagstips/ElementTagTipConfig.js +34 -38
  151. package/lib/core/models/topoData.js +69 -71
  152. package/lib/core/models/utils/linkUtils.js +41 -43
  153. package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
  154. package/lib/core/services/alarm.js +18 -20
  155. package/lib/core/services/background.js +70 -78
  156. package/lib/core/services/cmdb/metric.js +10 -12
  157. package/lib/core/services/cmdb.js +20 -22
  158. package/lib/core/services/index.js +45 -51
  159. package/lib/core/services/overview.js +131 -151
  160. package/lib/core/services/topo/basic.js +37 -41
  161. package/lib/core/services/topo/tagtip.js +12 -14
  162. package/lib/core/store/models/ciModel.js +66 -70
  163. package/lib/core/store/models/customIcon.js +120 -134
  164. package/lib/core/store/models/displayConfig.js +15 -19
  165. package/lib/core/store/models/selection.js +4 -6
  166. package/lib/core/store/models/topoAlarm.js +163 -145
  167. package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
  168. package/lib/core/store/models/topoBizMod.js +9 -11
  169. package/lib/core/store/models/topoConfig.js +222 -238
  170. package/lib/core/store/models/topoGraphView.js +4 -6
  171. package/lib/core/store/models/topoMod.js +375 -397
  172. package/lib/core/utils/imageUtil.js +22 -24
  173. package/lib/core/utils/saveSerialize.js +9 -11
  174. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
  175. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
  176. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +344 -358
  177. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
  178. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
  179. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +190 -206
  180. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
  181. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +29 -33
  183. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
  184. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
  185. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +18 -20
  186. package/lib/networkTopo/components/Link/hook.js +73 -77
  187. package/lib/networkTopo/components/Link/index.js +87 -95
  188. package/lib/networkTopo/components/Link/setting.js +42 -44
  189. package/lib/networkTopo/getTopoData.js +63 -69
  190. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +31 -33
  191. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  192. package/lib/networkTopo/models/TopoCenter.js +18 -22
  193. package/lib/networkTopo/services/alert.js +18 -22
  194. package/lib/networkTopo/services/authorization.js +55 -65
  195. package/lib/networkTopo/services/cmdb.js +422 -470
  196. package/lib/networkTopo/services/funcAuth.js +24 -26
  197. package/lib/networkTopo/services/link.js +108 -118
  198. package/lib/networkTopo/services/mdc.js +21 -27
  199. package/lib/networkTopo/services/metric.js +27 -31
  200. package/lib/networkTopo/services/model.js +445 -509
  201. package/lib/networkTopo/services/risk.js +11 -13
  202. package/lib/networkTopo/services/topo/auth.js +27 -33
  203. package/lib/networkTopo/services/topo/basic.js +252 -290
  204. package/lib/networkTopo/services/topo/blacklist.js +20 -24
  205. package/lib/networkTopo/services/topo/ciInfo.js +34 -38
  206. package/lib/networkTopo/services/topo/icon.js +59 -69
  207. package/lib/networkTopo/services/topo/networkLink.js +32 -36
  208. package/lib/networkTopo/services/topo/relation.js +11 -13
  209. package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
  210. package/lib/networkTopo/store/functionAuth.js +31 -37
  211. package/lib/networkTopo/store/topoCenter.js +142 -152
  212. package/lib/networkTopo/store/topoLinkMod.js +4 -6
  213. package/lib/networkTopo/store/topoTreeMod.js +166 -178
  214. package/lib/networkTopo/utils/exportData.js +59 -61
  215. package/lib/utils/htElementDataUtil.js +4 -2
  216. package/package.json +2 -2
@@ -106,38 +106,36 @@ 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) {
110
- switch (_context.prev = _context.next) {
111
- case 0:
112
- target = _ref.target, direction = _ref.direction;
113
- topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
109
+ while (1) switch (_context.prev = _context.next) {
110
+ case 0:
111
+ target = _ref.target, direction = _ref.direction;
112
+ topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
114
113
 
115
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
114
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
116
115
 
117
- _rlog["default"].info("onLayerAdd", {
118
- config: config
119
- }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
116
+ _rlog["default"].info("onLayerAdd", {
117
+ config: config
118
+ }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
120
119
 
121
120
 
122
- if (!(!isLayerTopo && config.layers.length)) {
123
- _context.next = 7;
124
- break;
125
- }
126
-
121
+ if (!(!isLayerTopo && config.layers.length)) {
127
122
  _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
- }
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();
135
+
136
+ case 8:
137
+ case "end":
138
+ return _context.stop();
141
139
  }
142
140
  }, _callee);
143
141
  }));
@@ -151,42 +149,40 @@ var useTopoEdit = function useTopoEdit(params) {
151
149
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(layerElement) {
152
150
  var config;
153
151
  return _regenerator["default"].wrap(function _callee2$(_context2) {
154
- while (1) {
155
- switch (_context2.prev = _context2.next) {
156
- case 0:
157
- topo.historyManager.beginTransaction();
158
- emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
159
-
160
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
152
+ while (1) switch (_context2.prev = _context2.next) {
153
+ case 0:
154
+ topo.historyManager.beginTransaction();
155
+ emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
161
156
 
162
- _rlog["default"].info("deleteLayer", {
163
- config: config
164
- }); // 如果没有分层,将拓扑类型切换为空白模板
157
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
165
158
 
159
+ _rlog["default"].info("deleteLayer", {
160
+ config: config
161
+ }); // 如果没有分层,将拓扑类型切换为空白模板
166
162
 
167
- if (config.layers.length) {
168
- _context2.next = 7;
169
- break;
170
- }
171
163
 
164
+ if (config.layers.length) {
172
165
  _context2.next = 7;
173
- return topoDispatchers.setTopoType(_template.TPL_BLANK);
166
+ break;
167
+ }
174
168
 
175
- case 7:
176
- _context2.next = 9;
177
- return resourceConfig.updateConfig(config);
169
+ _context2.next = 7;
170
+ return topoDispatchers.setTopoType(_template.TPL_BLANK);
178
171
 
179
- case 9:
180
- _context2.next = 11;
181
- return editDispatchers.fetchDataByConfig();
172
+ case 7:
173
+ _context2.next = 9;
174
+ return resourceConfig.updateConfig(config);
182
175
 
183
- case 11:
184
- topo.historyManager.endTransaction();
176
+ case 9:
177
+ _context2.next = 11;
178
+ return editDispatchers.fetchDataByConfig();
185
179
 
186
- case 12:
187
- case "end":
188
- return _context2.stop();
189
- }
180
+ case 11:
181
+ topo.historyManager.endTransaction();
182
+
183
+ case 12:
184
+ case "end":
185
+ return _context2.stop();
190
186
  }
191
187
  }, _callee2);
192
188
  }));
@@ -217,15 +213,13 @@ var useTopoEdit = function useTopoEdit(params) {
217
213
  onOk: function () {
218
214
  var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
219
215
  return _regenerator["default"].wrap(function _callee3$(_context3) {
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
- }
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();
229
223
  }
230
224
  }, _callee3);
231
225
  }));
@@ -391,35 +385,33 @@ var useTopoEdit = function useTopoEdit(params) {
391
385
 
392
386
  var config, edges, exportLinkIdList;
393
387
  return _regenerator["default"].wrap(function _callee4$(_context4) {
394
- while (1) {
395
- switch (_context4.prev = _context4.next) {
396
- case 0:
397
- config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
398
-
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 = [];
400
-
401
- if (!(edges.length > 0)) {
402
- _context4.next = 8;
403
- break;
404
- }
388
+ while (1) switch (_context4.prev = _context4.next) {
389
+ case 0:
390
+ config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
405
391
 
406
- exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
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 = [];
407
393
 
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;
394
+ if (!(edges.length > 0)) {
416
395
  _context4.next = 8;
417
- return resourceConfig.updateConfig(config);
396
+ break;
397
+ }
418
398
 
419
- case 8:
420
- case "end":
421
- return _context4.stop();
422
- }
399
+ exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
400
+
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();
423
415
  }
424
416
  }, _callee4);
425
417
  }));
@@ -511,43 +503,41 @@ var useTopoEdit = function useTopoEdit(params) {
511
503
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
512
504
 
513
505
  return _regenerator["default"].wrap(function _callee10$(_context10) {
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
- }
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();
543
533
  }
534
+ }
544
535
 
545
- topo.historyManager.endTransaction();
536
+ topo.historyManager.endTransaction();
546
537
 
547
- case 14:
548
- case "end":
549
- return _context10.stop();
550
- }
538
+ case 14:
539
+ case "end":
540
+ return _context10.stop();
551
541
  }
552
542
  }, _callee10);
553
543
  }));
@@ -566,24 +556,22 @@ var useTopoEdit = function useTopoEdit(params) {
566
556
  _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
567
557
  var groupConfig, resources, groupData;
568
558
  return _regenerator["default"].wrap(function _callee11$(_context11) {
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
- }
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();
587
575
  }
588
576
  }, _callee11);
589
577
  }));
@@ -606,36 +594,34 @@ var useTopoEdit = function useTopoEdit(params) {
606
594
  var config, result, _elements;
607
595
 
608
596
  return _regenerator["default"].wrap(function _callee12$(_context12) {
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
- }
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();
633
619
  }
620
+ }
634
621
 
635
- case 9:
636
- case "end":
637
- return _context12.stop();
638
- }
622
+ case 9:
623
+ case "end":
624
+ return _context12.stop();
639
625
  }
640
626
  }, _callee12);
641
627
  }));
@@ -651,46 +637,44 @@ var useTopoEdit = function useTopoEdit(params) {
651
637
  var _yield$editDispatcher3, elements, newElements;
652
638
 
653
639
  return _regenerator["default"].wrap(function _callee13$(_context13) {
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
- });
640
+ while (1) switch (_context13.prev = _context13.next) {
641
+ case 0:
642
+ topo.historyManager.beginTransaction(); // 构造新的配置
676
643
 
677
- topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
644
+ _context13.next = 3;
645
+ return resourceConfig.addLayerStaticResources(group, newResourceIds);
678
646
 
679
- if (topo.linkDynamicStyleExecutor) {
680
- topo.linkDynamicStyleExecutor.execute();
681
- }
647
+ case 3:
648
+ _context13.next = 5;
649
+ return editDispatchers.fetchDataByConfig();
682
650
 
683
- topo.historyManager.endTransaction();
684
- topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
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);
685
656
 
686
- topoEditDispatchers.update({
687
- resourceTabActiveKey: null
688
- });
657
+ _rlog["default"].debug("添加分层资源", {
658
+ layer: group,
659
+ newElements: newElements
660
+ });
689
661
 
690
- case 14:
691
- case "end":
692
- return _context13.stop();
693
- }
662
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
663
+
664
+ if (topo.linkDynamicStyleExecutor) {
665
+ topo.linkDynamicStyleExecutor.execute();
666
+ }
667
+
668
+ topo.historyManager.endTransaction();
669
+ topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
670
+
671
+ topoEditDispatchers.update({
672
+ resourceTabActiveKey: null
673
+ });
674
+
675
+ case 14:
676
+ case "end":
677
+ return _context13.stop();
694
678
  }
695
679
  }, _callee13);
696
680
  }));
@@ -705,17 +689,15 @@ var useTopoEdit = function useTopoEdit(params) {
705
689
  _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
706
690
  var group;
707
691
  return _regenerator["default"].wrap(function _callee14$(_context14) {
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
- }
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();
719
701
  }
720
702
  }, _callee14);
721
703
  }));
@@ -751,40 +733,38 @@ var useTopoEdit = function useTopoEdit(params) {
751
733
  var onSaveComboRes = /*#__PURE__*/function () {
752
734
  var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
753
735
  return _regenerator["default"].wrap(function _callee5$(_context5) {
754
- while (1) {
755
- switch (_context5.prev = _context5.next) {
756
- case 0:
757
- _rlog["default"].debug("关联资源-----onSaveComboRes", data);
736
+ while (1) switch (_context5.prev = _context5.next) {
737
+ case 0:
738
+ _rlog["default"].debug("关联资源-----onSaveComboRes", data);
758
739
 
759
- topo.historyManager.beginTransaction();
740
+ topo.historyManager.beginTransaction();
760
741
 
761
- if (!(getAddResourceType() === "addToFirstLayer")) {
762
- _context5.next = 7;
763
- break;
764
- }
742
+ if (!(getAddResourceType() === "addToFirstLayer")) {
743
+ _context5.next = 7;
744
+ break;
745
+ }
765
746
 
766
- _context5.next = 5;
767
- return addResourceToFirstLayer(data);
747
+ _context5.next = 5;
748
+ return addResourceToFirstLayer(data);
768
749
 
769
- case 5:
770
- _context5.next = 9;
771
- break;
750
+ case 5:
751
+ _context5.next = 9;
752
+ break;
772
753
 
773
- case 7:
774
- _context5.next = 9;
775
- return bindViewResources(data);
754
+ case 7:
755
+ _context5.next = 9;
756
+ return bindViewResources(data);
776
757
 
777
- case 9:
778
- topo.historyManager.endTransaction();
779
- topo.getHtTopo().fitContent();
780
- topoEditDispatchers.update({
781
- resourceTabActiveKey: null
782
- });
758
+ case 9:
759
+ topo.historyManager.endTransaction();
760
+ topo.getHtTopo().fitContent();
761
+ topoEditDispatchers.update({
762
+ resourceTabActiveKey: null
763
+ });
783
764
 
784
- case 12:
785
- case "end":
786
- return _context5.stop();
787
- }
765
+ case 12:
766
+ case "end":
767
+ return _context5.stop();
788
768
  }
789
769
  }, _callee5);
790
770
  }));
@@ -799,51 +779,47 @@ var useTopoEdit = function useTopoEdit(params) {
799
779
  var id, config, serialize, _config$layout, template, layout, saveConfig;
800
780
 
801
781
  return _regenerator["default"].wrap(function _callee7$(_context7) {
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
- }
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
+ }));
842
807
 
843
- case 3:
844
- case "end":
845
- return _context7.stop();
846
- }
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
+ }
819
+
820
+ case 3:
821
+ case "end":
822
+ return _context7.stop();
847
823
  }
848
824
  }, _callee7);
849
825
  }));
@@ -881,185 +857,181 @@ var useTopoEdit = function useTopoEdit(params) {
881
857
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
882
858
 
883
859
  return _regenerator["default"].wrap(function _callee9$(_context9) {
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
- });
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);
937
890
  } else {
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);
891
+ newGroupChildren.push(groupChildData);
949
892
  }
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
+ }
950
924
 
951
- _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
952
-
925
+ _rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
953
926
 
954
- newElement = dm.getDataByTag(newData.id);
955
927
 
956
- if (newElement) {
957
- newElement.setSize(node.getSize());
958
- newElement.setPosition(node.getPosition());
959
- newElement.setImage(node.getImage());
960
- } // 选中
928
+ newElement = dm.getDataByTag(newData.id);
961
929
 
930
+ if (newElement) {
931
+ newElement.setSize(node.getSize());
932
+ newElement.setPosition(node.getPosition());
933
+ newElement.setImage(node.getImage());
934
+ } // 选中
962
935
 
963
- sm = htTopo.getGraphView().sm();
964
- sm.setSelection([newElement]); // 移除旧节点
965
936
 
966
- dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
967
- // node.a("customName", null);
968
- // 删除关联在节点上的出口链路
937
+ sm = htTopo.getGraphView().sm();
938
+ sm.setSelection([newElement]); // 移除旧节点
969
939
 
970
- _context8.next = 12;
971
- return deleteExLink(node);
940
+ dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
941
+ // node.a("customName", null);
942
+ // 删除关联在节点上的出口链路
972
943
 
973
- case 12:
974
- // 临时放这里,仅拓扑中心有
975
- if (topo.linkDynamicStyleExecutor) {
976
- topo.linkDynamicStyleExecutor.execute();
977
- }
944
+ _context8.next = 12;
945
+ return deleteExLink(node);
978
946
 
979
- case 13:
980
- case "end":
981
- return _context8.stop();
947
+ case 12:
948
+ // 临时放这里,仅拓扑中心有
949
+ if (topo.linkDynamicStyleExecutor) {
950
+ topo.linkDynamicStyleExecutor.execute();
982
951
  }
983
- }
984
- }, _callee8);
985
- }));
986
- return _doBind.apply(this, arguments);
987
- };
988
952
 
989
- doBind = function _doBind2() {
990
- return _doBind.apply(this, arguments);
991
- };
953
+ case 13:
954
+ case "end":
955
+ return _context8.stop();
956
+ }
957
+ }, _callee8);
958
+ }));
959
+ return _doBind.apply(this, arguments);
960
+ };
992
961
 
993
- topo.historyManager.beginTransaction();
994
- id = params.id, oldResId = params.oldResId, newResId = params.newResId;
962
+ doBind = function _doBind2() {
963
+ return _doBind.apply(this, arguments);
964
+ };
995
965
 
996
- _rlog["default"].debug("bindNodeResource", params);
966
+ topo.historyManager.beginTransaction();
967
+ id = params.id, oldResId = params.oldResId, newResId = params.newResId;
997
968
 
998
- node = topo.getDataModel().getDataById(id); // 节点所属容器
969
+ _rlog["default"].debug("bindNodeResource", params);
999
970
 
1000
- parentGroupElement = node.getParent();
1001
- htTopo = topo.getHtTopo();
1002
- config = resourceConfig.getConfig();
971
+ node = topo.getDataModel().getDataById(id); // 节点所属容器
1003
972
 
1004
- if (parentGroupElement) {
1005
- // 在容器中
1006
- groupId = parentGroupElement.getTag(); // 容器业务id
973
+ parentGroupElement = node.getParent();
974
+ htTopo = topo.getHtTopo();
975
+ config = resourceConfig.getConfig();
1007
976
 
1008
- groupTag = parentGroupElement.a("tag"); // 容器临时id
977
+ if (parentGroupElement) {
978
+ // 在容器中
979
+ groupId = parentGroupElement.getTag(); // 容器业务id
1009
980
 
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
- } // 未匹配到容器
981
+ groupTag = parentGroupElement.a("tag"); // 容器临时id
1017
982
 
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
+ } // 未匹配到容器
1018
990
 
1019
- return g;
1020
- });
1021
- } else {
1022
- // 在画布上
1023
- config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
1024
- }
1025
991
 
1026
- _context9.next = 13;
1027
- return resourceConfig.updateConfig(config);
992
+ return g;
993
+ });
994
+ } else {
995
+ // 在画布上
996
+ config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
997
+ }
998
+
999
+ _context9.next = 13;
1000
+ return resourceConfig.updateConfig(config);
1028
1001
 
1029
- case 13:
1030
- _context9.next = 15;
1031
- return editDispatchers.fetchDataByConfig();
1002
+ case 13:
1003
+ _context9.next = 15;
1004
+ return editDispatchers.fetchDataByConfig();
1032
1005
 
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
- });
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
+ });
1039
1012
 
1040
- if (newData) {
1041
- _context9.next = 23;
1042
- break;
1043
- }
1013
+ if (newData) {
1014
+ _context9.next = 23;
1015
+ break;
1016
+ }
1044
1017
 
1045
- _message["default"].error("关联资源失败");
1018
+ _message["default"].error("关联资源失败");
1046
1019
 
1047
- _rlog["default"].warn("关联资源失败");
1020
+ _rlog["default"].warn("关联资源失败");
1048
1021
 
1049
- topo.historyManager.endTransaction();
1050
- return _context9.abrupt("return", false);
1022
+ topo.historyManager.endTransaction();
1023
+ return _context9.abrupt("return", false);
1051
1024
 
1052
- case 23:
1053
- _context9.next = 25;
1054
- return doBind();
1025
+ case 23:
1026
+ _context9.next = 25;
1027
+ return doBind();
1055
1028
 
1056
- case 25:
1057
- topo.historyManager.endTransaction();
1029
+ case 25:
1030
+ topo.historyManager.endTransaction();
1058
1031
 
1059
- case 26:
1060
- case "end":
1061
- return _context9.stop();
1062
- }
1032
+ case 26:
1033
+ case "end":
1034
+ return _context9.stop();
1063
1035
  }
1064
1036
  }, _callee9);
1065
1037
  }));
@@ -1082,79 +1054,77 @@ var useTopoEdit = function useTopoEdit(params) {
1082
1054
  var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1083
1055
 
1084
1056
  return _regenerator["default"].wrap(function _callee15$(_context15) {
1085
- while (1) {
1086
- switch (_context15.prev = _context15.next) {
1087
- case 0:
1088
- if (txtValue) {
1089
- _context15.next = 2;
1090
- break;
1091
- }
1092
-
1093
- return _context15.abrupt("return");
1094
-
1095
- case 2:
1096
- // if (txtValue === nodeElement.a('bindIp')) {
1097
- // return;
1098
- // }
1099
- // 根据配置查询拓扑数据
1100
- dm = topo.getDataModel(); // 执行唯一性验证
1101
-
1102
- isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1103
-
1104
- if (!isUnique) {
1105
- _context15.next = 24;
1106
- break;
1107
- }
1108
-
1109
- ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
1110
- _context15.next = 8;
1111
- return deleteExLink(nodeElement);
1057
+ while (1) switch (_context15.prev = _context15.next) {
1058
+ case 0:
1059
+ if (txtValue) {
1060
+ _context15.next = 2;
1061
+ break;
1062
+ }
1112
1063
 
1113
- case 8:
1114
- nodeElement.a(ip);
1115
- nodeElement.setName(txtValue);
1116
- nodeElement.setTag("ip:" + txtValue); // 获取配置
1064
+ return _context15.abrupt("return");
1117
1065
 
1118
- configObj = topo.resourceConfig.getConfig();
1119
- _context15.next = 14;
1120
- return resourceConfig.updateConfig(configObj);
1066
+ case 2:
1067
+ // if (txtValue === nodeElement.a('bindIp')) {
1068
+ // return;
1069
+ // }
1070
+ // 根据配置查询拓扑数据
1071
+ dm = topo.getDataModel(); // 执行唯一性验证
1121
1072
 
1122
- case 14:
1123
- _context15.next = 16;
1124
- return editDispatchers.fetchDataByConfig();
1073
+ isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1125
1074
 
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);
1075
+ if (!isUnique) {
1076
+ _context15.next = 24;
1077
+ break;
1078
+ }
1131
1079
 
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
- }
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
+ }
1153
1124
 
1154
- case 24:
1155
- case "end":
1156
- return _context15.stop();
1157
- }
1125
+ case 24:
1126
+ case "end":
1127
+ return _context15.stop();
1158
1128
  }
1159
1129
  }, _callee15);
1160
1130
  }));