@riil-frontend/component-topology 10.0.57 → 10.0.59

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 (227) 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/IndexSettingDrawer/index.js +6 -5
  6. package/es/components/MultiResourceDrawer/index.js +22 -26
  7. package/es/components/ResourceList/ResourceSelect.js +55 -58
  8. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +30 -34
  9. package/es/components/SingleResourceDrawer/SelectDrawer.js +24 -28
  10. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +29 -33
  11. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +78 -100
  12. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
  13. package/es/core/components/titlebar/widgets/TitleWidget.js +5 -4
  14. package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -18
  15. package/es/core/editor/components/BackgroundView/index.js +149 -178
  16. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +26 -30
  17. package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -34
  18. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +20 -24
  19. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +13 -17
  20. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
  21. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
  22. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
  23. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +17 -21
  24. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +27 -31
  25. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
  26. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +16 -20
  27. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +37 -55
  28. package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
  29. package/es/core/editor/hooks/useNewElementTheme.js +2 -2
  30. package/es/core/editor/store/background.js +8 -10
  31. package/es/core/editor/store/topoEdit.js +4 -6
  32. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  33. package/es/core/hooks/useCanvasTheme.js +1 -1
  34. package/es/core/hooks/usePolling.js +110 -122
  35. package/es/core/hooks/useResourceConfig.js +76 -100
  36. package/es/core/hooks/useTopoEdit.js +539 -638
  37. package/es/core/models/Alarm.js +311 -394
  38. package/es/core/models/AttributeMetricDisplay.js +115 -143
  39. package/es/core/models/PluginManager.js +4 -3
  40. package/es/core/models/SelectionModel.js +4 -5
  41. package/es/core/models/TopoApp.js +287 -454
  42. package/es/core/models/TopoGraphView.js +28 -41
  43. package/es/core/models/cache/CiCache.js +34 -39
  44. package/es/core/models/cache/CiTypeCache.js +70 -84
  45. package/es/core/models/cache/DictCache.js +36 -42
  46. package/es/core/models/graph/Background.js +21 -26
  47. package/es/core/models/plugins/resourceWebControllUrl.js +84 -103
  48. package/es/core/models/tagstips/ElementTagTipConfig.js +34 -40
  49. package/es/core/models/topoData.js +73 -77
  50. package/es/core/models/utils/linkUtils.js +46 -51
  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 +14 -18
  54. package/es/core/services/cmdb.js +23 -27
  55. package/es/core/services/index.js +48 -68
  56. package/es/core/services/overview.js +131 -151
  57. package/es/core/services/topo/basic.js +11 -13
  58. package/es/core/services/topo/tagtip.js +15 -19
  59. package/es/core/store/models/ciModel.js +58 -62
  60. package/es/core/store/models/customIcon.js +126 -145
  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 +28 -32
  66. package/es/core/store/models/topoConfig.js +217 -233
  67. package/es/core/store/models/topoGraphView.js +4 -6
  68. package/es/core/store/models/topoMod.js +379 -401
  69. package/es/core/utils/imageUtil.js +23 -27
  70. package/es/core/utils/saveSerialize.js +14 -18
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -25
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +363 -409
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +112 -131
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +40 -46
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +219 -275
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
  78. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
  79. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +45 -54
  80. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +32 -44
  81. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
  82. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +23 -27
  83. package/es/networkTopo/components/Link/hook.js +85 -96
  84. package/es/networkTopo/components/Link/index copy.js +104 -126
  85. package/es/networkTopo/components/Link/index.js +104 -126
  86. package/es/networkTopo/components/Link/setting.js +48 -52
  87. package/es/networkTopo/getTopoData.js +73 -92
  88. package/es/networkTopo/hooks/viewer/useRelateTopo.js +34 -39
  89. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  90. package/es/networkTopo/models/TopoCenter.js +28 -46
  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 +548 -696
  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 +33 -48
  97. package/es/networkTopo/services/metric.js +38 -47
  98. package/es/networkTopo/services/model.js +616 -809
  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 +274 -314
  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/linkDynamicStyle.js +102 -108
  110. package/es/networkTopo/store/linkDynamicStyleConfig.js +42 -44
  111. package/es/networkTopo/store/linkManager.js +4 -6
  112. package/es/networkTopo/store/topoCenter.js +142 -152
  113. package/es/networkTopo/store/topoLinkMod.js +4 -6
  114. package/es/networkTopo/store/topoTreeMod.js +170 -182
  115. package/es/networkTopo/utils/exportData.js +57 -61
  116. package/lib/components/IndexSettingDrawer/index.js +6 -5
  117. package/lib/components/MultiResourceDrawer/index.js +22 -26
  118. package/lib/components/ResourceList/ResourceSelect.js +54 -58
  119. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +33 -37
  120. package/lib/components/SingleResourceDrawer/SelectDrawer.js +24 -28
  121. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +36 -40
  122. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +82 -104
  123. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
  124. package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -4
  125. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +18 -18
  126. package/lib/core/editor/components/BackgroundView/index.js +148 -177
  127. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +28 -32
  128. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +34 -34
  129. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +23 -28
  130. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +14 -18
  131. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
  132. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
  133. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
  134. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +18 -22
  135. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +32 -36
  136. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
  137. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +18 -22
  138. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +41 -59
  139. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  140. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  141. package/lib/core/editor/store/background.js +8 -10
  142. package/lib/core/editor/store/topoEdit.js +4 -6
  143. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  144. package/lib/core/hooks/useCanvasTheme.js +1 -1
  145. package/lib/core/hooks/usePolling.js +108 -120
  146. package/lib/core/hooks/useResourceConfig.js +76 -100
  147. package/lib/core/hooks/useTopoEdit.js +530 -629
  148. package/lib/core/models/Alarm.js +308 -391
  149. package/lib/core/models/AttributeMetricDisplay.js +118 -146
  150. package/lib/core/models/PluginManager.js +4 -3
  151. package/lib/core/models/SelectionModel.js +4 -5
  152. package/lib/core/models/TopoApp.js +287 -454
  153. package/lib/core/models/TopoGraphView.js +28 -41
  154. package/lib/core/models/cache/CiCache.js +39 -44
  155. package/lib/core/models/cache/CiTypeCache.js +71 -85
  156. package/lib/core/models/cache/DictCache.js +39 -45
  157. package/lib/core/models/graph/Background.js +22 -27
  158. package/lib/core/models/plugins/resourceWebControllUrl.js +82 -101
  159. package/lib/core/models/tagstips/ElementTagTipConfig.js +34 -40
  160. package/lib/core/models/topoData.js +73 -78
  161. package/lib/core/models/utils/linkUtils.js +45 -51
  162. package/lib/core/services/alarm.js +18 -20
  163. package/lib/core/services/background.js +70 -78
  164. package/lib/core/services/cmdb/metric.js +14 -19
  165. package/lib/core/services/cmdb.js +24 -29
  166. package/lib/core/services/index.js +53 -72
  167. package/lib/core/services/overview.js +131 -151
  168. package/lib/core/services/topo/basic.js +13 -15
  169. package/lib/core/services/topo/tagtip.js +16 -21
  170. package/lib/core/store/models/ciModel.js +66 -70
  171. package/lib/core/store/models/customIcon.js +126 -145
  172. package/lib/core/store/models/displayConfig.js +15 -19
  173. package/lib/core/store/models/selection.js +4 -6
  174. package/lib/core/store/models/topoAlarm.js +163 -145
  175. package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
  176. package/lib/core/store/models/topoBizMod.js +34 -38
  177. package/lib/core/store/models/topoConfig.js +224 -240
  178. package/lib/core/store/models/topoGraphView.js +4 -6
  179. package/lib/core/store/models/topoMod.js +381 -403
  180. package/lib/core/utils/imageUtil.js +26 -31
  181. package/lib/core/utils/saveSerialize.js +13 -18
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
  183. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -26
  184. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +364 -410
  185. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +114 -133
  186. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +44 -50
  187. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +220 -274
  188. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
  189. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
  190. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +40 -50
  191. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +35 -47
  192. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
  193. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +24 -28
  194. package/lib/networkTopo/components/Link/hook.js +86 -98
  195. package/lib/networkTopo/components/Link/index copy.js +105 -127
  196. package/lib/networkTopo/components/Link/index.js +105 -127
  197. package/lib/networkTopo/components/Link/setting.js +48 -52
  198. package/lib/networkTopo/getTopoData.js +73 -92
  199. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +35 -40
  200. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  201. package/lib/networkTopo/models/TopoCenter.js +28 -46
  202. package/lib/networkTopo/services/alert.js +18 -22
  203. package/lib/networkTopo/services/authorization.js +55 -65
  204. package/lib/networkTopo/services/cmdb.js +551 -700
  205. package/lib/networkTopo/services/funcAuth.js +24 -26
  206. package/lib/networkTopo/services/link.js +108 -118
  207. package/lib/networkTopo/services/mdc.js +35 -51
  208. package/lib/networkTopo/services/metric.js +37 -47
  209. package/lib/networkTopo/services/model.js +615 -809
  210. package/lib/networkTopo/services/risk.js +11 -13
  211. package/lib/networkTopo/services/topo/auth.js +27 -33
  212. package/lib/networkTopo/services/topo/basic.js +277 -317
  213. package/lib/networkTopo/services/topo/blacklist.js +20 -24
  214. package/lib/networkTopo/services/topo/ciInfo.js +34 -38
  215. package/lib/networkTopo/services/topo/icon.js +59 -69
  216. package/lib/networkTopo/services/topo/networkLink.js +32 -36
  217. package/lib/networkTopo/services/topo/relation.js +11 -13
  218. package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
  219. package/lib/networkTopo/store/functionAuth.js +31 -37
  220. package/lib/networkTopo/store/linkDynamicStyle.js +103 -109
  221. package/lib/networkTopo/store/linkDynamicStyleConfig.js +42 -44
  222. package/lib/networkTopo/store/linkManager.js +4 -6
  223. package/lib/networkTopo/store/topoCenter.js +142 -152
  224. package/lib/networkTopo/store/topoLinkMod.js +4 -6
  225. package/lib/networkTopo/store/topoTreeMod.js +166 -178
  226. package/lib/networkTopo/utils/exportData.js +63 -68
  227. package/package.json +3 -3
