@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
@@ -76,36 +76,34 @@ var useTopoEdit = function useTopoEdit(params) {
76
76
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
77
77
  var target, direction, config;
78
78
  return _regeneratorRuntime.wrap(function _callee$(_context) {
79
- while (1) {
80
- switch (_context.prev = _context.next) {
81
- case 0:
82
- target = _ref.target, direction = _ref.direction;
83
- topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
84
-
85
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
86
- rlog.info("onLayerAdd", {
87
- config: config
88
- }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
89
-
90
- if (!(!isLayerTopo && config.layers.length)) {
91
- _context.next = 7;
92
- break;
93
- }
79
+ while (1) switch (_context.prev = _context.next) {
80
+ case 0:
81
+ target = _ref.target, direction = _ref.direction;
82
+ topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
83
+
84
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
85
+ rlog.info("onLayerAdd", {
86
+ config: config
87
+ }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
94
88
 
89
+ if (!(!isLayerTopo && config.layers.length)) {
95
90
  _context.next = 7;
96
- return topoDispatchers.setTopoType(TPL_TREE);
97
-
98
- case 7:
99
- // 更新配置
100
- // resourceConfig.updateConfig(config);
101
- // 更新配置对应的资源、链路
102
- // editDispatchers.fetchDataByConfig();
103
- topo.historyManager.endTransaction();
104
-
105
- case 8:
106
- case "end":
107
- return _context.stop();
108
- }
91
+ break;
92
+ }
93
+
94
+ _context.next = 7;
95
+ return topoDispatchers.setTopoType(TPL_TREE);
96
+
97
+ case 7:
98
+ // 更新配置
99
+ // resourceConfig.updateConfig(config);
100
+ // 更新配置对应的资源、链路
101
+ // editDispatchers.fetchDataByConfig();
102
+ topo.historyManager.endTransaction();
103
+
104
+ case 8:
105
+ case "end":
106
+ return _context.stop();
109
107
  }
110
108
  }, _callee);
111
109
  }));
@@ -119,40 +117,38 @@ var useTopoEdit = function useTopoEdit(params) {
119
117
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
120
118
  var config;
121
119
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
122
- while (1) {
123
- switch (_context2.prev = _context2.next) {
124
- case 0:
125
- topo.historyManager.beginTransaction();
126
- emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
127
-
128
- config = resourceConfig.getConfigFromHt(topo.getDataModel());
129
- rlog.info("deleteLayer", {
130
- config: config
131
- }); // 如果没有分层,将拓扑类型切换为空白模板
132
-
133
- if (config.layers.length) {
134
- _context2.next = 7;
135
- break;
136
- }
120
+ while (1) switch (_context2.prev = _context2.next) {
121
+ case 0:
122
+ topo.historyManager.beginTransaction();
123
+ emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
124
+
125
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
126
+ rlog.info("deleteLayer", {
127
+ config: config
128
+ }); // 如果没有分层,将拓扑类型切换为空白模板
137
129
 
130
+ if (config.layers.length) {
138
131
  _context2.next = 7;
139
- return topoDispatchers.setTopoType(TPL_BLANK);
132
+ break;
133
+ }
140
134
 
141
- case 7:
142
- _context2.next = 9;
143
- return resourceConfig.updateConfig(config);
135
+ _context2.next = 7;
136
+ return topoDispatchers.setTopoType(TPL_BLANK);
144
137
 
145
- case 9:
146
- _context2.next = 11;
147
- return editDispatchers.fetchDataByConfig();
138
+ case 7:
139
+ _context2.next = 9;
140
+ return resourceConfig.updateConfig(config);
148
141
 
149
- case 11:
150
- topo.historyManager.endTransaction();
142
+ case 9:
143
+ _context2.next = 11;
144
+ return editDispatchers.fetchDataByConfig();
151
145
 
152
- case 12:
153
- case "end":
154
- return _context2.stop();
155
- }
146
+ case 11:
147
+ topo.historyManager.endTransaction();
148
+
149
+ case 12:
150
+ case "end":
151
+ return _context2.stop();
156
152
  }
157
153
  }, _callee2);
158
154
  }));
@@ -183,15 +179,13 @@ var useTopoEdit = function useTopoEdit(params) {
183
179
  onOk: function () {
184
180
  var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
185
181
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
186
- while (1) {
187
- switch (_context3.prev = _context3.next) {
188
- case 0:
189
- deleteLayer(layerElement);
190
-
191
- case 1:
192
- case "end":
193
- return _context3.stop();
194
- }
182
+ while (1) switch (_context3.prev = _context3.next) {
183
+ case 0:
184
+ deleteLayer(layerElement);
185
+
186
+ case 1:
187
+ case "end":
188
+ return _context3.stop();
195
189
  }
196
190
  }, _callee3);
197
191
  }));
