@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
@@ -115,64 +115,62 @@ function _updateLink() {
115
115
  _updateLink = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(oldLink, params) {
116
116
  var result, src, dst, srcRelation, dstRelation, srcIsCurrentRelation, dstIsCurrentRelation, onlyChangeOneEnd, createResult;
117
117
  return _regenerator["default"].wrap(function _callee$(_context) {
118
- while (1) {
119
- switch (_context.prev = _context.next) {
120
- case 0:
121
- result = {
122
- oldId: oldLink.id
123
- };
124
- src = params.src, dst = params.dst; // 如果只修改一端,则先删除再新建
125
-
126
- _context.next = 4;
127
- return cmdbService.queryRelationByEndpoint(src.sub);
128
-
129
- case 4:
130
- srcRelation = _context.sent;
131
- _context.next = 7;
132
- return cmdbService.queryRelationByEndpoint(dst.sub);
133
-
134
- case 7:
135
- dstRelation = _context.sent;
136
- srcIsCurrentRelation = srcRelation && srcRelation.id === oldLink.id && !dstRelation;
137
- dstIsCurrentRelation = dstRelation && dstRelation.id === oldLink.id && !srcRelation;
138
- onlyChangeOneEnd = srcIsCurrentRelation || dstIsCurrentRelation;
139
-
140
- if (!onlyChangeOneEnd) {
141
- _context.next = 14;
142
- break;
143
- }
144
-
118
+ while (1) switch (_context.prev = _context.next) {
119
+ case 0:
120
+ result = {
121
+ oldId: oldLink.id
122
+ };
123
+ src = params.src, dst = params.dst; // 如果只修改一端,则先删除再新建
124
+
125
+ _context.next = 4;
126
+ return cmdbService.queryRelationByEndpoint(src.sub);
127
+
128
+ case 4:
129
+ srcRelation = _context.sent;
130
+ _context.next = 7;
131
+ return cmdbService.queryRelationByEndpoint(dst.sub);
132
+
133
+ case 7:
134
+ dstRelation = _context.sent;
135
+ srcIsCurrentRelation = srcRelation && srcRelation.id === oldLink.id && !dstRelation;
136
+ dstIsCurrentRelation = dstRelation && dstRelation.id === oldLink.id && !srcRelation;
137
+ onlyChangeOneEnd = srcIsCurrentRelation || dstIsCurrentRelation;
138
+
139
+ if (!onlyChangeOneEnd) {
145
140
  _context.next = 14;
146
- return cmdbService.forceDeleteRelation(oldLink.id);
141
+ break;
142
+ }
147
143
 
148
- case 14:
149
- _context.next = 16;
150
- return cmdbService.batchCreateRelation([buildCreateLinkParams(params, 0)]);
144
+ _context.next = 14;
145
+ return cmdbService.forceDeleteRelation(oldLink.id);
151
146
 
152
- case 16:
153
- createResult = _context.sent;
154
- Object.assign(result, createResult[0]);
147
+ case 14:
148
+ _context.next = 16;
149
+ return cmdbService.batchCreateRelation([buildCreateLinkParams(params, 0)]);
155
150
 
156
- if (!(result.status === 0)) {
157
- _context.next = 22;
158
- break;
159
- }
151
+ case 16:
152
+ createResult = _context.sent;
153
+ Object.assign(result, createResult[0]);
160
154
 
161
- if (onlyChangeOneEnd) {
162
- _context.next = 22;
163
- break;
164
- }
155
+ if (!(result.status === 0)) {
156
+ _context.next = 22;
157
+ break;
158
+ }
165
159
 
160
+ if (onlyChangeOneEnd) {
166
161
  _context.next = 22;
167
- return cmdbService.forceDeleteRelation(oldLink.id);
162
+ break;
163
+ }
164
+
165
+ _context.next = 22;
166
+ return cmdbService.forceDeleteRelation(oldLink.id);
168
167
 
169
- case 22:
170
- return _context.abrupt("return", result);
168
+ case 22:
169
+ return _context.abrupt("return", result);
171
170
 
172
- case 23:
173
- case "end":
174
- return _context.stop();
175
- }
171
+ case 23:
172
+ case "end":
173
+ return _context.stop();
176
174
  }
177
175
  }, _callee);
178
176
  }));