@@ -14,6 +14,8 @@ import LinkSetting from "./setting";
14
14
  */
15
15
 
16
16
  var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
17
+ var _ref2, _ref3, _ref4, _ref5;
18
+
17
19
  var topoContext = props.topoContext,
18
20
  topo = props.topo;
19
21
  var store = topo.store;
@@ -81,154 +83,130 @@ var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
81
83
  }
82
84
  }, [urlParams.showAddLink]); // 链路更新,通过资源重新获取链路信息通知HT来更新
83
85
 
84
- var refreshLink = /*#__PURE__*/function () {
85
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
86
+ var refreshLink = function refreshLink() {
87
+ return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
86
88
  var data;
87
89
  return _regeneratorRuntime.wrap(function _callee$(_context) {
88
- while (1) {
89
- switch (_context.prev = _context.next) {
90
- case 0:
91
- rlog.debug('useTopoEdit.refreshLink');
92
- _context.next = 3;
93
- return editDispatchers.fetchData();
94
-
95
- case 3:
96
- data = _context.sent;
97
- topo.view.topoClient.emitEvent(TopoEvent.EVENT_DATA_RESULT, {
98
- type: TopoEvent.DATA_TYPE_RESOURCE_COMBO,
99
- data: data
100
- });
101
-
102
- case 5:
103
- case "end":
104
- return _context.stop();
105
- }
90
+ while (1) switch (_context.prev = _context.next) {
91
+ case 0:
92
+ rlog.debug('useTopoEdit.refreshLink');
93
+ _context.next = 3;
94
+ return editDispatchers.fetchData();
95
+
96
+ case 3:
97
+ data = _context.sent;
98
+ topo.view.topoClient.emitEvent(TopoEvent.EVENT_DATA_RESULT, {
99
+ type: TopoEvent.DATA_TYPE_RESOURCE_COMBO,
100
+ data: data
101
+ });
102
+
103
+ case 5:
104
+ case "end":
105
+ return _context.stop();
106
106
  }
107
107
  }, _callee);
108
- }));
109
-
110
- return function refreshLink() {
111
- return _ref2.apply(this, arguments);
112
- };
113
- }();
108
+ }))).apply(this, arguments);
109
+ };
114
110
 