@@ -357,35 +351,33 @@ var useTopoEdit = function useTopoEdit(params) {
357
351
 
358
352
  var config, edges, exportLinkIdList;
359
353
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
360
- while (1) {
361
- switch (_context4.prev = _context4.next) {
362
- case 0:
363
- config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
364
-
365
- 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 = [];
366
-
367
- if (!(edges.length > 0)) {
368
- _context4.next = 8;
369
- break;
370
- }
354
+ while (1) switch (_context4.prev = _context4.next) {
355
+ case 0:
356
+ config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
371
357
 
372
- exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
358
+ 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 = [];
373
359
 
374
- edges.map(function (edge) {
375
- if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
376
- // exLink.push(edge);
377
- topo.getGraphView().dm().remove(edge);
378
- exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
379
- }
380
- });
381
- config.exportLinkIdList = exportLinkIdList;
360
+ if (!(edges.length > 0)) {
382
361
  _context4.next = 8;
383
- return resourceConfig.updateConfig(config);
362
+ break;
363
+ }
384
364
 
385
- case 8:
386
- case "end":
387
- return _context4.stop();
388
- }
365
+ exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
366
+
367
+ edges.map(function (edge) {
368
+ if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
369
+ // exLink.push(edge);
370
+ topo.getGraphView().dm().remove(edge);
371
+ exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
372
+ }
373
+ });
374
+ config.exportLinkIdList = exportLinkIdList;
375
+ _context4.next = 8;
376
+ return resourceConfig.updateConfig(config);
377
+
378
+ case 8:
379
+ case "end":
380
+ return _context4.stop();
389
381
  }
390
382
  }, _callee4);
391
383
  }));
@@ -476,41 +468,39 @@ var useTopoEdit = function useTopoEdit(params) {
476
468
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
477
469
 
478
470
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
479
- while (1) {
480
- switch (_context10.prev = _context10.next) {
481
- case 0:
482
- id = group.id, tag = group.tag;
483
- rlog.debug("bindGroupResources--id, tag", id, tag);
484
- topo.historyManager.beginTransaction();
485
- _context10.next = 5;
486
- return resourceConfig.updateGroupResources(group, resources);
487
-
488
- case 5:
489
- _context10.next = 7;
490
- return editDispatchers.fetchDataByConfig();
491
-
492
- case 7:
493
- _yield$editDispatcher2 = _context10.sent;
494
- elements = _yield$editDispatcher2.elements;
495
- // 区域里的子区域及子区域的节点、新增的链路
496
- nodeElements = findGroupChildren(elements, group);
497
- newLinkElements = findUNExistedLinkElements(elements);
498
- updateElements = [].concat(nodeElements, newLinkElements);
499
-
500
- if (updateElements.length) {
501
- saveBind(TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
502
-
503
- if (topo.linkDynamicStyleExecutor) {
504
- topo.linkDynamicStyleExecutor.execute();
505
- }
471
+ while (1) switch (_context10.prev = _context10.next) {
472
+ case 0:
473
+ id = group.id, tag = group.tag;
474
+ rlog.debug("bindGroupResources--id, tag", id, tag);
475
+ topo.historyManager.beginTransaction();
476
+ _context10.next = 5;
477
+ return resourceConfig.updateGroupResources(group, resources);
478
+
479
+ case 5:
480
+ _context10.next = 7;
481
+ return editDispatchers.fetchDataByConfig();
482
+
483
+ case 7:
484
+ _yield$editDispatcher2 = _context10.sent;
485
+ elements = _yield$editDispatcher2.elements;
486
+ // 区域里的子区域及子区域的节点、新增的链路
487
+ nodeElements = findGroupChildren(elements, group);
488
+ newLinkElements = findUNExistedLinkElements(elements);
489
+ updateElements = [].concat(nodeElements, newLinkElements);
490
+
491
+ if (updateElements.length) {
492
+ saveBind(TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
493
+
494
+ if (topo.linkDynamicStyleExecutor) {
495
+ topo.linkDynamicStyleExecutor.execute();
506
496
  }
497
+ }
507
498
 
508
- topo.historyManager.endTransaction();
499
+ topo.historyManager.endTransaction();
509
500
 
510
- case 14:
511
- case "end":
512
- return _context10.stop();
513
- }
501
+ case 14:
502
+ case "end":
503
+ return _context10.stop();
514
504
  }
515
505
  }, _callee10);
516
506
  }));
