@riil-frontend/component-topology 10.0.58 → 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 (225) 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/usePolling.js +110 -122
  34. package/es/core/hooks/useResourceConfig.js +76 -100
  35. package/es/core/hooks/useTopoEdit.js +539 -638
  36. package/es/core/models/Alarm.js +311 -394
  37. package/es/core/models/AttributeMetricDisplay.js +115 -143
  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 +287 -454
  41. package/es/core/models/TopoGraphView.js +28 -41
  42. package/es/core/models/cache/CiCache.js +34 -39
  43. package/es/core/models/cache/CiTypeCache.js +70 -84
  44. package/es/core/models/cache/DictCache.js +36 -42
  45. package/es/core/models/graph/Background.js +21 -26
  46. package/es/core/models/plugins/resourceWebControllUrl.js +84 -103
  47. package/es/core/models/tagstips/ElementTagTipConfig.js +34 -40
  48. package/es/core/models/topoData.js +73 -77
  49. package/es/core/models/utils/linkUtils.js +46 -51
  50. package/es/core/services/alarm.js +14 -16
  51. package/es/core/services/background.js +59 -67
  52. package/es/core/services/cmdb/metric.js +14 -18
  53. package/es/core/services/cmdb.js +23 -27
  54. package/es/core/services/index.js +48 -68
  55. package/es/core/services/overview.js +131 -151
  56. package/es/core/services/topo/basic.js +11 -13
  57. package/es/core/services/topo/tagtip.js +15 -19
  58. package/es/core/store/models/ciModel.js +58 -62
  59. package/es/core/store/models/customIcon.js +126 -145
  60. package/es/core/store/models/displayConfig.js +15 -19
  61. package/es/core/store/models/selection.js +4 -6
  62. package/es/core/store/models/topoAlarm.js +162 -145
  63. package/es/core/store/models/topoBaseInfoOverview.js +4 -6
  64. package/es/core/store/models/topoBizMod.js +28 -32
  65. package/es/core/store/models/topoConfig.js +217 -233
  66. package/es/core/store/models/topoGraphView.js +4 -6
  67. package/es/core/store/models/topoMod.js +379 -401
  68. package/es/core/utils/imageUtil.js +23 -27
  69. package/es/core/utils/saveSerialize.js +14 -18
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -25
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +363 -409
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +112 -131
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +40 -46
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +219 -275
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
  78. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +45 -54
  79. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +32 -44
  80. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
  81. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +23 -27
  82. package/es/networkTopo/components/Link/hook.js +85 -96
  83. package/es/networkTopo/components/Link/index copy.js +104 -126
  84. package/es/networkTopo/components/Link/index.js +104 -126
  85. package/es/networkTopo/components/Link/setting.js +48 -52
  86. package/es/networkTopo/getTopoData.js +73 -92
  87. package/es/networkTopo/hooks/viewer/useRelateTopo.js +34 -39
  88. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  89. package/es/networkTopo/models/TopoCenter.js +28 -46
  90. package/es/networkTopo/services/alert.js +18 -22
  91. package/es/networkTopo/services/authorization.js +45 -55
  92. package/es/networkTopo/services/cmdb.js +548 -696
  93. package/es/networkTopo/services/funcAuth.js +22 -24
  94. package/es/networkTopo/services/link.js +107 -117
  95. package/es/networkTopo/services/mdc.js +33 -48
  96. package/es/networkTopo/services/metric.js +38 -47
  97. package/es/networkTopo/services/model.js +616 -809
  98. package/es/networkTopo/services/risk.js +9 -11
  99. package/es/networkTopo/services/topo/auth.js +27 -33
  100. package/es/networkTopo/services/topo/basic.js +274 -314
  101. package/es/networkTopo/services/topo/blacklist.js +20 -24
  102. package/es/networkTopo/services/topo/ciInfo.js +27 -31
  103. package/es/networkTopo/services/topo/icon.js +49 -59
  104. package/es/networkTopo/services/topo/networkLink.js +32 -36
  105. package/es/networkTopo/services/topo/relation.js +9 -11
  106. package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
  107. package/es/networkTopo/store/functionAuth.js +31 -37
  108. package/es/networkTopo/store/linkDynamicStyle.js +102 -108
  109. package/es/networkTopo/store/linkDynamicStyleConfig.js +42 -44
  110. package/es/networkTopo/store/linkManager.js +4 -6
  111. package/es/networkTopo/store/topoCenter.js +142 -152
  112. package/es/networkTopo/store/topoLinkMod.js +4 -6
  113. package/es/networkTopo/store/topoTreeMod.js +170 -182
  114. package/es/networkTopo/utils/exportData.js +57 -61
  115. package/lib/components/IndexSettingDrawer/index.js +6 -5
  116. package/lib/components/MultiResourceDrawer/index.js +22 -26
  117. package/lib/components/ResourceList/ResourceSelect.js +54 -58
  118. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +33 -37
  119. package/lib/components/SingleResourceDrawer/SelectDrawer.js +24 -28
  120. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +36 -40
  121. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +82 -104
  122. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
  123. package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -4
  124. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +18 -18
  125. package/lib/core/editor/components/BackgroundView/index.js +148 -177
  126. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +28 -32
  127. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +34 -34
  128. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +23 -28
  129. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +14 -18
  130. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
  131. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
  132. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
  133. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +18 -22
  134. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +32 -36
  135. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
  136. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +18 -22
  137. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +41 -59
  138. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  139. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  140. package/lib/core/editor/store/background.js +8 -10
  141. package/lib/core/editor/store/topoEdit.js +4 -6
  142. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
  143. package/lib/core/hooks/usePolling.js +108 -120
  144. package/lib/core/hooks/useResourceConfig.js +76 -100
  145. package/lib/core/hooks/useTopoEdit.js +530 -629
  146. package/lib/core/models/Alarm.js +308 -391
  147. package/lib/core/models/AttributeMetricDisplay.js +118 -146
  148. package/lib/core/models/PluginManager.js +4 -3
  149. package/lib/core/models/SelectionModel.js +4 -5
  150. package/lib/core/models/TopoApp.js +287 -454
  151. package/lib/core/models/TopoGraphView.js +28 -41
  152. package/lib/core/models/cache/CiCache.js +39 -44
  153. package/lib/core/models/cache/CiTypeCache.js +71 -85
  154. package/lib/core/models/cache/DictCache.js +39 -45
  155. package/lib/core/models/graph/Background.js +22 -27
  156. package/lib/core/models/plugins/resourceWebControllUrl.js +82 -101
  157. package/lib/core/models/tagstips/ElementTagTipConfig.js +34 -40
  158. package/lib/core/models/topoData.js +73 -78
  159. package/lib/core/models/utils/linkUtils.js +45 -51
  160. package/lib/core/services/alarm.js +18 -20
  161. package/lib/core/services/background.js +70 -78
  162. package/lib/core/services/cmdb/metric.js +14 -19
  163. package/lib/core/services/cmdb.js +24 -29
  164. package/lib/core/services/index.js +53 -72
  165. package/lib/core/services/overview.js +131 -151
  166. package/lib/core/services/topo/basic.js +13 -15
  167. package/lib/core/services/topo/tagtip.js +16 -21
  168. package/lib/core/store/models/ciModel.js +66 -70
  169. package/lib/core/store/models/customIcon.js +126 -145
  170. package/lib/core/store/models/displayConfig.js +15 -19
  171. package/lib/core/store/models/selection.js +4 -6
  172. package/lib/core/store/models/topoAlarm.js +163 -145
  173. package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
  174. package/lib/core/store/models/topoBizMod.js +34 -38
  175. package/lib/core/store/models/topoConfig.js +224 -240
  176. package/lib/core/store/models/topoGraphView.js +4 -6
  177. package/lib/core/store/models/topoMod.js +381 -403
  178. package/lib/core/utils/imageUtil.js +26 -31
  179. package/lib/core/utils/saveSerialize.js +13 -18
  180. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
  181. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -26
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +364 -410
  183. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +114 -133
  184. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +44 -50
  185. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +220 -274
  186. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
  187. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
  188. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +40 -50
  189. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +35 -47
  190. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
  191. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +24 -28
  192. package/lib/networkTopo/components/Link/hook.js +86 -98
  193. package/lib/networkTopo/components/Link/index copy.js +105 -127
  194. package/lib/networkTopo/components/Link/index.js +105 -127
  195. package/lib/networkTopo/components/Link/setting.js +48 -52
  196. package/lib/networkTopo/getTopoData.js +73 -92
  197. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +35 -40
  198. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  199. package/lib/networkTopo/models/TopoCenter.js +28 -46
  200. package/lib/networkTopo/services/alert.js +18 -22
  201. package/lib/networkTopo/services/authorization.js +55 -65
  202. package/lib/networkTopo/services/cmdb.js +551 -700
  203. package/lib/networkTopo/services/funcAuth.js +24 -26
  204. package/lib/networkTopo/services/link.js +108 -118
  205. package/lib/networkTopo/services/mdc.js +35 -51
  206. package/lib/networkTopo/services/metric.js +37 -47
  207. package/lib/networkTopo/services/model.js +615 -809
  208. package/lib/networkTopo/services/risk.js +11 -13
  209. package/lib/networkTopo/services/topo/auth.js +27 -33
  210. package/lib/networkTopo/services/topo/basic.js +277 -317
  211. package/lib/networkTopo/services/topo/blacklist.js +20 -24
  212. package/lib/networkTopo/services/topo/ciInfo.js +34 -38
  213. package/lib/networkTopo/services/topo/icon.js +59 -69
  214. package/lib/networkTopo/services/topo/networkLink.js +32 -36
  215. package/lib/networkTopo/services/topo/relation.js +11 -13
  216. package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
  217. package/lib/networkTopo/store/functionAuth.js +31 -37
  218. package/lib/networkTopo/store/linkDynamicStyle.js +103 -109
  219. package/lib/networkTopo/store/linkDynamicStyleConfig.js +42 -44
  220. package/lib/networkTopo/store/linkManager.js +4 -6
  221. package/lib/networkTopo/store/topoCenter.js +142 -152
  222. package/lib/networkTopo/store/topoLinkMod.js +4 -6
  223. package/lib/networkTopo/store/topoTreeMod.js +166 -178
  224. package/lib/networkTopo/utils/exportData.js +63 -68
  225. package/package.json +3 -3
