@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
@@ -55,44 +55,42 @@ function List(props) {
55
55
  _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(e, id) {
56
56
  var canDelete;
57
57
  return _regenerator["default"].wrap(function _callee$(_context) {
58
- while (1) {
59
- switch (_context.prev = _context.next) {
60
- case 0:
61
- e.stopPropagation();
62
- _context.next = 3;
63
- return _background["default"].canDeleteBackground(id);
64
-
65
- case 3:
66
- canDelete = _context.sent;
67
-
68
- // console.log('canDelete', canDelete);
69
- if (canDelete) {
70
- _dialog["default"].confirm({
71
- title: '删除',
72
- messageProps: {
73
- type: 'warning'
74
- },
75
- content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
76
- onOk: function onOk() {
77
- return onRemove(id);
78
- }
79
- });
80
- } else {
81
- _dialog["default"].confirm({
82
- title: '提示',
83
- messageProps: {
84
- type: 'warning'
85
- },
86
- content: '此背景被占用,不能删除。',
87
- footerActions: ['ok'],
88
- onOk: function onOk() {}
89
- });
90
- }
91
-
92
- case 5:
93
- case "end":
94
- return _context.stop();
95
- }
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ e.stopPropagation();
61
+ _context.next = 3;
62
+ return _background["default"].canDeleteBackground(id);
63
+
64
+ case 3:
65
+ canDelete = _context.sent;
66
+
67
+ // console.log('canDelete', canDelete);
68
+ if (canDelete) {
69
+ _dialog["default"].confirm({
70
+ title: '删除',
71
+ messageProps: {
72
+ type: 'warning'
73
+ },
74
+ content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
75
+ onOk: function onOk() {
76
+ return onRemove(id);
77
+ }
78
+ });
79
+ } else {
80
+ _dialog["default"].confirm({
81
+ title: '提示',
82
+ messageProps: {
83
+ type: 'warning'
84
+ },
85
+ content: '此背景被占用,不能删除。',
86
+ footerActions: ['ok'],
87
+ onOk: function onOk() {}
88
+ });
89
+ }
90
+
91
+ case 5:
92
+ case "end":
93
+ return _context.stop();
96
94
  }
97
95
  }, _callee);
98
96
  }));
@@ -160,20 +158,18 @@ function BackgroundView(props) {
160
158
  _getBackground = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
161
159
  var res;
162
160
  return _regenerator["default"].wrap(function _callee4$(_context4) {
163
- while (1) {
164
- switch (_context4.prev = _context4.next) {
165
- case 0:
166
- _context4.next = 2;
167
- return _background["default"].getBackgroundList();
168
-
169
- case 2:
170
- res = _context4.sent;
171
- setBgList(res);
172
-
173
- case 4:
174
- case "end":
175
- return _context4.stop();
176
- }
161
+ while (1) switch (_context4.prev = _context4.next) {
162
+ case 0:
163
+ _context4.next = 2;
164
+ return _background["default"].getBackgroundList();
165
+
166
+ case 2:
167
+ res = _context4.sent;
168
+ setBgList(res);
169
+
170
+ case 4:
171
+ case "end":
172
+ return _context4.stop();
177
173
  }
178
174
  }, _callee4);
179
175
  }));
