@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
@@ -9,7 +9,6 @@ var Alarm = /*#__PURE__*/function () {
9
9
  function Alarm() {
10
10
  this.topo = void 0;
11
11
  this.currentTopoId = void 0;
12
- // 告警通道id
13
12
  this.secretKey = null;
14
13
  this.alarmSwitch = true;
15
14
  }
@@ -38,31 +37,33 @@ var Alarm = /*#__PURE__*/function () {
38
37
 
39
38
  var nodeCount;
40
39
  return _regeneratorRuntime.wrap(function _callee$(_context) {
41
- while (1) switch (_context.prev = _context.next) {
42
- case 0:
43
- this.resetData();
44
-
45
- if (!(!this.isEnabled() || this.topo.isEditMode())) {
46
- _context.next = 3;
47
- break;
48
- }
40
+ while (1) {
41
+ switch (_context.prev = _context.next) {
42
+ case 0:
43
+ this.resetData();
44
+
45
+ if (!(!this.isEnabled() || this.topo.isEditMode())) {
46
+ _context.next = 3;
47
+ break;
48
+ }
49
49
 
50
- return _context.abrupt("return");
50
+ return _context.abrupt("return");
51
51
 
52
- case 3:
53
- nodeCount = this.topo.dataModel.getNodes().length;
52
+ case 3:
53
+ nodeCount = this.topo.dataModel.getNodes().length;
54
54
 
55
- if (nodeCount < 1500) {
56
- this.doOpen();
57
- } else {
58
- this.confirmOpenWhenLargeResource(function () {
59
- _this.doOpen();
60
- });
61
- }
55
+ if (nodeCount < 1500) {
56
+ this.doOpen();
57
+ } else {
58
+ this.confirmOpenWhenLargeResource(function () {
59
+ _this.doOpen();
60
+ });
61
+ }
62
62
 
63
- case 5:
64
- case "end":
65
- return _context.stop();
63
+ case 5:
64
+ case "end":
65
+ return _context.stop();
66
+ }
66
67
  }
67
68
  }, _callee, this);
68
69
  }));
@@ -181,27 +182,29 @@ var Alarm = /*#__PURE__*/function () {
181
182
  var result, alarms, state, _this$topo$store$getM, alarmListDefaultOpen;
182
183
 
183
184
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
184
- while (1) switch (_context2.prev = _context2.next) {
185
- case 0:
186
- result = this.getAlarms();
187
- rlog.debug('hmGetTopoAlarmByDoc', result);
188
- alarms = result.map(function (item) {
189
- return item.obj;
190
- });
191
- state = {
192
- alarmData: alarms.length > 0 ? alarms : []
193
- };
194
- _this$topo$store$getM = this.topo.store.getModelState('displayConfig'), alarmListDefaultOpen = _this$topo$store$getM.alarmListDefaultOpen;
195
-
196
- if (alarmListDefaultOpen) {
197
- state.alarmPanelIsOpen = alarms.length > 0;
198
- }
199
-
200
- this.updateState(state);
201
-
202
- case 7:
203
- case "end":
204
- return _context2.stop();
185
+ while (1) {
186
+ switch (_context2.prev = _context2.next) {
187
+ case 0:
188
+ result = this.getAlarms();
189
+ rlog.debug('hmGetTopoAlarmByDoc', result);
190
+ alarms = result.map(function (item) {
191
+ return item.obj;
192
+ });
193
+ state = {
194
+ alarmData: alarms.length > 0 ? alarms : []
195
+ };
196
+ _this$topo$store$getM = this.topo.store.getModelState('displayConfig'), alarmListDefaultOpen = _this$topo$store$getM.alarmListDefaultOpen;
197
+
198
+ if (alarmListDefaultOpen) {
199
+ state.alarmPanelIsOpen = alarms.length > 0;
200
+ }
201
+
202
+ this.updateState(state);
203
+
204
+ case 7:
205
+ case "end":
206
+ return _context2.stop();
207
+ }
205
208
  }
206
209
  }, _callee2, this);
207
210
  }));
