@riil-frontend/component-topology 10.0.57 → 10.0.59

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