@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/es/core/models/Alarm.js
CHANGED
@@ -9,6 +9,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
9
9
|
function Alarm() {
|
10
10
|
this.topo = void 0;
|
11
11
|
this.currentTopoId = void 0;
|
12
|
+
// 告警通道id
|
12
13
|
this.secretKey = null;
|
13
14
|
this.alarmSwitch = true;
|
14
15
|
}
|
@@ -37,33 +38,31 @@ var Alarm = /*#__PURE__*/function () {
|
|
37
38
|
|
38
39
|
var nodeCount;
|
39
40
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
40
|
-
while (1) {
|
41
|
-
|
42
|
-
|
43
|
-
this.resetData();
|
44
|
-
|
45
|
-
if (!(!this.isEnabled() || this.topo.isEditMode())) {
|
46
|
-
_context.next = 3;
|
47
|
-
break;
|
48
|
-
}
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
42
|
+
case 0:
|
43
|
+
this.resetData();
|
49
44
|
|
50
|
-
|
45
|
+
if (!(!this.isEnabled() || this.topo.isEditMode())) {
|
46
|
+
_context.next = 3;
|
47
|
+
break;
|
48
|
+
}
|
51
49
|
|
52
|
-
|
53
|
-
nodeCount = this.topo.dataModel.getNodes().length;
|
50
|
+
return _context.abrupt("return");
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
} else {
|
58
|
-
this.confirmOpenWhenLargeResource(function () {
|
59
|
-
_this.doOpen();
|
60
|
-
});
|
61
|
-
}
|
52
|
+
case 3:
|
53
|
+
nodeCount = this.topo.dataModel.getNodes().length;
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
55
|
+
if (nodeCount < 1500) {
|
56
|
+
this.doOpen();
|
57
|
+
} else {
|
58
|
+
this.confirmOpenWhenLargeResource(function () {
|
59
|
+
_this.doOpen();
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
63
|
+
case 5:
|
64
|
+
case "end":
|
65
|
+
return _context.stop();
|
67
66
|
}
|
68
67
|
}, _callee, this);
|
69
68
|
}));
|
@@ -182,29 +181,27 @@ var Alarm = /*#__PURE__*/function () {
|
|
182
181
|
var result, alarms, state, _this$topo$store$getM, alarmListDefaultOpen;
|
183
182
|
|
184
183
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
185
|
-
while (1) {
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
return _context2.stop();
|
207
|
-
}
|
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();
|
208
205
|
}
|
209
206
|
}, _callee2, this);
|
210
207
|
}));
|
@@ -220,70 +217,68 @@ var Alarm = /*#__PURE__*/function () {
|
|
220
217
|
var _hmGetTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
221
218
|
var mainCiIdList, endTime, startTime, parms, result;
|
222
219
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
223
|
-
while (1) {
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
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
|
236
263
|
}
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
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
|
-
}
|
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();
|
287
282
|
}
|
288
283
|
}, _callee3, this);
|
289
284
|
}));
|
@@ -305,18 +300,16 @@ var Alarm = /*#__PURE__*/function () {
|
|
305
300
|
function () {
|
306
301
|
var _setAlarmDataByMock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(datas) {
|
307
302
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
308
|
-
while (1) {
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
return _context4.stop();
|
319
|
-
}
|
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();
|
320
313
|
}
|
321
314
|
}, _callee4, this);
|
322
315
|
}));
|
@@ -339,19 +332,17 @@ var Alarm = /*#__PURE__*/function () {
|
|
339
332
|
var _switchAlarmPopPanel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(flag) {
|
340
333
|
var topoDispatchers;
|
341
334
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
342
|
-
while (1) {
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
return _context5.stop();
|
354
|
-
}
|
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();
|
355
346
|
}
|
356
347
|
}, _callee5, this);
|
357
348
|
}));
|
@@ -376,55 +367,53 @@ var Alarm = /*#__PURE__*/function () {
|
|
376
367
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
377
368
|
|
378
369
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
379
|
-
while (1) {
|
380
|
-
|
381
|
-
|
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
|
-
}
|
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;
|
389
374
|
|
390
|
-
|
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;
|
375
|
+
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
376
|
+
_context6.next = 3;
|
414
377
|
break;
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
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();
|
428
417
|
}
|
429
418
|
}, _callee6, this, [[8, 16]]);
|
430
419
|
}));
|
@@ -449,34 +438,32 @@ var Alarm = /*#__PURE__*/function () {
|
|
449
438
|
var _this$getState3, alarmIsOpened, alarmOpening;
|
450
439
|
|
451
440
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
452
|
-
while (1) {
|
453
|
-
|
454
|
-
|
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
|
-
}
|
462
|
-
|
463
|
-
return _context7.abrupt("return");
|
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;
|
464
445
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
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();
|
480
467
|
}
|
481
468
|
}, _callee7, this);
|
482
469
|
}));
|
@@ -509,17 +496,15 @@ var Alarm = /*#__PURE__*/function () {
|
|
509
496
|
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
510
497
|
var id;
|
511
498
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
512
|
-
while (1) {
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
return _context8.stop();
|
522
|
-
}
|
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();
|
523
508
|
}
|
524
509
|
}, _callee8, this);
|
525
510
|
}));
|
@@ -539,96 +524,94 @@ var Alarm = /*#__PURE__*/function () {
|
|
539
524
|
/*#__PURE__*/
|
540
525
|
function () {
|
541
526
|
var _handleAlarmEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(alertData) {
|
542
|
-
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$
|
527
|
+
var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche2, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
|
543
528
|
|
544
529
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
545
|
-
while (1) {
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
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);
|
557
549
|
}
|
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
|
+
};
|
558
565
|
|
559
|
-
|
560
|
-
|
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;
|
566
|
+
if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
|
567
|
+
sendAl.push(obj);
|
590
568
|
}
|
569
|
+
}); // console.log("before-combAlarmData", sendAl, idsList);
|
591
570
|
|
592
|
-
|
593
|
-
_context9.
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
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
|
+
}
|
598
598
|
|
599
|
-
|
600
|
-
|
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
|
-
}
|
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());
|
618
601
|
}
|
602
|
+
}
|
619
603
|
|
620
|
-
|
621
|
-
|
604
|
+
_context9.next = 24;
|
605
|
+
break;
|
622
606
|
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
607
|
+
case 21:
|
608
|
+
_context9.prev = 21;
|
609
|
+
_context9.t0 = _context9["catch"](12);
|
610
|
+
rlog.error('告警发送异常', _context9.t0);
|
627
611
|
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
}
|
612
|
+
case 24:
|
613
|
+
case "end":
|
614
|
+
return _context9.stop();
|
632
615
|
}
|
633
616
|
}, _callee9, this, [[12, 21]]);
|
634
617
|
}));
|