@riil-frontend/component-topology 11.0.39 → 11.0.40

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 (216) 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 +49 -34
  5. package/es/components/MultiResourceDrawer/index.js +16 -18
  6. package/es/components/ResourceList/ResourceSelect.js +48 -50
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +24 -26
  8. package/es/components/SingleResourceDrawer/SelectDrawer.js +18 -20
  9. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +23 -25
  10. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
  11. package/es/core/components/titlebar/widgets/TitleWidget.js +5 -3
  12. package/es/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
  13. package/es/core/editor/components/BackgroundView/index.js +119 -129
  14. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +20 -22
  15. package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
  16. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +15 -17
  17. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +7 -9
  18. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
  19. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
  20. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
  21. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +11 -13
  22. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +21 -23
  23. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
  24. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +10 -12
  25. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +21 -27
  26. package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
  27. package/es/core/editor/hooks/useNewElementTheme.js +2 -2
  28. package/es/core/editor/store/background.js +8 -10
  29. package/es/core/editor/store/topoEdit.js +4 -6
  30. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  31. package/es/core/hooks/usePolling.js +117 -121
  32. package/es/core/hooks/useResourceConfig.js +58 -66
  33. package/es/core/hooks/useTopoEdit.js +477 -507
  34. package/es/core/models/Alarm.js +281 -298
  35. package/es/core/models/AttributeMetricDisplay.js +101 -107
  36. package/es/core/models/PluginManager.js +4 -3
  37. package/es/core/models/SelectionModel.js +4 -5
  38. package/es/core/models/TopoApp.js +205 -240
  39. package/es/core/models/TopoGraphView.js +18 -21
  40. package/es/core/models/cache/CiCache.js +28 -27
  41. package/es/core/models/cache/CiTypeCache.js +37 -41
  42. package/es/core/models/cache/DictCache.js +33 -35
  43. package/es/core/models/graph/Background.js +15 -17
  44. package/es/core/models/plugins/resourceWebControllUrl.js +76 -82
  45. package/es/core/models/tagstips/ElementTagTipConfig.js +34 -38
  46. package/es/core/models/topoData.js +68 -70
  47. package/es/core/models/utils/linkUtils.js +41 -43
  48. package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
  49. package/es/core/services/alarm.js +14 -16
  50. package/es/core/services/background.js +59 -67
  51. package/es/core/services/cmdb/metric.js +9 -11
  52. package/es/core/services/cmdb.js +18 -20
  53. package/es/core/services/index.js +39 -45
  54. package/es/core/services/overview.js +131 -151
  55. package/es/core/services/topo/basic.js +37 -41
  56. package/es/core/services/topo/tagtip.js +10 -12
  57. package/es/core/store/models/ciModel.js +58 -62
  58. package/es/core/store/models/customIcon.js +120 -134
  59. package/es/core/store/models/displayConfig.js +15 -19
  60. package/es/core/store/models/selection.js +4 -6
  61. package/es/core/store/models/topoAlarm.js +162 -145
  62. package/es/core/store/models/topoBaseInfoOverview.js +4 -6
  63. package/es/core/store/models/topoBizMod.js +9 -11
  64. package/es/core/store/models/topoConfig.js +215 -231
  65. package/es/core/store/models/topoGraphView.js +4 -6
  66. package/es/core/store/models/topoMod.js +373 -395
  67. package/es/core/utils/imageUtil.js +18 -20
  68. package/es/core/utils/saveSerialize.js +9 -11
  69. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +343 -357
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +189 -205
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -37
  78. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
  79. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
  80. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +17 -19
  81. package/es/networkTopo/components/Link/hook.js +73 -77
  82. package/es/networkTopo/components/Link/index.js +86 -94
  83. package/es/networkTopo/components/Link/setting.js +42 -44
  84. package/es/networkTopo/getTopoData.js +63 -69
  85. package/es/networkTopo/hooks/viewer/useRelateTopo.js +30 -32
  86. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  87. package/es/networkTopo/models/TopoCenter.js +18 -22
  88. package/es/networkTopo/services/alert.js +18 -22
  89. package/es/networkTopo/services/authorization.js +45 -55
  90. package/es/networkTopo/services/cmdb.js +422 -470
  91. package/es/networkTopo/services/funcAuth.js +22 -24
  92. package/es/networkTopo/services/link.js +107 -117
  93. package/es/networkTopo/services/mdc.js +18 -24
  94. package/es/networkTopo/services/metric.js +23 -27
  95. package/es/networkTopo/services/model.js +445 -509
  96. package/es/networkTopo/services/risk.js +9 -11
  97. package/es/networkTopo/services/topo/auth.js +27 -33
  98. package/es/networkTopo/services/topo/basic.js +251 -289
  99. package/es/networkTopo/services/topo/blacklist.js +20 -24
  100. package/es/networkTopo/services/topo/ciInfo.js +27 -31
  101. package/es/networkTopo/services/topo/icon.js +49 -59
  102. package/es/networkTopo/services/topo/networkLink.js +32 -36
  103. package/es/networkTopo/services/topo/relation.js +9 -11
  104. package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
  105. package/es/networkTopo/store/functionAuth.js +31 -37
  106. package/es/networkTopo/store/topoCenter.js +142 -152
  107. package/es/networkTopo/store/topoLinkMod.js +4 -6
  108. package/es/networkTopo/store/topoTreeMod.js +170 -182
  109. package/es/networkTopo/utils/exportData.js +52 -54
  110. package/lib/components/MultiResourceDrawer/index.js +16 -18
  111. package/lib/components/ResourceList/ResourceSelect.js +48 -50
  112. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +27 -29
  113. package/lib/components/SingleResourceDrawer/SelectDrawer.js +18 -20
  114. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +30 -32
  115. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
  116. package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -3
  117. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
  118. package/lib/core/editor/components/BackgroundView/index.js +118 -128
  119. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -24
  120. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
  121. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +19 -21
  122. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -10
  123. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
  124. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
  125. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
  126. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +12 -14
  127. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +26 -28
  128. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
  129. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -14
  130. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +25 -31
  131. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  132. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  133. package/lib/core/editor/store/background.js +8 -10
  134. package/lib/core/editor/store/topoEdit.js +4 -6
  135. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  136. package/lib/core/hooks/usePolling.js +116 -120
  137. package/lib/core/hooks/useResourceConfig.js +58 -66
  138. package/lib/core/hooks/useTopoEdit.js +469 -499
  139. package/lib/core/models/Alarm.js +275 -292
  140. package/lib/core/models/AttributeMetricDisplay.js +104 -110
  141. package/lib/core/models/PluginManager.js +4 -3
  142. package/lib/core/models/SelectionModel.js +4 -5
  143. package/lib/core/models/TopoApp.js +205 -240
  144. package/lib/core/models/TopoGraphView.js +18 -21
  145. package/lib/core/models/cache/CiCache.js +33 -32
  146. package/lib/core/models/cache/CiTypeCache.js +38 -42
  147. package/lib/core/models/cache/DictCache.js +33 -35
  148. package/lib/core/models/graph/Background.js +16 -18
  149. package/lib/core/models/plugins/resourceWebControllUrl.js +74 -80
  150. package/lib/core/models/tagstips/ElementTagTipConfig.js +34 -38
  151. package/lib/core/models/topoData.js +69 -71
  152. package/lib/core/models/utils/linkUtils.js +41 -43
  153. package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
  154. package/lib/core/services/alarm.js +18 -20
  155. package/lib/core/services/background.js +70 -78
  156. package/lib/core/services/cmdb/metric.js +10 -12
  157. package/lib/core/services/cmdb.js +20 -22
  158. package/lib/core/services/index.js +45 -51
  159. package/lib/core/services/overview.js +131 -151
  160. package/lib/core/services/topo/basic.js +37 -41
  161. package/lib/core/services/topo/tagtip.js +12 -14
  162. package/lib/core/store/models/ciModel.js +66 -70
  163. package/lib/core/store/models/customIcon.js +120 -134
  164. package/lib/core/store/models/displayConfig.js +15 -19
  165. package/lib/core/store/models/selection.js +4 -6
  166. package/lib/core/store/models/topoAlarm.js +163 -145
  167. package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
  168. package/lib/core/store/models/topoBizMod.js +9 -11
  169. package/lib/core/store/models/topoConfig.js +222 -238
  170. package/lib/core/store/models/topoGraphView.js +4 -6
  171. package/lib/core/store/models/topoMod.js +375 -397
  172. package/lib/core/utils/imageUtil.js +22 -24
  173. package/lib/core/utils/saveSerialize.js +9 -11
  174. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
  175. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
  176. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +344 -358
  177. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
  178. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
  179. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +190 -206
  180. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
  181. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +29 -33
  183. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
  184. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
  185. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +18 -20
  186. package/lib/networkTopo/components/Link/hook.js +73 -77
  187. package/lib/networkTopo/components/Link/index.js +87 -95
  188. package/lib/networkTopo/components/Link/setting.js +42 -44
  189. package/lib/networkTopo/getTopoData.js +63 -69
  190. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +31 -33
  191. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  192. package/lib/networkTopo/models/TopoCenter.js +18 -22
  193. package/lib/networkTopo/services/alert.js +18 -22
  194. package/lib/networkTopo/services/authorization.js +55 -65
  195. package/lib/networkTopo/services/cmdb.js +422 -470
  196. package/lib/networkTopo/services/funcAuth.js +24 -26
  197. package/lib/networkTopo/services/link.js +108 -118
  198. package/lib/networkTopo/services/mdc.js +21 -27
  199. package/lib/networkTopo/services/metric.js +27 -31
  200. package/lib/networkTopo/services/model.js +445 -509
  201. package/lib/networkTopo/services/risk.js +11 -13
  202. package/lib/networkTopo/services/topo/auth.js +27 -33
  203. package/lib/networkTopo/services/topo/basic.js +252 -290
  204. package/lib/networkTopo/services/topo/blacklist.js +20 -24
  205. package/lib/networkTopo/services/topo/ciInfo.js +34 -38
  206. package/lib/networkTopo/services/topo/icon.js +59 -69
  207. package/lib/networkTopo/services/topo/networkLink.js +32 -36
  208. package/lib/networkTopo/services/topo/relation.js +11 -13
  209. package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
  210. package/lib/networkTopo/store/functionAuth.js +31 -37
  211. package/lib/networkTopo/store/topoCenter.js +142 -152
  212. package/lib/networkTopo/store/topoLinkMod.js +4 -6
  213. package/lib/networkTopo/store/topoTreeMod.js +166 -178
  214. package/lib/networkTopo/utils/exportData.js +59 -61
  215. package/lib/utils/htElementDataUtil.js +4 -2
  216. package/package.json +2 -2
