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