115
- var getLink = /*#__PURE__*/function () {
116
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
111
+ var getLink = function getLink(_x) {
112
+ return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
117
113
  var data;
118
114
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
119
- while (1) {
120
- switch (_context2.prev = _context2.next) {
121
- case 0:
122
- _context2.next = 2;
123
- return editDispatchers.fetchData();
124
-
125
- case 2:
126
- data = _context2.sent;
127
- return _context2.abrupt("return", data.filter(function (item) {
128
- return item.id === id;
129
- })[0]);
130
-
131
- case 4:
132
- case "end":
133
- return _context2.stop();
134
- }
115
+ while (1) switch (_context2.prev = _context2.next) {
116
+ case 0:
117
+ _context2.next = 2;
118
+ return editDispatchers.fetchData();
119
+
120
+ case 2:
121
+ data = _context2.sent;
122
+ return _context2.abrupt("return", data.filter(function (item) {
123
+ return item.id === id;
124
+ })[0]);
125
+
126
+ case 4:
127
+ case "end":
128
+ return _context2.stop();
135
129
  }
136
130
  }, _callee2);
137
- }));
138
-
139
- return function getLink(_x) {
140
- return _ref3.apply(this, arguments);
141
- };
142
- }();
131
+ }))).apply(this, arguments);
132
+ };
143
133
 