@@ -29,44 +29,42 @@ function List(props) {
29
29
  _remove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e, id) {
30
30
  var canDelete;
31
31
  return _regeneratorRuntime.wrap(function _callee$(_context) {
32
- while (1) {
33
- switch (_context.prev = _context.next) {
34
- case 0:
35
- e.stopPropagation();
36
- _context.next = 3;
37
- return api.canDeleteBackground(id);
38
-
39
- case 3:
40
- canDelete = _context.sent;
41
-
42
- // console.log('canDelete', canDelete);
43
- if (canDelete) {
44
- _Dialog.confirm({
45
- title: '删除',
46
- messageProps: {
47
- type: 'warning'
48
- },
49
- content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
50
- onOk: function onOk() {
51
- return onRemove(id);
52
- }
53
- });
54
- } else {
55
- _Dialog.confirm({
56
- title: '提示',
57
- messageProps: {
58
- type: 'warning'
59
- },
60
- content: '此背景被占用,不能删除。',
61
- footerActions: ['ok'],
62
- onOk: function onOk() {}
63
- });
64
- }
65
-
66
- case 5:
67
- case "end":
68
- return _context.stop();
69
- }
32
+ while (1) switch (_context.prev = _context.next) {
33
+ case 0:
34
+ e.stopPropagation();
35
+ _context.next = 3;
36
+ return api.canDeleteBackground(id);
37
+
38
+ case 3:
39
+ canDelete = _context.sent;
40
+
41
+ // console.log('canDelete', canDelete);
42
+ if (canDelete) {
43
+ _Dialog.confirm({
44
+ title: '删除',
45
+ messageProps: {
46
+ type: 'warning'
47
+ },
48
+ content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
49
+ onOk: function onOk() {
50
+ return onRemove(id);
51
+ }
52
+ });
53
+ } else {
54
+ _Dialog.confirm({
55
+ title: '提示',
56
+ messageProps: {
57
+ type: 'warning'
58
+ },
59
+ content: '此背景被占用,不能删除。',
60
+ footerActions: ['ok'],
61
+ onOk: function onOk() {}
62
+ });
63
+ }
64
+
65
+ case 5:
66
+ case "end":
67
+ return _context.stop();
70
68
  }
71
69
  }, _callee);
72
70
  }));