@@ -217,68 +220,70 @@ var Alarm = /*#__PURE__*/function () {
217
220
  var _hmGetTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
218
221
  var mainCiIdList, endTime, startTime, parms, result;
219
222
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
220
- while (1) switch (_context3.prev = _context3.next) {
221
- case 0:
222
- mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
223
- return !!ci.operation;
224
- }) // 过滤掉权限
225
- .map(function (ci) {
226
- return ci.id;
227
- });
228
-
229
- if (!(mainCiIdList.length === 0)) {
230
- _context3.next = 4;
231
- break;
232
- }
233
-
234
- this.updateState({
235
- alarmData: [],
236
- alarmPanelIsOpen: false
237
- });
238
- return _context3.abrupt("return");
239
-
240
- case 4:
241
- //rlog.debug("获取告警列表", mainCiIdList);
242
- endTime = null; // new Date().valueOf();
243
-
244
- startTime = null; // moment().subtract(1, "months").valueOf();
245
-
246
- parms = {
247
- mainCiIdList: mainCiIdList,
248
- alertStatusList: ['toDeal', 'dealing'],
249
- pageNum: 1,
250
- pageSize: 10,
251
- sortField: 'alertLevel',
252
- alertLevelList: [],
253
- orders: [{
254
- property: 'alertLevel',
255
- direction: 'ASC'
256
- }, {
257
- property: 'createTime',
258
- direction: 'DESC'
259
- }],
260
- createTime: {
261
- startTime: startTime,
262
- endTime: endTime
223
+ while (1) {
224
+ switch (_context3.prev = _context3.next) {
225
+ case 0:
226
+ mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
227
+ return !!ci.operation;
228
+ }) // 过滤掉权限
229
+ .map(function (ci) {
230
+ return ci.id;
231
+ });
232
+
233
+ if (!(mainCiIdList.length === 0)) {
234
+ _context3.next = 4;
235
+ break;
263
236
  }
264
- };
265
- _context3.next = 9;
266
- return topoService.getAlarmByIds(parms);
267
-
268
- case 9:
269
- result = _context3.sent;
270
- rlog.debug('getAlarmById-result', result); // if (alarmIsOpened) {
271
- // //this.topo.loadAlarm(result.datas);
272
- // this.handleAlarmEvent({ type: "alarm", data: result.datas });
273
- // }
274
- // this.updateState({
275
- // alarmData: result.datas.length > 0 ? result.datas : [],
276
- // alarmPanelIsOpen: result.datas.length > 0,
277
- // });
278
-
279
- case 11:
280
- case "end":
281
- return _context3.stop();
237
+
238
+ this.updateState({
239
+ alarmData: [],
240
+ alarmPanelIsOpen: false
241
+ });
242
+ return _context3.abrupt("return");
243
+
244
+ case 4:
245
+ //rlog.debug("获取告警列表", mainCiIdList);
246
+ endTime = null; // new Date().valueOf();
247
+
248
+ startTime = null; // moment().subtract(1, "months").valueOf();
249
+
250
+ parms = {
251
+ mainCiIdList: mainCiIdList,
252
+ alertStatusList: ['toDeal', 'dealing'],
253
+ pageNum: 1,
254
+ pageSize: 10,
255
+ sortField: 'alertLevel',
256
+ alertLevelList: [],
257
+ orders: [{
258
+ property: 'alertLevel',
259
+ direction: 'ASC'
260
+ }, {
261
+ property: 'createTime',
262
+ direction: 'DESC'
263
+ }],
264
+ createTime: {
265
+ startTime: startTime,
266
+ endTime: endTime
267
+ }
268
+ };
269
+ _context3.next = 9;
270
+ return topoService.getAlarmByIds(parms);
271
+
272
+ case 9:
273
+ result = _context3.sent;
274
+ rlog.debug('getAlarmById-result', result); // if (alarmIsOpened) {
275
+ // //this.topo.loadAlarm(result.datas);
276
+ // this.handleAlarmEvent({ type: "alarm", data: result.datas });
277
+ // }
278
+ // this.updateState({
279
+ // alarmData: result.datas.length > 0 ? result.datas : [],
280
+ // alarmPanelIsOpen: result.datas.length > 0,
281
+ // });
282
+
283
+ case 11:
284
+ case "end":
285
+ return _context3.stop();
286
+ }
282
287
  }
283
288
  }, _callee3, this);
284
289
  }));
@@ -300,16 +305,18 @@ var Alarm = /*#__PURE__*/function () {
300
305
  function () {
301
306
  var _setAlarmDataByMock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(datas) {
302
307
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
303
- while (1) switch (_context4.prev = _context4.next) {
304
- case 0:
305
- this.updateState({
306
- alarmData: datas.length > 0 ? datas : [],
307
- alarmPanelIsOpen: datas.length > 0
308
- });
309
-
310
- case 1:
311
- case "end":
312
- return _context4.stop();
308
+ while (1) {
309
+ switch (_context4.prev = _context4.next) {
310
+ case 0:
311
+ this.updateState({
312
+ alarmData: datas.length > 0 ? datas : [],
313
+ alarmPanelIsOpen: datas.length > 0
314
+ });
315
+
316
+ case 1:
317
+ case "end":
318
+ return _context4.stop();
319
+ }
313
320
  }
314
321
  }, _callee4, this);
315
322
  }));