144
- var updateTopo = useCallback( /*#__PURE__*/function () {
145
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
146
- var changed, isAdd, _data$result$, oldId, id, linkData;
134
+ var updateTopo = useCallback(function (_x2) {
135
+ return (_ref4 = _ref4 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
136
+ var changed, isAdd, _data$result$2, oldId, id, linkData;
147
137
 
148
138
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
149
- while (1) {
150
- switch (_context3.prev = _context3.next) {
151
- case 0:
152
- changed = data.changed, isAdd = data.isAddMode;
153
-
154
- if (!(changed === false)) {
155
- _context3.next = 3;
156
- break;
157
- }
139
+ while (1) switch (_context3.prev = _context3.next) {
140
+ case 0:
141
+ changed = data.changed, isAdd = data.isAddMode;
158
142
 
159
- return _context3.abrupt("return");
160
-
161
- case 3:
162
- if (!isAdd) {
163
- _context3.next = 8;
164
- break;
165
- }
143
+ if (!(changed === false)) {
144
+ _context3.next = 3;
145
+ break;
146
+ }
166
147
 
167
- _context3.next = 6;
168
- return refreshLink();
148
+ return _context3.abrupt("return");
169
149
 
170
- case 6:
171
- _context3.next = 13;
150
+ case 3:
151
+ if (!isAdd) {
152
+ _context3.next = 8;
172
153
  break;
173
-
174
- case 8:
175
- _data$result$ = data.result[0], oldId = _data$result$.oldId, id = _data$result$.id;
176
- _context3.next = 11;
177
- return getLink(id);
178
-
179
- case 11:
180
- linkData = _context3.sent;
181
- topo.view.topoClient.emitEvent('topo_link_update', {
182
- id: oldId,
183
- link: linkData
184
- });
185
-
186
- case 13:
187
- case "end":
188
- return _context3.stop();
189
- }
154
+ }
155
+
156
+ _context3.next = 6;
157
+ return refreshLink();
158
+
159
+ case 6:
160
+ _context3.next = 13;
161
+ break;
162
+
163
+ case 8:
164
+ _data$result$2 = data.result[0], oldId = _data$result$2.oldId, id = _data$result$2.id;
165
+ _context3.next = 11;
166
+ return getLink(id);
167
+
168
+ case 11:
169
+ linkData = _context3.sent;
170
+ topo.view.topoClient.emitEvent('topo_link_update', {
171
+ id: oldId,
172
+ link: linkData
173
+ });
174
+
175
+ case 13:
176
+ case "end":
177
+ return _context3.stop();
190
178
  }
191
179
  }, _callee3);
192
- }));
193
-
194
- return function (_x2) {
195
- return _ref4.apply(this, arguments);
196
- };
197
- }(), []);
198
- var handleSaved = useCallback( /*#__PURE__*/function () {
199
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
180
+ }))).apply(this, arguments);
181
+ }, []);
182
+ var handleSaved = useCallback(function (_x3) {
183
+ return (_ref5 = _ref5 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
200
184
  var errorItems;
201
185
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
202
- while (1) {
203
- switch (_context4.prev = _context4.next) {
204
- case 0:
205
- errorItems = data.errorItems;
206
-
207
- if (errorItems.length) {
208
- _context4.next = 7;
209
- break;
210
- }
211
-
212
- setFalse();
213
- setUpdateTopoState(true);
214
- _context4.next = 6;
215
- return updateTopo(data);
216
-
217
- case 6:
218
- setUpdateTopoState(false);
219
-
220
- case 7:
221
- case "end":
222
- return _context4.stop();
223
- }
186
+ while (1) switch (_context4.prev = _context4.next) {
187
+ case 0:
188
+ errorItems = data.errorItems;
189
+
190
+ if (errorItems.length) {
191
+ _context4.next = 7;
192
+ break;
193
+ }
194
+
195
+ setFalse();
196
+ setUpdateTopoState(true);
197
+ _context4.next = 6;
198
+ return updateTopo(data);
199
+
200
+ case 6:
201
+ setUpdateTopoState(false);
202
+
203
+ case 7:
204
+ case "end":
205
+ return _context4.stop();
224
206
  }
225
207
  }, _callee4);
226
- }));
227
-
228
- return function (_x3) {
229
- return _ref5.apply(this, arguments);
230
- };
231
- }(), []);
208
+ }))).apply(this, arguments);
209
+ }, []);
232
210
  return /*#__PURE__*/React.createElement(_Drawer, {
233
211
  closeMode: ['close', 'esc'],
234
212
  visible: visible,
@@ -38,6 +38,8 @@ var Title = function Title(_ref) {
38
38
 
39
39
 
40
40
  var LinkSetting = function LinkSetting(_ref2) {
41
+ var _ref3;
42
+
41
43
  var link = _ref2.link,
42
44
  topoElements = _ref2.topoElements,
43
45
  topo = _ref2.topo,
@@ -106,62 +108,56 @@ var LinkSetting = function LinkSetting(_ref2) {
106
108
  return validatorErrors;
107
109
  };
108
110
 
109
- var onSave = /*#__PURE__*/function () {
110
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
111
- var values, _values$, src, dst;
111
+ var onSave = function onSave() {
112
+ return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
113
+ var values, _values$2, src, dst;
112
114
 
113
115
  return _regeneratorRuntime.wrap(function _callee$(_context) {
114
- while (1) {
115
- switch (_context.prev = _context.next) {
116
- case 0:
117
- if (!isAvailableArray(getValidatorErrors())) {
118
- _context.next = 2;
119
- break;
120
- }
121
-
122
- return _context.abrupt("return");
123
-
124
- case 2:
125
- values = list.map(function (i, index) {
126
- return refs[index].field.getValues();
127
- });
128
-
129
- if (isAddMode) {
130
- _context.next = 8;
131
- break;
132
- }
133
-
134
- _values$ = values[0], src = _values$.src, dst = _values$.dst;
135
-
136
- if (!(src.sub === link.interfaceSource && dst.sub === link.interfaceTarget)) {
137
- _context.next = 8;
138
- break;
139
- }
140
-
141
- saveCb({
142
- changed: false
143
- });
144
- return _context.abrupt("return");
145
-
146
- case 8:
147
- _context.next = 10;
148
- return execSave({
149
- link: link,
150
- values: values
151
- });
152
-
153
- case 10:
154
- case "end":
155
- return _context.stop();
156
- }
116
+ while (1) switch (_context.prev = _context.next) {
117
+ case 0:
118
+ if (!isAvailableArray(getValidatorErrors())) {
119
+ _context.next = 2;
120
+ break;
121
+ }
122
+
123
+ return _context.abrupt("return");
124
+
125
+ case 2:
126
+ values = list.map(function (i, index) {
127
+ return refs[index].field.getValues();
128
+ });
129
+
130
+ if (isAddMode) {
131
+ _context.next = 8;
132
+ break;
133
+ }
134
+
135
+ _values$2 = values[0], src = _values$2.src, dst = _values$2.dst;
136
+
137
+ if (!(src.sub === link.interfaceSource && dst.sub === link.interfaceTarget)) {
138
+ _context.next = 8;
139
+ break;
140
+ }
141
+
142
+ saveCb({
143
+ changed: false
144
+ });
145
+ return _context.abrupt("return");
146
+
147
+ case 8:
148
+ _context.next = 10;
149
+ return execSave({
150
+ link: link,
151
+ values: values
152
+ });
153
+
154
+ case 10:
155
+ case "end":
156
+ return _context.stop();
157
157
  }
158
158
  }, _callee);
159
- }));
160
-
161
- return function onSave() {
162
- return _ref3.apply(this, arguments);
163
- };
164
- }();
159
+ }))).apply(this, arguments);
160
+ };
165
161
 