@@ -134,20 +132,18 @@ export default function BackgroundView(props) {
134
132
  _getBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
135
133
  var res;
136
134
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
137
- while (1) {
138
- switch (_context4.prev = _context4.next) {
139
- case 0:
140
- _context4.next = 2;
141
- return api.getBackgroundList();
142
-
143
- case 2:
144
- res = _context4.sent;
145
- setBgList(res);
146
-
147
- case 4:
148
- case "end":
149
- return _context4.stop();
150
- }
135
+ while (1) switch (_context4.prev = _context4.next) {
136
+ case 0:
137
+ _context4.next = 2;
138
+ return api.getBackgroundList();
139
+
140
+ case 2:
141
+ res = _context4.sent;
142
+ setBgList(res);
143
+
144
+ case 4:
145
+ case "end":
146
+ return _context4.stop();
151
147
  }
152
148
  }, _callee4);
153
149
  }));
@@ -163,37 +159,35 @@ export default function BackgroundView(props) {
163
159
  _removeBg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
164
160
  var res;
165
161
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
166
- while (1) {
167
- switch (_context5.prev = _context5.next) {
168
- case 0:
169
- _context5.next = 2;
170
- return api.deleteBackground(id);
162
+ while (1) switch (_context5.prev = _context5.next) {
163
+ case 0:
164
+ _context5.next = 2;
165
+ return api.deleteBackground(id);
171
166
 
172
- case 2:
173
- res = _context5.sent;
167
+ case 2:
168
+ res = _context5.sent;
174
169
 
175
- if (!(id === (current === null || current === void 0 ? void 0 : current.id))) {
176
- _context5.next = 9;
177
- break;
178
- }
170
+ if (!(id === (current === null || current === void 0 ? void 0 : current.id))) {
171
+ _context5.next = 9;
172
+ break;
173
+ }
179
174
 
180
- topo.historyManager.setDisabled(true, '删除背景');
181
- _context5.next = 7;
182
- return reset();
175
+ topo.historyManager.setDisabled(true, '删除背景');
176
+ _context5.next = 7;
177
+ return reset();
183
178
 
184
- case 7:
185
- setHtTopoBackground(null);
186
- topo.historyManager.setDisabled(false, '删除背景');
179
+ case 7:
180
+ setHtTopoBackground(null);
181
+ topo.historyManager.setDisabled(false, '删除背景');
187
182
 
188
- case 9:
189
- getBackground();
183
+ case 9:
184
+ getBackground();
190
185
 
191
- _Message.success('删除成功');
186
+ _Message.success('删除成功');
192
187
 
193
- case 11:
194
- case "end":
195
- return _context5.stop();
196
- }
188
+ case 11:
189
+ case "end":
190
+ return _context5.stop();
197
191
  }
198
192
  }, _callee5);
