@riil-frontend/component-topology 11.0.33 → 11.0.35

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