@@ -189,37 +185,35 @@ function BackgroundView(props) {
189
185
  _removeBg = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(id) {
190
186
  var res;
191
187
  return _regenerator["default"].wrap(function _callee5$(_context5) {
192
- while (1) {
193
- switch (_context5.prev = _context5.next) {
194
- case 0:
195
- _context5.next = 2;
196
- return _background["default"].deleteBackground(id);
188
+ while (1) switch (_context5.prev = _context5.next) {
189
+ case 0:
190
+ _context5.next = 2;
191
+ return _background["default"].deleteBackground(id);
197
192
 
198
- case 2:
199
- res = _context5.sent;
193
+ case 2:
194
+ res = _context5.sent;
200
195
 
201
- if (!(id === (current === null || current === void 0 ? void 0 : current.id))) {
202
- _context5.next = 9;
203
- break;
204
- }
196
+ if (!(id === (current === null || current === void 0 ? void 0 : current.id))) {
197
+ _context5.next = 9;
198
+ break;
199
+ }
205
200
 
206
- topo.historyManager.setDisabled(true, '删除背景');
207
- _context5.next = 7;
208
- return reset();
201
+ topo.historyManager.setDisabled(true, '删除背景');
202
+ _context5.next = 7;
203
+ return reset();
209
204
 
210
- case 7:
211
- setHtTopoBackground(null);
212
- topo.historyManager.setDisabled(false, '删除背景');
205
+ case 7:
206
+ setHtTopoBackground(null);
207
+ topo.historyManager.setDisabled(false, '删除背景');
213
208
 
214
- case 9:
215
- getBackground();
209
+ case 9:
210
+ getBackground();
216
211
 
217
- _message["default"].success('删除成功');
212
+ _message["default"].success('删除成功');
218
213
 
219
- case 11:
220
- case "end":
221
- return _context5.stop();
222
- }
214
+ case 11:
215
+ case "end":
216
+ return _context5.stop();
223
217
  }
224
218
  }, _callee5);
225
219
  }));
@@ -234,48 +228,46 @@ function BackgroundView(props) {
234
228
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(currentBg) {
235
229
  var imgUrl, size;
236
230
  return _regenerator["default"].wrap(function _callee2$(_context2) {
237
- while (1) {
238
- switch (_context2.prev = _context2.next) {
239
- case 0:
240
- if (!(currentBg !== null && currentBg !== void 0 && currentBg.id && currentBg.id !== (current === null || current === void 0 ? void 0 : current.id))) {
241
- _context2.next = 19;
242
- break;
243
- }
244
-
245
- setLoadingBackground(true);
246
- topo.historyManager.beginTransaction();
247
- imgUrl = (0, _backgroundUtil.getBackgroundImageUrl)(currentBg);
248
- _context2.prev = 4;
249
- _context2.next = 7;
250
- return (0, _imageUtil.getImageSize)(imgUrl);
251
-
252
- case 7:
253
- size = _context2.sent;
254
-
255
- _rlog["default"].debug('获取图片大小', size);
256
-
257
- _context2.next = 11;
258
- return setBackground((0, _extends2["default"])({}, currentBg, size));
259
-
260
- case 11:
261
- topo.getHtTopo().setBackgroundImgUrl(imgUrl, size.width, size.height);
262
- _context2.next = 17;
231
+ while (1) switch (_context2.prev = _context2.next) {
232
+ case 0:
233
+ if (!(currentBg !== null && currentBg !== void 0 && currentBg.id && currentBg.id !== (current === null || current === void 0 ? void 0 : current.id))) {
234
+ _context2.next = 19;
263
235
  break;
236
+ }
237
+
238
+ setLoadingBackground(true);
239
+ topo.historyManager.beginTransaction();
240
+ imgUrl = (0, _backgroundUtil.getBackgroundImageUrl)(currentBg);
241
+ _context2.prev = 4;
242
+ _context2.next = 7;
243
+ return (0, _imageUtil.getImageSize)(imgUrl);
244
+
245
+ case 7:
246
+ size = _context2.sent;
247
+
248
+ _rlog["default"].debug('获取图片大小', size);
249
+
250
+ _context2.next = 11;
251
+ return setBackground((0, _extends2["default"])({}, currentBg, size));
252
+
253
+ case 11:
254
+ topo.getHtTopo().setBackgroundImgUrl(imgUrl, size.width, size.height);
255
+ _context2.next = 17;
256
+ break;
264
257
 
265
- case 14:
266
- _context2.prev = 14;
267
- _context2.t0 = _context2["catch"](4);
258
+ case 14:
259
+ _context2.prev = 14;
260
+ _context2.t0 = _context2["catch"](4);
268
261
 
269
- _rlog["default"].error('设置背景失败', _context2.t0);
262
+ _rlog["default"].error('设置背景失败', _context2.t0);
270
263
 
271
- case 17:
272
- topo.historyManager.endTransaction();
273
- setLoadingBackground(false);
264
+ case 17:
265
+ topo.historyManager.endTransaction();
266
+ setLoadingBackground(false);
274
267
 
275
- case 19:
276
- case "end":
277
- return _context2.stop();
278
- }
268
+ case 19:
269
+ case "end":
270
+ return _context2.stop();
279
271
  }
280
272
  }, _callee2, null, [[4, 14]]);
281
273
  }));