166
162
  var formProp = {
167
163
  link: link,
@@ -1,5 +1,8 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+
4
+ var _addLinkData, _buildData, _getTopoData;
5
+
3
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
7
  import { getLinksDetail } from "../core/models/utils/linkUtils";
5
8
  import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil"; // import "./utils/__tests__/resourcePermissionUtil.test";
@@ -57,112 +60,90 @@ function fixNodeGroupId(data) {
57
60
  }
58
61
 
59
62
  export function addLinkData(_x) {
60
- return _addLinkData.apply(this, arguments);
61
- } // FIXME 业务拓扑不需要链路相关逻辑
62
-
63
- function _addLinkData() {
64
- _addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
63
+ return (_addLinkData = _addLinkData || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
65
64
  var links, nodes, networkLinks, otherLinks;
66
65
  return _regeneratorRuntime.wrap(function _callee$(_context) {
67
- while (1) {
68
- switch (_context.prev = _context.next) {
69
- case 0:
70
- links = data.links || [];
71
- nodes = data.nodes || []; // 如果是网络链路,补充详情信息
72
-
73
- _context.next = 4;
74
- return getLinksDetail(links.filter(function (link) {
75
- return link.ciType === 'network_link';
76
- }), nodes);
77
-
78
- case 4:
79
- networkLinks = _context.sent;
80
- // console.log("如果是网络链路,补充详情信息", networkLinks);
81
- otherLinks = links.filter(function (link) {
82
- return link.ciType !== 'network_link';
83
- });
84
- return _context.abrupt("return", _extends({}, data, {
85
- links: [].concat(networkLinks, otherLinks),
86
- linkGroups: []
87
- }));
88
-
89
- case 7:
90
- case "end":
91
- return _context.stop();
92
- }
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ links = data.links || [];
69
+ nodes = data.nodes || []; // 如果是网络链路,补充详情信息
70
+
71
+ _context.next = 4;
72
+ return getLinksDetail(links.filter(function (link) {
73
+ return link.ciType === 'network_link';
74
+ }), nodes);
75
+
76
+ case 4:
77
+ networkLinks = _context.sent;
78
+ // console.log("如果是网络链路,补充详情信息", networkLinks);
79
+ otherLinks = links.filter(function (link) {
80
+ return link.ciType !== 'network_link';
81
+ });
82
+ return _context.abrupt("return", _extends({}, data, {
83
+ links: [].concat(networkLinks, otherLinks),
84
+ linkGroups: []
85
+ }));
86
+
87
+ case 7:
88
+ case "end":
89
+ return _context.stop();
93
90
  }
94
91
  }, _callee);
95
- }));
96
- return _addLinkData.apply(this, arguments);
97
- }
92
+ }))).apply(this, arguments);
93
+ } // FIXME 业务拓扑不需要链路相关逻辑
98
94
 
