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