@@ -332,17 +339,19 @@ var Alarm = /*#__PURE__*/function () {
332
339
  var _switchAlarmPopPanel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(flag) {
333
340
  var topoDispatchers;
334
341
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
335
- while (1) switch (_context5.prev = _context5.next) {
336
- case 0:
337
- // console.log("switchAlarmPopPanel", flag);
338
- topoDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
339
- topoDispatchers.update({
340
- alarmPanelIsOpen: flag
341
- });
342
-
343
- case 2:
344
- case "end":
345
- return _context5.stop();
342
+ while (1) {
343
+ switch (_context5.prev = _context5.next) {
344
+ case 0:
345
+ // console.log("switchAlarmPopPanel", flag);
346
+ topoDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
347
+ topoDispatchers.update({
348
+ alarmPanelIsOpen: flag
349
+ });
350
+
351
+ case 2:
352
+ case "end":
353
+ return _context5.stop();
354
+ }
346
355
  }
347
356
  }, _callee5, this);
348
357
  }));
@@ -367,53 +376,55 @@ var Alarm = /*#__PURE__*/function () {
367
376
  var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
368
377
 
369
378
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
370
- while (1) switch (_context6.prev = _context6.next) {
371
- case 0:
372
- // 如果当前拓扑图开启中或已开启则退出
373
- _this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
379
+ while (1) {
380
+ switch (_context6.prev = _context6.next) {
381
+ case 0:
382
+ // 如果当前拓扑图开启中或已开启则退出
383
+ _this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
384
+
385
+ if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
386
+ _context6.next = 3;
387
+ break;
388
+ }
374
389
 
375
- if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
376
- _context6.next = 3;
390
+ return _context6.abrupt("return");
391
+
392
+ case 3:
393
+ this.currentTopoId = id;
394
+ this.updateState({
395
+ alarmOpening: true
396
+ });
397
+ alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
398
+ _context6.next = 8;
399
+ return alarmDispatchers.resetAlarmDoc();
400
+
401
+ case 8:
402
+ _context6.prev = 8;
403
+ _context6.next = 11;
404
+ return this.topo.serverApi.openTopoAlarm(id);
405
+
406
+ case 11:
407
+ this.secretKey = _context6.sent;
408
+ rlog.info('openTopoAlarm 打开拓扑告警推送-------------------开始');
409
+ this.updateState({
410
+ alarmOpening: false,
411
+ alarmIsOpened: true
412
+ });
413
+ _context6.next = 20;
377
414
  break;
378
- }
379
-
380
- return _context6.abrupt("return");
381
-
382
- case 3:
383
- this.currentTopoId = id;
384
- this.updateState({
385
- alarmOpening: true
386
- });
387
- alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
388
- _context6.next = 8;
389
- return alarmDispatchers.resetAlarmDoc();
390
-
391
- case 8:
392
- _context6.prev = 8;
393
- _context6.next = 11;
394
- return this.topo.serverApi.openTopoAlarm(id);
395
-
396
- case 11:
397
- this.secretKey = _context6.sent;
398
- rlog.info('openTopoAlarm 打开拓扑告警推送-------------------开始');
399
- this.updateState({
400
- alarmOpening: false,
401
- alarmIsOpened: true
402
- });
403
- _context6.next = 20;
404
- break;
405
-
406
- case 16:
407
- _context6.prev = 16;
408
- _context6.t0 = _context6["catch"](8);
409
- rlog.error('打开拓扑告警推送 失败');
410
- this.updateState({
411
- alarmOpening: false
412
- });
413
-
414
- case 20:
415
- case "end":
416
- return _context6.stop();
415
+
416
+ case 16:
417
+ _context6.prev = 16;
418
+ _context6.t0 = _context6["catch"](8);
419
+ rlog.error('打开拓扑告警推送 失败');
420
+ this.updateState({
421
+ alarmOpening: false
422
+ });
423
+
424
+ case 20:
425
+ case "end":
426
+ return _context6.stop();
427
+ }
417
428
  }
418
429
  }, _callee6, this, [[8, 16]]);