199
193
  }));
@@ -208,45 +202,43 @@ export default function BackgroundView(props) {
208
202
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(currentBg) {
209
203
  var imgUrl, size;
210
204
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
211
- while (1) {
212
- switch (_context2.prev = _context2.next) {
213
- case 0:
214
- if (!(currentBg !== null && currentBg !== void 0 && currentBg.id && currentBg.id !== (current === null || current === void 0 ? void 0 : current.id))) {
215
- _context2.next = 19;
216
- break;
217
- }
218
-
219
- setLoadingBackground(true);
220
- topo.historyManager.beginTransaction();
221
- imgUrl = getBackgroundImageUrl(currentBg);
222
- _context2.prev = 4;
223
- _context2.next = 7;
224
- return getImageSize(imgUrl);
225
-
226
- case 7:
227
- size = _context2.sent;
228
- rlog.debug('获取图片大小', size);
229
- _context2.next = 11;
230
- return setBackground(_extends({}, currentBg, size));
231
-
232
- case 11:
233
- topo.getHtTopo().setBackgroundImgUrl(imgUrl, size.width, size.height);
234
- _context2.next = 17;
205
+ while (1) switch (_context2.prev = _context2.next) {
206
+ case 0:
207
+ if (!(currentBg !== null && currentBg !== void 0 && currentBg.id && currentBg.id !== (current === null || current === void 0 ? void 0 : current.id))) {
208
+ _context2.next = 19;
235
209
  break;
236
-
237
- case 14:
238
- _context2.prev = 14;
239
- _context2.t0 = _context2["catch"](4);
240
- rlog.error('设置背景失败', _context2.t0);
241
-
242
- case 17:
243
- topo.historyManager.endTransaction();
244
- setLoadingBackground(false);
245
-
246
- case 19:
247
- case "end":
248
- return _context2.stop();
249
- }
210
+ }
211
+
212
+ setLoadingBackground(true);
213
+ topo.historyManager.beginTransaction();
214
+ imgUrl = getBackgroundImageUrl(currentBg);
215
+ _context2.prev = 4;
216
+ _context2.next = 7;
217
+ return getImageSize(imgUrl);
218
+
219
+ case 7:
220
+ size = _context2.sent;
221
+ rlog.debug('获取图片大小', size);
222
+ _context2.next = 11;
223
+ return setBackground(_extends({}, currentBg, size));
224
+
225
+ case 11:
226
+ topo.getHtTopo().setBackgroundImgUrl(imgUrl, size.width, size.height);
227
+ _context2.next = 17;
228
+ break;
229
+
230
+ case 14:
231
+ _context2.prev = 14;
232
+ _context2.t0 = _context2["catch"](4);
233
+ rlog.error('设置背景失败', _context2.t0);
234
+
235
+ case 17:
236
+ topo.historyManager.endTransaction();
237
+ setLoadingBackground(false);
238
+
239
+ case 19:
240
+ case "end":
241
+ return _context2.stop();
250
242
  }
251
243
  }, _callee2, null, [[4, 14]]);
252
244
  }));