@@ -195,34 +193,32 @@ function _saveLink() {
195
193
  var link, values, params, result, _params;
196
194
 
197
195
  return _regenerator["default"].wrap(function _callee2$(_context2) {
198
- while (1) {
199
- switch (_context2.prev = _context2.next) {
200
- case 0:
201
- link = _ref2.link, values = _ref2.values;
202
-
203
- if (!link) {
204
- _context2.next = 9;
205
- break;
206
- }
207
-
208
- params = values[0];
209
- _context2.next = 5;
210
- return updateLink(link, params);
211
-
212
- case 5:
213
- result = _context2.sent;
214
- return _context2.abrupt("return", [result]);
215
-
216
- case 9:
217
- _params = values.map(function (item, index) {
218
- return buildCreateLinkParams(item, index);
219
- });
220
- return _context2.abrupt("return", cmdbService.batchCreateRelation(_params));
221
-
222
- case 11:
223
- case "end":
224
- return _context2.stop();
225
- }
196
+ while (1) switch (_context2.prev = _context2.next) {
197
+ case 0:
198
+ link = _ref2.link, values = _ref2.values;
199
+
200
+ if (!link) {
201
+ _context2.next = 9;
202
+ break;
203
+ }
204
+
205
+ params = values[0];
206
+ _context2.next = 5;
207
+ return updateLink(link, params);
208
+
209
+ case 5:
210
+ result = _context2.sent;
211
+ return _context2.abrupt("return", [result]);
212
+
213
+ case 9:
214
+ _params = values.map(function (item, index) {
215
+ return buildCreateLinkParams(item, index);
216
+ });
217
+ return _context2.abrupt("return", cmdbService.batchCreateRelation(_params));
218
+
219
+ case 11:
220
+ case "end":
221
+ return _context2.stop();
226
222
  }
227
223
  }, _callee2);
228
224
  }));
@@ -105,25 +105,23 @@ var LinkDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
105
105
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
106
106
  var data;
107
107
  return _regenerator["default"].wrap(function _callee$(_context) {
108
- while (1) {
109
- switch (_context.prev = _context.next) {
110
- case 0:
111
- _rlog["default"].debug('useTopoEdit.refreshLink');
112
-
113
- _context.next = 3;
114
- return editDispatchers.fetchData();
115
-
116
- case 3:
117
- data = _context.sent;
118
- topo.view.topoClient.emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, {
119
- type: _componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO,
120
- data: data
121
- });
122
-
123
- case 5:
124
- case "end":
125
- return _context.stop();
126
- }
108
+ while (1) switch (_context.prev = _context.next) {
109
+ case 0:
110
+ _rlog["default"].debug('useTopoEdit.refreshLink');
111
+
112
+ _context.next = 3;
113
+ return editDispatchers.fetchData();
114
+
115
+ case 3:
116
+ data = _context.sent;
117
+ topo.view.topoClient.emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, {
118
+ type: _componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO,
119
+ data: data
120
+ });
121
+
122
+ case 5:
123
+ case "end":
124
+ return _context.stop();
127
125
  }
128
126
  }, _callee);
129
127
  }));
@@ -137,22 +135,20 @@ var LinkDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
137
135
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(id) {
138
136
  var data;
139
137
  return _regenerator["default"].wrap(function _callee2$(_context2) {
140
- while (1) {
141
- switch (_context2.prev = _context2.next) {
142
- case 0:
143
- _context2.next = 2;
144
- return editDispatchers.fetchData();
145
-
146
- case 2:
147
- data = _context2.sent;
148
- return _context2.abrupt("return", data.filter(function (item) {
149
- return item.id === id;
150
- })[0]);
151
-
152
- case 4:
153
- case "end":
154
- return _context2.stop();
155
- }
138
+ while (1) switch (_context2.prev = _context2.next) {
139
+ case 0:
140
+ _context2.next = 2;
141
+ return editDispatchers.fetchData();
142
+
143
+ case 2:
144
+ data = _context2.sent;
145
+ return _context2.abrupt("return", data.filter(function (item) {
146
+ return item.id === id;
147
+ })[0]);
148
+
149
+ case 4:
150
+ case "end":
151
+ return _context2.stop();
156
152
  }
157
153
  }, _callee2);
158
154
  }));