@@ -529,24 +519,22 @@ var useTopoEdit = function useTopoEdit(params) {
529
519
  _addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, newResourceIds) {
530
520
  var groupConfig, resources, groupData;
531
521
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
532
- while (1) {
533
- switch (_context11.prev = _context11.next) {
534
- case 0:
535
- groupConfig = resourceConfig.getGroupConfigByElement(group);
536
- resources = {
537
- "static": [].concat(groupConfig.resources["static"], newResourceIds)
538
- };
539
- groupData = {
540
- id: group.getTag(),
541
- tag: group.a("tag")
542
- };
543
- _context11.next = 5;
544
- return bindGroupResources(groupData, resources);
545
-
546
- case 5:
547
- case "end":
548
- return _context11.stop();
549
- }
522
+ while (1) switch (_context11.prev = _context11.next) {
523
+ case 0:
524
+ groupConfig = resourceConfig.getGroupConfigByElement(group);
525
+ resources = {
526
+ "static": [].concat(groupConfig.resources["static"], newResourceIds)
527
+ };
528
+ groupData = {
529
+ id: group.getTag(),
530
+ tag: group.a("tag")
531
+ };
532
+ _context11.next = 5;
533
+ return bindGroupResources(groupData, resources);
534
+
535
+ case 5:
536
+ case "end":
537
+ return _context11.stop();
550
538
  }
551
539
  }, _callee11);
552
540
  }));
@@ -569,32 +557,30 @@ var useTopoEdit = function useTopoEdit(params) {
569
557
  var config, _yield$editDispatcher3, elements;
570
558
 
571
559
  return _regeneratorRuntime.wrap(function _callee12$(_context12) {
572
- while (1) {
573
- switch (_context12.prev = _context12.next) {
574
- case 0:
575
- // console.log("关联视图的资源", data);
576
- config = resourceConfig.getConfig();
577
- config.resources = data;
578
- _context12.next = 4;
579
- return resourceConfig.updateConfig(config);
580
-
581
- case 4:
582
- _context12.next = 6;
583
- return editDispatchers.fetchDataByConfig();
584
-
585
- case 6:
586
- _yield$editDispatcher3 = _context12.sent;
587
- elements = _yield$editDispatcher3.elements;
588
- saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
589
-
590
- if (topo.linkDynamicStyleExecutor) {
591
- topo.linkDynamicStyleExecutor.execute();
592
- }
560
+ while (1) switch (_context12.prev = _context12.next) {
561
+ case 0:
562
+ // console.log("关联视图的资源", data);
563
+ config = resourceConfig.getConfig();
564
+ config.resources = data;
565
+ _context12.next = 4;
566
+ return resourceConfig.updateConfig(config);
567
+
568
+ case 4:
569
+ _context12.next = 6;
570
+ return editDispatchers.fetchDataByConfig();
571
+
572
+ case 6:
573
+ _yield$editDispatcher3 = _context12.sent;
574
+ elements = _yield$editDispatcher3.elements;
575
+ saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
576
+
577
+ if (topo.linkDynamicStyleExecutor) {
578
+ topo.linkDynamicStyleExecutor.execute();
579
+ }
593
580
 
594
- case 10:
595
- case "end":
596
- return _context12.stop();
597
- }
581
+ case 10:
582
+ case "end":
583
+ return _context12.stop();
598
584
  }
599
585
  }, _callee12);
600
586
  }));