419
430
  }));
@@ -438,32 +449,34 @@ var Alarm = /*#__PURE__*/function () {
438
449
  var _this$getState3, alarmIsOpened, alarmOpening;
439
450
 
440
451
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
441
- while (1) switch (_context7.prev = _context7.next) {
442
- case 0:
443
- // 如果未开启则退出
444
- _this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
452
+ while (1) {
453
+ switch (_context7.prev = _context7.next) {
454
+ case 0:
455
+ // 如果未开启则退出
456
+ _this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
457
+
458
+ if (!(!alarmIsOpened && !alarmOpening)) {
459
+ _context7.next = 3;
460
+ break;
461
+ }
445
462
 
446
- if (!(!alarmIsOpened && !alarmOpening)) {
447
- _context7.next = 3;
448
- break;
449
- }
450
-
451
- return _context7.abrupt("return");
452
-
453
- case 3:
454
- this.currentTopoId = null;
455
- rlog.debug('useAlarm.useEffect 告警WebSocket 结束');
456
- this.updateState({
457
- topoAlarmIsOpen: false,
458
- alarmOpening: false,
459
- alarmPanelIsOpen: false
460
- });
461
- _context7.next = 8;
462
- return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
463
-
464
- case 8:
465
- case "end":
466
- return _context7.stop();
463
+ return _context7.abrupt("return");
464
+
465
+ case 3:
466
+ this.currentTopoId = null;
467
+ rlog.debug('useAlarm.useEffect 告警WebSocket 结束');
468
+ this.updateState({
469
+ topoAlarmIsOpen: false,
470
+ alarmOpening: false,
471
+ alarmPanelIsOpen: false
472
+ });
473
+ _context7.next = 8;
474
+ return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
475
+
476
+ case 8:
477
+ case "end":
478
+ return _context7.stop();
479
+ }
467
480
  }
468
481
  }, _callee7, this);
469
482
  }));
@@ -496,15 +509,17 @@ var Alarm = /*#__PURE__*/function () {
496
509
  var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
497
510
  var id;
498
511
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
499
- while (1) switch (_context8.prev = _context8.next) {
500
- case 0:
501
- id = this.currentTopoId;
502
- _context8.next = 3;
503
- return this.openTopoAlarm(id);
504
-
505
- case 3:
506
- case "end":
507
- return _context8.stop();
512
+ while (1) {
513
+ switch (_context8.prev = _context8.next) {
514
+ case 0:
515
+ id = this.currentTopoId;
516
+ _context8.next = 3;
517
+ return this.openTopoAlarm(id);
518
+
519
+ case 3:
520
+ case "end":
521
+ return _context8.stop();
522
+ }
508
523
  }
509
524
  }, _callee8, this);
510
525
  }));