@@ -164,50 +160,48 @@ var LinkDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
164
160
 
165
161
  var updateTopo = (0, _react.useCallback)( /*#__PURE__*/function () {
166
162
  var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(data) {
167
- var changed, isAdd, _data$result$, oldId, id, linkData;
163
+ var changed, isAdd, _data$result$2, oldId, id, linkData;
168
164
 
169
165
  return _regenerator["default"].wrap(function _callee3$(_context3) {
170
- while (1) {
171
- switch (_context3.prev = _context3.next) {
172
- case 0:
173
- changed = data.changed, isAdd = data.isAddMode;
166
+ while (1) switch (_context3.prev = _context3.next) {
167
+ case 0:
168
+ changed = data.changed, isAdd = data.isAddMode;
174
169
 
175
- if (!(changed === false)) {
176
- _context3.next = 3;
177
- break;
178
- }
179
-
180
- return _context3.abrupt("return");
181
-
182
- case 3:
183
- if (!isAdd) {
184
- _context3.next = 8;
185
- break;
186
- }
170
+ if (!(changed === false)) {
171
+ _context3.next = 3;
172
+ break;
173
+ }
187
174
 
188
- _context3.next = 6;
189
- return refreshLink();
175
+ return _context3.abrupt("return");
190
176
 
191
- case 6:
192
- _context3.next = 13;
177
+ case 3:
178
+ if (!isAdd) {
179
+ _context3.next = 8;
193
180
  break;
194
-
195
- case 8:
196
- _data$result$ = data.result[0], oldId = _data$result$.oldId, id = _data$result$.id;
197
- _context3.next = 11;
198
- return getLink(id);
199
-
200
- case 11:
201
- linkData = _context3.sent;
202
- topo.view.topoClient.emitEvent('topo_link_update', {
203
- id: oldId,
204
- link: linkData
205
- });
206
-
207
- case 13:
208
- case "end":
209
- return _context3.stop();
210
- }
181
+ }
182
+
183
+ _context3.next = 6;
184
+ return refreshLink();
185
+
186
+ case 6:
187
+ _context3.next = 13;
188
+ break;
189
+
190
+ case 8:
191
+ _data$result$2 = data.result[0], oldId = _data$result$2.oldId, id = _data$result$2.id;
192
+ _context3.next = 11;
193
+ return getLink(id);
194
+
195
+ case 11:
196
+ linkData = _context3.sent;
197
+ topo.view.topoClient.emitEvent('topo_link_update', {
198
+ id: oldId,
199
+ link: linkData
200
+ });
201
+
202
+ case 13:
203
+ case "end":
204
+ return _context3.stop();
211
205
  }
212
206
  }, _callee3);
213
207
  }));
@@ -220,28 +214,26 @@ var LinkDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
220
214
  var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data) {
221
215
  var errorItems;
222
216
  return _regenerator["default"].wrap(function _callee4$(_context4) {
223
- while (1) {
224
- switch (_context4.prev = _context4.next) {
225
- case 0:
226
- errorItems = data.errorItems;
227
-
228
- if (errorItems.length) {
229
- _context4.next = 7;
230
- break;
231
- }
232
-
233
- setFalse();
234
- setUpdateTopoState(true);
235
- _context4.next = 6;
236
- return updateTopo(data);
237
-
238
- case 6:
239
- setUpdateTopoState(false);
240
-
241
- case 7:
242
- case "end":
243
- return _context4.stop();
244
- }
217
+ while (1) switch (_context4.prev = _context4.next) {
218
+ case 0:
219
+ errorItems = data.errorItems;
220
+
221
+ if (errorItems.length) {
222
+ _context4.next = 7;
223
+ break;
224
+ }
225
+
226
+ setFalse();
227
+ setUpdateTopoState(true);
228
+ _context4.next = 6;
229
+ return updateTopo(data);
230
+
231
+ case 6:
232
+ setUpdateTopoState(false);
233
+
234
+ case 7:
235
+ case "end":
236
+ return _context4.stop();
245
237
  }
246
238
  }, _callee4);
247
239
  }));