@@ -74,58 +74,56 @@ function _default(topoApp) {
74
74
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
75
75
  var topoModState, type, id;
76
76
  return _regenerator["default"].wrap(function _callee$(_context) {
77
- while (1) {
78
- switch (_context.prev = _context.next) {
79
- case 0:
80
- if (params === void 0) {
81
- params = {};
82
- }
83
-
84
- topoModState = rootState.topoMod; // 处理URL参数
85
-
86
- type = params.type || 'view';
87
- id = params.id || topoModState.topoId || '';
88
-
89
- _rlog["default"].debug("topoMod.init \u521D\u59CB\u5316(" + id + ")...", {
90
- params: params,
91
- rootState: rootState
92
- });
93
-
94
- _this.update({
95
- viewState: type,
96
- currentTopo: id ? {
97
- id: id
98
- } : null,
99
- topoId: id,
100
- graphLoaded: false,
101
- graphLoaded2: false,
102
- initParams: params
103
- });
104
-
105
- if (!id) {
106
- _context.next = 9;
107
- break;
108
- }
109
-
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ if (params === void 0) {
80
+ params = {};
81
+ }
82
+
83
+ topoModState = rootState.topoMod; // 处理URL参数
84
+
85
+ type = params.type || 'view';
86
+ id = params.id || topoModState.topoId || '';
87
+
88
+ _rlog["default"].debug("topoMod.init \u521D\u59CB\u5316(" + id + ")...", {
89
+ params: params,
90
+ rootState: rootState
91
+ });
92
+
93
+ _this.update({
94
+ viewState: type,
95
+ currentTopo: id ? {
96
+ id: id
97
+ } : null,
98
+ topoId: id,
99
+ graphLoaded: false,
100
+ graphLoaded2: false,
101
+ initParams: params
102
+ });
103
+
104
+ if (!id) {
110
105
  _context.next = 9;
111
- return _this.openTopoPage({
112
- id: id,
113
- viewState: type
114
- });
115
-
116
- case 9:
117
- _this.update({
118
- loading: false
119
- });
120
-
121
- _rlog["default"].debug('topoMod.initTopoCenter 初始化完成', {
122
- rootState: rootState
123
- });
124
-
125
- case 11:
126
- case "end":
127
- return _context.stop();
128
- }
106
+ break;
107
+ }
108
+
109
+ _context.next = 9;
110
+ return _this.openTopoPage({
111
+ id: id,
112
+ viewState: type
113
+ });
114
+
115
+ case 9:
116
+ _this.update({
117
+ loading: false
118
+ });
119
+
120
+ _rlog["default"].debug('topoMod.initTopoCenter 初始化完成', {
121
+ rootState: rootState
122
+ });
123
+
124
+ case 11:
125
+ case "end":
126
+ return _context.stop();
129
127
  }
130
128
  }, _callee);
131
129
  }))();