@@ -259,21 +251,19 @@ export default function BackgroundView(props) {
259
251
  var resetDefault = /*#__PURE__*/function () {
260
252
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
261
253
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
262
- while (1) {
263
- switch (_context3.prev = _context3.next) {
264
- case 0:
265
- topo.historyManager.beginTransaction();
266
- _context3.next = 3;
267
- return reset();
268
-
269
- case 3:
270
- setHtTopoBackground(null);
271
- topo.historyManager.endTransaction();
272
-
273
- case 5:
274
- case "end":
275
- return _context3.stop();
276
- }
254
+ while (1) switch (_context3.prev = _context3.next) {
255
+ case 0:
256
+ topo.historyManager.beginTransaction();
257
+ _context3.next = 3;
258
+ return reset();
259
+
260
+ case 3:
261
+ setHtTopoBackground(null);
262
+ topo.historyManager.endTransaction();
263
+
264
+ case 5:
265
+ case "end":
266
+ return _context3.stop();
277
267
  }
278
268
  }, _callee3);
279
269
  }));
@@ -41,32 +41,30 @@ export default function RenameDialog(props) {
41
41
  var _yield$field$validate, errors, values;
42
42
 
43
43
  return _regeneratorRuntime.wrap(function _callee$(_context) {
44
- while (1) {
45
- switch (_context.prev = _context.next) {
46
- case 0:
47
- _context.next = 2;
48
- return field.validatePromise();
44
+ while (1) switch (_context.prev = _context.next) {
45
+ case 0:
46
+ _context.next = 2;
47
+ return field.validatePromise();
49
48
 
50
- case 2:
51
- _yield$field$validate = _context.sent;
52
- errors = _yield$field$validate.errors;
53
- values = _yield$field$validate.values;
54
-
55
- if (errors) {
56
- _context.next = 8;
57
- break;
58
- }
49
+ case 2:
50
+ _yield$field$validate = _context.sent;
51
+ errors = _yield$field$validate.errors;
52
+ values = _yield$field$validate.values;
59
53
 
54
+ if (errors) {
60
55
  _context.next = 8;
61
- return dispatchers.renameIcon({
62
- id: icon.id,
63
- name: values.name
64
- });
56
+ break;
57
+ }
58
+
59
+ _context.next = 8;
60
+ return dispatchers.renameIcon({
61
+ id: icon.id,
62
+ name: values.name
63
+ });
65
64
 
66
- case 8:
67
- case "end":
68
- return _context.stop();
69
- }
65
+ case 8:
66
+ case "end":
67
+ return _context.stop();
70
68
  }
71
69
  }, _callee);
72
70
  }));