@@ -610,44 +596,42 @@ var useTopoEdit = function useTopoEdit(params) {
610
596
  var _yield$editDispatcher4, elements, newElements;
611
597
 
612
598
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
613
- while (1) {
614
- switch (_context13.prev = _context13.next) {
615
- case 0:
616
- topo.historyManager.beginTransaction(); // 构造新的配置
617
-
618
- _context13.next = 3;
619
- return resourceConfig.addLayerStaticResources(group, newResourceIds);
620
-
621
- case 3:
622
- _context13.next = 5;
623
- return editDispatchers.fetchDataByConfig();
624
-
625
- case 5:
626
- _yield$editDispatcher4 = _context13.sent;
627
- elements = _yield$editDispatcher4.elements;
628
- // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
629
- newElements = findUNExistedElements(elements);
630
- rlog.debug("添加分层资源", {
631
- layer: group,
632
- newElements: newElements
633
- });
634
- topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
635
-
636
- if (topo.linkDynamicStyleExecutor) {
637
- topo.linkDynamicStyleExecutor.execute();
638
- }
599
+ while (1) switch (_context13.prev = _context13.next) {
600
+ case 0:
601
+ topo.historyManager.beginTransaction(); // 构造新的配置
602
+
603
+ _context13.next = 3;
604
+ return resourceConfig.addLayerStaticResources(group, newResourceIds);
605
+
606
+ case 3:
607
+ _context13.next = 5;
608
+ return editDispatchers.fetchDataByConfig();
609
+
610
+ case 5:
611
+ _yield$editDispatcher4 = _context13.sent;
612
+ elements = _yield$editDispatcher4.elements;
613
+ // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
614
+ newElements = findUNExistedElements(elements);
615
+ rlog.debug("添加分层资源", {
616
+ layer: group,
617
+ newElements: newElements
618
+ });
619
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
620
+
621
+ if (topo.linkDynamicStyleExecutor) {
622
+ topo.linkDynamicStyleExecutor.execute();
623
+ }
639
624
 
640
- topo.historyManager.endTransaction();
641
- topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
625
+ topo.historyManager.endTransaction();
626
+ topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
642
627
 
643
- topoEditDispatchers.update({
644
- resourceTabActiveKey: null
645
- });
628
+ topoEditDispatchers.update({
629
+ resourceTabActiveKey: null
630
+ });
646
631
 
647
- case 14:
648
- case "end":
649
- return _context13.stop();
650
- }
632
+ case 14:
633
+ case "end":
634
+ return _context13.stop();
651
635
  }
652
636
  }, _callee13);
653
637
  }));
@@ -662,17 +646,15 @@ var useTopoEdit = function useTopoEdit(params) {
662
646
  _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
663
647
  var group;
664
648
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
665
- while (1) {
666
- switch (_context14.prev = _context14.next) {
667
- case 0:
668
- group = resourceConfig.getGroups()[0];
669
- _context14.next = 3;
670
- return addLayerResources(group, data);
671
-
672
- case 3:
673
- case "end":
674
- return _context14.stop();
675
- }
649
+ while (1) switch (_context14.prev = _context14.next) {
650
+ case 0:
651
+ group = resourceConfig.getGroups()[0];
652
+ _context14.next = 3;
653
+ return addLayerResources(group, data);
654
+
655
+ case 3:
656
+ case "end":
657
+ return _context14.stop();
676
658
  }
677
659
  }, _callee14);
678
660
  }));
@@ -708,39 +690,37 @@ var useTopoEdit = function useTopoEdit(params) {
708
690
  var onSaveComboRes = /*#__PURE__*/function () {
709
691
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
710
692
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
711
- while (1) {
712
- switch (_context5.prev = _context5.next) {
713
- case 0:
714
- rlog.debug("关联资源-----onSaveComboRes", data);
715
- topo.historyManager.beginTransaction();
716
-
717
- if (!(getAddResourceType() === "addToFirstLayer")) {
718
- _context5.next = 7;
719
- break;
720
- }
721
-
722
- _context5.next = 5;
723
- return addResourceToFirstLayer(data);
693
+ while (1) switch (_context5.prev = _context5.next) {
694
+ case 0:
695
+ rlog.debug("关联资源-----onSaveComboRes", data);
696
+ topo.historyManager.beginTransaction();
724
697
 
725
- case 5:
726
- _context5.next = 9;
698
+ if (!(getAddResourceType() === "addToFirstLayer")) {
699
+ _context5.next = 7;
727
700
  break;
701
+ }
728
702
 
729
- case 7:
730
- _context5.next = 9;
731
- return bindViewResources(data);
703
+ _context5.next = 5;
704
+ return addResourceToFirstLayer(data);
732
705
 
733
- case 9:
734
- topo.historyManager.endTransaction();
735
- topo.getHtTopo().fitContent();
736
- topoEditDispatchers.update({
737
- resourceTabActiveKey: null
738
- });
706
+ case 5:
707
+ _context5.next = 9;
708
+ break;
739
709
 
740
- case 12:
741
- case "end":
742
- return _context5.stop();
743
- }
710
+ case 7:
711
+ _context5.next = 9;
712
+ return bindViewResources(data);
713
+
714
+ case 9:
715
+ topo.historyManager.endTransaction();
716
+ topo.getHtTopo().fitContent();
717
+ topoEditDispatchers.update({
718
+ resourceTabActiveKey: null
719
+ });
720
+
721
+ case 12:
722
+ case "end":
723
+ return _context5.stop();
744
724
  }
745
725
  }, _callee5);
746
726
  }));