@@ -159,43 +157,41 @@ function _default(topoApp) {
159
157
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
160
158
  var id, data, linkTo, viewState, topoId;
161
159
  return _regenerator["default"].wrap(function _callee2$(_context2) {
162
- while (1) {
163
- switch (_context2.prev = _context2.next) {
164
- case 0:
165
- id = playload.id, data = playload.data, linkTo = playload.linkTo;
166
- viewState = playload.mode || playload.viewState || 'view';
167
- topoId = id || data.config.id;
168
-
160
+ while (1) switch (_context2.prev = _context2.next) {
161
+ case 0:
162
+ id = playload.id, data = playload.data, linkTo = playload.linkTo;
163
+ viewState = playload.mode || playload.viewState || 'view';
164
+ topoId = id || data.config.id;
165
+
166
+ _this2.update({
167
+ viewState: viewState,
168
+ currentTopo: playload,
169
+ topoId: topoId,
170
+ graphLoaded: false,
171
+ graphLoaded2: false,
172
+ topoPermission: undefined
173
+ });
174
+
175
+ _context2.next = 6;
176
+ return _this2.initTopoData({
177
+ topoId: topoId,
178
+ data: data,
179
+ linkTo: linkTo
180
+ });
181
+
182
+ case 6:
183
+ if (viewState === 'edit') {
184
+ // TODO 待优化进入编辑模式方式
169
185
  _this2.update({
170
- viewState: viewState,
171
- currentTopo: playload,
172
- topoId: topoId,
173
- graphLoaded: false,
174
- graphLoaded2: false,
175
- topoPermission: undefined
176
- });
177
-
178
- _context2.next = 6;
179
- return _this2.initTopoData({
180
- topoId: topoId,
181
- data: data,
182
- linkTo: linkTo
186
+ graphLoaded2: false
183
187
  });
184
188
 
185
- case 6:
186
- if (viewState === 'edit') {
187
- // TODO 待优化进入编辑模式方式
188
- _this2.update({
189
- graphLoaded2: false
190
- });
191
-
192
- _this2.enterEditMode();
193
- }
189
+ _this2.enterEditMode();
190
+ }
194
191
 
195
- case 7:
196
- case "end":
197
- return _context2.stop();
198
- }
192
+ case 7:
193
+ case "end":
194
+ return _context2.stop();
199
195
  }
200
196
  }, _callee2);
201
197
  }))();