99
95
  export function buildData(_x2) {
100
- return _buildData.apply(this, arguments);
101
- }
102
-
103
- function _buildData() {
104
- _buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(oldData) {
96
+ return (_buildData = _buildData || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(oldData) {
105
97
  var data;
106
98
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
107
- while (1) {
108
- switch (_context2.prev = _context2.next) {
109
- case 0:
110
- data = oldData;
111
- data = fixNodeGroupId(data);
112
- data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
113
-
114
- data = addTopoDataResourcePermission(data);
115
- return _context2.abrupt("return", data);
116
-
117
- case 5:
118
- case "end":
119
- return _context2.stop();
120
- }
99
+ while (1) switch (_context2.prev = _context2.next) {
100
+ case 0:
101
+ data = oldData;
102
+ data = fixNodeGroupId(data);
103
+ data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
104
+
105
+ data = addTopoDataResourcePermission(data);
106
+ return _context2.abrupt("return", data);
107
+
108
+ case 5:
109
+ case "end":
110
+ return _context2.stop();
121
111
  }
122
112
  }, _callee2);
123
- }));
124
- return _buildData.apply(this, arguments);
113
+ }))).apply(this, arguments);
125
114
  }
126
-
127
115
  export default function getTopoData(_x3, _x4) {
128
- return _getTopoData.apply(this, arguments);
129
- }
130
-
131
- function _getTopoData() {
132
- _getTopoData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, topoService) {
116
+ return (_getTopoData = _getTopoData || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, topoService) {
133
117
  var data;
134
118
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
135
- while (1) {
136
- switch (_context3.prev = _context3.next) {
137
- case 0:
138
- _context3.next = 2;
139
- return topoService.getTopoData(id);
140
-
141
- case 2:
142
- data = _context3.sent;
143
-
144
- if (data) {
145
- _context3.next = 5;
146
- break;
147
- }
148
-
149
- return _context3.abrupt("return", data);
150
-
151
- case 5:
152
- data = fixAlarmConfig(data);
153
- _context3.next = 8;
154
- return buildData(data);
155
-
156
- case 8:
157
- data = _context3.sent;
158
- return _context3.abrupt("return", data);
159
-
160
- case 10:
161
- case "end":
162
- return _context3.stop();
163
- }
119
+ while (1) switch (_context3.prev = _context3.next) {
120
+ case 0:
121
+ _context3.next = 2;
122
+ return topoService.getTopoData(id);
123
+
124
+ case 2:
125
+ data = _context3.sent;
126
+
127
+ if (data) {
128
+ _context3.next = 5;
129
+ break;
130
+ }
131
+
132
+ return _context3.abrupt("return", data);
133
+
134
+ case 5:
135
+ data = fixAlarmConfig(data);
136
+ _context3.next = 8;
137
+ return buildData(data);
138
+
139
+ case 8:
140
+ data = _context3.sent;
141
+ return _context3.abrupt("return", data);
142
+
143
+ case 10:
144
+ case "end":
145
+ return _context3.stop();
164
146
  }
165
147
  }, _callee3);
166
- }));
167
- return _getTopoData.apply(this, arguments);
148
+ }))).apply(this, arguments);
168
149
  }