@@ -755,51 +735,47 @@ var useTopoEdit = function useTopoEdit(params) {
755
735
  var id, config, serialize, _config$layout, template, layout, saveConfig;
756
736
 
757
737
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
758
- while (1) {
759
- switch (_context7.prev = _context7.next) {
760
- case 0:
761
- id = data.id, config = data.config, serialize = data.serialize;
762
- _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
763
-
764
- if (onSave) {
765
- // 自定义保存
766
- saveConfig = /*#__PURE__*/function () {
767
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
768
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
769
- while (1) {
770
- switch (_context6.prev = _context6.next) {
771
- case 0:
772
- _context6.next = 2;
773
- return editDispatchers.saveTopo({
774
- id: id,
775
- layout: layout,
776
- serialize: serialize
777
- });
778
-
779
- case 2:
780
- case "end":
781
- return _context6.stop();
782
- }
783
- }
784
- }, _callee6);
785
- }));
786
-
787
- return function saveConfig() {
788
- return _ref7.apply(this, arguments);
789
- };
790
- }();
791
-
792
- onSave({
793
- topo: topo,
794
- data: data,
795
- saveConfig: saveConfig
796
- });
797
- }
738
+ while (1) switch (_context7.prev = _context7.next) {
739
+ case 0:
740
+ id = data.id, config = data.config, serialize = data.serialize;
741
+ _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
742
+
743
+ if (onSave) {
744
+ // 自定义保存
745
+ saveConfig = /*#__PURE__*/function () {
746
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
747
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
748
+ while (1) switch (_context6.prev = _context6.next) {
749
+ case 0:
750
+ _context6.next = 2;
751
+ return editDispatchers.saveTopo({
752
+ id: id,
753
+ layout: layout,
754
+ serialize: serialize
755
+ });
756
+
757
+ case 2:
758
+ case "end":
759
+ return _context6.stop();
760
+ }
761
+ }, _callee6);
762
+ }));
798
763
 
799
- case 3:
800
- case "end":
801
- return _context7.stop();
802
- }
764
+ return function saveConfig() {
765
+ return _ref7.apply(this, arguments);
766
+ };
767
+ }();
768
+
769
+ onSave({
770
+ topo: topo,
771
+ data: data,
772
+ saveConfig: saveConfig
773
+ });
774
+ }
775
+
776
+ case 3:
777
+ case "end":
778
+ return _context7.stop();
803
779
  }
804
780
  }, _callee7);
805
781
  }));