@@ -288,21 +280,19 @@ function BackgroundView(props) {
288
280
  var resetDefault = /*#__PURE__*/function () {
289
281
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
290
282
  return _regenerator["default"].wrap(function _callee3$(_context3) {
291
- while (1) {
292
- switch (_context3.prev = _context3.next) {
293
- case 0:
294
- topo.historyManager.beginTransaction();
295
- _context3.next = 3;
296
- return reset();
297
-
298
- case 3:
299
- setHtTopoBackground(null);
300
- topo.historyManager.endTransaction();
301
-
302
- case 5:
303
- case "end":
304
- return _context3.stop();
305
- }
283
+ while (1) switch (_context3.prev = _context3.next) {
284
+ case 0:
285
+ topo.historyManager.beginTransaction();
286
+ _context3.next = 3;
287
+ return reset();
288
+
289
+ case 3:
290
+ setHtTopoBackground(null);
291
+ topo.historyManager.endTransaction();
292
+
293
+ case 5:
294
+ case "end":
295
+ return _context3.stop();
306
296
  }
307
297
  }, _callee3);
308
298
  }));
@@ -63,32 +63,30 @@ function RenameDialog(props) {
63
63
  var _yield$field$validate, errors, values;
64
64
 
65
65
  return _regenerator["default"].wrap(function _callee$(_context) {
66
- while (1) {
67
- switch (_context.prev = _context.next) {
68
- case 0:
69
- _context.next = 2;
70
- return field.validatePromise();
71
-
72
- case 2:
73
- _yield$field$validate = _context.sent;
74
- errors = _yield$field$validate.errors;
75
- values = _yield$field$validate.values;
76
-
77
- if (errors) {
78
- _context.next = 8;
79
- break;
80
- }
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ _context.next = 2;
69
+ return field.validatePromise();
81
70
 
71
+ case 2:
72
+ _yield$field$validate = _context.sent;
73
+ errors = _yield$field$validate.errors;
74
+ values = _yield$field$validate.values;
75
+
76
+ if (errors) {
82
77
  _context.next = 8;
83
- return dispatchers.renameIcon({
84
- id: icon.id,
85
- name: values.name
86
- });
87
-
88
- case 8:
89
- case "end":
90
- return _context.stop();
91
- }
78
+ break;
79
+ }
80
+
81
+ _context.next = 8;
82
+ return dispatchers.renameIcon({
83
+ id: icon.id,
84
+ name: values.name
85
+ });
86
+
87
+ case 8:
88
+ case "end":
89
+ return _context.stop();
92
90
  }
93
91
  }, _callee);
94
92
  }));