@@ -179,39 +179,37 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
179
179
  _this.handleSuccess = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
180
180
  var files, dispatchers;
181
181
  return _regeneratorRuntime.wrap(function _callee$(_context) {
182
- while (1) {
183
- switch (_context.prev = _context.next) {
184
- case 0:
185
- files = _this.state.files;
186
-
187
- _Message.show({
188
- type: 'success',
189
- title: '图片上传成功'
190
- });
191
-
192
- _this.setState({
193
- uploading: false
194
- });
195
-
196
- dispatchers = _this.props.dispatchers;
197
- _context.next = 6;
198
- return dispatchers.uploadSuccess({
199
- type: _this.props.type,
200
- data: files.map(function (file) {
201
- return {
202
- id: file.response.result,
203
- name: getFileName(file)
204
- };
205
- })
206
- });
207
-
208
- case 6:
209
- _this.resetState();
210
-
211
- case 7:
212
- case "end":
213
- return _context.stop();
214
- }
182
+ while (1) switch (_context.prev = _context.next) {
183
+ case 0:
184
+ files = _this.state.files;
185
+
186
+ _Message.show({
187
+ type: 'success',
188
+ title: '图片上传成功'
189
+ });
190
+
191
+ _this.setState({
192
+ uploading: false
193
+ });
194
+
195
+ dispatchers = _this.props.dispatchers;
196
+ _context.next = 6;
197
+ return dispatchers.uploadSuccess({
198
+ type: _this.props.type,
199
+ data: files.map(function (file) {
200
+ return {
201
+ id: file.response.result,
202
+ name: getFileName(file)
203
+ };
204
+ })
205
+ });
206
+
207
+ case 6:
208
+ _this.resetState();
209
+
210
+ case 7:
211
+ case "end":
212
+ return _context.stop();
215
213
  }
216
214
  }, _callee);
217
215
  }));
@@ -9,27 +9,25 @@ export default function svgToShape(_x) {
9
9
  function _svgToShape() {
10
10
  _svgToShape = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
11
11
  return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", new Promise(function (resolve, reject) {
16
- var reader = new FileReader();
12
+ while (1) switch (_context.prev = _context.next) {
13
+ case 0:
14
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
15
+ var reader = new FileReader();
17
16
 
18
- reader.onload = function () {
19
- resolve(ht.Default.svgToShape(this.result).output);
20
- };
17
+ reader.onload = function () {
18
+ resolve(ht.Default.svgToShape(this.result).output);
19
+ };
21
20
 
22
- reader.onerror = function () {
23
- reject();
24
- };
21
+ reader.onerror = function () {
22
+ reject();
23
+ };
25
24
 
26
- reader.readAsText(file);
27
- }));
25
+ reader.readAsText(file);
26
+ }));
28
27
 
29
- case 1:
30
- case "end":
31
- return _context.stop();
32
- }
28
+ case 1:
29
+ case "end":
30
+ return _context.stop();
33
31
  }
34
32
  }, _callee);
35
33
  }));
@@ -12,16 +12,14 @@ var GroupAddResourceDrawer = function GroupAddResourceDrawer(props) {
12
12
  var onOk = /*#__PURE__*/function () {
13
13
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selected) {
14
14
  return _regeneratorRuntime.wrap(function _callee$(_context) {
15
- while (1) {
16
- switch (_context.prev = _context.next) {
17
- case 0:
18
- _context.next = 2;
19
- return topoEdit.addGroupResources(group, selected);
15
+ while (1) switch (_context.prev = _context.next) {
16
+ case 0:
17
+ _context.next = 2;
18
+ return topoEdit.addGroupResources(group, selected);
20
19
 
21
- case 2:
22
- case "end":
23
- return _context.stop();
24
- }
20
+ case 2:
21
+ case "end":
22
+ return _context.stop();
25
23
  }
26
24
  }, _callee);
27
25
  }));
