@riil-frontend/component-topology 11.0.30 → 11.0.31

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