@@ -29,6 +29,8 @@ var _index = _interopRequireDefault(require("@riil-frontend/component-topology-c
29
29
 
30
30
  var _lodash = _interopRequireDefault(require("lodash"));
31
31
 
32
+ var _utils = require("@riil-frontend/utils");
33
+
32
34
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
33
35
 
34
36
  var _SpecialCharacterValidateUtil = require("../../../../utils/SpecialCharacterValidateUtil");
@@ -201,39 +203,37 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
201
203
  _this.handleSuccess = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
202
204
  var files, dispatchers;
203
205
  return _regenerator["default"].wrap(function _callee$(_context) {
204
- while (1) {
205
- switch (_context.prev = _context.next) {
206
- case 0:
207
- files = _this.state.files;
208
-
209
- _message["default"].show({
210
- type: 'success',
211
- title: '图片上传成功'
212
- });
213
-
214
- _this.setState({
215
- uploading: false
216
- });
217
-
218
- dispatchers = _this.props.dispatchers;
219
- _context.next = 6;
220
- return dispatchers.uploadSuccess({
221
- type: _this.props.type,
222
- data: files.map(function (file) {
223
- return {
224
- id: file.response.result,
225
- name: getFileName(file)
226
- };
227
- })
228
- });
229
-
230
- case 6:
231
- _this.resetState();
232
-
233
- case 7:
234
- case "end":
235
- return _context.stop();
236
- }
206
+ while (1) switch (_context.prev = _context.next) {
207
+ case 0:
208
+ files = _this.state.files;
209
+
210
+ _message["default"].show({
211
+ type: 'success',
212
+ title: '图片上传成功'
213
+ });
214
+
215
+ _this.setState({
216
+ uploading: false
217
+ });
218
+
219
+ dispatchers = _this.props.dispatchers;
220
+ _context.next = 6;
221
+ return dispatchers.uploadSuccess({
222
+ type: _this.props.type,
223
+ data: files.map(function (file) {
224
+ return {
225
+ id: file.response.result,
226
+ name: getFileName(file)
227
+ };
228
+ })
229
+ });
230
+
231
+ case 6:
232
+ _this.resetState();
233
+
234
+ case 7:
235
+ case "end":
236
+ return _context.stop();
237
237
  }
238
238
  }, _callee);
239
239
  }));
@@ -311,7 +311,7 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
311
311
  disabled: uploading,
312
312
  action: UPLOAD_ICON_URL,
313
313
  headers: {
314
- Authorization: localStorage.getItem('token')
314
+ Authorization: (0, _utils.getToken)()
315
315
  },
316
316
  accept: ".jpg,.jpeg,.png,.svg",
317
317
  autoUpload: false,
@@ -19,27 +19,25 @@ function svgToShape(_x) {
19
19
  function _svgToShape() {
20
20
  _svgToShape = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
21
21
  return _regenerator["default"].wrap(function _callee$(_context) {
22
- while (1) {
23
- switch (_context.prev = _context.next) {
24
- case 0:
25
- return _context.abrupt("return", new Promise(function (resolve, reject) {
26
- var reader = new FileReader();
27
-
28
- reader.onload = function () {
29
- resolve(ht.Default.svgToShape(this.result).output);
30
- };
31
-
32
- reader.onerror = function () {
33
- reject();
34
- };
35
-
36
- reader.readAsText(file);
37
- }));
38
-
39
- case 1:
40
- case "end":
41
- return _context.stop();
42
- }
22
+ while (1) switch (_context.prev = _context.next) {
23
+ case 0:
24
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
25
+ var reader = new FileReader();
26
+
27
+ reader.onload = function () {
28
+ resolve(ht.Default.svgToShape(this.result).output);
29
+ };
30
+
31
+ reader.onerror = function () {
32
+ reject();
33
+ };
34
+
35
+ reader.readAsText(file);
36
+ }));
37
+
38
+ case 1:
39
+ case "end":
40
+ return _context.stop();
43
41
  }
44
42
  }, _callee);
45
43
  }));
@@ -26,16 +26,14 @@ var GroupAddResourceDrawer = function GroupAddResourceDrawer(props) {
26
26
  var onOk = /*#__PURE__*/function () {
27
27
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(selected) {
28
28
  return _regenerator["default"].wrap(function _callee$(_context) {
29
- while (1) {
30
- switch (_context.prev = _context.next) {
31
- case 0:
32
- _context.next = 2;
33
- return topoEdit.addGroupResources(group, selected);
34
-
35
- case 2:
36
- case "end":
37
- return _context.stop();
38
- }
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ _context.next = 2;
32
+ return topoEdit.addGroupResources(group, selected);
33
+
34
+ case 2:
35
+ case "end":
36
+ return _context.stop();
39
37
  }
40
38
  }, _callee);
41
39
  }));