@@ -12,6 +12,8 @@ import { loopTreeFun } from "../../../utils/tree";
12
12
  */
13
13
 
14
14
  export default function useRelateTopo(params) {
15
+ var _openLinkedTopo;
16
+
15
17
  var topo = params.topo;
16
18
  var store = topo.store;
17
19
  var topoState = store.useModelState('topoMod');
@@ -54,51 +56,44 @@ export default function useRelateTopo(params) {
54
56
 
55
57
 
56
58
  function openLinkedTopo(_x) {
57
- return _openLinkedTopo.apply(this, arguments);
58
- }
59
-
60
- function _openLinkedTopo() {
61
- _openLinkedTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topoId) {
59
+ return (_openLinkedTopo = _openLinkedTopo || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topoId) {
62
60
  var thumbnailImg;
63
61
  return _regeneratorRuntime.wrap(function _callee$(_context) {
64
- while (1) {
65
- switch (_context.prev = _context.next) {
66
- case 0:
67
- rlog.info('打开关联拓扑图', topoId);
68
-
69
- if (checkTopoExisted(topoId)) {
70
- _context.next = 4;
71
- break;
72
- }
73
-
74
- rlog.error('关联拓扑图不存在:', topoId);
75
- return _context.abrupt("return");
76
-
77
- case 4:
78
- _context.next = 6;
79
- return topo.getHtTopo().createThumbnail();
80
-
81
- case 6:
82
- thumbnailImg = _context.sent;
83
- // 打开新拓扑,传递缩略图和原拓扑id
84
- topoCenterDispatchers.openTopoPage({
85
- id: topoId,
86
- linkTo: {
87
- img: thumbnailImg,
88
- sourceTopo: {
89
- id: topoState.topoId
90
- }
62
+ while (1) switch (_context.prev = _context.next) {
63
+ case 0:
64
+ rlog.info('打开关联拓扑图', topoId);
65
+
66
+ if (checkTopoExisted(topoId)) {
67
+ _context.next = 4;
68
+ break;
69
+ }
70
+
71
+ rlog.error('关联拓扑图不存在:', topoId);
72
+ return _context.abrupt("return");
73
+
74
+ case 4:
75
+ _context.next = 6;
76
+ return topo.getHtTopo().createThumbnail();
77
+
78
+ case 6:
79
+ thumbnailImg = _context.sent;
80
+ // 打开新拓扑,传递缩略图和原拓扑id
81
+ topoCenterDispatchers.openTopoPage({
82
+ id: topoId,
83
+ linkTo: {
84
+ img: thumbnailImg,
85
+ sourceTopo: {
86
+ id: topoState.topoId
91
87
  }
92
- });
88
+ }
89
+ });
93
90
 
94
- case 8:
95
- case "end":
96
- return _context.stop();
97
- }
91
+ case 8:
92
+ case "end":
93
+ return _context.stop();
98
94
  }
99
95
  }, _callee);
100
- }));
101
- return _openLinkedTopo.apply(this, arguments);
96
+ }))).apply(this, arguments);
102
97
  }
103
98
 
104
99
  function returnSourceTopo(data) {