@@ -19,30 +19,28 @@ function useCanvasThemeConfig(props) {
19
19
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeName) {
20
20
  var themeConfig;
21
21
  return _regeneratorRuntime.wrap(function _callee$(_context) {
22
- while (1) {
23
- switch (_context.prev = _context.next) {
24
- case 0:
25
- themeConfig = THEMES.find(function (item) {
26
- return item.name === themeName;
27
- });
28
- topo.historyManager.beginTransaction();
29
- _context.next = 4;
30
- return displayConfigDispatchers.update({
31
- canvasTheme: themeName
32
- });
33
-
34
- case 4:
35
- _context.next = 6;
36
- return setGlobalTagTheme(themeConfig);
37
-
38
- case 6:
39
- setElementsTheme(themeConfig);
40
- topo.historyManager.endTransaction();
41
-
42
- case 8:
43
- case "end":
44
- return _context.stop();
45
- }
22
+ while (1) switch (_context.prev = _context.next) {
23
+ case 0:
24
+ themeConfig = THEMES.find(function (item) {
25
+ return item.name === themeName;
26
+ });
27
+ topo.historyManager.beginTransaction();
28
+ _context.next = 4;
29
+ return displayConfigDispatchers.update({
30
+ canvasTheme: themeName
31
+ });
32
+
33
+ case 4:
34
+ _context.next = 6;
35
+ return setGlobalTagTheme(themeConfig);
36
+
37
+ case 6:
38
+ setElementsTheme(themeConfig);
39
+ topo.historyManager.endTransaction();
40
+
41
+ case 8:
42
+ case "end":
43
+ return _context.stop();
46
44
  }
47
45
  }, _callee);
48
46
  }));
@@ -62,23 +60,21 @@ function useCanvasThemeConfig(props) {
62
60
  var _topo$store$getModelS, nodeLabelStyle, defaultEdgeLabelStyle;
63
61
 
64
62
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
65
- while (1) {
66
- switch (_context2.prev = _context2.next) {
67
- case 0:
68
- topo.getHtTopo().setGlobalNodeLabelStyle(themeConfig.globalNodeLabelStyle);
69
- topo.getHtTopo().setGlobalEdgeTagStyle(themeConfig.globalEdgeTagStyle); // 更新默认配置
70
-
71
- _topo$store$getModelS = topo.store.getModelState('displayConfig'), nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle, defaultEdgeLabelStyle = _topo$store$getModelS.defaultEdgeLabelStyle;
72
- _context2.next = 5;
73
- return displayConfigDispatchers.update({
74
- nodeLabelStyle: _extends({}, nodeLabelStyle, themeConfig.globalNodeLabelStyle),
75
- defaultEdgeLabelStyle: _extends({}, defaultEdgeLabelStyle, themeConfig.globalEdgeTagStyle)
76
- });
77
-
78
- case 5:
79
- case "end":
80
- return _context2.stop();
81
- }
63
+ while (1) switch (_context2.prev = _context2.next) {
64
+ case 0:
65
+ topo.getHtTopo().setGlobalNodeLabelStyle(themeConfig.globalNodeLabelStyle);
66
+ topo.getHtTopo().setGlobalEdgeTagStyle(themeConfig.globalEdgeTagStyle); // 更新默认配置
67
+
68
+ _topo$store$getModelS = topo.store.getModelState('displayConfig'), nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle, defaultEdgeLabelStyle = _topo$store$getModelS.defaultEdgeLabelStyle;
69
+ _context2.next = 5;
70
+ return displayConfigDispatchers.update({
71
+ nodeLabelStyle: _extends({}, nodeLabelStyle, themeConfig.globalNodeLabelStyle),
72
+ defaultEdgeLabelStyle: _extends({}, defaultEdgeLabelStyle, themeConfig.globalEdgeTagStyle)
73
+ });
74
+
75
+ case 5:
76
+ case "end":
77
+ return _context2.stop();
82
78
  }
83
79
  }, _callee2);
84
80
  }));