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