@@ -524,94 +539,96 @@ var Alarm = /*#__PURE__*/function () {
524
539
  /*#__PURE__*/
525
540
  function () {
526
541
  var _handleAlarmEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(alertData) {
527
- var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche2, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
542
+ var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
528
543
 
529
544
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
530
- while (1) switch (_context9.prev = _context9.next) {
531
- case 0:
532
- _this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
533
- resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
534
- resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
535
- alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm'); // 添加事件
536
- // console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
537
-
538
- if (!(isAvailableArray(alertData) && isAvailableArray(resIdsList))) {
539
- _context9.next = 24;
540
- break;
541
- }
542
-
543
- sendAl = [];
544
- idsList = [].concat(nodeIdsList, linkIdsList);
545
- operations = [];
546
- idsList.forEach(function (idItem) {
547
- if (idItem.operation === null) {
548
- operations.push(idItem.ciId);
545
+ while (1) {
546
+ switch (_context9.prev = _context9.next) {
547
+ case 0:
548
+ _this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
549
+ resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
550
+ resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
551
+ alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm'); // 添加事件
552
+ // console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
553
+
554
+ if (!(isAvailableArray(alertData) && isAvailableArray(resIdsList))) {
555
+ _context9.next = 24;
556
+ break;
549
557
  }
550
- });
551
- alertData.forEach(function (item, index) {
552
- var _item$resourceId;
553
-
554
- var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
555
- var obj = {
556
- id: ciId,
557
- level: item.alertLevel,
558
- alertId: item.alertId,
559
- status: item.status,
560
- obj: item,
561
- info: item.alertType,
562
- ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
563
- ruleId: item === null || item === void 0 ? void 0 : item.ruleId
564
- };
565
558
 
566
- if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
567
- sendAl.push(obj);
559
+ sendAl = [];
560
+ idsList = [].concat(nodeIdsList, linkIdsList);
561
+ operations = [];
562
+ idsList.forEach(function (idItem) {
563
+ if (idItem.operation === null) {
564
+ operations.push(idItem.ciId);
565
+ }
566
+ });
567
+ alertData.forEach(function (item, index) {
568
+ var _item$resourceId;
569
+
570
+ var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
571
+ var obj = {
572
+ id: ciId,
573
+ level: item.alertLevel,
574
+ alertId: item.alertId,
575
+ status: item.status,
576
+ obj: item,
577
+ info: item.alertType,
578
+ ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
579
+ ruleId: item === null || item === void 0 ? void 0 : item.ruleId
580
+ };
581
+
582
+ if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
583
+ sendAl.push(obj);
584
+ }
585
+ }); // console.log("before-combAlarmData", sendAl, idsList);
586
+
587
+ if (!(sendAl.length > 0)) {
588
+ _context9.next = 24;
589
+ break;
568
590
  }
569
- }); // console.log("before-combAlarmData", sendAl, idsList);
570
591
 
571
- if (!(sendAl.length > 0)) {
572
- _context9.next = 24;
573
- break;
574
- }
575
-
576
- rlog.debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
577
- _context9.prev = 12;
578
- _context9.next = 15;
579
- return alarmDispatchers.combAlarmData({
580
- alarmdata: sendAl
581
- });
582
-
583
- case 15:
584
- _yield$alarmDispatche2 = _context9.sent;
585
- eqFlag = _yield$alarmDispatche2.eqFlag;
586
- alarmlist = _yield$alarmDispatche2.alarmlist;
587
-
588
- // console.log("handleAlarmEvent", alarmIsOpened,eqFlag);
589
- // console.log("handleAlarmEvent-topo.viewProps", this.topo.viewProps);
590
- if (alarmIsOpened) {
591
- this.hmGetTopoAlarmByDoc(); // 通知所有告警
592
-
593
- if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
594
- this.topo.viewProps.onAlarm(this.getAlarms().map(function (item) {
595
- return item.obj;
596
- }));
597
- }
592
+ rlog.debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
593
+ _context9.prev = 12;
594
+ _context9.next = 15;
595
+ return alarmDispatchers.combAlarmData({
596
+ alarmdata: sendAl
597
+ });
598
598
 
599
- if ((_this$topo$viewProps2 = this.topo.viewProps) !== null && _this$topo$viewProps2 !== void 0 && _this$topo$viewProps2.onResourceEvent) {
600
- this.topo.viewProps.onResourceEvent(this.getEvents());
599
+ case 15:
600
+ _yield$alarmDispatche = _context9.sent;
601
+ eqFlag = _yield$alarmDispatche.eqFlag;
602
+ alarmlist = _yield$alarmDispatche.alarmlist;
603
+
604
+ // console.log("handleAlarmEvent", alarmIsOpened,eqFlag);
605
+ // console.log("handleAlarmEvent-topo.viewProps", this.topo.viewProps);
606
+ if (alarmIsOpened) {
607
+ this.hmGetTopoAlarmByDoc(); // 通知所有告警
608
+
609
+ if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
610
+ this.topo.viewProps.onAlarm(this.getAlarms().map(function (item) {
611
+ return item.obj;
612
+ }));
613
+ }
614
+
615
+ if ((_this$topo$viewProps2 = this.topo.viewProps) !== null && _this$topo$viewProps2 !== void 0 && _this$topo$viewProps2.onResourceEvent) {
616
+ this.topo.viewProps.onResourceEvent(this.getEvents());
617
+ }
601
618
  }
602
- }
603
619
 
604
- _context9.next = 24;
605
- break;
620
+ _context9.next = 24;
621
+ break;
606
622
 
607
- case 21:
608
- _context9.prev = 21;
609
- _context9.t0 = _context9["catch"](12);
610
- rlog.error('告警发送异常', _context9.t0);
623
+ case 21:
624
+ _context9.prev = 21;
625
+ _context9.t0 = _context9["catch"](12);
626
+ rlog.error('告警发送异常', _context9.t0);
611
627
 
612
- case 24:
613
- case "end":
614
- return _context9.stop();
628
+ case 24:
629
+ case "end":
630
+ return _context9.stop();
631
+ }
615
632
  }
616
633
  }, _callee9, this, [[12, 21]]);
617
634
  }));