@@ -835,181 +811,177 @@ var useTopoEdit = function useTopoEdit(params) {
835
811
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
836
812
 
837
813
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
838
- while (1) {
839
- switch (_context9.prev = _context9.next) {
840
- case 0:
841
- replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
842
- return _extends({}, resources, {
843
- "static": [].concat(resources["static"].filter(function (item) {
844
- return item !== oldResId;
845
- }), [newResId])
846
- });
847
- };
848
-
849
- _doBind = function _doBind3() {
850
- _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
851
- var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
852
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
853
- while (1) {
854
- switch (_context8.prev = _context8.next) {
855
- case 0:
856
- dm = htTopo.getGraphView().dm(); // 创建
857
-
858
- newLinkElements = findUNExistedLinkElements(elements);
859
- createElementsData = null;
860
-
861
- if (newData.type === "group") {
862
- groupChildren = findGroupChildren(elements, newData);
863
- newGroupChildren = [];
864
- existedGroupChildren = [];
865
- groupChildren.forEach(function (groupChildData) {
866
- var ele = dm.getDataByTag(groupChildData.id);
867
-
868
- if (ele) {
869
- existedGroupChildren.push(groupChildData);
870
- } else {
871
- newGroupChildren.push(groupChildData);
872
- }
873
- });
874
- createElementsData = {
875
- groups: [newData],
876
- nodes: newGroupChildren,
877
- links: newLinkElements.filter(function (item) {
878
- return item.type === "link";
879
- }),
880
- linkGroups: newLinkElements.filter(function (item) {
881
- return item.type === "linkGroup";
882
- })
883
- };
884
- htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
885
-
886
- groupElement = dm.getDataByTag(newData.id);
887
- existedGroupChildren.forEach(function (groupChildData) {
888
- var nodeElement = dm.getDataByTag(groupChildData.id);
889
- nodeElement.setParent(groupElement);
890
- });
814
+ while (1) switch (_context9.prev = _context9.next) {
815
+ case 0:
816
+ replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
817
+ return _extends({}, resources, {
818
+ "static": [].concat(resources["static"].filter(function (item) {
819
+ return item !== oldResId;
820
+ }), [newResId])
821
+ });
822
+ };
823
+
824
+ _doBind = function _doBind3() {
825
+ _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
826
+ var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
827
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
828
+ while (1) switch (_context8.prev = _context8.next) {
829
+ case 0:
830
+ dm = htTopo.getGraphView().dm(); // 创建
831
+
832
+ newLinkElements = findUNExistedLinkElements(elements);
833
+ createElementsData = null;
834
+
835
+ if (newData.type === "group") {
836
+ groupChildren = findGroupChildren(elements, newData);
837
+ newGroupChildren = [];
838
+ existedGroupChildren = [];
839
+ groupChildren.forEach(function (groupChildData) {
840
+ var ele = dm.getDataByTag(groupChildData.id);
841
+
842
+ if (ele) {
843
+ existedGroupChildren.push(groupChildData);
891
844
  } else {
892
- createElementsData = {
893
- groups: [],
894
- nodes: [newData],
895
- links: newLinkElements.filter(function (item) {
896
- return item.type === "link";
897
- }),
898
- linkGroups: newLinkElements.filter(function (item) {
899
- return item.type === "linkGroup";
900
- })
901
- };
902
- htTopo.createElements(createElementsData);
845
+ newGroupChildren.push(groupChildData);
903
846
  }
847
+ });
848
+ createElementsData = {
849
+ groups: [newData],
850
+ nodes: newGroupChildren,
851
+ links: newLinkElements.filter(function (item) {
852
+ return item.type === "link";
853
+ }),
854
+ linkGroups: newLinkElements.filter(function (item) {
855
+ return item.type === "linkGroup";
856
+ })
857
+ };
858
+ htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
859
+
860
+ groupElement = dm.getDataByTag(newData.id);
861
+ existedGroupChildren.forEach(function (groupChildData) {
862
+ var nodeElement = dm.getDataByTag(groupChildData.id);
863
+ nodeElement.setParent(groupElement);
864
+ });
865
+ } else {
866
+ createElementsData = {
867
+ groups: [],
868
+ nodes: [newData],
869
+ links: newLinkElements.filter(function (item) {
870
+ return item.type === "link";
871
+ }),
872
+ linkGroups: newLinkElements.filter(function (item) {
873
+ return item.type === "linkGroup";
874
+ })
875
+ };
876
+ htTopo.createElements(createElementsData);
877
+ }
904
878
 
905
- rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
906
-
907
- newElement = dm.getDataByTag(newData.id);
879
+ rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
908
880
 
909
- if (newElement) {
910
- newElement.setSize(node.getSize());
911
- newElement.setPosition(node.getPosition());
912
- newElement.setImage(node.getImage());
913
- } // 选中
881
+ newElement = dm.getDataByTag(newData.id);
914
882
 
883
+ if (newElement) {
884
+ newElement.setSize(node.getSize());
885
+ newElement.setPosition(node.getPosition());
886
+ newElement.setImage(node.getImage());
887
+ } // 选中
915
888
 
916
- sm = htTopo.getGraphView().sm();
917
- sm.setSelection([newElement]); // 移除旧节点
918
889
 
919
- dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
920
- // node.a("customName", null);
921
- // 删除关联在节点上的出口链路
890
+ sm = htTopo.getGraphView().sm();
891
+ sm.setSelection([newElement]); // 移除旧节点
922
892
 
923
- _context8.next = 12;
924
- return deleteExLink(node);
893
+ dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
894
+ // node.a("customName", null);
895
+ // 删除关联在节点上的出口链路
925
896
 
926
- case 12:
927
- // 临时放这里,仅拓扑中心有
928
- if (topo.linkDynamicStyleExecutor) {
929
- topo.linkDynamicStyleExecutor.execute();
930
- }
897
+ _context8.next = 12;
898
+ return deleteExLink(node);
931
899
 
932
- case 13:
933
- case "end":
934
- return _context8.stop();
900
+ case 12:
901
+ // 临时放这里,仅拓扑中心有
902
+ if (topo.linkDynamicStyleExecutor) {
903
+ topo.linkDynamicStyleExecutor.execute();
935
904
  }
936
- }
937
- }, _callee8);
938
- }));
939
- return _doBind.apply(this, arguments);
940
- };
941
-
942
- doBind = function _doBind2() {
943
- return _doBind.apply(this, arguments);
944
- };
945
-
946
- topo.historyManager.beginTransaction();
947
- id = params.id, oldResId = params.oldResId, newResId = params.newResId;
948
- rlog.debug("bindNodeResource", params);
949
- node = topo.getDataModel().getDataById(id); // 节点所属容器
950
-
951
- parentGroupElement = node.getParent();
952
- htTopo = topo.getHtTopo();
953
- config = resourceConfig.getConfig();
954
-
955
- if (parentGroupElement) {
956
- // 在容器中
957
- groupId = parentGroupElement.getTag(); // 容器业务id
958
-
959
- groupTag = parentGroupElement.a("tag"); // 容器临时id
960
-
961
- config.groups = config.groups.map(function (g) {
962
- // 匹配到容器,替换资源或增加
963
- if (g.id === groupId || g.tag === groupTag) {
964
- return _extends({}, g, {
965
- resources: replaceOrAddRes(g.resources, oldResId, newResId)
966
- });
967
- } // 未匹配到容器
968
-
969
-
970
- return g;
971
- });
972
- } else {
973
- // 在画布上
974
- config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
975
- }
976
905
 
977
- _context9.next = 13;
978
- return resourceConfig.updateConfig(config);
906
+ case 13:
907
+ case "end":
908
+ return _context8.stop();
909
+ }
910
+ }, _callee8);
911
+ }));
912
+ return _doBind.apply(this, arguments);
913
+ };
914
+
915
+ doBind = function _doBind2() {
916
+ return _doBind.apply(this, arguments);
917
+ };
918
+
919
+ topo.historyManager.beginTransaction();
920
+ id = params.id, oldResId = params.oldResId, newResId = params.newResId;
921
+ rlog.debug("bindNodeResource", params);
922
+ node = topo.getDataModel().getDataById(id); // 节点所属容器
923
+
924
+ parentGroupElement = node.getParent();
925
+ htTopo = topo.getHtTopo();
926
+ config = resourceConfig.getConfig();
927
+
928
+ if (parentGroupElement) {
929
+ // 在容器中
930
+ groupId = parentGroupElement.getTag(); // 容器业务id
931
+
932
+ groupTag = parentGroupElement.a("tag"); // 容器临时id
979
933
 
980
- case 13:
981
- _context9.next = 15;
982
- return editDispatchers.fetchDataByConfig();
934
+ config.groups = config.groups.map(function (g) {
935
+ // 匹配到容器,替换资源或增加
936
+ if (g.id === groupId || g.tag === groupTag) {
937
+ return _extends({}, g, {
938
+ resources: replaceOrAddRes(g.resources, oldResId, newResId)
939
+ });
940
+ } // 未匹配到容器
983
941
 
984
- case 15:
985
- _yield$editDispatcher = _context9.sent;
986
- elements = _yield$editDispatcher.elements;
987
- newData = elements.find(function (item) {
988
- return item.id === newResId;
942
+
943
+ return g;
989
944
  });
945
+ } else {
946
+ // 在画布上
947
+ config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
948
+ }
990
949
 
991
- if (newData) {
992
- _context9.next = 23;
993
- break;
994
- }
950
+ _context9.next = 13;
951
+ return resourceConfig.updateConfig(config);
995
952
 
996
- _Message.error("关联资源失败");
953
+ case 13:
954
+ _context9.next = 15;
955
+ return editDispatchers.fetchDataByConfig();
997
956
 
998
- rlog.warn("关联资源失败");
999
- topo.historyManager.endTransaction();
1000
- return _context9.abrupt("return", false);
957
+ case 15:
958
+ _yield$editDispatcher = _context9.sent;
959
+ elements = _yield$editDispatcher.elements;
960
+ newData = elements.find(function (item) {
961
+ return item.id === newResId;
962
+ });
1001
963
 
1002
- case 23:
1003
- _context9.next = 25;
1004
- return doBind();
964
+ if (newData) {
965
+ _context9.next = 23;
966
+ break;
967
+ }
1005
968
 
1006
- case 25:
1007
- topo.historyManager.endTransaction();
969
+ _Message.error("关联资源失败");
1008
970
 
1009
- case 26:
1010
- case "end":
1011
- return _context9.stop();
1012
- }
971
+ rlog.warn("关联资源失败");
972
+ topo.historyManager.endTransaction();
973
+ return _context9.abrupt("return", false);
974
+
975
+ case 23:
976
+ _context9.next = 25;
977
+ return doBind();
978
+
979
+ case 25:
980
+ topo.historyManager.endTransaction();
981
+
982
+ case 26:
983
+ case "end":
984
+ return _context9.stop();
1013
985
  }