@@ -236,34 +232,32 @@ function _default(topoApp) {
236
232
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
237
233
  var topoId, treeData;
238
234
  return _regenerator["default"].wrap(function _callee3$(_context3) {
239
- while (1) {
240
- switch (_context3.prev = _context3.next) {
241
- case 0:
242
- if (conditions === void 0) {
243
- conditions = {};
244
- }
245
-
246
- topoId = rootState.topoTreeMod.defId;
247
-
248
- if (!topoId) {
249
- // 查找第一个
250
- treeData = rootState.topoTreeMod.treeData;
251
- (0, _tree.loopTreeByKey)(treeData, 'type', 1, function (item, index, arr) {
252
- if (!topoId) {
253
- topoId = item.id;
254
- }
255
- });
256
- } // 右侧切换拓扑图
235
+ while (1) switch (_context3.prev = _context3.next) {
236
+ case 0:
237
+ if (conditions === void 0) {
238
+ conditions = {};
239
+ }
240
+
241
+ topoId = rootState.topoTreeMod.defId;
242
+
243
+ if (!topoId) {
244
+ // 查找第一个
245
+ treeData = rootState.topoTreeMod.treeData;
246
+ (0, _tree.loopTreeByKey)(treeData, 'type', 1, function (item, index, arr) {
247
+ if (!topoId) {
248
+ topoId = item.id;
249
+ }
250
+ });
251
+ } // 右侧切换拓扑图
257
252
 
258
253
 
259
- _this3.openTopoPage({
260
- id: topoId
261
- });
254
+ _this3.openTopoPage({
255
+ id: topoId
256
+ });
262
257
 
263
- case 4:
264
- case "end":
265
- return _context3.stop();
266
- }
258
+ case 4:
259
+ case "end":
260
+ return _context3.stop();
267
261
  }
268
262
  }, _callee3);
269
263
  }))();
@@ -273,20 +267,18 @@ function _default(topoApp) {
273
267
 
274
268
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
275
269
  return _regenerator["default"].wrap(function _callee4$(_context4) {
276
- while (1) {
277
- switch (_context4.prev = _context4.next) {
278
- case 0:
279
- _context4.next = 2;
280
- return dispatch.functionAuth.refresh();
281
-
282
- case 2:
283
- _context4.next = 4;
284
- return _this4.refreshTopoTree();
285
-
286
- case 4:
287
- case "end":
288
- return _context4.stop();
289
- }
270
+ while (1) switch (_context4.prev = _context4.next) {
271
+ case 0:
272
+ _context4.next = 2;
273
+ return dispatch.functionAuth.refresh();
274
+
275
+ case 2:
276
+ _context4.next = 4;
277
+ return _this4.refreshTopoTree();
278
+
279
+ case 4:
280
+ case "end":
281
+ return _context4.stop();
290
282
  }
291
283
  }, _callee4);
292
284
  }))();
@@ -294,16 +286,14 @@ function _default(topoApp) {
294
286
  refreshTopoTree: function refreshTopoTree() {
295
287
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
296
288
  return _regenerator["default"].wrap(function _callee5$(_context5) {
297
- while (1) {
298
- switch (_context5.prev = _context5.next) {
299
- case 0:
300
- _context5.next = 2;
301
- return dispatch.topoTreeMod.refreshTree();
302
-
303
- case 2:
304
- case "end":
305
- return _context5.stop();
306
- }
289
+ while (1) switch (_context5.prev = _context5.next) {
290
+ case 0:
291
+ _context5.next = 2;
292
+ return dispatch.topoTreeMod.refreshTree();
293
+
294
+ case 2:
295
+ case "end":
296
+ return _context5.stop();
307
297
  }
308
298
  }, _callee5);
309
299
  }))();