@@ -136,52 +136,50 @@ var LinkSetting = function LinkSetting(_ref2) {
136
136
 
137
137
  var onSave = /*#__PURE__*/function () {
138
138
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
139
- var values, _values$, src, dst;
139
+ var values, _values$2, src, dst;
140
140
 
141
141
  return _regenerator["default"].wrap(function _callee$(_context) {
142
- while (1) {
143
- switch (_context.prev = _context.next) {
144
- case 0:
145
- if (!(0, _utils.isAvailableArray)(getValidatorErrors())) {
146
- _context.next = 2;
147
- break;
148
- }
149
-
150
- return _context.abrupt("return");
151
-
152
- case 2:
153
- values = list.map(function (i, index) {
154
- return refs[index].field.getValues();
155
- });
156
-
157
- if (isAddMode) {
158
- _context.next = 8;
159
- break;
160
- }
161
-
162
- _values$ = values[0], src = _values$.src, dst = _values$.dst;
163
-
164
- if (!(src.sub === link.interfaceSource && dst.sub === link.interfaceTarget)) {
165
- _context.next = 8;
166
- break;
167
- }
168
-
169
- saveCb({
170
- changed: false
171
- });
172
- return _context.abrupt("return");
173
-
174
- case 8:
175
- _context.next = 10;
176
- return execSave({
177
- link: link,
178
- values: values
179
- });
180
-
181
- case 10:
182
- case "end":
183
- return _context.stop();
184
- }
142
+ while (1) switch (_context.prev = _context.next) {
143
+ case 0:
144
+ if (!(0, _utils.isAvailableArray)(getValidatorErrors())) {
145
+ _context.next = 2;
146
+ break;
147
+ }
148
+
149
+ return _context.abrupt("return");
150
+
151
+ case 2:
152
+ values = list.map(function (i, index) {
153
+ return refs[index].field.getValues();
154
+ });
155
+
156
+ if (isAddMode) {
157
+ _context.next = 8;
158
+ break;
159
+ }
160
+
161
+ _values$2 = values[0], src = _values$2.src, dst = _values$2.dst;
162
+
163
+ if (!(src.sub === link.interfaceSource && dst.sub === link.interfaceTarget)) {
164
+ _context.next = 8;
165
+ break;
166
+ }
167
+
168
+ saveCb({
169
+ changed: false
170
+ });
171
+ return _context.abrupt("return");
172
+
173
+ case 8:
174
+ _context.next = 10;
175
+ return execSave({
176
+ link: link,
177
+ values: values
178
+ });
179
+
180
+ case 10:
181
+ case "end":
182
+ return _context.stop();
185
183
  }
186
184
  }, _callee);
187
185
  }));