1014
986
  }, _callee9);
1015
987
  }));
@@ -1032,78 +1004,76 @@ var useTopoEdit = function useTopoEdit(params) {
1032
1004
  var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1033
1005
 
1034
1006
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1035
- while (1) {
1036
- switch (_context15.prev = _context15.next) {
1037
- case 0:
1038
- if (txtValue) {
1039
- _context15.next = 2;
1040
- break;
1041
- }
1042
-
1043
- return _context15.abrupt("return");
1044
-
1045
- case 2:
1046
- // if (txtValue === nodeElement.a('bindIp')) {
1047
- // return;
1048
- // }
1049
- // 根据配置查询拓扑数据
1050
- dm = topo.getDataModel(); // 执行唯一性验证
1051
-
1052
- isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
1053
-
1054
- if (!isUnique) {
1055
- _context15.next = 23;
1056
- break;
1057
- }
1058
-
1059
- ip = buildIpNode(txtValue);
1060
- _context15.next = 8;
1061
- return deleteExLink(nodeElement);
1007
+ while (1) switch (_context15.prev = _context15.next) {
1008
+ case 0:
1009
+ if (txtValue) {
1010
+ _context15.next = 2;
1011
+ break;
1012
+ }
1062
1013
 
1063
- case 8:
1064
- nodeElement.a(ip);
1065
- nodeElement.setName(txtValue);
1066
- nodeElement.setTag("ip:" + txtValue); // 获取配置
1014
+ return _context15.abrupt("return");
1067
1015
 
1068
- configObj = topo.resourceConfig.getConfig();
1069
- _context15.next = 14;
1070
- return resourceConfig.updateConfig(configObj);
1016
+ case 2:
1017
+ // if (txtValue === nodeElement.a('bindIp')) {
1018
+ // return;
1019
+ // }
1020
+ // 根据配置查询拓扑数据
1021
+ dm = topo.getDataModel(); // 执行唯一性验证
1071
1022
 
1072
- case 14:
1073
- _context15.next = 16;
1074
- return editDispatchers.fetchDataByConfig();
1023
+ isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
1075
1024
 
1076
- case 16:
1077
- configData = _context15.sent;
1078
- // console.log("configData",configObj, configData);
1079
- _elements = configData.elements;
1080
- newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
1025
+ if (!isUnique) {
1026
+ _context15.next = 23;
1027
+ break;
1028
+ }
1081
1029
 
1082
- newLink = newLinkElements.filter(function (item) {
1083
- return item.type === "link";
1084
- });
1085
- newLinkGroup = newLinkElements.filter(function (item) {
1086
- return item.type === "linkGroup";
1087
- }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1088
- // console.log("newData",newLinkElements, newLink);
1089
-
1090
- createElementsData = {
1091
- groups: [],
1092
- nodes: [],
1093
- links: newLink,
1094
- linkGroups: newLinkGroup
1095
- }; // console.log("createElementsData", createElementsData);
1096
-
1097
- if ([].concat(newLink, newLinkGroup).length > 0) {
1098
- _htTopo = topo.getHtTopo();
1099
-
1100
- _htTopo.createElements(createElementsData);
1101
- }
1030
+ ip = buildIpNode(txtValue);
1031
+ _context15.next = 8;
1032
+ return deleteExLink(nodeElement);
1033
+
1034
+ case 8:
1035
+ nodeElement.a(ip);
1036
+ nodeElement.setName(txtValue);
1037
+ nodeElement.setTag("ip:" + txtValue); // 获取配置
1038
+
1039
+ configObj = topo.resourceConfig.getConfig();
1040
+ _context15.next = 14;
1041
+ return resourceConfig.updateConfig(configObj);
1042
+
1043
+ case 14:
1044
+ _context15.next = 16;
1045
+ return editDispatchers.fetchDataByConfig();
1046
+
1047
+ case 16:
1048
+ configData = _context15.sent;
1049
+ // console.log("configData",configObj, configData);
1050
+ _elements = configData.elements;
1051
+ newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
1052
+
1053
+ newLink = newLinkElements.filter(function (item) {
1054
+ return item.type === "link";
1055
+ });
1056
+ newLinkGroup = newLinkElements.filter(function (item) {
1057
+ return item.type === "linkGroup";
1058
+ }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1059
+ // console.log("newData",newLinkElements, newLink);
1060
+
1061
+ createElementsData = {
1062
+ groups: [],
1063
+ nodes: [],
1064
+ links: newLink,
1065
+ linkGroups: newLinkGroup
1066
+ }; // console.log("createElementsData", createElementsData);
1067
+
1068
+ if ([].concat(newLink, newLinkGroup).length > 0) {
1069
+ _htTopo = topo.getHtTopo();
1070
+
1071
+ _htTopo.createElements(createElementsData);
1072
+ }
1102
1073
 
1103
- case 23:
1104
- case "end":
1105
- return _context15.stop();
1106
- }
1074
+ case 23:
1075
+ case "end":
1076
+ return _context15.stop();
1107
1077
  }
1108
1078
  }, _callee15);
1109
1079
  }));