@@ -32,30 +32,28 @@ function useCanvasThemeConfig(props) {
32
32
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(themeName) {
33
33
  var themeConfig;
34
34
  return _regenerator["default"].wrap(function _callee$(_context) {
35
- while (1) {
36
- switch (_context.prev = _context.next) {
37
- case 0:
38
- themeConfig = _themes["default"].find(function (item) {
39
- return item.name === themeName;
40
- });
41
- topo.historyManager.beginTransaction();
42
- _context.next = 4;
43
- return displayConfigDispatchers.update({
44
- canvasTheme: themeName
45
- });
46
-
47
- case 4:
48
- _context.next = 6;
49
- return setGlobalTagTheme(themeConfig);
50
-
51
- case 6:
52
- setElementsTheme(themeConfig);
53
- topo.historyManager.endTransaction();
54
-
55
- case 8:
56
- case "end":
57
- return _context.stop();
58
- }
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ themeConfig = _themes["default"].find(function (item) {
38
+ return item.name === themeName;
39
+ });
40
+ topo.historyManager.beginTransaction();
41
+ _context.next = 4;
42
+ return displayConfigDispatchers.update({
43
+ canvasTheme: themeName
44
+ });
45
+
46
+ case 4:
47
+ _context.next = 6;
48
+ return setGlobalTagTheme(themeConfig);
49
+
50
+ case 6:
51
+ setElementsTheme(themeConfig);
52
+ topo.historyManager.endTransaction();
53
+
54
+ case 8:
55
+ case "end":
56
+ return _context.stop();
59
57
  }
60
58
  }, _callee);
61
59
  }));
@@ -75,23 +73,21 @@ function useCanvasThemeConfig(props) {
75
73
  var _topo$store$getModelS, nodeLabelStyle, defaultEdgeLabelStyle;
76
74
 
77
75
  return _regenerator["default"].wrap(function _callee2$(_context2) {
78
- while (1) {
79
- switch (_context2.prev = _context2.next) {
80
- case 0:
81
- topo.getHtTopo().setGlobalNodeLabelStyle(themeConfig.globalNodeLabelStyle);
82
- topo.getHtTopo().setGlobalEdgeTagStyle(themeConfig.globalEdgeTagStyle); // 更新默认配置
83
-
84
- _topo$store$getModelS = topo.store.getModelState('displayConfig'), nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle, defaultEdgeLabelStyle = _topo$store$getModelS.defaultEdgeLabelStyle;
85
- _context2.next = 5;
86
- return displayConfigDispatchers.update({
87
- nodeLabelStyle: (0, _extends2["default"])({}, nodeLabelStyle, themeConfig.globalNodeLabelStyle),
88
- defaultEdgeLabelStyle: (0, _extends2["default"])({}, defaultEdgeLabelStyle, themeConfig.globalEdgeTagStyle)
89
- });
90
-
91
- case 5:
92
- case "end":
93
- return _context2.stop();
94
- }
76
+ while (1) switch (_context2.prev = _context2.next) {
77
+ case 0:
78
+ topo.getHtTopo().setGlobalNodeLabelStyle(themeConfig.globalNodeLabelStyle);
79
+ topo.getHtTopo().setGlobalEdgeTagStyle(themeConfig.globalEdgeTagStyle); // 更新默认配置
80
+
81
+ _topo$store$getModelS = topo.store.getModelState('displayConfig'), nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle, defaultEdgeLabelStyle = _topo$store$getModelS.defaultEdgeLabelStyle;
82
+ _context2.next = 5;
83
+ return displayConfigDispatchers.update({
84
+ nodeLabelStyle: (0, _extends2["default"])({}, nodeLabelStyle, themeConfig.globalNodeLabelStyle),
85
+ defaultEdgeLabelStyle: (0, _extends2["default"])({}, defaultEdgeLabelStyle, themeConfig.globalEdgeTagStyle)
86
+ });
87
+
88
+ case 5:
89
+ case "end":
90
+ return _context2.stop();
95
91
  }
96
92
  }, _callee2);
97
93
  }));