@@ -83,32 +83,30 @@ function _addLinkData() {
83
83
  _addLinkData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
84
84
  var links, nodes, prevNetworkLinks, networkLinks, otherLinks;
85
85
  return _regenerator["default"].wrap(function _callee$(_context) {
86
- while (1) {
87
- switch (_context.prev = _context.next) {
88
- case 0:
89
- links = data.links || [];
90
- nodes = data.nodes || []; // 如果是网络链路,补充详情信息
91
-
92
- prevNetworkLinks = links.filter(function (link) {
93
- return isNetworkLink(link);
94
- });
95
- _context.next = 5;
96
- return (0, _linkUtils.getLinksDetail)(prevNetworkLinks, nodes);
97
-
98
- case 5:
99
- networkLinks = _context.sent;
100
- otherLinks = links.filter(function (link) {
101
- return !isNetworkLink(link);
102
- });
103
- return _context.abrupt("return", (0, _extends2["default"])({}, data, {
104
- links: [].concat(networkLinks, otherLinks),
105
- linkGroups: []
106
- }));
107
-
108
- case 8:
109
- case "end":
110
- return _context.stop();
111
- }
86
+ while (1) switch (_context.prev = _context.next) {
87
+ case 0:
88
+ links = data.links || [];
89
+ nodes = data.nodes || []; // 如果是网络链路,补充详情信息
90
+
91
+ prevNetworkLinks = links.filter(function (link) {
92
+ return isNetworkLink(link);
93
+ });
94
+ _context.next = 5;
95
+ return (0, _linkUtils.getLinksDetail)(prevNetworkLinks, nodes);
96
+
97
+ case 5:
98
+ networkLinks = _context.sent;
99
+ otherLinks = links.filter(function (link) {
100
+ return !isNetworkLink(link);
101
+ });
102
+ return _context.abrupt("return", (0, _extends2["default"])({}, data, {
103
+ links: [].concat(networkLinks, otherLinks),
104
+ linkGroups: []
105
+ }));
106
+
107
+ case 8:
108
+ case "end":
109
+ return _context.stop();
112
110
  }
113
111
  }, _callee);
114
112
  }));
@@ -123,20 +121,18 @@ function _buildData() {
123
121
  _buildData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(oldData) {
124
122
  var data;
125
123
  return _regenerator["default"].wrap(function _callee2$(_context2) {
126
- while (1) {
127
- switch (_context2.prev = _context2.next) {
128
- case 0:
129
- data = oldData;
130
- data = fixNodeGroupId(data);
131
- data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
132
-
133
- data = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(data);
134
- return _context2.abrupt("return", data);
135
-
136
- case 5:
137
- case "end":
138
- return _context2.stop();
139
- }
124
+ while (1) switch (_context2.prev = _context2.next) {
125
+ case 0:
126
+ data = oldData;
127
+ data = fixNodeGroupId(data);
128
+ data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
129
+
130
+ data = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(data);
131
+ return _context2.abrupt("return", data);
132
+
133
+ case 5:
134
+ case "end":
135
+ return _context2.stop();
140
136
  }
141
137
  }, _callee2);
142
138
  }));
@@ -151,35 +147,33 @@ function _getTopoData() {
151
147
  _getTopoData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(id, topoService) {
152
148
  var data;
153
149
  return _regenerator["default"].wrap(function _callee3$(_context3) {
154
- while (1) {
155
- switch (_context3.prev = _context3.next) {
156
- case 0:
157
- _context3.next = 2;
158
- return topoService.getTopoData(id);
159
-
160
- case 2:
161
- data = _context3.sent;
162
-
163
- if (data) {
164
- _context3.next = 5;
165
- break;
166
- }
167
-
168
- return _context3.abrupt("return", data);
169
-
170
- case 5:
171
- data = fixAlarmConfig(data);
172
- _context3.next = 8;
173
- return buildData(data);
174
-
175
- case 8:
176
- data = _context3.sent;
177
- return _context3.abrupt("return", data);
178
-
179
- case 10:
180
- case "end":
181
- return _context3.stop();
182
- }
150
+ while (1) switch (_context3.prev = _context3.next) {
151
+ case 0:
152
+ _context3.next = 2;
153
+ return topoService.getTopoData(id);
154
+
155
+ case 2:
156
+ data = _context3.sent;
157
+
158
+ if (data) {
159
+ _context3.next = 5;
160
+ break;
161
+ }
162
+
163
+ return _context3.abrupt("return", data);
164
+
165
+ case 5:
166
+ data = fixAlarmConfig(data);
167
+ _context3.next = 8;
168
+ return buildData(data);
169
+
170
+ case 8:
171
+ data = _context3.sent;
172
+ return _context3.abrupt("return", data);
173
+
174
+ case 10:
175
+ case "end":
176
+ return _context3.stop();
183
177
  }
184
178
  }, _callee3);
185
179
  }));