@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.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +2 -4
- package/build/index.js +34 -49
- package/es/components/MultiResourceDrawer/index.js +18 -16
- package/es/components/ResourceList/ResourceSelect.js +50 -48
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +26 -24
- package/es/components/SingleResourceDrawer/SelectDrawer.js +20 -18
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +25 -23
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
- package/es/core/components/titlebar/widgets/TitleWidget.js +3 -5
- package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
- package/es/core/editor/components/BackgroundView/index.js +129 -119
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -20
- package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +17 -15
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +9 -7
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
- package/es/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +13 -11
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +23 -21
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -10
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +27 -21
- package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/es/core/editor/hooks/useNewElementTheme.js +2 -2
- package/es/core/editor/store/background.js +10 -8
- package/es/core/editor/store/topoEdit.js +6 -4
- package/es/core/editor/utils/edgeTypeStyleUtil.js +4 -2
- package/es/core/hooks/usePolling.js +121 -117
- package/es/core/hooks/useResourceConfig.js +66 -58
- package/es/core/hooks/useTopoEdit.js +511 -476
- package/es/core/models/Alarm.js +298 -281
- package/es/core/models/AttributeMetricDisplay.js +107 -101
- package/es/core/models/PluginManager.js +3 -4
- package/es/core/models/SelectionModel.js +5 -4
- package/es/core/models/TopoApp.js +240 -205
- package/es/core/models/TopoGraphView.js +21 -18
- package/es/core/models/cache/CiCache.js +27 -28
- package/es/core/models/cache/CiTypeCache.js +41 -37
- package/es/core/models/cache/DictCache.js +35 -33
- package/es/core/models/graph/Background.js +17 -15
- package/es/core/models/plugins/resourceWebControllUrl.js +82 -76
- package/es/core/models/tagstips/ElementTagTipConfig.js +38 -34
- package/es/core/models/topoData.js +70 -68
- package/es/core/models/utils/linkUtils.js +43 -41
- package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/es/core/services/alarm.js +16 -14
- package/es/core/services/background.js +67 -59
- package/es/core/services/cmdb/metric.js +11 -9
- package/es/core/services/cmdb.js +20 -18
- package/es/core/services/index.js +45 -39
- package/es/core/services/overview.js +151 -131
- package/es/core/services/topo/basic.js +13 -11
- package/es/core/services/topo/tagtip.js +12 -10
- package/es/core/store/models/ciModel.js +62 -58
- package/es/core/store/models/customIcon.js +134 -120
- package/es/core/store/models/displayConfig.js +19 -15
- package/es/core/store/models/selection.js +6 -4
- package/es/core/store/models/topoAlarm.js +145 -162
- package/es/core/store/models/topoBaseInfoOverview.js +6 -4
- package/es/core/store/models/topoBizMod.js +32 -28
- package/es/core/store/models/topoConfig.js +231 -215
- package/es/core/store/models/topoGraphView.js +6 -4
- package/es/core/store/models/topoMod.js +395 -373
- package/es/core/utils/imageUtil.js +20 -18
- package/es/core/utils/saveSerialize.js +11 -9
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +357 -343
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +205 -189
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +37 -33
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +19 -17
- package/es/networkTopo/components/Link/hook.js +77 -73
- package/es/networkTopo/components/Link/index.js +94 -86
- package/es/networkTopo/components/Link/setting.js +44 -42
- package/es/networkTopo/getTopoData.js +69 -63
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +32 -30
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/es/networkTopo/models/TopoCenter.js +22 -18
- package/es/networkTopo/services/alert.js +22 -18
- package/es/networkTopo/services/authorization.js +55 -45
- package/es/networkTopo/services/cmdb.js +470 -422
- package/es/networkTopo/services/funcAuth.js +24 -22
- package/es/networkTopo/services/link.js +117 -107
- package/es/networkTopo/services/mdc.js +24 -18
- package/es/networkTopo/services/metric.js +27 -23
- package/es/networkTopo/services/model.js +509 -445
- package/es/networkTopo/services/risk.js +11 -9
- package/es/networkTopo/services/topo/auth.js +33 -27
- package/es/networkTopo/services/topo/basic.js +314 -274
- package/es/networkTopo/services/topo/blacklist.js +24 -20
- package/es/networkTopo/services/topo/ciInfo.js +31 -27
- package/es/networkTopo/services/topo/icon.js +59 -49
- package/es/networkTopo/services/topo/networkLink.js +36 -32
- package/es/networkTopo/services/topo/relation.js +11 -9
- package/es/networkTopo/services/topo/resourceWebUrl.js +42 -36
- package/es/networkTopo/store/functionAuth.js +37 -31
- package/es/networkTopo/store/topoCenter.js +152 -142
- package/es/networkTopo/store/topoLinkMod.js +6 -4
- package/es/networkTopo/store/topoTreeMod.js +182 -170
- package/es/networkTopo/utils/exportData.js +54 -52
- package/lib/components/MultiResourceDrawer/index.js +18 -16
- package/lib/components/ResourceList/ResourceSelect.js +50 -48
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +29 -27
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +20 -18
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +32 -30
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
- package/lib/core/components/titlebar/widgets/TitleWidget.js +3 -5
- package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
- package/lib/core/editor/components/BackgroundView/index.js +128 -118
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +24 -22
- package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +21 -19
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +10 -8
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
- package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +14 -12
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +28 -26
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +14 -12
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +31 -25
- package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
- package/lib/core/editor/store/background.js +10 -8
- package/lib/core/editor/store/topoEdit.js +6 -4
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +4 -2
- package/lib/core/hooks/usePolling.js +120 -116
- package/lib/core/hooks/useResourceConfig.js +66 -58
- package/lib/core/hooks/useTopoEdit.js +503 -468
- package/lib/core/models/Alarm.js +292 -275
- package/lib/core/models/AttributeMetricDisplay.js +110 -104
- package/lib/core/models/PluginManager.js +3 -4
- package/lib/core/models/SelectionModel.js +5 -4
- package/lib/core/models/TopoApp.js +240 -205
- package/lib/core/models/TopoGraphView.js +21 -18
- package/lib/core/models/cache/CiCache.js +32 -33
- package/lib/core/models/cache/CiTypeCache.js +42 -38
- package/lib/core/models/cache/DictCache.js +35 -33
- package/lib/core/models/graph/Background.js +18 -16
- package/lib/core/models/plugins/resourceWebControllUrl.js +80 -74
- package/lib/core/models/tagstips/ElementTagTipConfig.js +38 -34
- package/lib/core/models/topoData.js +71 -69
- package/lib/core/models/utils/linkUtils.js +43 -41
- package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/lib/core/services/alarm.js +20 -18
- package/lib/core/services/background.js +78 -70
- package/lib/core/services/cmdb/metric.js +12 -10
- package/lib/core/services/cmdb.js +22 -20
- package/lib/core/services/index.js +51 -45
- package/lib/core/services/overview.js +151 -131
- package/lib/core/services/topo/basic.js +15 -13
- package/lib/core/services/topo/tagtip.js +14 -12
- package/lib/core/store/models/ciModel.js +70 -66
- package/lib/core/store/models/customIcon.js +134 -120
- package/lib/core/store/models/displayConfig.js +19 -15
- package/lib/core/store/models/selection.js +6 -4
- package/lib/core/store/models/topoAlarm.js +145 -163
- package/lib/core/store/models/topoBaseInfoOverview.js +6 -4
- package/lib/core/store/models/topoBizMod.js +38 -34
- package/lib/core/store/models/topoConfig.js +238 -222
- package/lib/core/store/models/topoGraphView.js +6 -4
- package/lib/core/store/models/topoMod.js +397 -375
- package/lib/core/utils/imageUtil.js +24 -22
- package/lib/core/utils/saveSerialize.js +11 -9
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +358 -344
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +206 -190
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -29
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +20 -18
- package/lib/networkTopo/components/Link/hook.js +77 -73
- package/lib/networkTopo/components/Link/index.js +95 -87
- package/lib/networkTopo/components/Link/setting.js +44 -42
- package/lib/networkTopo/getTopoData.js +69 -63
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +33 -31
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/lib/networkTopo/models/TopoCenter.js +22 -18
- package/lib/networkTopo/services/alert.js +22 -18
- package/lib/networkTopo/services/authorization.js +65 -55
- package/lib/networkTopo/services/cmdb.js +470 -422
- package/lib/networkTopo/services/funcAuth.js +26 -24
- package/lib/networkTopo/services/link.js +118 -108
- package/lib/networkTopo/services/mdc.js +27 -21
- package/lib/networkTopo/services/metric.js +31 -27
- package/lib/networkTopo/services/model.js +509 -445
- package/lib/networkTopo/services/risk.js +13 -11
- package/lib/networkTopo/services/topo/auth.js +33 -27
- package/lib/networkTopo/services/topo/basic.js +317 -277
- package/lib/networkTopo/services/topo/blacklist.js +24 -20
- package/lib/networkTopo/services/topo/ciInfo.js +38 -34
- package/lib/networkTopo/services/topo/icon.js +69 -59
- package/lib/networkTopo/services/topo/networkLink.js +36 -32
- package/lib/networkTopo/services/topo/relation.js +13 -11
- package/lib/networkTopo/services/topo/resourceWebUrl.js +50 -44
- package/lib/networkTopo/store/functionAuth.js +37 -31
- package/lib/networkTopo/store/topoCenter.js +152 -142
- package/lib/networkTopo/store/topoLinkMod.js +6 -4
- package/lib/networkTopo/store/topoTreeMod.js +178 -166
- package/lib/networkTopo/utils/exportData.js +61 -59
- package/package.json +3 -3
package/lib/core/models/Alarm.js
CHANGED
@@ -21,7 +21,6 @@ var Alarm = /*#__PURE__*/function () {
|
|
21
21
|
function Alarm() {
|
22
22
|
this.topo = void 0;
|
23
23
|
this.currentTopoId = void 0;
|
24
|
-
// 告警通道id
|
25
24
|
this.secretKey = null;
|
26
25
|
this.alarmSwitch = true;
|
27
26
|
}
|
@@ -50,31 +49,33 @@ var Alarm = /*#__PURE__*/function () {
|
|
50
49
|
|
51
50
|
var nodeCount;
|
52
51
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
53
|
-
while (1)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
while (1) {
|
53
|
+
switch (_context.prev = _context.next) {
|
54
|
+
case 0:
|
55
|
+
this.resetData();
|
56
|
+
|
57
|
+
if (!(!this.isEnabled() || this.topo.isEditMode())) {
|
58
|
+
_context.next = 3;
|
59
|
+
break;
|
60
|
+
}
|
61
61
|
|
62
|
-
|
62
|
+
return _context.abrupt("return");
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
case 3:
|
65
|
+
nodeCount = this.topo.dataModel.getNodes().length;
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
if (nodeCount < 1500) {
|
68
|
+
this.doOpen();
|
69
|
+
} else {
|
70
|
+
this.confirmOpenWhenLargeResource(function () {
|
71
|
+
_this.doOpen();
|
72
|
+
});
|
73
|
+
}
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
case 5:
|
76
|
+
case "end":
|
77
|
+
return _context.stop();
|
78
|
+
}
|
78
79
|
}
|
79
80
|
}, _callee, this);
|
80
81
|
}));
|
@@ -195,29 +196,31 @@ var Alarm = /*#__PURE__*/function () {
|
|
195
196
|
var result, alarms, state, _this$topo$store$getM, alarmListDefaultOpen;
|
196
197
|
|
197
198
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
198
|
-
while (1)
|
199
|
-
|
200
|
-
|
199
|
+
while (1) {
|
200
|
+
switch (_context2.prev = _context2.next) {
|
201
|
+
case 0:
|
202
|
+
result = this.getAlarms();
|
201
203
|
|
202
|
-
|
204
|
+
_rlog["default"].debug('hmGetTopoAlarmByDoc', result);
|
203
205
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
alarms = result.map(function (item) {
|
207
|
+
return item.obj;
|
208
|
+
});
|
209
|
+
state = {
|
210
|
+
alarmData: alarms.length > 0 ? alarms : []
|
211
|
+
};
|
212
|
+
_this$topo$store$getM = this.topo.store.getModelState('displayConfig'), alarmListDefaultOpen = _this$topo$store$getM.alarmListDefaultOpen;
|
211
213
|
|
212
|
-
|
213
|
-
|
214
|
-
|
214
|
+
if (alarmListDefaultOpen) {
|
215
|
+
state.alarmPanelIsOpen = alarms.length > 0;
|
216
|
+
}
|
215
217
|
|
216
|
-
|
218
|
+
this.updateState(state);
|
217
219
|
|
218
|
-
|
219
|
-
|
220
|
-
|
220
|
+
case 7:
|
221
|
+
case "end":
|
222
|
+
return _context2.stop();
|
223
|
+
}
|
221
224
|
}
|
222
225
|
}, _callee2, this);
|
223
226
|
}));
|
@@ -233,70 +236,72 @@ var Alarm = /*#__PURE__*/function () {
|
|
233
236
|
var _hmGetTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(id) {
|
234
237
|
var mainCiIdList, endTime, startTime, parms, result;
|
235
238
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
236
|
-
while (1)
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
this.updateState({
|
251
|
-
alarmData: [],
|
252
|
-
alarmPanelIsOpen: false
|
253
|
-
});
|
254
|
-
return _context3.abrupt("return");
|
255
|
-
|
256
|
-
case 4:
|
257
|
-
//rlog.debug("获取告警列表", mainCiIdList);
|
258
|
-
endTime = null; // new Date().valueOf();
|
259
|
-
|
260
|
-
startTime = null; // moment().subtract(1, "months").valueOf();
|
261
|
-
|
262
|
-
parms = {
|
263
|
-
mainCiIdList: mainCiIdList,
|
264
|
-
alertStatusList: ['toDeal', 'dealing'],
|
265
|
-
pageNum: 1,
|
266
|
-
pageSize: 10,
|
267
|
-
sortField: 'alertLevel',
|
268
|
-
alertLevelList: [],
|
269
|
-
orders: [{
|
270
|
-
property: 'alertLevel',
|
271
|
-
direction: 'ASC'
|
272
|
-
}, {
|
273
|
-
property: 'createTime',
|
274
|
-
direction: 'DESC'
|
275
|
-
}],
|
276
|
-
createTime: {
|
277
|
-
startTime: startTime,
|
278
|
-
endTime: endTime
|
239
|
+
while (1) {
|
240
|
+
switch (_context3.prev = _context3.next) {
|
241
|
+
case 0:
|
242
|
+
mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
|
243
|
+
return !!ci.operation;
|
244
|
+
}) // 过滤掉权限
|
245
|
+
.map(function (ci) {
|
246
|
+
return ci.id;
|
247
|
+
});
|
248
|
+
|
249
|
+
if (!(mainCiIdList.length === 0)) {
|
250
|
+
_context3.next = 4;
|
251
|
+
break;
|
279
252
|
}
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
253
|
+
|
254
|
+
this.updateState({
|
255
|
+
alarmData: [],
|
256
|
+
alarmPanelIsOpen: false
|
257
|
+
});
|
258
|
+
return _context3.abrupt("return");
|
259
|
+
|
260
|
+
case 4:
|
261
|
+
//rlog.debug("获取告警列表", mainCiIdList);
|
262
|
+
endTime = null; // new Date().valueOf();
|
263
|
+
|
264
|
+
startTime = null; // moment().subtract(1, "months").valueOf();
|
265
|
+
|
266
|
+
parms = {
|
267
|
+
mainCiIdList: mainCiIdList,
|
268
|
+
alertStatusList: ['toDeal', 'dealing'],
|
269
|
+
pageNum: 1,
|
270
|
+
pageSize: 10,
|
271
|
+
sortField: 'alertLevel',
|
272
|
+
alertLevelList: [],
|
273
|
+
orders: [{
|
274
|
+
property: 'alertLevel',
|
275
|
+
direction: 'ASC'
|
276
|
+
}, {
|
277
|
+
property: 'createTime',
|
278
|
+
direction: 'DESC'
|
279
|
+
}],
|
280
|
+
createTime: {
|
281
|
+
startTime: startTime,
|
282
|
+
endTime: endTime
|
283
|
+
}
|
284
|
+
};
|
285
|
+
_context3.next = 9;
|
286
|
+
return _topo["default"].getAlarmByIds(parms);
|
287
|
+
|
288
|
+
case 9:
|
289
|
+
result = _context3.sent;
|
290
|
+
|
291
|
+
_rlog["default"].debug('getAlarmById-result', result); // if (alarmIsOpened) {
|
292
|
+
// //this.topo.loadAlarm(result.datas);
|
293
|
+
// this.handleAlarmEvent({ type: "alarm", data: result.datas });
|
294
|
+
// }
|
295
|
+
// this.updateState({
|
296
|
+
// alarmData: result.datas.length > 0 ? result.datas : [],
|
297
|
+
// alarmPanelIsOpen: result.datas.length > 0,
|
298
|
+
// });
|
299
|
+
|
300
|
+
|
301
|
+
case 11:
|
302
|
+
case "end":
|
303
|
+
return _context3.stop();
|
304
|
+
}
|
300
305
|
}
|
301
306
|
}, _callee3, this);
|
302
307
|
}));
|
@@ -318,16 +323,18 @@ var Alarm = /*#__PURE__*/function () {
|
|
318
323
|
function () {
|
319
324
|
var _setAlarmDataByMock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(datas) {
|
320
325
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
321
|
-
while (1)
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
326
|
+
while (1) {
|
327
|
+
switch (_context4.prev = _context4.next) {
|
328
|
+
case 0:
|
329
|
+
this.updateState({
|
330
|
+
alarmData: datas.length > 0 ? datas : [],
|
331
|
+
alarmPanelIsOpen: datas.length > 0
|
332
|
+
});
|
333
|
+
|
334
|
+
case 1:
|
335
|
+
case "end":
|
336
|
+
return _context4.stop();
|
337
|
+
}
|
331
338
|
}
|
332
339
|
}, _callee4, this);
|
333
340
|
}));
|
@@ -350,17 +357,19 @@ var Alarm = /*#__PURE__*/function () {
|
|
350
357
|
var _switchAlarmPopPanel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(flag) {
|
351
358
|
var topoDispatchers;
|
352
359
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
353
|
-
while (1)
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
360
|
+
while (1) {
|
361
|
+
switch (_context5.prev = _context5.next) {
|
362
|
+
case 0:
|
363
|
+
// console.log("switchAlarmPopPanel", flag);
|
364
|
+
topoDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
365
|
+
topoDispatchers.update({
|
366
|
+
alarmPanelIsOpen: flag
|
367
|
+
});
|
368
|
+
|
369
|
+
case 2:
|
370
|
+
case "end":
|
371
|
+
return _context5.stop();
|
372
|
+
}
|
364
373
|
}
|
365
374
|
}, _callee5, this);
|
366
375
|
}));
|
@@ -385,57 +394,59 @@ var Alarm = /*#__PURE__*/function () {
|
|
385
394
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
386
395
|
|
387
396
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
388
|
-
while (1)
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
+
while (1) {
|
398
|
+
switch (_context6.prev = _context6.next) {
|
399
|
+
case 0:
|
400
|
+
// 如果当前拓扑图开启中或已开启则退出
|
401
|
+
_this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
|
402
|
+
|
403
|
+
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
404
|
+
_context6.next = 3;
|
405
|
+
break;
|
406
|
+
}
|
397
407
|
|
398
|
-
|
408
|
+
return _context6.abrupt("return");
|
399
409
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
410
|
+
case 3:
|
411
|
+
this.currentTopoId = id;
|
412
|
+
this.updateState({
|
413
|
+
alarmOpening: true
|
414
|
+
});
|
415
|
+
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm');
|
416
|
+
_context6.next = 8;
|
417
|
+
return alarmDispatchers.resetAlarmDoc();
|
408
418
|
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
419
|
+
case 8:
|
420
|
+
_context6.prev = 8;
|
421
|
+
_context6.next = 11;
|
422
|
+
return this.topo.serverApi.openTopoAlarm(id);
|
413
423
|
|
414
|
-
|
415
|
-
|
424
|
+
case 11:
|
425
|
+
this.secretKey = _context6.sent;
|
416
426
|
|
417
|
-
|
427
|
+
_rlog["default"].info('openTopoAlarm 打开拓扑告警推送-------------------开始');
|
418
428
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
429
|
+
this.updateState({
|
430
|
+
alarmOpening: false,
|
431
|
+
alarmIsOpened: true
|
432
|
+
});
|
433
|
+
_context6.next = 20;
|
434
|
+
break;
|
425
435
|
|
426
|
-
|
427
|
-
|
428
|
-
|
436
|
+
case 16:
|
437
|
+
_context6.prev = 16;
|
438
|
+
_context6.t0 = _context6["catch"](8);
|
429
439
|
|
430
|
-
|
440
|
+
_rlog["default"].error('打开拓扑告警推送 失败');
|
431
441
|
|
432
|
-
|
433
|
-
|
434
|
-
|
442
|
+
this.updateState({
|
443
|
+
alarmOpening: false
|
444
|
+
});
|
435
445
|
|
436
|
-
|
437
|
-
|
438
|
-
|
446
|
+
case 20:
|
447
|
+
case "end":
|
448
|
+
return _context6.stop();
|
449
|
+
}
|
439
450
|
}
|
440
451
|
}, _callee6, this, [[8, 16]]);
|
441
452
|
}));
|
@@ -460,34 +471,36 @@ var Alarm = /*#__PURE__*/function () {
|
|
460
471
|
var _this$getState3, alarmIsOpened, alarmOpening;
|
461
472
|
|
462
473
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
463
|
-
while (1)
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
474
|
+
while (1) {
|
475
|
+
switch (_context7.prev = _context7.next) {
|
476
|
+
case 0:
|
477
|
+
// 如果未开启则退出
|
478
|
+
_this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
|
479
|
+
|
480
|
+
if (!(!alarmIsOpened && !alarmOpening)) {
|
481
|
+
_context7.next = 3;
|
482
|
+
break;
|
483
|
+
}
|
472
484
|
|
473
|
-
|
485
|
+
return _context7.abrupt("return");
|
474
486
|
|
475
|
-
|
476
|
-
|
487
|
+
case 3:
|
488
|
+
this.currentTopoId = null;
|
477
489
|
|
478
|
-
|
490
|
+
_rlog["default"].debug('useAlarm.useEffect 告警WebSocket 结束');
|
479
491
|
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
492
|
+
this.updateState({
|
493
|
+
topoAlarmIsOpen: false,
|
494
|
+
alarmOpening: false,
|
495
|
+
alarmPanelIsOpen: false
|
496
|
+
});
|
497
|
+
_context7.next = 8;
|
498
|
+
return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
|
487
499
|
|
488
|
-
|
489
|
-
|
490
|
-
|
500
|
+
case 8:
|
501
|
+
case "end":
|
502
|
+
return _context7.stop();
|
503
|
+
}
|
491
504
|
}
|
492
505
|
}, _callee7, this);
|
493
506
|
}));
|
@@ -520,15 +533,17 @@ var Alarm = /*#__PURE__*/function () {
|
|
520
533
|
var _restart = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
521
534
|
var id;
|
522
535
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
523
|
-
while (1)
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
536
|
+
while (1) {
|
537
|
+
switch (_context8.prev = _context8.next) {
|
538
|
+
case 0:
|
539
|
+
id = this.currentTopoId;
|
540
|
+
_context8.next = 3;
|
541
|
+
return this.openTopoAlarm(id);
|
542
|
+
|
543
|
+
case 3:
|
544
|
+
case "end":
|
545
|
+
return _context8.stop();
|
546
|
+
}
|
532
547
|
}
|
533
548
|
}, _callee8, this);
|
534
549
|
}));
|
@@ -548,96 +563,98 @@ var Alarm = /*#__PURE__*/function () {
|
|
548
563
|
/*#__PURE__*/
|
549
564
|
function () {
|
550
565
|
var _handleAlarmEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(alertData) {
|
551
|
-
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$
|
566
|
+
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
|
552
567
|
|
553
568
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
554
|
-
while (1)
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
sendAl = [];
|
568
|
-
idsList = [].concat(nodeIdsList, linkIdsList);
|
569
|
-
operations = [];
|
570
|
-
idsList.forEach(function (idItem) {
|
571
|
-
if (idItem.operation === null) {
|
572
|
-
operations.push(idItem.ciId);
|
569
|
+
while (1) {
|
570
|
+
switch (_context9.prev = _context9.next) {
|
571
|
+
case 0:
|
572
|
+
_this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
|
573
|
+
resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
|
574
|
+
resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
|
575
|
+
alarmDispatchers = this.topo.store.getModelDispatchers('topoAlarm'); // 添加事件
|
576
|
+
// console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
|
577
|
+
|
578
|
+
if (!((0, _utils.isAvailableArray)(alertData) && (0, _utils.isAvailableArray)(resIdsList))) {
|
579
|
+
_context9.next = 24;
|
580
|
+
break;
|
573
581
|
}
|
574
|
-
});
|
575
|
-
alertData.forEach(function (item, index) {
|
576
|
-
var _item$resourceId;
|
577
|
-
|
578
|
-
var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
|
579
|
-
var obj = {
|
580
|
-
id: ciId,
|
581
|
-
level: item.alertLevel,
|
582
|
-
alertId: item.alertId,
|
583
|
-
status: item.status,
|
584
|
-
obj: item,
|
585
|
-
info: item.alertType,
|
586
|
-
ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
|
587
|
-
ruleId: item === null || item === void 0 ? void 0 : item.ruleId
|
588
|
-
};
|
589
582
|
|
590
|
-
|
591
|
-
|
583
|
+
sendAl = [];
|
584
|
+
idsList = [].concat(nodeIdsList, linkIdsList);
|
585
|
+
operations = [];
|
586
|
+
idsList.forEach(function (idItem) {
|
587
|
+
if (idItem.operation === null) {
|
588
|
+
operations.push(idItem.ciId);
|
589
|
+
}
|
590
|
+
});
|
591
|
+
alertData.forEach(function (item, index) {
|
592
|
+
var _item$resourceId;
|
593
|
+
|
594
|
+
var ciId = (_item$resourceId = item.resourceId) !== null && _item$resourceId !== void 0 ? _item$resourceId : item.ciId;
|
595
|
+
var obj = {
|
596
|
+
id: ciId,
|
597
|
+
level: item.alertLevel,
|
598
|
+
alertId: item.alertId,
|
599
|
+
status: item.status,
|
600
|
+
obj: item,
|
601
|
+
info: item.alertType,
|
602
|
+
ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
|
603
|
+
ruleId: item === null || item === void 0 ? void 0 : item.ruleId
|
604
|
+
};
|
605
|
+
|
606
|
+
if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
|
607
|
+
sendAl.push(obj);
|
608
|
+
}
|
609
|
+
}); // console.log("before-combAlarmData", sendAl, idsList);
|
610
|
+
|
611
|
+
if (!(sendAl.length > 0)) {
|
612
|
+
_context9.next = 24;
|
613
|
+
break;
|
592
614
|
}
|
593
|
-
}); // console.log("before-combAlarmData", sendAl, idsList);
|
594
615
|
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
_context9.prev = 12;
|
603
|
-
_context9.next = 15;
|
604
|
-
return alarmDispatchers.combAlarmData({
|
605
|
-
alarmdata: sendAl
|
606
|
-
});
|
607
|
-
|
608
|
-
case 15:
|
609
|
-
_yield$alarmDispatche2 = _context9.sent;
|
610
|
-
eqFlag = _yield$alarmDispatche2.eqFlag;
|
611
|
-
alarmlist = _yield$alarmDispatche2.alarmlist;
|
612
|
-
|
613
|
-
// console.log("handleAlarmEvent", alarmIsOpened,eqFlag);
|
614
|
-
// console.log("handleAlarmEvent-topo.viewProps", this.topo.viewProps);
|
615
|
-
if (alarmIsOpened) {
|
616
|
-
this.hmGetTopoAlarmByDoc(); // 通知所有告警
|
617
|
-
|
618
|
-
if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
|
619
|
-
this.topo.viewProps.onAlarm(this.getAlarms().map(function (item) {
|
620
|
-
return item.obj;
|
621
|
-
}));
|
622
|
-
}
|
616
|
+
_rlog["default"].debug('过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl', alarmIsOpened, sendAl);
|
617
|
+
|
618
|
+
_context9.prev = 12;
|
619
|
+
_context9.next = 15;
|
620
|
+
return alarmDispatchers.combAlarmData({
|
621
|
+
alarmdata: sendAl
|
622
|
+
});
|
623
623
|
|
624
|
-
|
625
|
-
|
624
|
+
case 15:
|
625
|
+
_yield$alarmDispatche = _context9.sent;
|
626
|
+
eqFlag = _yield$alarmDispatche.eqFlag;
|
627
|
+
alarmlist = _yield$alarmDispatche.alarmlist;
|
628
|
+
|
629
|
+
// console.log("handleAlarmEvent", alarmIsOpened,eqFlag);
|
630
|
+
// console.log("handleAlarmEvent-topo.viewProps", this.topo.viewProps);
|
631
|
+
if (alarmIsOpened) {
|
632
|
+
this.hmGetTopoAlarmByDoc(); // 通知所有告警
|
633
|
+
|
634
|
+
if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
|
635
|
+
this.topo.viewProps.onAlarm(this.getAlarms().map(function (item) {
|
636
|
+
return item.obj;
|
637
|
+
}));
|
638
|
+
}
|
639
|
+
|
640
|
+
if ((_this$topo$viewProps2 = this.topo.viewProps) !== null && _this$topo$viewProps2 !== void 0 && _this$topo$viewProps2.onResourceEvent) {
|
641
|
+
this.topo.viewProps.onResourceEvent(this.getEvents());
|
642
|
+
}
|
626
643
|
}
|
627
|
-
}
|
628
644
|
|
629
|
-
|
630
|
-
|
645
|
+
_context9.next = 24;
|
646
|
+
break;
|
631
647
|
|
632
|
-
|
633
|
-
|
634
|
-
|
648
|
+
case 21:
|
649
|
+
_context9.prev = 21;
|
650
|
+
_context9.t0 = _context9["catch"](12);
|
635
651
|
|
636
|
-
|
652
|
+
_rlog["default"].error('告警发送异常', _context9.t0);
|
637
653
|
|
638
|
-
|
639
|
-
|
640
|
-
|
654
|
+
case 24:
|
655
|
+
case "end":
|
656
|
+
return _context9.stop();
|
657
|
+
}
|
641
658
|
}
|
642
659
|
}, _callee9, this, [[12, 21]]);
|
643
660
|
}));
|