@riil-frontend/component-topology 3.5.0-a.9 → 3.5.2
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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +12 -12
- package/es/components/index.module.scss +3 -114
- package/es/core/components/AlarmListPanel/index.js +7 -12
- package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +8 -5
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +10 -5
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +10 -5
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
- package/es/core/components/TopoView/topoView.js +1 -0
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -140
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +18 -17
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +62 -18
- package/es/core/models/Alarm.js +206 -120
- package/es/core/models/DataModel.js +15 -1
- package/es/core/models/TopoApp.js +4 -6
- package/es/core/models/cache/CiTyeCache.js +4 -0
- package/es/core/models/utils/linkUtils.js +87 -42
- package/es/core/services/index.js +28 -0
- package/es/core/utils/saveSerialize.js +34 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +31 -28
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +44 -43
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +39 -26
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +0 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +143 -0
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +37 -0
- package/es/core/viewer/components/titlebar/BasicTools.js +11 -1
- package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +21 -13
- package/es/hooks/useGraphAlarmDisplay.js +3 -4
- package/es/hooks/useManageStatus.js +1 -1
- package/es/hooks/useTopoEdit.js +200 -144
- package/es/hooks/useTopoEventListener.js +13 -6
- package/es/index.js +3 -2
- package/es/models/topoConfig.js +0 -1
- package/es/models/topoMod.js +15 -10
- package/es/topoCenter/components/Topo404.js +3 -1
- package/es/topoCenter/components/TopoNoPermission.js +3 -1
- package/es/topoCenter/components/TopoView.js +77 -32
- package/es/topoCenter/components/Topology.js +2 -0
- package/es/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +10 -0
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -20
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +12 -6
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +84 -43
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -34
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -19
- package/es/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +157 -0
- package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
- package/es/topoCenter/utils/resourcePermissionUtil.js +18 -12
- package/es/utils/topoData.js +15 -13
- package/lib/components/index.module.scss +3 -114
- package/lib/core/components/AlarmListPanel/index.js +7 -12
- package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +9 -5
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +11 -5
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +12 -5
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
- package/lib/core/components/TopoView/topoView.js +1 -0
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -151
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -16
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +66 -20
- package/lib/core/models/Alarm.js +206 -121
- package/lib/core/models/DataModel.js +15 -1
- package/lib/core/models/TopoApp.js +4 -6
- package/lib/core/models/cache/CiTyeCache.js +4 -0
- package/lib/core/models/utils/linkUtils.js +92 -43
- package/lib/core/services/index.js +29 -0
- package/lib/core/utils/saveSerialize.js +43 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +29 -26
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +45 -43
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +38 -24
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +1 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +155 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +47 -0
- package/lib/core/viewer/components/titlebar/BasicTools.js +11 -1
- package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +22 -15
- package/lib/hooks/useGraphAlarmDisplay.js +3 -5
- package/lib/hooks/useManageStatus.js +1 -1
- package/lib/hooks/useTopoEdit.js +197 -141
- package/lib/hooks/useTopoEventListener.js +13 -6
- package/lib/index.js +5 -0
- package/lib/models/topoConfig.js +0 -1
- package/lib/models/topoMod.js +15 -10
- package/lib/topoCenter/components/Topo404.js +4 -1
- package/lib/topoCenter/components/TopoNoPermission.js +4 -1
- package/lib/topoCenter/components/TopoView.js +78 -33
- package/lib/topoCenter/components/Topology.js +3 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +22 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -21
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +13 -8
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +87 -42
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -37
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -18
- package/lib/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +183 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
- package/lib/topoCenter/utils/resourcePermissionUtil.js +20 -12
- package/lib/utils/topoData.js +15 -13
- package/package.json +5 -5
package/lib/core/models/Alarm.js
CHANGED
|
@@ -7,6 +7,8 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
|
|
10
|
+
var _dialog = _interopRequireDefault(require("@alifd/next/lib/dialog"));
|
|
11
|
+
|
|
10
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
13
|
|
|
12
14
|
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
|
@@ -23,6 +25,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
23
25
|
function Alarm() {
|
|
24
26
|
this.topo = void 0;
|
|
25
27
|
this.currentTopoId = void 0;
|
|
28
|
+
this.secretKey = null;
|
|
26
29
|
this.alarmSwitch = true;
|
|
27
30
|
}
|
|
28
31
|
|
|
@@ -46,7 +49,8 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
46
49
|
/*#__PURE__*/
|
|
47
50
|
function () {
|
|
48
51
|
var _open = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
49
|
-
var
|
|
52
|
+
var _this = this;
|
|
53
|
+
|
|
50
54
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
51
55
|
while (1) {
|
|
52
56
|
switch (_context.prev = _context.next) {
|
|
@@ -59,25 +63,23 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
59
63
|
return _context.abrupt("return");
|
|
60
64
|
|
|
61
65
|
case 2:
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
this.confirmLargeResourceCount(function () {
|
|
67
|
+
// 获得拓扑id
|
|
68
|
+
var id = _this.topo.id;
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return _context.abrupt("return");
|
|
70
|
+
if (!id) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
_rlog["default"].info("Alarm.open 打开告警通道", id); // 订阅告警推送
|
|
74
|
+
_rlog["default"].info("Alarm.open 打开告警通道", id);
|
|
74
75
|
|
|
76
|
+
_this.openTopoAlarm(id); // this.hmGetTopoAlarm(id);
|
|
75
77
|
|
|
76
|
-
this.hmGetTopoAlarm(id); // 打开告警推送通道
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
_this.hmGetTopoAlarmByDoc(id);
|
|
80
|
+
});
|
|
79
81
|
|
|
80
|
-
case
|
|
82
|
+
case 3:
|
|
81
83
|
case "end":
|
|
82
84
|
return _context.stop();
|
|
83
85
|
}
|
|
@@ -115,36 +117,112 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
115
117
|
alarmPanelIsOpen: false
|
|
116
118
|
});
|
|
117
119
|
this.closeTopoAlarm(currentTopoId);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
_proto.getAlarms = function getAlarms() {}
|
|
121
|
-
/**
|
|
122
|
-
* 增加告警
|
|
123
|
-
*/
|
|
120
|
+
} // 资源数量多时确认是否开启
|
|
124
121
|
;
|
|
125
122
|
|
|
126
|
-
_proto.
|
|
123
|
+
_proto.confirmLargeResourceCount = function confirmLargeResourceCount(cb) {
|
|
124
|
+
var nodeCount = this.topo.dataModel.getNodes().length;
|
|
125
|
+
|
|
126
|
+
if (nodeCount < 1500 || this.topo.isEditMode()) {
|
|
127
|
+
cb();
|
|
128
|
+
} else {
|
|
129
|
+
_dialog["default"].confirm({
|
|
130
|
+
title: "提示",
|
|
131
|
+
messageProps: {
|
|
132
|
+
type: "warning"
|
|
133
|
+
},
|
|
134
|
+
content: "该拓扑图上节点较多,继续查询告警可能影响系统整体性能,是否开启告警静默?",
|
|
135
|
+
onCancel: function onCancel() {
|
|
136
|
+
cb();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
127
141
|
/**
|
|
128
|
-
*
|
|
142
|
+
* 查询当前拓扑图有权限资源的告警列表
|
|
143
|
+
*
|
|
144
|
+
* @returns 告警列表
|
|
129
145
|
*/
|
|
130
146
|
;
|
|
131
147
|
|
|
132
|
-
_proto.
|
|
148
|
+
_proto.getAlarms = function getAlarms() {
|
|
149
|
+
var _this$getState = this.getState(),
|
|
150
|
+
ciAlarmsMap = _this$getState.alarmDoc;
|
|
133
151
|
|
|
134
|
-
|
|
135
|
-
var
|
|
136
|
-
|
|
152
|
+
var cis = this.topo.dataModel.getCis();
|
|
153
|
+
var alarms = [];
|
|
154
|
+
cis.filter(function (ci) {
|
|
155
|
+
var _ci$permission;
|
|
156
|
+
|
|
157
|
+
return (_ci$permission = ci.permission) === null || _ci$permission === void 0 ? void 0 : _ci$permission.readable;
|
|
158
|
+
}).forEach(function (ci) {
|
|
159
|
+
var _alarms;
|
|
137
160
|
|
|
161
|
+
var ciAlarms = ciAlarmsMap[ci.id] || [];
|
|
162
|
+
|
|
163
|
+
(_alarms = alarms).push.apply(_alarms, ciAlarms);
|
|
164
|
+
}); // 按告警由高到低、产生时间从后到前
|
|
165
|
+
|
|
166
|
+
alarms = alarms.sort(function (a, b) {
|
|
167
|
+
return a.obj.createTime - b.obj.createTime;
|
|
168
|
+
}).sort(function (a, b) {
|
|
169
|
+
return a.level > b.level ? 1 : -1;
|
|
170
|
+
});
|
|
171
|
+
return alarms;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
_proto.hmGetTopoAlarmByDoc = /*#__PURE__*/function () {
|
|
175
|
+
var _hmGetTopoAlarmByDoc = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(id) {
|
|
176
|
+
var result, alarms;
|
|
138
177
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
139
178
|
while (1) {
|
|
140
179
|
switch (_context2.prev = _context2.next) {
|
|
141
180
|
case 0:
|
|
142
|
-
|
|
143
|
-
|
|
181
|
+
result = this.getAlarms();
|
|
182
|
+
|
|
183
|
+
_rlog["default"].debug("hmGetTopoAlarmByDoc", result);
|
|
144
184
|
|
|
145
|
-
|
|
185
|
+
alarms = result.map(function (item) {
|
|
186
|
+
return item.obj;
|
|
187
|
+
});
|
|
188
|
+
this.updateState({
|
|
189
|
+
alarmData: alarms.length > 0 ? alarms : [],
|
|
190
|
+
alarmPanelIsOpen: alarms.length > 0
|
|
191
|
+
});
|
|
146
192
|
|
|
147
|
-
|
|
193
|
+
case 4:
|
|
194
|
+
case "end":
|
|
195
|
+
return _context2.stop();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}, _callee2, this);
|
|
199
|
+
}));
|
|
200
|
+
|
|
201
|
+
function hmGetTopoAlarmByDoc(_x) {
|
|
202
|
+
return _hmGetTopoAlarmByDoc.apply(this, arguments);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return hmGetTopoAlarmByDoc;
|
|
206
|
+
}();
|
|
207
|
+
|
|
208
|
+
_proto.hmGetTopoAlarm = /*#__PURE__*/function () {
|
|
209
|
+
var _hmGetTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(id) {
|
|
210
|
+
var _this$topo$store$getS, data, resAndMetrics, topoData, _this$getState2, alarmIsOpened, alarmOpening, nodeIdsList, linkIdsList, resIdsList, mainCiIdList, endTime, startTime, parms, result;
|
|
211
|
+
|
|
212
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
213
|
+
while (1) {
|
|
214
|
+
switch (_context3.prev = _context3.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
_this$topo$store$getS = this.topo.store.getState().topoMod, data = _this$topo$store$getS.data, resAndMetrics = _this$topo$store$getS.resAndMetrics, topoData = _this$topo$store$getS.topoData;
|
|
217
|
+
_this$getState2 = this.getState(), alarmIsOpened = _this$getState2.alarmIsOpened, alarmOpening = _this$getState2.alarmOpening; // const { nodes, links } = data;
|
|
218
|
+
|
|
219
|
+
nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList, resIdsList = resAndMetrics.resIdsList; // rlog.debug(
|
|
220
|
+
// "获取告警列表--resAndMetrics,topoData,data",
|
|
221
|
+
// this.topo,
|
|
222
|
+
// resAndMetrics,
|
|
223
|
+
// topoData,
|
|
224
|
+
// data
|
|
225
|
+
// );
|
|
148
226
|
|
|
149
227
|
mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
|
|
150
228
|
return !!ci.operation;
|
|
@@ -154,7 +232,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
154
232
|
});
|
|
155
233
|
|
|
156
234
|
if (!(mainCiIdList.length === 0)) {
|
|
157
|
-
|
|
235
|
+
_context3.next = 7;
|
|
158
236
|
break;
|
|
159
237
|
}
|
|
160
238
|
|
|
@@ -162,11 +240,10 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
162
240
|
alarmData: [],
|
|
163
241
|
alarmPanelIsOpen: false
|
|
164
242
|
});
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
case 8:
|
|
168
|
-
_rlog["default"].debug("获取告警列表", mainCiIdList);
|
|
243
|
+
return _context3.abrupt("return");
|
|
169
244
|
|
|
245
|
+
case 7:
|
|
246
|
+
//rlog.debug("获取告警列表", mainCiIdList);
|
|
170
247
|
endTime = null; // new Date().valueOf();
|
|
171
248
|
|
|
172
249
|
startTime = null; // moment().subtract(1, "months").valueOf();
|
|
@@ -178,38 +255,43 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
178
255
|
pageSize: 10,
|
|
179
256
|
sortField: "alertLevel",
|
|
180
257
|
alertLevelList: [],
|
|
181
|
-
|
|
258
|
+
orders: [{
|
|
259
|
+
property: "alertLevel",
|
|
260
|
+
direction: "ASC"
|
|
261
|
+
}, {
|
|
262
|
+
property: "createTime",
|
|
263
|
+
direction: "DESC"
|
|
264
|
+
}],
|
|
182
265
|
createTime: {
|
|
183
266
|
startTime: startTime,
|
|
184
267
|
endTime: endTime
|
|
185
268
|
}
|
|
186
269
|
};
|
|
187
|
-
|
|
270
|
+
_context3.next = 12;
|
|
188
271
|
return _topo["default"].getAlarmByIds(parms);
|
|
189
272
|
|
|
190
|
-
case
|
|
191
|
-
result =
|
|
273
|
+
case 12:
|
|
274
|
+
result = _context3.sent;
|
|
192
275
|
|
|
193
276
|
_rlog["default"].debug("getAlarmById-result", result); // if (alarmIsOpened) {
|
|
194
277
|
// //this.topo.loadAlarm(result.datas);
|
|
195
278
|
// this.handleAlarmEvent({ type: "alarm", data: result.datas });
|
|
196
279
|
// }
|
|
280
|
+
// this.updateState({
|
|
281
|
+
// alarmData: result.datas.length > 0 ? result.datas : [],
|
|
282
|
+
// alarmPanelIsOpen: result.datas.length > 0,
|
|
283
|
+
// });
|
|
197
284
|
|
|
198
285
|
|
|
199
|
-
|
|
200
|
-
alarmData: result.datas.length > 0 ? result.datas : [],
|
|
201
|
-
alarmPanelIsOpen: result.datas.length > 0
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
case 17:
|
|
286
|
+
case 14:
|
|
205
287
|
case "end":
|
|
206
|
-
return
|
|
288
|
+
return _context3.stop();
|
|
207
289
|
}
|
|
208
290
|
}
|
|
209
|
-
},
|
|
291
|
+
}, _callee3, this);
|
|
210
292
|
}));
|
|
211
293
|
|
|
212
|
-
function hmGetTopoAlarm(
|
|
294
|
+
function hmGetTopoAlarm(_x2) {
|
|
213
295
|
return _hmGetTopoAlarm.apply(this, arguments);
|
|
214
296
|
}
|
|
215
297
|
|
|
@@ -224,10 +306,10 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
224
306
|
_proto.setAlarmDataByMock =
|
|
225
307
|
/*#__PURE__*/
|
|
226
308
|
function () {
|
|
227
|
-
var _setAlarmDataByMock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
228
|
-
return _regenerator["default"].wrap(function
|
|
309
|
+
var _setAlarmDataByMock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(datas) {
|
|
310
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
229
311
|
while (1) {
|
|
230
|
-
switch (
|
|
312
|
+
switch (_context4.prev = _context4.next) {
|
|
231
313
|
case 0:
|
|
232
314
|
this.updateState({
|
|
233
315
|
alarmData: datas.length > 0 ? datas : [],
|
|
@@ -236,13 +318,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
236
318
|
|
|
237
319
|
case 1:
|
|
238
320
|
case "end":
|
|
239
|
-
return
|
|
321
|
+
return _context4.stop();
|
|
240
322
|
}
|
|
241
323
|
}
|
|
242
|
-
},
|
|
324
|
+
}, _callee4, this);
|
|
243
325
|
}));
|
|
244
326
|
|
|
245
|
-
function setAlarmDataByMock(
|
|
327
|
+
function setAlarmDataByMock(_x3) {
|
|
246
328
|
return _setAlarmDataByMock.apply(this, arguments);
|
|
247
329
|
}
|
|
248
330
|
|
|
@@ -257,11 +339,11 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
257
339
|
_proto.switchAlarmPopPanel =
|
|
258
340
|
/*#__PURE__*/
|
|
259
341
|
function () {
|
|
260
|
-
var _switchAlarmPopPanel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
342
|
+
var _switchAlarmPopPanel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(flag) {
|
|
261
343
|
var topoDispatchers;
|
|
262
|
-
return _regenerator["default"].wrap(function
|
|
344
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
263
345
|
while (1) {
|
|
264
|
-
switch (
|
|
346
|
+
switch (_context5.prev = _context5.next) {
|
|
265
347
|
case 0:
|
|
266
348
|
console.log("switchAlarmPopPanel", flag);
|
|
267
349
|
topoDispatchers = this.topo.store.getModelDispatchers("topoAlarm");
|
|
@@ -271,13 +353,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
271
353
|
|
|
272
354
|
case 3:
|
|
273
355
|
case "end":
|
|
274
|
-
return
|
|
356
|
+
return _context5.stop();
|
|
275
357
|
}
|
|
276
358
|
}
|
|
277
|
-
},
|
|
359
|
+
}, _callee5, this);
|
|
278
360
|
}));
|
|
279
361
|
|
|
280
|
-
function switchAlarmPopPanel(
|
|
362
|
+
function switchAlarmPopPanel(_x4) {
|
|
281
363
|
return _switchAlarmPopPanel.apply(this, arguments);
|
|
282
364
|
}
|
|
283
365
|
|
|
@@ -293,24 +375,24 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
293
375
|
_proto.openTopoAlarm =
|
|
294
376
|
/*#__PURE__*/
|
|
295
377
|
function () {
|
|
296
|
-
var _openTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
297
|
-
var
|
|
378
|
+
var _openTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id) {
|
|
379
|
+
var _this2 = this;
|
|
298
380
|
|
|
299
|
-
var _this$
|
|
381
|
+
var _this$getState3, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
|
300
382
|
|
|
301
|
-
return _regenerator["default"].wrap(function
|
|
383
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
302
384
|
while (1) {
|
|
303
|
-
switch (
|
|
385
|
+
switch (_context6.prev = _context6.next) {
|
|
304
386
|
case 0:
|
|
305
387
|
// 如果当前拓扑图开启中或已开启则退出
|
|
306
|
-
_this$
|
|
388
|
+
_this$getState3 = this.getState(), alarmOpening = _this$getState3.alarmOpening, topoAlarmIsOpen = _this$getState3.topoAlarmIsOpen;
|
|
307
389
|
|
|
308
390
|
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
|
309
|
-
|
|
391
|
+
_context6.next = 3;
|
|
310
392
|
break;
|
|
311
393
|
}
|
|
312
394
|
|
|
313
|
-
return
|
|
395
|
+
return _context6.abrupt("return");
|
|
314
396
|
|
|
315
397
|
case 3:
|
|
316
398
|
this.currentTopoId = id;
|
|
@@ -318,19 +400,21 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
318
400
|
alarmOpening: true
|
|
319
401
|
});
|
|
320
402
|
alarmDispatchers = this.topo.store.getModelDispatchers("topoAlarm");
|
|
321
|
-
|
|
403
|
+
_context6.next = 8;
|
|
322
404
|
return alarmDispatchers.resetAlarmDoc();
|
|
323
405
|
|
|
324
406
|
case 8:
|
|
325
|
-
|
|
407
|
+
_context6.next = 10;
|
|
326
408
|
return _topo["default"].openTopoAlarm(id);
|
|
327
409
|
|
|
328
410
|
case 10:
|
|
411
|
+
this.secretKey = _context6.sent;
|
|
412
|
+
|
|
329
413
|
// rlog.debug("openTopoAlarm 获取初始化告警-------------------开始");
|
|
330
414
|
_componentRiilEventEmitter.EE.on("topo", "topo", function (data, other) {
|
|
331
415
|
_rlog["default"].debug("openTopoAlarm 获取初始化告警------收到信息", data);
|
|
332
416
|
|
|
333
|
-
|
|
417
|
+
_this2.handleAlarmEvent(data);
|
|
334
418
|
});
|
|
335
419
|
|
|
336
420
|
this.updateState({
|
|
@@ -338,15 +422,15 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
338
422
|
alarmIsOpened: true
|
|
339
423
|
});
|
|
340
424
|
|
|
341
|
-
case
|
|
425
|
+
case 13:
|
|
342
426
|
case "end":
|
|
343
|
-
return
|
|
427
|
+
return _context6.stop();
|
|
344
428
|
}
|
|
345
429
|
}
|
|
346
|
-
},
|
|
430
|
+
}, _callee6, this);
|
|
347
431
|
}));
|
|
348
432
|
|
|
349
|
-
function openTopoAlarm(
|
|
433
|
+
function openTopoAlarm(_x5) {
|
|
350
434
|
return _openTopoAlarm.apply(this, arguments);
|
|
351
435
|
}
|
|
352
436
|
|
|
@@ -362,22 +446,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
362
446
|
_proto.closeTopoAlarm =
|
|
363
447
|
/*#__PURE__*/
|
|
364
448
|
function () {
|
|
365
|
-
var _closeTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
366
|
-
var _this$
|
|
449
|
+
var _closeTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(id) {
|
|
450
|
+
var _this$getState4, alarmIsOpened, alarmOpening;
|
|
367
451
|
|
|
368
|
-
return _regenerator["default"].wrap(function
|
|
452
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
369
453
|
while (1) {
|
|
370
|
-
switch (
|
|
454
|
+
switch (_context7.prev = _context7.next) {
|
|
371
455
|
case 0:
|
|
372
456
|
// 如果未开启则退出
|
|
373
|
-
_this$
|
|
457
|
+
_this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened, alarmOpening = _this$getState4.alarmOpening;
|
|
374
458
|
|
|
375
459
|
if (!(!alarmIsOpened && !alarmOpening)) {
|
|
376
|
-
|
|
460
|
+
_context7.next = 3;
|
|
377
461
|
break;
|
|
378
462
|
}
|
|
379
463
|
|
|
380
|
-
return
|
|
464
|
+
return _context7.abrupt("return");
|
|
381
465
|
|
|
382
466
|
case 3:
|
|
383
467
|
this.currentTopoId = null;
|
|
@@ -391,18 +475,18 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
391
475
|
alarmOpening: false,
|
|
392
476
|
alarmPanelIsOpen: false
|
|
393
477
|
});
|
|
394
|
-
|
|
395
|
-
return _topo["default"].closeTopoAlarm(id);
|
|
478
|
+
_context7.next = 9;
|
|
479
|
+
return _topo["default"].closeTopoAlarm(id, this.secretKey);
|
|
396
480
|
|
|
397
481
|
case 9:
|
|
398
482
|
case "end":
|
|
399
|
-
return
|
|
483
|
+
return _context7.stop();
|
|
400
484
|
}
|
|
401
485
|
}
|
|
402
|
-
},
|
|
486
|
+
}, _callee7, this);
|
|
403
487
|
}));
|
|
404
488
|
|
|
405
|
-
function closeTopoAlarm(
|
|
489
|
+
function closeTopoAlarm(_x6) {
|
|
406
490
|
return _closeTopoAlarm.apply(this, arguments);
|
|
407
491
|
}
|
|
408
492
|
|
|
@@ -427,22 +511,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
427
511
|
_proto.restart =
|
|
428
512
|
/*#__PURE__*/
|
|
429
513
|
function () {
|
|
430
|
-
var _restart = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
514
|
+
var _restart = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
431
515
|
var id;
|
|
432
|
-
return _regenerator["default"].wrap(function
|
|
516
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
433
517
|
while (1) {
|
|
434
|
-
switch (
|
|
518
|
+
switch (_context8.prev = _context8.next) {
|
|
435
519
|
case 0:
|
|
436
520
|
id = this.currentTopoId;
|
|
437
|
-
|
|
521
|
+
_context8.next = 3;
|
|
438
522
|
return this.openTopoAlarm(id);
|
|
439
523
|
|
|
440
524
|
case 3:
|
|
441
525
|
case "end":
|
|
442
|
-
return
|
|
526
|
+
return _context8.stop();
|
|
443
527
|
}
|
|
444
528
|
}
|
|
445
|
-
},
|
|
529
|
+
}, _callee8, this);
|
|
446
530
|
}));
|
|
447
531
|
|
|
448
532
|
function restart() {
|
|
@@ -459,14 +543,14 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
459
543
|
_proto.handleAlarmEvent =
|
|
460
544
|
/*#__PURE__*/
|
|
461
545
|
function () {
|
|
462
|
-
var _handleAlarmEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
463
|
-
var _this$
|
|
546
|
+
var _handleAlarmEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(alertData) {
|
|
547
|
+
var _this$getState5, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist, _this$topo$viewProps;
|
|
464
548
|
|
|
465
|
-
return _regenerator["default"].wrap(function
|
|
549
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
466
550
|
while (1) {
|
|
467
|
-
switch (
|
|
551
|
+
switch (_context9.prev = _context9.next) {
|
|
468
552
|
case 0:
|
|
469
|
-
_this$
|
|
553
|
+
_this$getState5 = this.getState(), alarmIsOpened = _this$getState5.alarmIsOpened;
|
|
470
554
|
resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
|
|
471
555
|
resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
|
|
472
556
|
alarmDispatchers = this.topo.store.getModelDispatchers("topoAlarm"); // 添加事件
|
|
@@ -474,7 +558,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
474
558
|
console.log("handleAlarmEvent-接收到推送的原始告警信息", alertData);
|
|
475
559
|
|
|
476
560
|
if (!((0, _utils.isAvailableArray)(alertData) && (0, _utils.isAvailableArray)(resIdsList))) {
|
|
477
|
-
|
|
561
|
+
_context9.next = 25;
|
|
478
562
|
break;
|
|
479
563
|
}
|
|
480
564
|
|
|
@@ -496,7 +580,9 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
496
580
|
alertId: item.alertId,
|
|
497
581
|
status: item.status,
|
|
498
582
|
obj: item,
|
|
499
|
-
info: item.alertType
|
|
583
|
+
info: item.alertType,
|
|
584
|
+
ciCode: item === null || item === void 0 ? void 0 : item.ciCode,
|
|
585
|
+
ruleId: item === null || item === void 0 ? void 0 : item.ruleId
|
|
500
586
|
};
|
|
501
587
|
|
|
502
588
|
if (resIdsList.indexOf(ciId) >= 0 && operations.indexOf(ciId) < 0) {
|
|
@@ -507,52 +593,51 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
507
593
|
}); // rlog.debug("before-combAlarmData", al, bizState);
|
|
508
594
|
|
|
509
595
|
if (!(sendAl.length > 0)) {
|
|
510
|
-
|
|
596
|
+
_context9.next = 25;
|
|
511
597
|
break;
|
|
512
598
|
}
|
|
513
599
|
|
|
514
600
|
_rlog["default"].debug("过滤掉非本拓扑的告警信息 告警开关-推送告警到ht-alarmIsOpened-sendAl", alarmIsOpened, sendAl);
|
|
515
601
|
|
|
516
|
-
|
|
517
|
-
|
|
602
|
+
_context9.prev = 13;
|
|
603
|
+
_context9.next = 16;
|
|
518
604
|
return alarmDispatchers.combAlarmData({
|
|
519
605
|
alarmdata: sendAl
|
|
520
606
|
});
|
|
521
607
|
|
|
522
608
|
case 16:
|
|
523
|
-
_yield$alarmDispatche =
|
|
609
|
+
_yield$alarmDispatche = _context9.sent;
|
|
524
610
|
eqFlag = _yield$alarmDispatche.eqFlag;
|
|
525
611
|
alarmlist = _yield$alarmDispatche.alarmlist;
|
|
526
612
|
|
|
527
|
-
if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
|
|
528
|
-
// 通知所有告警
|
|
529
|
-
this.topo.viewProps.onAlarm(sendAl.map(function (item) {
|
|
530
|
-
return item.obj;
|
|
531
|
-
}));
|
|
532
|
-
}
|
|
533
|
-
|
|
534
613
|
if (alarmIsOpened && !eqFlag) {
|
|
535
|
-
this.
|
|
614
|
+
this.hmGetTopoAlarmByDoc(); // 通知所有告警
|
|
615
|
+
|
|
616
|
+
if ((_this$topo$viewProps = this.topo.viewProps) !== null && _this$topo$viewProps !== void 0 && _this$topo$viewProps.onAlarm) {
|
|
617
|
+
this.topo.viewProps.onAlarm(this.getAlarms().map(function (item) {
|
|
618
|
+
return item.obj;
|
|
619
|
+
}));
|
|
620
|
+
}
|
|
536
621
|
}
|
|
537
622
|
|
|
538
|
-
|
|
623
|
+
_context9.next = 25;
|
|
539
624
|
break;
|
|
540
625
|
|
|
541
|
-
case
|
|
542
|
-
|
|
543
|
-
|
|
626
|
+
case 22:
|
|
627
|
+
_context9.prev = 22;
|
|
628
|
+
_context9.t0 = _context9["catch"](13);
|
|
544
629
|
|
|
545
|
-
_rlog["default"].error("告警发送异常",
|
|
630
|
+
_rlog["default"].error("告警发送异常", _context9.t0);
|
|
546
631
|
|
|
547
|
-
case
|
|
632
|
+
case 25:
|
|
548
633
|
case "end":
|
|
549
|
-
return
|
|
634
|
+
return _context9.stop();
|
|
550
635
|
}
|
|
551
636
|
}
|
|
552
|
-
},
|
|
637
|
+
}, _callee9, this, [[13, 22]]);
|
|
553
638
|
}));
|
|
554
639
|
|
|
555
|
-
function handleAlarmEvent(
|
|
640
|
+
function handleAlarmEvent(_x7) {
|
|
556
641
|
return _handleAlarmEvent.apply(this, arguments);
|
|
557
642
|
}
|
|
558
643
|
|
|
@@ -40,13 +40,27 @@ var DataModel = /*#__PURE__*/function () {
|
|
|
40
40
|
return [];
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
_proto.
|
|
43
|
+
_proto.getCis = function getCis() {
|
|
44
|
+
var datas = this.getDatas();
|
|
45
|
+
return datas.filter(function (item) {
|
|
46
|
+
return item.type !== 'group';
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_proto.useCis = function useCis() {
|
|
44
51
|
var datas = this.useDatas();
|
|
45
52
|
return datas.filter(function (item) {
|
|
46
53
|
return item.type !== 'group';
|
|
47
54
|
});
|
|
48
55
|
};
|
|
49
56
|
|
|
57
|
+
_proto.useDataById = function useDataById(id) {
|
|
58
|
+
var datas = this.useDatas();
|
|
59
|
+
return datas.filter(function (item) {
|
|
60
|
+
return item.id === id;
|
|
61
|
+
})[0];
|
|
62
|
+
};
|
|
63
|
+
|
|
50
64
|
_proto.getDataById = function getDataById(id) {
|
|
51
65
|
return this.getDatas().find(function (item) {
|
|
52
66
|
return item.id === id;
|
|
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
|
|
|
48
48
|
var _topoFactory = _interopRequireDefault(require("./topoFactory"));
|
|
49
49
|
|
|
50
50
|
// eslint-disable-next-line no-undef
|
|
51
|
-
var version = typeof "3.5.
|
|
51
|
+
var version = typeof "3.5.2" === 'string' ? "3.5.2" : null;
|
|
52
52
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
53
53
|
/**
|
|
54
54
|
* 拓扑显示和编辑
|
|
@@ -551,7 +551,7 @@ var Topo = /*#__PURE__*/function () {
|
|
|
551
551
|
/*#__PURE__*/
|
|
552
552
|
function () {
|
|
553
553
|
var _enterEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
554
|
-
var topoDispatchers,
|
|
554
|
+
var topoDispatchers, iconManageDispatchers;
|
|
555
555
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
556
556
|
while (1) {
|
|
557
557
|
switch (_context12.prev = _context12.next) {
|
|
@@ -579,8 +579,6 @@ var Topo = /*#__PURE__*/function () {
|
|
|
579
579
|
|
|
580
580
|
case 9:
|
|
581
581
|
(0, _edgeUtil.updateEdgeExpanded)(this);
|
|
582
|
-
editDispatchers = this.store.getModelDispatchers('topoConfig');
|
|
583
|
-
editDispatchers.switchToEditMode();
|
|
584
582
|
|
|
585
583
|
if (this.options.onSwitchToEditMode) {
|
|
586
584
|
this.options.onSwitchToEditMode(this);
|
|
@@ -590,7 +588,7 @@ var Topo = /*#__PURE__*/function () {
|
|
|
590
588
|
iconManageDispatchers = this.store.getModelDispatchers('customIcon');
|
|
591
589
|
iconManageDispatchers.loadEditorIcons();
|
|
592
590
|
|
|
593
|
-
case
|
|
591
|
+
case 13:
|
|
594
592
|
case "end":
|
|
595
593
|
return _context12.stop();
|
|
596
594
|
}
|
|
@@ -667,7 +665,7 @@ var Topo = /*#__PURE__*/function () {
|
|
|
667
665
|
return triggerSaveEvent;
|
|
668
666
|
}()
|
|
669
667
|
/**
|
|
670
|
-
*
|
|
668
|
+
* FIXME 待优化,移除该接口,由ht提供原子接口获取相关数据
|
|
671
669
|
*/
|
|
672
670
|
;
|
|
673
671
|
|