@riil-frontend/component-topology 2.12.7-alpha.21 → 2.12.7-alpha.25
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/index.css +1 -1
- package/build/index.js +9 -9
- package/es/core/components/AlarmListPanel/components/AlarmListItem.js +2 -3
- package/es/core/components/AlarmListPanel/index.js +16 -8
- package/es/core/editor/components/settings/common/LayoutSettings.module.scss +3 -3
- package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +2 -2
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +1 -1
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/RelateData.js +3 -3
- package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +20 -5
- package/es/core/models/common/Alarm.js +89 -34
- package/es/core/models/common/mocks/index.js +39 -0
- package/es/hooks/useAlarm.js +33 -17
- package/es/hooks/useTopoEdit.js +2 -2
- package/es/models/topoAlarm.js +3 -2
- package/es/models/topoMod.js +2 -2
- package/es/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +1 -1
- package/es/utils/htElementUtils.js +8 -7
- package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +1 -2
- package/lib/core/components/AlarmListPanel/index.js +15 -7
- package/lib/core/editor/components/settings/common/LayoutSettings.module.scss +3 -3
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +1 -1
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +1 -1
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/RelateData.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +21 -5
- package/lib/core/models/common/Alarm.js +93 -32
- package/lib/core/models/common/mocks/index.js +44 -0
- package/lib/hooks/useAlarm.js +29 -13
- package/lib/hooks/useTopoEdit.js +1 -1
- package/lib/models/topoAlarm.js +2 -1
- package/lib/models/topoMod.js +2 -2
- package/lib/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +1 -1
- package/lib/utils/htElementUtils.js +9 -8
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _List from "@alifd/next/es/list";
|
|
2
2
|
import _Icon from "@alifd/next/es/icon";
|
|
3
3
|
import React, { useState, useEffect } from "react";
|
|
4
|
-
import { Link } from
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
5
5
|
import styles from "./index.module.scss";
|
|
6
6
|
import { PAGE_TYPE } from "../constants/uicbb";
|
|
7
7
|
|
|
@@ -9,11 +9,10 @@ function AlarmListItem(props) {
|
|
|
9
9
|
// 传入参数
|
|
10
10
|
var topo = props.topo,
|
|
11
11
|
alarmInfo = props.alarmInfo;
|
|
12
|
-
console.log("AlarmListPanel-AlarmListItem", alarmInfo);
|
|
13
12
|
return /*#__PURE__*/React.createElement(_List.Item, {
|
|
14
13
|
className: styles.AlarmListItem,
|
|
15
14
|
media: /*#__PURE__*/React.createElement(_Icon, {
|
|
16
|
-
type: "
|
|
15
|
+
type: "gaojing-3",
|
|
17
16
|
size: "xs",
|
|
18
17
|
className: styles["alarm-color-icon"] + " alarm-color-icon-lv" + alarmInfo.alertLevel
|
|
19
18
|
})
|
|
@@ -2,7 +2,7 @@ import _Dialog from "@alifd/next/es/dialog";
|
|
|
2
2
|
import _List from "@alifd/next/es/list";
|
|
3
3
|
import React, { useState, useEffect } from "react";
|
|
4
4
|
import AlarmListItem from "./components/AlarmListItem";
|
|
5
|
-
import { Link } from
|
|
5
|
+
import { Link } from "react-router-dom";
|
|
6
6
|
import styles from "./index.module.scss";
|
|
7
7
|
import { alarmListDemo } from "./mocks";
|
|
8
8
|
|
|
@@ -11,27 +11,35 @@ function AlarmListPanel(props, ref) {
|
|
|
11
11
|
var topo = props.topo,
|
|
12
12
|
topoState = props.topoState,
|
|
13
13
|
visible = props.visible;
|
|
14
|
-
var
|
|
15
|
-
|
|
14
|
+
var alarm = topo.alarm;
|
|
15
|
+
|
|
16
|
+
var _alarm$getState = alarm.getState(),
|
|
17
|
+
alarmData = _alarm$getState.alarmData;
|
|
16
18
|
|
|
17
19
|
var onClose = function onClose() {
|
|
18
20
|
topo.switchAlarmPopPanel(false);
|
|
19
21
|
};
|
|
20
22
|
|
|
21
|
-
var _useState = useState(
|
|
23
|
+
var _useState = useState(alarmListDemo),
|
|
22
24
|
alarmList = _useState[0],
|
|
23
25
|
setAlarmList = _useState[1];
|
|
24
26
|
|
|
25
27
|
useEffect(function () {
|
|
26
|
-
topo.switchAlarmPopPanel(alarm.
|
|
28
|
+
topo.switchAlarmPopPanel(alarm.alarmIsOpened && (alarmList === null || alarmList === void 0 ? void 0 : alarmList.length) > 0);
|
|
27
29
|
}, []);
|
|
28
30
|
useEffect(function () {
|
|
29
|
-
console.log("AlarmListPanel-useEffect",
|
|
31
|
+
console.log("AlarmListPanel-useEffect", topo, alarmData);
|
|
30
32
|
|
|
31
33
|
if (alarm.alarmSwitch) {
|
|
32
|
-
|
|
34
|
+
if (alarmData) {
|
|
35
|
+
var _alarmData$slice;
|
|
36
|
+
|
|
37
|
+
setAlarmList((_alarmData$slice = alarmData === null || alarmData === void 0 ? void 0 : alarmData.slice(0, 9)) !== null && _alarmData$slice !== void 0 ? _alarmData$slice : []);
|
|
38
|
+
} else {
|
|
39
|
+
setAlarmList([]);
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
|
-
}, [
|
|
42
|
+
}, [alarmData]);
|
|
35
43
|
return /*#__PURE__*/React.createElement(_Dialog, {
|
|
36
44
|
className: styles.AlarmListPanel,
|
|
37
45
|
id: "AlarmListPanel",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
3
3
|
import sortBy from 'lodash/sortBy';
|
|
4
|
-
import {
|
|
4
|
+
import { getGroupChildrenNodes, getNodeData } from "../../../../../../../../utils/htElementUtils";
|
|
5
5
|
import { getIconById } from "../../../../common/GroupNodeList/icon";
|
|
6
6
|
|
|
7
7
|
function sortResourcesByName(resources) {
|
|
@@ -14,7 +14,7 @@ export default function useGroupRelateResource(props) {
|
|
|
14
14
|
var group = props.group,
|
|
15
15
|
topo = props.topo; // const [resources, setResources] = useState([]);
|
|
16
16
|
|
|
17
|
-
var nodes =
|
|
17
|
+
var nodes = getGroupChildrenNodes(group); // 过滤出资源
|
|
18
18
|
|
|
19
19
|
var resourceNodes = nodes.filter(function (node) {
|
|
20
20
|
return !!node.getTag();
|
|
@@ -13,7 +13,7 @@ export default function LayerResourceList(props) {
|
|
|
13
13
|
var _topo$store$useModelS = topo.store.useModelState('topoMod'),
|
|
14
14
|
topoData = _topo$store$useModelS.data;
|
|
15
15
|
|
|
16
|
-
var nodes = getLayerChildrenNodes(
|
|
16
|
+
var nodes = getLayerChildrenNodes(layer);
|
|
17
17
|
var data = nodes.map(function (node) {
|
|
18
18
|
return {
|
|
19
19
|
title: node.a('name'),
|
|
@@ -16,7 +16,7 @@ export default function LayerRelateData(props) {
|
|
|
16
16
|
key: "\u5173\u8054\u8D44\u6E90",
|
|
17
17
|
title: /*#__PURE__*/React.createElement("div", {
|
|
18
18
|
style: {
|
|
19
|
-
display:
|
|
19
|
+
display: 'flex',
|
|
20
20
|
paddingRight: 12
|
|
21
21
|
}
|
|
22
22
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -28,13 +28,13 @@ export default function LayerRelateData(props) {
|
|
|
28
28
|
layer: values,
|
|
29
29
|
topoEdit: topoEditApi,
|
|
30
30
|
onAdd: function onAdd() {
|
|
31
|
-
/*TODO 刷新列表 refreshList*/
|
|
31
|
+
/* TODO 刷新列表 refreshList */
|
|
32
32
|
},
|
|
33
33
|
addResourceDrawer: editorProps === null || editorProps === void 0 ? void 0 : editorProps.layerResourceSelectComponent
|
|
34
34
|
}))
|
|
35
35
|
}, /*#__PURE__*/React.createElement(RelatedNodeList, {
|
|
36
36
|
topo: topo,
|
|
37
|
-
layer:
|
|
37
|
+
layer: layer
|
|
38
38
|
}));
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -12,12 +12,15 @@ import NodeIconSelect from "./NodeIconSelect";
|
|
|
12
12
|
import NodeRelateResourceButton from "./data/NodeRelateResourceButton";
|
|
13
13
|
import styles from "./NodePropertyView.module.scss";
|
|
14
14
|
import TabView from "../../common/tab/TabView";
|
|
15
|
+
import useHtElement from "../../../../../common/hooks/useHtElement";
|
|
15
16
|
var Option = _Select.Option;
|
|
16
17
|
var CollapsePanel = _Collapse.Panel;
|
|
17
18
|
|
|
18
19
|
function parseValues(values) {
|
|
19
20
|
return _extends({}, values, {
|
|
20
|
-
'attrObject.customName': values['attrObject.customName'] || values['attrObject.name']
|
|
21
|
+
'attrObject.customName': values['attrObject.customName'] || values['attrObject.name'],
|
|
22
|
+
'attrObject.bindTopo': values['attrObject.bindTopo'] || '' // 解决切换节点时关联拓扑选项未重置
|
|
23
|
+
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -43,6 +46,10 @@ export default function NodePropertyView(props) {
|
|
|
43
46
|
editorProps = props.editorProps,
|
|
44
47
|
settingRuntimeState = props.settingRuntimeState;
|
|
45
48
|
var bindType = getBindType(values);
|
|
49
|
+
var node = useHtElement({
|
|
50
|
+
topo: topo,
|
|
51
|
+
id: values.id
|
|
52
|
+
});
|
|
46
53
|
|
|
47
54
|
var field = _Field.useField({
|
|
48
55
|
autoUnmount: false,
|
|
@@ -56,13 +63,20 @@ export default function NodePropertyView(props) {
|
|
|
56
63
|
}
|
|
57
64
|
});
|
|
58
65
|
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
field.setValues(parseValues(values));
|
|
68
|
+
}, [values]);
|
|
69
|
+
|
|
59
70
|
var setBindType = function setBindType(value) {
|
|
60
71
|
_onChange('attrObject.bindType', value);
|
|
61
72
|
};
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
var handleBindTopoChange = function handleBindTopoChange(value, data) {
|
|
75
|
+
// 清空自定义名称
|
|
76
|
+
// 设置名称为拓扑名称
|
|
77
|
+
node.a('name', data.label);
|
|
78
|
+
node.a('customName', null);
|
|
79
|
+
};
|
|
66
80
|
|
|
67
81
|
var renderData = function renderData() {
|
|
68
82
|
var RelateTopoTree = editorProps === null || editorProps === void 0 ? void 0 : editorProps.relateTopoTree;
|
|
@@ -115,7 +129,8 @@ export default function NodePropertyView(props) {
|
|
|
115
129
|
label: "\u5173\u8054\u62D3\u6251"
|
|
116
130
|
}, /*#__PURE__*/React.createElement(RelateTopoTree, {
|
|
117
131
|
name: "attrObject.bindTopo",
|
|
118
|
-
topo: topo
|
|
132
|
+
topo: topo,
|
|
133
|
+
onChange: handleBindTopoChange
|
|
119
134
|
})))));
|
|
120
135
|
};
|
|
121
136
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import topoService from
|
|
4
|
-
import rlog from
|
|
3
|
+
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
4
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
5
|
+
import moment from "moment";
|
|
6
|
+
import { alarmListDemo } from "./mocks";
|
|
5
7
|
|
|
6
8
|
var Alarm = /*#__PURE__*/function () {
|
|
7
9
|
function Alarm() {
|
|
@@ -54,12 +56,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
54
56
|
return _context.abrupt("return");
|
|
55
57
|
|
|
56
58
|
case 5:
|
|
57
|
-
rlog.info(
|
|
58
|
-
|
|
59
|
+
rlog.info("Alarm.open 打开告警通道", id); // 订阅告警推送
|
|
60
|
+
|
|
61
|
+
this.hmGetTopoAlarm(id); // 打开告警推送通道
|
|
59
62
|
|
|
60
63
|
this.openTopoAlarm(id);
|
|
61
64
|
|
|
62
|
-
case
|
|
65
|
+
case 8:
|
|
63
66
|
case "end":
|
|
64
67
|
return _context.stop();
|
|
65
68
|
}
|
|
@@ -87,7 +90,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
var id = this.topoApp.id;
|
|
90
|
-
rlog.info(
|
|
93
|
+
rlog.info("关闭告警通道", id); // 取消订阅告警推送
|
|
91
94
|
// 关闭告警推送通道
|
|
92
95
|
|
|
93
96
|
this.closeTopoAlarm(id);
|
|
@@ -111,7 +114,59 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
111
114
|
*/
|
|
112
115
|
;
|
|
113
116
|
|
|
114
|
-
_proto.removeAlarms = function removeAlarms() {}
|
|
117
|
+
_proto.removeAlarms = function removeAlarms() {};
|
|
118
|
+
|
|
119
|
+
_proto.hmGetTopoAlarm = /*#__PURE__*/function () {
|
|
120
|
+
var _hmGetTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
121
|
+
var data, nodes, ids, endTime, startTime, parms, result;
|
|
122
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
123
|
+
while (1) {
|
|
124
|
+
switch (_context2.prev = _context2.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
data = this.topoApp.store.getState().topoMod.data;
|
|
127
|
+
rlog.debug("获取告警列表", this.topoApp, data);
|
|
128
|
+
nodes = data.nodes;
|
|
129
|
+
ids = nodes.map(function (node, i) {
|
|
130
|
+
return node.id;
|
|
131
|
+
});
|
|
132
|
+
endTime = new Date().valueOf();
|
|
133
|
+
startTime = moment().subtract(1, "months").valueOf();
|
|
134
|
+
parms = {
|
|
135
|
+
ciIdList: ids,
|
|
136
|
+
alertStatusList: ["toDeal"],
|
|
137
|
+
pageNum: 1,
|
|
138
|
+
pageSize: 10,
|
|
139
|
+
sortField: "alertLevel",
|
|
140
|
+
sortOrder: "asc",
|
|
141
|
+
createTime: {
|
|
142
|
+
startTime: startTime,
|
|
143
|
+
endTime: endTime
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
_context2.next = 9;
|
|
147
|
+
return topoService.getAlarmByIds(parms);
|
|
148
|
+
|
|
149
|
+
case 9:
|
|
150
|
+
result = _context2.sent;
|
|
151
|
+
rlog.debug("getAlarmById-result", result);
|
|
152
|
+
this.updateState({
|
|
153
|
+
alarmData: result.datas.length > 0 ? result.datas : alarmListDemo
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
case 12:
|
|
157
|
+
case "end":
|
|
158
|
+
return _context2.stop();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, _callee2, this);
|
|
162
|
+
}));
|
|
163
|
+
|
|
164
|
+
function hmGetTopoAlarm(_x) {
|
|
165
|
+
return _hmGetTopoAlarm.apply(this, arguments);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return hmGetTopoAlarm;
|
|
169
|
+
}()
|
|
115
170
|
/**
|
|
116
171
|
* 打开告警推送。
|
|
117
172
|
*
|
|
@@ -122,29 +177,29 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
122
177
|
_proto.openTopoAlarm =
|
|
123
178
|
/*#__PURE__*/
|
|
124
179
|
function () {
|
|
125
|
-
var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
180
|
+
var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
|
126
181
|
var _this$getState, alarmOpening, topoAlarmIsOpen;
|
|
127
182
|
|
|
128
|
-
return _regeneratorRuntime.wrap(function
|
|
183
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
129
184
|
while (1) {
|
|
130
|
-
switch (
|
|
185
|
+
switch (_context3.prev = _context3.next) {
|
|
131
186
|
case 0:
|
|
132
187
|
// 如果当前拓扑图开启中或已开启则退出
|
|
133
188
|
_this$getState = this.getState(), alarmOpening = _this$getState.alarmOpening, topoAlarmIsOpen = _this$getState.topoAlarmIsOpen;
|
|
134
189
|
|
|
135
190
|
if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
|
|
136
|
-
|
|
191
|
+
_context3.next = 3;
|
|
137
192
|
break;
|
|
138
193
|
}
|
|
139
194
|
|
|
140
|
-
return
|
|
195
|
+
return _context3.abrupt("return");
|
|
141
196
|
|
|
142
197
|
case 3:
|
|
143
198
|
this.currentTopoId = id;
|
|
144
199
|
this.updateState({
|
|
145
200
|
alarmOpening: true
|
|
146
201
|
});
|
|
147
|
-
|
|
202
|
+
_context3.next = 7;
|
|
148
203
|
return topoService.openTopoAlarm(id);
|
|
149
204
|
|
|
150
205
|
case 7:
|
|
@@ -155,13 +210,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
155
210
|
|
|
156
211
|
case 8:
|
|
157
212
|
case "end":
|
|
158
|
-
return
|
|
213
|
+
return _context3.stop();
|
|
159
214
|
}
|
|
160
215
|
}
|
|
161
|
-
},
|
|
216
|
+
}, _callee3, this);
|
|
162
217
|
}));
|
|
163
218
|
|
|
164
|
-
function openTopoAlarm(
|
|
219
|
+
function openTopoAlarm(_x2) {
|
|
165
220
|
return _openTopoAlarm.apply(this, arguments);
|
|
166
221
|
}
|
|
167
222
|
|
|
@@ -177,22 +232,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
177
232
|
_proto.closeTopoAlarm =
|
|
178
233
|
/*#__PURE__*/
|
|
179
234
|
function () {
|
|
180
|
-
var _closeTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
235
|
+
var _closeTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) {
|
|
181
236
|
var _this$getState2, alarmIsOpened, alarmOpening;
|
|
182
237
|
|
|
183
|
-
return _regeneratorRuntime.wrap(function
|
|
238
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
184
239
|
while (1) {
|
|
185
|
-
switch (
|
|
240
|
+
switch (_context4.prev = _context4.next) {
|
|
186
241
|
case 0:
|
|
187
242
|
// 如果未开启则退出
|
|
188
243
|
_this$getState2 = this.getState(), alarmIsOpened = _this$getState2.alarmIsOpened, alarmOpening = _this$getState2.alarmOpening;
|
|
189
244
|
|
|
190
245
|
if (!(!alarmIsOpened && !alarmOpening)) {
|
|
191
|
-
|
|
246
|
+
_context4.next = 3;
|
|
192
247
|
break;
|
|
193
248
|
}
|
|
194
249
|
|
|
195
|
-
return
|
|
250
|
+
return _context4.abrupt("return");
|
|
196
251
|
|
|
197
252
|
case 3:
|
|
198
253
|
this.currentTopoId = null;
|
|
@@ -200,18 +255,18 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
200
255
|
topoAlarmIsOpen: false,
|
|
201
256
|
alarmOpening: false
|
|
202
257
|
});
|
|
203
|
-
|
|
258
|
+
_context4.next = 7;
|
|
204
259
|
return topoService.closeTopoAlarm(id);
|
|
205
260
|
|
|
206
261
|
case 7:
|
|
207
262
|
case "end":
|
|
208
|
-
return
|
|
263
|
+
return _context4.stop();
|
|
209
264
|
}
|
|
210
265
|
}
|
|
211
|
-
},
|
|
266
|
+
}, _callee4, this);
|
|
212
267
|
}));
|
|
213
268
|
|
|
214
|
-
function closeTopoAlarm(
|
|
269
|
+
function closeTopoAlarm(_x3) {
|
|
215
270
|
return _closeTopoAlarm.apply(this, arguments);
|
|
216
271
|
}
|
|
217
272
|
|
|
@@ -225,22 +280,22 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
225
280
|
_proto.restart =
|
|
226
281
|
/*#__PURE__*/
|
|
227
282
|
function () {
|
|
228
|
-
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
283
|
+
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
229
284
|
var id;
|
|
230
|
-
return _regeneratorRuntime.wrap(function
|
|
285
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
231
286
|
while (1) {
|
|
232
|
-
switch (
|
|
287
|
+
switch (_context5.prev = _context5.next) {
|
|
233
288
|
case 0:
|
|
234
289
|
id = this.currentTopoId;
|
|
235
|
-
|
|
290
|
+
_context5.next = 3;
|
|
236
291
|
return this.openTopoAlarm(id);
|
|
237
292
|
|
|
238
293
|
case 3:
|
|
239
294
|
case "end":
|
|
240
|
-
return
|
|
295
|
+
return _context5.stop();
|
|
241
296
|
}
|
|
242
297
|
}
|
|
243
|
-
},
|
|
298
|
+
}, _callee5, this);
|
|
244
299
|
}));
|
|
245
300
|
|
|
246
301
|
function restart() {
|
|
@@ -255,16 +310,16 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
255
310
|
};
|
|
256
311
|
|
|
257
312
|
_proto.getState = function getState() {
|
|
258
|
-
return this.topoApp.store.getModelState(
|
|
313
|
+
return this.topoApp.store.getModelState("topoAlarm");
|
|
259
314
|
};
|
|
260
315
|
|
|
261
316
|
_proto.useState = function useState() {
|
|
262
|
-
var state = this.topoApp.store.useModelState(
|
|
317
|
+
var state = this.topoApp.store.useModelState("topoAlarm");
|
|
263
318
|
return state;
|
|
264
319
|
};
|
|
265
320
|
|
|
266
321
|
_proto.updateState = function updateState(state) {
|
|
267
|
-
return this.topoApp.store.getModelDispatchers(
|
|
322
|
+
return this.topoApp.store.getModelDispatchers("topoAlarm").update(state);
|
|
268
323
|
};
|
|
269
324
|
|
|
270
325
|
return Alarm;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export var alarmListDemo = [{
|
|
2
|
+
alertAggInfo: null,
|
|
3
|
+
alertId: 54,
|
|
4
|
+
alertLevel: 1,
|
|
5
|
+
alertObject: "Oracle实例ORCL(172.17.162.192)",
|
|
6
|
+
alertTitle: "数据库实例宕机",
|
|
7
|
+
alertType: "通断类告警",
|
|
8
|
+
changeTime: null,
|
|
9
|
+
ciId: "0000000019986715",
|
|
10
|
+
ciName: "ORCL",
|
|
11
|
+
ciType: "Oracle实例",
|
|
12
|
+
closeTime: 0,
|
|
13
|
+
createTime: 1640860800000,
|
|
14
|
+
duration: 422241000,
|
|
15
|
+
processTime: 0,
|
|
16
|
+
recoverTime: 0,
|
|
17
|
+
ruleId: "157",
|
|
18
|
+
status: "toDeal",
|
|
19
|
+
tags: null
|
|
20
|
+
}, {
|
|
21
|
+
alertId: 53,
|
|
22
|
+
alertLevel: 2,
|
|
23
|
+
alertObject: "Oracle实例ORCL(172.17.160.119)",
|
|
24
|
+
alertTitle: "数据库实例宕机",
|
|
25
|
+
createTime: 1640860800000,
|
|
26
|
+
ruleId: "157",
|
|
27
|
+
alertType: "通断类告警",
|
|
28
|
+
duration: 422241000,
|
|
29
|
+
ciType: "Oracle实例",
|
|
30
|
+
ciId: "000000001abb92b6",
|
|
31
|
+
ciName: "ORCL",
|
|
32
|
+
processTime: 0,
|
|
33
|
+
changeTime: null,
|
|
34
|
+
recoverTime: 0,
|
|
35
|
+
closeTime: 0,
|
|
36
|
+
tags: null,
|
|
37
|
+
status: "toDeal",
|
|
38
|
+
alertAggInfo: null
|
|
39
|
+
}];
|
package/es/hooks/useAlarm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { useEffect } from
|
|
4
|
-
import rlog from
|
|
5
|
-
import { EE } from
|
|
6
|
-
import { isAvailableArray } from
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
5
|
+
import { EE } from "@riil-frontend/component-riil-event-emitter";
|
|
6
|
+
import { isAvailableArray } from "@riil-frontend/utils";
|
|
7
7
|
export default function useAlarm(options) {
|
|
8
8
|
var topo = options.topo;
|
|
9
9
|
var store = topo.store;
|
|
@@ -11,15 +11,31 @@ export default function useAlarm(options) {
|
|
|
11
11
|
var _topo$alarm$useState = topo.alarm.useState(),
|
|
12
12
|
alarmIsOpened = _topo$alarm$useState.alarmIsOpened;
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
bizState = _store$useModel[0],
|
|
16
|
-
bizDispatchers = _store$useModel[1];
|
|
14
|
+
var allData = topo.store.getState().topoMod.data;
|
|
17
15
|
|
|
18
|
-
var
|
|
16
|
+
var _store$useModel = store.useModel("topoMod"),
|
|
17
|
+
state = _store$useModel[0],
|
|
18
|
+
dispatchers = _store$useModel[1];
|
|
19
|
+
|
|
20
|
+
var _store$useModel2 = store.useModel("topoBizMod"),
|
|
21
|
+
bizState = _store$useModel2[0],
|
|
22
|
+
bizDispatchers = _store$useModel2[1];
|
|
23
|
+
|
|
24
|
+
var linkDynamicStyleDispatcher = store.getModel("linkDynamicStyle")[1];
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
rlog.debug("useAlarm.useEffect 获取初始化告警---开始", topo, allData, state, alarmIsOpened);
|
|
27
|
+
|
|
28
|
+
if (alarmIsOpened) {
|
|
29
|
+
var conditions = {
|
|
30
|
+
id: ""
|
|
31
|
+
};
|
|
32
|
+
dispatchers.getAlarmById(conditions);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
19
35
|
useEffect(function () {
|
|
20
36
|
if (alarmIsOpened) {
|
|
21
|
-
rlog.debug(
|
|
22
|
-
EE.on(
|
|
37
|
+
rlog.debug("useAlarm.useEffect 告警WebSocket 开始", alarmIsOpened);
|
|
38
|
+
EE.on("topo", "topo", function (data, other, t) {
|
|
23
39
|
if (t === void 0) {
|
|
24
40
|
t = alarmIsOpened;
|
|
25
41
|
}
|
|
@@ -29,8 +45,8 @@ export default function useAlarm(options) {
|
|
|
29
45
|
}
|
|
30
46
|
|
|
31
47
|
return function () {
|
|
32
|
-
rlog.debug(
|
|
33
|
-
EE.removeListener(
|
|
48
|
+
rlog.debug("useAlarm.useEffect 告警WebSocket 结束");
|
|
49
|
+
EE.removeListener("topo", "topo");
|
|
34
50
|
};
|
|
35
51
|
}, [alarmIsOpened]);
|
|
36
52
|
|
|
@@ -46,16 +62,16 @@ export default function useAlarm(options) {
|
|
|
46
62
|
while (1) {
|
|
47
63
|
switch (_context.prev = _context.next) {
|
|
48
64
|
case 0:
|
|
49
|
-
_store$getModelState = store.getModelState(
|
|
65
|
+
_store$getModelState = store.getModelState("topoMod"), viewState = _store$getModelState.viewState; // 添加事件
|
|
50
66
|
|
|
51
67
|
type = data.type, alertData = data.data;
|
|
52
68
|
|
|
53
|
-
if (!(viewState ===
|
|
69
|
+
if (!(viewState === "view" && type === "alarm" && isAvailableArray(alertData))) {
|
|
54
70
|
_context.next = 11;
|
|
55
71
|
break;
|
|
56
72
|
}
|
|
57
73
|
|
|
58
|
-
rlog.debug(
|
|
74
|
+
rlog.debug("useAlarm.getAlarmByEE 告警原始数据", alertData);
|
|
59
75
|
al = alertData.map(function (item, index) {
|
|
60
76
|
var _item$resourceId;
|
|
61
77
|
|
|
@@ -69,7 +85,7 @@ export default function useAlarm(options) {
|
|
|
69
85
|
info: item.alertType
|
|
70
86
|
};
|
|
71
87
|
});
|
|
72
|
-
rlog.debug(
|
|
88
|
+
rlog.debug("before-combAlarmData", al, bizState);
|
|
73
89
|
_context.next = 8;
|
|
74
90
|
return bizDispatchers.combAlarmData({
|
|
75
91
|
alarmdata: al
|
|
@@ -77,7 +93,7 @@ export default function useAlarm(options) {
|
|
|
77
93
|
|
|
78
94
|
case 8:
|
|
79
95
|
alarmList = _context.sent;
|
|
80
|
-
rlog.debug(
|
|
96
|
+
rlog.debug("useAlarm.getAlarmByEE 推送告警到ht", alarmList, bizState);
|
|
81
97
|
|
|
82
98
|
if (alarmIsOpened) {
|
|
83
99
|
topo.loadAlarm(alarmList); // 告警变化后,刷新链路动态样式
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -10,7 +10,7 @@ import { TopoEvent } from '@riil-frontend/component-topology-graph';
|
|
|
10
10
|
import { filterNode, filterGroupById, filterGroupByTag } from "../utils/format";
|
|
11
11
|
import { DEFAULT_GROUP } from "../utils/template";
|
|
12
12
|
import topoPermissonUtil from "../utils/topoPermissionUtil";
|
|
13
|
-
import {
|
|
13
|
+
import { getGroupChildrenNodes, getGroupElementByTag } from "../utils/htElementUtils";
|
|
14
14
|
import useResourceConfig from "./useResourceConfig";
|
|
15
15
|
|
|
16
16
|
var useTopoEdit = function useTopoEdit(params) {
|
|
@@ -273,7 +273,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
if (!
|
|
276
|
+
if (!getGroupChildrenNodes(group).length) {
|
|
277
277
|
doDelete();
|
|
278
278
|
} // 有子节点时需要确认
|
|
279
279
|
|
package/es/models/topoAlarm.js
CHANGED
|
@@ -5,13 +5,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
5
5
|
/**
|
|
6
6
|
* 告警
|
|
7
7
|
*/
|
|
8
|
-
import topoService from
|
|
8
|
+
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
9
9
|
export default {
|
|
10
10
|
// 定义 model 的初始 state
|
|
11
11
|
state: {
|
|
12
12
|
currentTopoId: undefined,
|
|
13
13
|
alarmOpening: false,
|
|
14
|
-
alarmIsOpened:
|
|
14
|
+
alarmIsOpened: true,
|
|
15
|
+
alarmDatas: []
|
|
15
16
|
},
|
|
16
17
|
// 定义改变该模型状态的纯函数
|
|
17
18
|
reducers: {
|
package/es/models/topoMod.js
CHANGED
|
@@ -571,8 +571,8 @@ export default function (topoApp) {
|
|
|
571
571
|
while (1) {
|
|
572
572
|
switch (_context11.prev = _context11.next) {
|
|
573
573
|
case 0:
|
|
574
|
-
endTime = conditions.endTime || new Date().valueOf();
|
|
575
|
-
startTime = conditions.startTime || moment().subtract(1, "months").valueOf();
|
|
574
|
+
endTime = (conditions === null || conditions === void 0 ? void 0 : conditions.endTime) || new Date().valueOf();
|
|
575
|
+
startTime = (conditions === null || conditions === void 0 ? void 0 : conditions.startTime) || moment().subtract(1, "months").valueOf();
|
|
576
576
|
parms = {
|
|
577
577
|
ciIdList: [conditions.id],
|
|
578
578
|
alertStatusList: ["toDeal"],
|