@@ -328,203 +318,201 @@ function _default(topoApp) {
328
318
  var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, graphConfig, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, xxx, extraConfig, _combTopoData, topoData, resAndMetrics, _yield$Promise$all2, newData, endTime;
329
319
 
330
320
  return _regenerator["default"].wrap(function _callee6$(_context6) {
331
- while (1) {
332
- switch (_context6.prev = _context6.next) {
333
- case 0:
334
- startTime = (0, _moment["default"])();
335
- topoId = props.topoId, data = props.data, linkToData = props.linkTo, refresh = props.refresh, clear = props.clear;
336
- _context6.next = 4;
337
- return topoApp.open(topoId);
338
-
339
- case 4:
340
- // 关联拓扑图
341
- linkTo = refresh === true ? state.topoMod.linkTo : linkToData || null;
342
- startState = {
343
- loading: true,
344
- graphLoaded: false,
345
- graphLoaded2: false,
346
- topoLoadError: false,
347
- linkTo: linkTo
348
- };
349
-
350
- if (clear === true || topoId < 0) {
351
- Object.assign(startState, {
352
- topoData: null,
353
- data: null,
354
- globalConfig: null // 全局配置
355
-
356
- });
357
- }
358
-
359
- _this5.update(startState);
360
-
361
- dispatch.topoBizMod.update({
362
- pollingSwitch: false
363
- });
364
- topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
365
-
366
- permission = 'write';
367
-
368
- if (!topoApp.options.usePermission) {
369
- _context6.next = 19;
370
- break;
371
- }
372
-
373
- _context6.next = 14;
374
- return _this5.getTopoPermission({
375
- id: topoId
376
- });
377
-
378
- case 14:
379
- permission = _context6.sent;
380
-
381
- if (_topoPermissionUtil["default"].isReadable(permission)) {
382
- _context6.next = 19;
383
- break;
384
- }
385
-
386
- _this5.update({
387
- loading: false,
321
+ while (1) switch (_context6.prev = _context6.next) {
322
+ case 0:
323
+ startTime = (0, _moment["default"])();
324
+ topoId = props.topoId, data = props.data, linkToData = props.linkTo, refresh = props.refresh, clear = props.clear;
325
+ _context6.next = 4;
326
+ return topoApp.open(topoId);
327
+
328
+ case 4:
329
+ // 关联拓扑图
330
+ linkTo = refresh === true ? state.topoMod.linkTo : linkToData || null;
331
+ startState = {
332
+ loading: true,
333
+ graphLoaded: false,
334
+ graphLoaded2: false,
335
+ topoLoadError: false,
336
+ linkTo: linkTo
337
+ };
338
+
339
+ if (clear === true || topoId < 0) {
340
+ Object.assign(startState, {
388
341
  topoData: null,
389
342
  data: null,
390
343
  globalConfig: null // 全局配置
391
344
 
392
345
  });
346
+ }
393
347
 
394
- topoApp.options.onLoad();
395
- return _context6.abrupt("return");
348
+ _this5.update(startState);
396
349
 
397
- case 19:
398
- if (!data) {
399
- _context6.next = 30;
400
- break;
401
- }
402
-
403
- graphConfig = {};
350
+ dispatch.topoBizMod.update({
351
+ pollingSwitch: false
352
+ });
353
+ topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
404
354
 
405
- if (!topoId) {
406
- _context6.next = 27;
407
- break;
408
- }
355
+ permission = 'write';
409
356
 
410
- _context6.next = 24;
411
- return _topo["default"].getTopoData(topoId);
412
-
413
- case 24:
414
- topoConfig = _context6.sent;
415
- if (!topoConfig) _rlog["default"].error("\u672A\u67E5\u8BE2\u5230\u62D3\u6251id " + topoId + " \u7684\u6570\u636E\uFF0C\u8BF7\u68C0\u67E5");
416
- graphConfig = {
417
- global: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.global,
418
- customGlobal: data.global,
419
- serialize: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.serialize
420
- };
421
-
422
- case 27:
423
- result = (0, _extends2["default"])({}, data, graphConfig);
424
- _context6.next = 33;
357
+ if (!topoApp.options.usePermission) {
358
+ _context6.next = 19;
425
359
  break;
360
+ }
426
361
 
427
- case 30:
428
- _context6.next = 32;
429
- return topoApp.options.loadData(topoId, topoApp.serverApi);
430
-
431
- case 32:
432
- result = _context6.sent;
433
-
434
- case 33:
435
- if (result) {
436
- _context6.next = 37;
437
- break;
438
- }
439
-
440
- _this5.update({
441
- loading: false,
442
- data: null,
443
- globalConfig: null,
444
- // 全局配置
445
- topoData: null
446
- });
447
-
448
- topoApp.options.onLoad();
449
- return _context6.abrupt("return");
450
-
451
- case 37:
452
- result = (0, _topoData.parseTopoData)(result);
453
-
454
- _rlog["default"].debug('topoMod.initTopoData 查询数据完成', topoId, linkTo, result);
455
-
456
- _context6.next = 41;
457
- return Promise.all([// topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)),
458
- dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
459
- ]);
460
-
461
- case 41:
462
- _yield$Promise$all = _context6.sent;
463
- ciTypeMap = _yield$Promise$all[0];
464
- customIcons = _yield$Promise$all[1];
465
- xxx = _yield$Promise$all[2];
466
- extraConfig = result.global.extraConfig;
467
- _context6.next = 48;
468
- return dispatch.displayConfig.setConfig((0, _extends2["default"])({}, extraConfig, {
469
- alarmSwitch: result.global.alarmSwitch,
470
- alarmListDefaultOpen: result.global.alarmListDefaultOpen
471
- }));
472
-
473
- case 48:
474
- _combTopoData = (0, _topoData.combTopoData)({
475
- engine: topoApp,
476
- data: result,
477
- linkTo: linkTo,
478
- globalConfig: extraConfig
479
- }), topoData = _combTopoData.topoData, resAndMetrics = _combTopoData.resAndMetrics; // rlog.debug("topoMod.initTopoData combTopoData", { topoData, resAndMetrics, });
480
-
481
- _context6.next = 51;
482
- return _this5.update({
483
- currentTopo: topoData.config,
484
- data: result,
485
- globalConfig: extraConfig,
486
- type: (_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.showType,
487
- topoData: topoData,
488
- resAndMetrics: resAndMetrics
489
- });
362
+ _context6.next = 14;
363
+ return _this5.getTopoPermission({
364
+ id: topoId
365
+ });
490
366
 
491
- case 51:
492
- dispatch.topoBizMod.combBatchCiInfo(resAndMetrics);
493
- dispatch.background.init(extraConfig); // TODO 优化打开拓扑图显示告警速度:打开拓扑图立即请求告警
367
+ case 14:
368
+ permission = _context6.sent;
494
369
 
495
- topoApp.alarm.open(); // 加载标注悬浮框数据
370
+ if (_topoPermissionUtil["default"].isReadable(permission)) {
371
+ _context6.next = 19;
372
+ break;
373
+ }
496
374
 
497
- _context6.next = 56;
498
- return Promise.all([(0, _getTopoData.addLinkData)(result), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(result)), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
499
- ]);
375
+ _this5.update({
376
+ loading: false,
377
+ topoData: null,
378
+ data: null,
379
+ globalConfig: null // 全局配置
500
380
 
501
- case 56:
502
- _yield$Promise$all2 = _context6.sent;
503
- newData = _yield$Promise$all2[0];
504
- _context6.next = 60;
505
- return _this5.update({
506
- data: newData
507
- });
508
-
509
- case 60:
510
- dispatch.topoBizMod.update({
511
- pollingSwitch: true
512
- });
513
- topoApp.onTopoDataLoaded(topoData);
514
- endTime = (0, _moment["default"])();
381
+ });
515
382
 
516
- _rlog["default"].info('topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ', endTime.diff(startTime, 'seconds', true));
383
+ topoApp.options.onLoad();
384
+ return _context6.abrupt("return");
517
385
 
518
- topoApp.options.onLoad();
386
+ case 19:
387
+ if (!data) {
388
+ _context6.next = 30;
389
+ break;
390
+ }
519
391
 
520
- _this5.update({
521
- loading: false
522
- });
392
+ graphConfig = {};
523
393
 
524
- case 66:
525
- case "end":
526
- return _context6.stop();
527
- }
394
+ if (!topoId) {
395
+ _context6.next = 27;
396
+ break;
397
+ }
398
+
399
+ _context6.next = 24;
400
+ return _topo["default"].getTopoData(topoId);
401
+
402
+ case 24:
403
+ topoConfig = _context6.sent;
404
+ if (!topoConfig) _rlog["default"].error("\u672A\u67E5\u8BE2\u5230\u62D3\u6251id " + topoId + " \u7684\u6570\u636E\uFF0C\u8BF7\u68C0\u67E5");
405
+ graphConfig = {
406
+ global: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.global,
407
+ customGlobal: data.global,
408
+ serialize: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.serialize
409
+ };
410
+
411
+ case 27:
412
+ result = (0, _extends2["default"])({}, data, graphConfig);
413
+ _context6.next = 33;
414
+ break;
415
+
416
+ case 30:
417
+ _context6.next = 32;
418
+ return topoApp.options.loadData(topoId, topoApp.serverApi);
419
+
420
+ case 32:
421
+ result = _context6.sent;
422
+
423
+ case 33:
424
+ if (result) {
425
+ _context6.next = 37;
426
+ break;
427
+ }
428
+
429
+ _this5.update({
430
+ loading: false,
431
+ data: null,
432
+ globalConfig: null,
433
+ // 全局配置
434
+ topoData: null
435
+ });
436
+
437
+ topoApp.options.onLoad();
438
+ return _context6.abrupt("return");
439
+
440
+ case 37:
441
+ result = (0, _topoData.parseTopoData)(result);
442
+
443
+ _rlog["default"].debug('topoMod.initTopoData 查询数据完成', topoId, linkTo, result);
444
+
445
+ _context6.next = 41;
446
+ return Promise.all([// topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)),
447
+ dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
448
+ ]);
449
+
450
+ case 41:
451
+ _yield$Promise$all = _context6.sent;
452
+ ciTypeMap = _yield$Promise$all[0];
453
+ customIcons = _yield$Promise$all[1];
454
+ xxx = _yield$Promise$all[2];
455
+ extraConfig = result.global.extraConfig;
456
+ _context6.next = 48;
457
+ return dispatch.displayConfig.setConfig((0, _extends2["default"])({}, extraConfig, {
458
+ alarmSwitch: result.global.alarmSwitch,
459
+ alarmListDefaultOpen: result.global.alarmListDefaultOpen
460
+ }));
461
+
462
+ case 48:
463
+ _combTopoData = (0, _topoData.combTopoData)({
464
+ engine: topoApp,
465
+ data: result,
466
+ linkTo: linkTo,
467
+ globalConfig: extraConfig
468
+ }), topoData = _combTopoData.topoData, resAndMetrics = _combTopoData.resAndMetrics; // rlog.debug("topoMod.initTopoData combTopoData", { topoData, resAndMetrics, });
469
+
470
+ _context6.next = 51;
471
+ return _this5.update({
472
+ currentTopo: topoData.config,
473
+ data: result,
474
+ globalConfig: extraConfig,
475
+ type: (_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.showType,
476
+ topoData: topoData,
477
+ resAndMetrics: resAndMetrics
478
+ });
479
+
480
+ case 51:
481
+ dispatch.topoBizMod.combBatchCiInfo(resAndMetrics);
482
+ dispatch.background.init(extraConfig); // TODO 优化打开拓扑图显示告警速度:打开拓扑图立即请求告警
483
+
484
+ topoApp.alarm.open(); // 加载标注悬浮框数据
485
+
486
+ _context6.next = 56;
487
+ return Promise.all([(0, _getTopoData.addLinkData)(result), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(result)), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
488
+ ]);
489
+
490
+ case 56:
491
+ _yield$Promise$all2 = _context6.sent;
492
+ newData = _yield$Promise$all2[0];
493
+ _context6.next = 60;
494
+ return _this5.update({
495
+ data: newData
496
+ });
497
+
498
+ case 60:
499
+ dispatch.topoBizMod.update({
500
+ pollingSwitch: true
501
+ });
502
+ topoApp.onTopoDataLoaded(topoData);
503
+ endTime = (0, _moment["default"])();
504
+
505
+ _rlog["default"].info('topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ', endTime.diff(startTime, 'seconds', true));
506
+
507
+ topoApp.options.onLoad();
508
+
509
+ _this5.update({
510
+ loading: false
511
+ });
512
+
513
+ case 66:
514
+ case "end":
515
+ return _context6.stop();
528
516
  }
529
517
  }, _callee6);
530
518
  }))();
@@ -540,25 +528,23 @@ function _default(topoApp) {
540
528
  var _payload, clear;
541
529
 
542
530
  return _regenerator["default"].wrap(function _callee7$(_context7) {
543
- while (1) {
544
- switch (_context7.prev = _context7.next) {
545
- case 0:
546
- if (payload === void 0) {
547
- payload = {};
548
- }
549
-
550
- _payload = payload, clear = _payload.clear;
551
- _context7.next = 4;
552
- return _this6.initTopoData({
553
- topoId: rootState.topoMod.topoId,
554
- refresh: true,
555
- clear: clear
556
- });
557
-
558
- case 4:
559
- case "end":
560
- return _context7.stop();
561
- }
531
+ while (1) switch (_context7.prev = _context7.next) {
532
+ case 0:
533
+ if (payload === void 0) {
534
+ payload = {};
535
+ }
536
+
537
+ _payload = payload, clear = _payload.clear;
538
+ _context7.next = 4;
539
+ return _this6.initTopoData({
540
+ topoId: rootState.topoMod.topoId,
541
+ refresh: true,
542
+ clear: clear
543
+ });
544
+
545
+ case 4:
546
+ case "end":
547
+ return _context7.stop();
562
548
  }
563
549
  }, _callee7);
564
550
  }))();
