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

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