@@ -569,37 +555,35 @@ function _default(topoApp) {
569
555
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
570
556
  var td;
571
557
  return _regenerator["default"].wrap(function _callee8$(_context8) {
572
- while (1) {
573
- switch (_context8.prev = _context8.next) {
574
- case 0:
575
- if (conditions === void 0) {
576
- conditions = {};
558
+ while (1) switch (_context8.prev = _context8.next) {
559
+ case 0:
560
+ if (conditions === void 0) {
561
+ conditions = {};
562
+ }
563
+
564
+ if (conditions.id === state.topoMod.topoId) {
565
+ if (conditions.type === 'delete') {
566
+ _this7.update({
567
+ topoId: conditions.defId
568
+ });
577
569
  }
578
570
 
579
- if (conditions.id === state.topoMod.topoId) {
580
- if (conditions.type === 'delete') {
581
- _this7.update({
582
- topoId: conditions.defId
583
- });
584
- }
585
-
586
- if (conditions.type === 'rename') {
587
- td = (0, _extends2["default"])({}, state.topoMod.topoData, {
588
- config: (0, _extends2["default"])({}, state.topoMod.topoData.config, {
589
- name: conditions.name
590
- })
591
- });
571
+ if (conditions.type === 'rename') {
572
+ td = (0, _extends2["default"])({}, state.topoMod.topoData, {
573
+ config: (0, _extends2["default"])({}, state.topoMod.topoData.config, {
574
+ name: conditions.name
575
+ })
576
+ });
592
577
 
593
- _this7.update({
594
- topoData: td
595
- });
596
- }
578
+ _this7.update({
579
+ topoData: td
580
+ });
597
581
  }
582
+ }
598
583
 
599
- case 2:
600
- case "end":
601
- return _context8.stop();
602
- }
584
+ case 2:
585
+ case "end":
586
+ return _context8.stop();
603
587
  }
604
588
  }, _callee8);
605
589
  }))();
@@ -607,15 +591,13 @@ function _default(topoApp) {
607
591
  openPermissionSetting: function openPermissionSetting(payload, rootState) {
608
592
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
609
593
  return _regenerator["default"].wrap(function _callee9$(_context9) {
610
- while (1) {
611
- switch (_context9.prev = _context9.next) {
612
- case 0:
613
- dispatch.permissionSetting.open();
614
-
615
- case 1:
616
- case "end":
617
- return _context9.stop();
618
- }
594
+ while (1) switch (_context9.prev = _context9.next) {
595
+ case 0:
596
+ dispatch.permissionSetting.open();
597
+
598
+ case 1:
599
+ case "end":
600
+ return _context9.stop();
619
601
  }
620
602
  }, _callee9);
621
603
  }))();
@@ -623,19 +605,17 @@ function _default(topoApp) {
623
605
  updateDelId: function updateDelId(conditions, state) {
624
606
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
625
607
  return _regenerator["default"].wrap(function _callee10$(_context10) {
626
- while (1) {
627
- switch (_context10.prev = _context10.next) {
628
- case 0:
629
- if (conditions === void 0) {
630
- conditions = '';
631
- }
608
+ while (1) switch (_context10.prev = _context10.next) {
609
+ case 0:
610
+ if (conditions === void 0) {
611
+ conditions = '';
612
+ }
632
613
 
633
- _rlog["default"].debug('updateDelId', conditions);
614
+ _rlog["default"].debug('updateDelId', conditions);
634
615
 
635
- case 2:
636
- case "end":
637
- return _context10.stop();
638
- }
616
+ case 2:
617
+ case "end":
618
+ return _context10.stop();
639
619
  }
640
620
  }, _callee10);
641
621
  }))();
@@ -646,42 +626,40 @@ function _default(topoApp) {
646
626
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
647
627
  var id, update, topoPermission;
648
628
  return _regenerator["default"].wrap(function _callee11$(_context11) {
649
- while (1) {
650
- switch (_context11.prev = _context11.next) {
651
- case 0:
652
- id = playload.id, update = playload.update;
653
- _context11.prev = 1;
654
- _context11.next = 4;
655
- return topoApp.serverApi.auth.getTopoPermission(id);
629
+ while (1) switch (_context11.prev = _context11.next) {
630
+ case 0:
631
+ id = playload.id, update = playload.update;
632
+ _context11.prev = 1;
633
+ _context11.next = 4;
634
+ return topoApp.serverApi.auth.getTopoPermission(id);
656
635
 
657
- case 4:
658
- topoPermission = _context11.sent;
636
+ case 4:
637
+ topoPermission = _context11.sent;
659
638
 
660
- _rlog["default"].debug('查询拓扑权限', topoPermission);
639
+ _rlog["default"].debug('查询拓扑权限', topoPermission);
661
640
 
662
- _context11.next = 11;
663
- break;
641
+ _context11.next = 11;
642
+ break;
664
643
 
665
- case 8:
666
- _context11.prev = 8;
667
- _context11.t0 = _context11["catch"](1);
644
+ case 8:
645
+ _context11.prev = 8;
646
+ _context11.t0 = _context11["catch"](1);
668
647
 
669
- _rlog["default"].error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
648
+ _rlog["default"].error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
670
649
 
671
650
 
672
- case 11:
673
- if (update !== false) {
674
- _this8.update({
675
- topoPermission: topoPermission
676
- });
677
- }
651
+ case 11:
652
+ if (update !== false) {
653
+ _this8.update({
654
+ topoPermission: topoPermission
655
+ });
656
+ }
678
657
 
679
- return _context11.abrupt("return", topoPermission);
658
+ return _context11.abrupt("return", topoPermission);
680
659
 
681
- case 13:
682
- case "end":
683
- return _context11.stop();
684
- }
660
+ case 13:
661
+ case "end":
662
+ return _context11.stop();
685
663
  }
686
664
  }, _callee11, null, [[1, 8]]);
687
665
  }))();