@riil-frontend/component-topology 2.14.2-alpha.13 → 2.14.2-alpha.15
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 +27 -27
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +1 -1
- package/es/core/services/overview.js +29 -0
- package/es/core/utils/exportData.js +1 -1
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +326 -136
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +12 -1
- package/es/core/viewer/components/plugins/BaseInfo/index.js +6 -4
- package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +1 -1
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +1 -1
- package/lib/core/services/overview.js +40 -0
- package/lib/core/utils/exportData.js +1 -1
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +335 -136
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +12 -1
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +6 -4
- package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { getRequest } from '@riil-frontend/component-topology-common/es/utils/request';
|
|
4
|
+
export default {
|
|
5
|
+
/**
|
|
6
|
+
* 根据资源id获取风险
|
|
7
|
+
* @param {*} params ciIdList
|
|
8
|
+
*/
|
|
9
|
+
getRiskByIds: function getRiskByIds(params) {
|
|
10
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
11
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
+
while (1) {
|
|
13
|
+
switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
_context.next = 2;
|
|
16
|
+
return getRequest().post('/health/v1/api/management/getRiskList', params);
|
|
17
|
+
|
|
18
|
+
case 2:
|
|
19
|
+
return _context.abrupt("return", _context.sent);
|
|
20
|
+
|
|
21
|
+
case 3:
|
|
22
|
+
case "end":
|
|
23
|
+
return _context.stop();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, _callee);
|
|
27
|
+
}))();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -24,7 +24,7 @@ function _ref() {
|
|
|
24
24
|
'imageName': element.a('customName') || element.a('name') || element.getName()
|
|
25
25
|
};
|
|
26
26
|
}),
|
|
27
|
-
'
|
|
27
|
+
'links': links.map(function (link) {
|
|
28
28
|
var id = link.id,
|
|
29
29
|
source = link.source,
|
|
30
30
|
target = link.target,
|
|
@@ -1,15 +1,116 @@
|
|
|
1
1
|
import _Table from "@alifd/next/es/table";
|
|
2
2
|
import _Divider from "@alifd/next/es/divider";
|
|
3
|
+
import _Button from "@alifd/next/es/button";
|
|
4
|
+
import _Icon from "@alifd/next/es/icon";
|
|
5
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
6
|
import _extends from "@babel/runtime/helpers/extends";
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
8
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
9
|
+
import { Link } from "react-router-dom";
|
|
10
|
+
import moment from "moment";
|
|
5
11
|
import { TopoEvent } from '@riil-frontend/component-topology-graph';
|
|
6
12
|
import { findItem } from "../../../../../../../utils/topoData";
|
|
13
|
+
import alertService from '@riil-frontend/component-topology-common/es/services/alert'; // import riskService from '@riil-frontend/component-topology-common/es/services/risk';
|
|
14
|
+
|
|
15
|
+
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
|
16
|
+
import service from "../../../../../../services/overview";
|
|
7
17
|
import NoDataPage from '@riil-frontend/component-topology-common/es/components/NoDataPage'; // import ResourceDiplayInfoSetting from './Setting';
|
|
8
18
|
// bimport '@riil-frontend/css/lib/index.scss';
|
|
9
19
|
|
|
10
|
-
import styles from "./index.module.scss"; //
|
|
20
|
+
import styles from "./index.module.scss"; // 基本信息
|
|
21
|
+
|
|
22
|
+
function BaseInfoRender(type, data) {
|
|
23
|
+
if (type === 'link') {
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: styles['base-info']
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles.row
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: styles.item,
|
|
30
|
+
style: {
|
|
31
|
+
width: '100%'
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: styles.label
|
|
35
|
+
}, "\u94FE\u8DEF\u5E26\u5BBD\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: styles.content
|
|
37
|
+
}, data.rated_bandwidth))), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: styles.row
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: styles.item
|
|
41
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
42
|
+
className: styles.label
|
|
43
|
+
}, "\u6E90IP\u5730\u5740\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
44
|
+
className: styles.content
|
|
45
|
+
}, data.source_ipv4)), /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: styles.item
|
|
47
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
className: styles.label
|
|
49
|
+
}, "\u76EE\u7684IP\u5730\u5740\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: styles.content
|
|
51
|
+
}, data.destination_ipv4))), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: styles.row
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: styles.item
|
|
55
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
56
|
+
className: styles.label
|
|
57
|
+
}, "\u6E90\u63A5\u53E3\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: styles.content
|
|
59
|
+
}, data.source_Interface)), /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: styles.item
|
|
61
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
62
|
+
className: styles.label
|
|
63
|
+
}, "\u76EE\u7684\u63A5\u53E3\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
className: styles.content
|
|
65
|
+
}, data.destination_Interface))));
|
|
66
|
+
} else {
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: styles['base-info']
|
|
69
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: styles.row
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: styles.item
|
|
73
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: styles.label
|
|
75
|
+
}, "\u8D44\u6E90\u540D\u79F0\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
className: styles.content
|
|
77
|
+
}, data.display_name)), /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: styles.item
|
|
79
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: styles.label
|
|
81
|
+
}, "IP\u5730\u5740\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: styles.content
|
|
83
|
+
}, data.ipv4_address))), /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: styles.row
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: styles.item
|
|
87
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
className: styles.label
|
|
89
|
+
}, "\u8D44\u4EA7\u7F16\u53F7\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
90
|
+
className: styles.content
|
|
91
|
+
}, data.asset_number)), /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: styles.item
|
|
93
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
className: styles.label
|
|
95
|
+
}, "\u8D44\u6E90\u7C7B\u578B\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
className: styles.content
|
|
97
|
+
}, data.ciName))), /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: styles.row
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: styles.item,
|
|
101
|
+
style: {
|
|
102
|
+
width: '100%'
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: styles.label
|
|
106
|
+
}, "\u8D44\u6E90\u4F4D\u7F6E\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: styles.content
|
|
108
|
+
}, data.res_address))));
|
|
109
|
+
}
|
|
110
|
+
} // 关键指标
|
|
111
|
+
|
|
11
112
|
|
|
12
|
-
function indicatorRander(data) {
|
|
113
|
+
function indicatorRander(type, data) {
|
|
13
114
|
console.log('indicatorRander', data);
|
|
14
115
|
return /*#__PURE__*/React.createElement("div", {
|
|
15
116
|
className: styles.indicator
|
|
@@ -21,10 +122,10 @@ function indicatorRander(data) {
|
|
|
21
122
|
key: item.code
|
|
22
123
|
}, /*#__PURE__*/React.createElement("span", {
|
|
23
124
|
className: styles.content
|
|
24
|
-
}, item.value ? item.value + item.unit : '
|
|
125
|
+
}, item.value ? item.value + item.unit : '-'), /*#__PURE__*/React.createElement("span", {
|
|
25
126
|
className: styles.label
|
|
26
127
|
}, item.name));
|
|
27
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
})), type === 'node' ? /*#__PURE__*/React.createElement("div", {
|
|
28
129
|
className: styles.row
|
|
29
130
|
}, data.slice(3, 6).map(function (item) {
|
|
30
131
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -32,10 +133,10 @@ function indicatorRander(data) {
|
|
|
32
133
|
key: item.code
|
|
33
134
|
}, /*#__PURE__*/React.createElement("span", {
|
|
34
135
|
className: styles.content
|
|
35
|
-
}, item.value ? item.value + item.unit : '
|
|
136
|
+
}, item.value ? item.value + item.unit : '-'), /*#__PURE__*/React.createElement("span", {
|
|
36
137
|
className: styles.label
|
|
37
138
|
}, item.name));
|
|
38
|
-
})));
|
|
139
|
+
})) : '');
|
|
39
140
|
}
|
|
40
141
|
/**
|
|
41
142
|
* 资源概览
|
|
@@ -45,23 +146,35 @@ function indicatorRander(data) {
|
|
|
45
146
|
export default function ResourceOverview(props) {
|
|
46
147
|
var topo = props.topo,
|
|
47
148
|
id = props.id,
|
|
48
|
-
|
|
149
|
+
type = props.type,
|
|
150
|
+
ciType = props.ciType,
|
|
151
|
+
ciName = props.ciName;
|
|
49
152
|
|
|
50
153
|
var _topo$store$useModelS = topo.store.useModelState('topoBizMod'),
|
|
51
154
|
attrsAndMetrics = _topo$store$useModelS.attrsAndMetrics;
|
|
52
155
|
|
|
53
156
|
var _useState = useState({
|
|
157
|
+
// 资源
|
|
54
158
|
display_name: '',
|
|
55
159
|
// 资源名称/显示名称
|
|
56
160
|
ipv4_address: '',
|
|
57
161
|
// IP地址
|
|
58
162
|
asset_number: '',
|
|
59
163
|
// 资产编号
|
|
60
|
-
|
|
164
|
+
ciName: '',
|
|
61
165
|
// 资源类型
|
|
62
|
-
|
|
166
|
+
res_address: '',
|
|
63
167
|
// 资源位置
|
|
64
|
-
|
|
168
|
+
// 链路
|
|
169
|
+
rated_bandwidth: '',
|
|
170
|
+
// 链路带宽
|
|
171
|
+
source_ipv4: '',
|
|
172
|
+
// 源IP地址
|
|
173
|
+
destination_ipv4: '',
|
|
174
|
+
// 目的IP地址
|
|
175
|
+
source_Interface: '',
|
|
176
|
+
// 源接口
|
|
177
|
+
destination_Interface: '' // 目的接口
|
|
65
178
|
|
|
66
179
|
}),
|
|
67
180
|
baseInfo = _useState[0],
|
|
@@ -71,113 +184,234 @@ export default function ResourceOverview(props) {
|
|
|
71
184
|
indicator = _useState2[0],
|
|
72
185
|
setIndicator = _useState2[1];
|
|
73
186
|
|
|
187
|
+
var _useState3 = useState([]),
|
|
188
|
+
alarmRiskList = _useState3[0],
|
|
189
|
+
setAlarmRiskList = _useState3[1];
|
|
190
|
+
|
|
74
191
|
useEffect(function () {
|
|
75
192
|
init();
|
|
76
|
-
}, [attrsAndMetrics]);
|
|
193
|
+
}, [attrsAndMetrics, id]);
|
|
77
194
|
|
|
78
195
|
function init() {
|
|
79
|
-
var
|
|
196
|
+
var _topo$options$resourc, _attributeMap$source_, _attributeMap$destina;
|
|
197
|
+
|
|
198
|
+
// 指标模型
|
|
199
|
+
var _topo$ciTyeCache$getC = topo.ciTyeCache.getCiType(ciType),
|
|
200
|
+
modelMetrics = _topo$ciTyeCache$getC.metrics;
|
|
201
|
+
|
|
202
|
+
var topModelMetrics = modelMetrics.slice(0, 6); // 应用拓扑处理
|
|
203
|
+
|
|
204
|
+
if ((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData) {
|
|
205
|
+
var _topo$options$resourc3;
|
|
206
|
+
|
|
207
|
+
topo.resourceOverviewDrawer && (topo.resourceOverviewDrawer['refreshData'] = init);
|
|
208
|
+
|
|
209
|
+
var _topo$options$resourc2 = (_topo$options$resourc3 = topo.options.resourceOverviewDrawer) === null || _topo$options$resourc3 === void 0 ? void 0 : _topo$options$resourc3.getData({
|
|
210
|
+
id: id,
|
|
211
|
+
metrics: topModelMetrics
|
|
212
|
+
}),
|
|
213
|
+
_metrics = _topo$options$resourc2.metrics,
|
|
214
|
+
alarms = _topo$options$resourc2.alarms;
|
|
215
|
+
|
|
216
|
+
console.log('应用拓扑 参数获取', _metrics, alarms);
|
|
217
|
+
getAttribute(id);
|
|
218
|
+
setIndicator(topModelMetrics.map(function (item) {
|
|
219
|
+
return _extends({}, item, {
|
|
220
|
+
value: _metrics[item.code] || ''
|
|
221
|
+
});
|
|
222
|
+
}));
|
|
223
|
+
setAlarmList(alarms || []);
|
|
224
|
+
return;
|
|
225
|
+
} // 拓扑(默认) ---------------------------
|
|
226
|
+
// 基本信息
|
|
227
|
+
|
|
80
228
|
|
|
81
|
-
// 资源-基本信息
|
|
82
229
|
console.log('资源-基本信息------------------------', id, attrsAndMetrics);
|
|
83
230
|
|
|
84
231
|
var _findItem = findItem(attrsAndMetrics, 'id', id),
|
|
85
|
-
|
|
232
|
+
attributeMap = _findItem.attributeMap,
|
|
86
233
|
metrics = _findItem.metrics;
|
|
87
234
|
|
|
88
|
-
console.log('
|
|
89
|
-
|
|
90
|
-
setBaseInfo({
|
|
91
|
-
display_name: (_findItem2 = findItem(attributes, 'code', 'display_name')) === null || _findItem2 === void 0 ? void 0 : _findItem2.value,
|
|
92
|
-
ipv4_address: (_findItem3 = findItem(attributes, 'code', 'ipv4_address')) === null || _findItem3 === void 0 ? void 0 : _findItem3.value,
|
|
93
|
-
asset_number: (_findItem4 = findItem(attributes, 'code', 'asset_number')) === null || _findItem4 === void 0 ? void 0 : _findItem4.value,
|
|
94
|
-
type: (_findItem5 = findItem(attributes, 'code', 'type')) === null || _findItem5 === void 0 ? void 0 : _findItem5.value
|
|
95
|
-
}); // 链路-基本信息
|
|
96
|
-
// 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
|
|
235
|
+
console.log('attributeMap', attributeMap);
|
|
236
|
+
var res_address = '-';
|
|
97
237
|
|
|
98
|
-
|
|
238
|
+
if (attributeMap.owned_computer_room) {
|
|
239
|
+
res_address = attributeMap.owned_computer_room + " " + attributeMap.owned_cabinet + " " + attributeMap.start_u_location + "-" + attributeMap.end_u_location;
|
|
240
|
+
}
|
|
99
241
|
|
|
100
|
-
|
|
101
|
-
|
|
242
|
+
setBaseInfo({
|
|
243
|
+
// 资源
|
|
244
|
+
display_name: attributeMap.display_name || '-',
|
|
245
|
+
ipv4_address: attributeMap.ipv4_address || '-',
|
|
246
|
+
asset_number: attributeMap.asset_number || '-',
|
|
247
|
+
// type: findItem(attributes, 'code', 'type')?.value || '-',
|
|
248
|
+
ciName: ciName || '-',
|
|
249
|
+
res_address: res_address,
|
|
250
|
+
// 链路
|
|
251
|
+
rated_bandwidth: attributeMap.rated_bandwidth || '-',
|
|
252
|
+
// 额定带宽
|
|
253
|
+
// rated_bandwidth:[network_link.actual_bandwidth] || '-',// 实际带宽
|
|
254
|
+
source_ipv4: attributeMap.source_ipv4 || '-',
|
|
255
|
+
destination_ipv4: attributeMap.destination_ipv4 || '-',
|
|
256
|
+
source_Interface: ((_attributeMap$source_ = attributeMap.source_id_object) === null || _attributeMap$source_ === void 0 ? void 0 : _attributeMap$source_.displayName) || '-',
|
|
257
|
+
destination_Interface: ((_attributeMap$destina = attributeMap.destination_id_object) === null || _attributeMap$destina === void 0 ? void 0 : _attributeMap$destina.displayName) || '-'
|
|
258
|
+
}); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
|
|
102
259
|
|
|
103
|
-
|
|
104
|
-
|
|
260
|
+
console.log('资源/链路-关键指标------------------------', id, metrics);
|
|
261
|
+
setIndicator(topModelMetrics.map(function (item) {
|
|
262
|
+
var _findItem2;
|
|
105
263
|
|
|
106
264
|
return _extends({}, item, {
|
|
107
|
-
value: (
|
|
265
|
+
value: (_findItem2 = findItem(metrics, 'code', item.code)) === null || _findItem2 === void 0 ? void 0 : _findItem2.value
|
|
108
266
|
});
|
|
267
|
+
})); // 资源-告警/风险
|
|
268
|
+
|
|
269
|
+
getAlarmRiskData(id);
|
|
270
|
+
} // 获取属性信息(应用拓扑)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
function getAttribute(_x) {
|
|
274
|
+
return _getAttribute.apply(this, arguments);
|
|
275
|
+
} // 获取告警/风险信息
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
function _getAttribute() {
|
|
279
|
+
_getAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
280
|
+
var res, _ref, attributes, attributeMap, res_address;
|
|
281
|
+
|
|
282
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
283
|
+
while (1) {
|
|
284
|
+
switch (_context.prev = _context.next) {
|
|
285
|
+
case 0:
|
|
286
|
+
_context.next = 2;
|
|
287
|
+
return topoService.ciInfo.batchQueryCiInfo({
|
|
288
|
+
ciId: [{
|
|
289
|
+
ciId: id,
|
|
290
|
+
operation: 'delete'
|
|
291
|
+
}],
|
|
292
|
+
codes: [],
|
|
293
|
+
relationId: []
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
case 2:
|
|
297
|
+
res = _context.sent;
|
|
298
|
+
console.log('应用拓扑 查询结果 res', res);
|
|
299
|
+
_ref = res[0] || {}, attributes = _ref.attributes;
|
|
300
|
+
attributeMap = {};
|
|
301
|
+
attributes.forEach(function (item) {
|
|
302
|
+
attributeMap[item.code] = item.value;
|
|
303
|
+
});
|
|
304
|
+
res_address = '-';
|
|
305
|
+
|
|
306
|
+
if (attributeMap.owned_computer_room) {
|
|
307
|
+
res_address = attributeMap.owned_computer_room + " " + attributeMap.owned_cabinet + " " + attributeMap.start_u_location + "-" + attributeMap.end_u_location;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
setBaseInfo({
|
|
311
|
+
// 资源
|
|
312
|
+
display_name: attributeMap.display_name || '-',
|
|
313
|
+
ipv4_address: attributeMap.ipv4_address || '-',
|
|
314
|
+
asset_number: attributeMap.asset_number || '-',
|
|
315
|
+
ciName: ciName || '-',
|
|
316
|
+
res_address: res_address
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
case 10:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context.stop();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}, _callee);
|
|
109
325
|
}));
|
|
326
|
+
return _getAttribute.apply(this, arguments);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function getAlarmRiskData(_x2) {
|
|
330
|
+
return _getAlarmRiskData.apply(this, arguments);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function _getAlarmRiskData() {
|
|
334
|
+
_getAlarmRiskData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
335
|
+
var resAlarm, resRisk;
|
|
336
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
337
|
+
while (1) {
|
|
338
|
+
switch (_context2.prev = _context2.next) {
|
|
339
|
+
case 0:
|
|
340
|
+
_context2.next = 2;
|
|
341
|
+
return alertService.getAlarmByIds({
|
|
342
|
+
ciIdList: [id],
|
|
343
|
+
alertStatusList: ['toDeal', 'dealing'],
|
|
344
|
+
// toDeal: 待处理, dealing:处理中
|
|
345
|
+
pageNum: 1,
|
|
346
|
+
pageSize: 10,
|
|
347
|
+
sortField: "alertLevel",
|
|
348
|
+
sortOrder: "asc"
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
case 2:
|
|
352
|
+
resAlarm = _context2.sent;
|
|
353
|
+
_context2.next = 5;
|
|
354
|
+
return service.getRiskByIds({
|
|
355
|
+
ciIdList: [id],
|
|
356
|
+
statusList: ['toDeal', 'dealing'],
|
|
357
|
+
current: 1,
|
|
358
|
+
pageSize: 10
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
case 5:
|
|
362
|
+
resRisk = _context2.sent;
|
|
363
|
+
console.log('资源-告警/风险', resAlarm, resRisk);
|
|
364
|
+
setAlarmRiskList([].concat(resAlarm === null || resAlarm === void 0 ? void 0 : resAlarm.datas, resRisk === null || resRisk === void 0 ? void 0 : resRisk.content));
|
|
365
|
+
|
|
366
|
+
case 8:
|
|
367
|
+
case "end":
|
|
368
|
+
return _context2.stop();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}, _callee2);
|
|
372
|
+
}));
|
|
373
|
+
return _getAlarmRiskData.apply(this, arguments);
|
|
110
374
|
}
|
|
111
375
|
|
|
112
|
-
var topoBizMod = topo.store.useModelState('topoBizMod');
|
|
113
|
-
useEffect(function () {
|
|
114
|
-
console.log('topoBizMod', topoBizMod);
|
|
115
|
-
}, [topoBizMod]);
|
|
116
376
|
var columns = [{
|
|
117
377
|
title: '事件',
|
|
118
|
-
dataIndex: '
|
|
119
|
-
key: '
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
378
|
+
dataIndex: 'alertTitle',
|
|
379
|
+
key: 'alertTitle',
|
|
380
|
+
cell: function cell(value, index, record) {
|
|
381
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Icon, {
|
|
382
|
+
type: "gaojing-3",
|
|
383
|
+
size: "xs",
|
|
384
|
+
className: styles["alarm-color-icon"] + " alarm-color-icon-lv" + record.alertLevel
|
|
385
|
+
}), /*#__PURE__*/React.createElement(Link, {
|
|
386
|
+
to: "/default/pagecenter/alertDetail/view/" + record.alertId + "?alertId=" + record.alertId + "&resId=" + record.ciId + "&title=" + record.alertObject
|
|
387
|
+
}, "[" + record.alertObject + "] " + value));
|
|
388
|
+
}
|
|
128
389
|
}, {
|
|
129
390
|
title: '时间',
|
|
130
391
|
dataIndex: 'createTime',
|
|
131
392
|
key: 'createTime',
|
|
132
|
-
width: 128
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
393
|
+
width: 128,
|
|
394
|
+
cell: function cell(createTime, index, record) {
|
|
395
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
396
|
+
title: moment(createTime).format('YYYY-MM-DD HH:mm')
|
|
397
|
+
}, moment(createTime).format('YYYY-MM-DD HH:mm'));
|
|
398
|
+
}
|
|
138
399
|
}, {
|
|
139
400
|
title: '操作',
|
|
140
|
-
dataIndex: '
|
|
141
|
-
key: '
|
|
142
|
-
width: 64
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}, {
|
|
154
|
-
id: 3,
|
|
155
|
-
a: 12312
|
|
156
|
-
}, {
|
|
157
|
-
id: 4,
|
|
158
|
-
a: 12312
|
|
159
|
-
}, {
|
|
160
|
-
id: 5,
|
|
161
|
-
a: 12312
|
|
162
|
-
}, {
|
|
163
|
-
id: 6,
|
|
164
|
-
a: 12312
|
|
165
|
-
}, {
|
|
166
|
-
id: 7,
|
|
167
|
-
a: 12312
|
|
168
|
-
}, {
|
|
169
|
-
id: 8,
|
|
170
|
-
a: 12312
|
|
171
|
-
}, {
|
|
172
|
-
id: 9,
|
|
173
|
-
a: 12312
|
|
174
|
-
}, {
|
|
175
|
-
id: 10,
|
|
176
|
-
a: 12312
|
|
401
|
+
dataIndex: 'status',
|
|
402
|
+
key: 'status',
|
|
403
|
+
width: 64,
|
|
404
|
+
cell: function cell(status, index, record) {
|
|
405
|
+
return status === 'toDeal' ? /*#__PURE__*/React.createElement(_Button, {
|
|
406
|
+
text: true,
|
|
407
|
+
type: "primary"
|
|
408
|
+
}, "\u53D7\u7406") : /*#__PURE__*/React.createElement(_Button, {
|
|
409
|
+
disabled: true,
|
|
410
|
+
text: true,
|
|
411
|
+
type: "primary"
|
|
412
|
+
}, "\u5DF2\u53D7\u7406");
|
|
413
|
+
}
|
|
177
414
|
}];
|
|
178
|
-
|
|
179
|
-
function BaseInfo(type, data) {}
|
|
180
|
-
|
|
181
415
|
return /*#__PURE__*/React.createElement("div", {
|
|
182
416
|
className: styles['resource-overview']
|
|
183
417
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -188,51 +422,7 @@ export default function ResourceOverview(props) {
|
|
|
188
422
|
direction: "ver"
|
|
189
423
|
}), "\u57FA\u672C\u4FE1\u606F"), /*#__PURE__*/React.createElement("div", {
|
|
190
424
|
className: styles.body
|
|
191
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
192
|
-
className: styles['base-info']
|
|
193
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
-
className: styles.row
|
|
195
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
196
|
-
className: styles.item
|
|
197
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
198
|
-
className: styles.label
|
|
199
|
-
}, "\u8D44\u6E90\u540D\u79F0\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
200
|
-
className: styles.content
|
|
201
|
-
}, baseInfo.display_name)), /*#__PURE__*/React.createElement("div", {
|
|
202
|
-
className: styles.item
|
|
203
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
204
|
-
className: styles.label
|
|
205
|
-
}, "IP\u5730\u5740\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
206
|
-
className: styles.content
|
|
207
|
-
}, baseInfo.ipv4_address))), /*#__PURE__*/React.createElement("div", {
|
|
208
|
-
className: styles.row
|
|
209
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
210
|
-
className: styles.item
|
|
211
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
212
|
-
className: styles.label
|
|
213
|
-
}, "\u8D44\u4EA7\u7F16\u53F7\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
214
|
-
className: styles.content
|
|
215
|
-
}, baseInfo.asset_number)), /*#__PURE__*/React.createElement("div", {
|
|
216
|
-
className: styles.item
|
|
217
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
218
|
-
className: styles.label
|
|
219
|
-
}, "\u8D44\u6E90\u7C7B\u578B\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
220
|
-
className: styles.content
|
|
221
|
-
}, baseInfo.type))), /*#__PURE__*/React.createElement("div", {
|
|
222
|
-
className: styles.row
|
|
223
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
224
|
-
className: styles.item
|
|
225
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
226
|
-
className: styles.label
|
|
227
|
-
}, "\u8D44\u6E90\u4F4D\u7F6E\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
228
|
-
className: styles.content
|
|
229
|
-
}, baseInfo.b)), /*#__PURE__*/React.createElement("div", {
|
|
230
|
-
className: styles.item
|
|
231
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
232
|
-
className: styles.label
|
|
233
|
-
}, "\u8D23\u4EFB\u4EBA\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
234
|
-
className: styles.content
|
|
235
|
-
}, baseInfo.c)))))), /*#__PURE__*/React.createElement("div", {
|
|
425
|
+
}, BaseInfoRender(type, baseInfo))), /*#__PURE__*/React.createElement("div", {
|
|
236
426
|
className: styles['block-box']
|
|
237
427
|
}, /*#__PURE__*/React.createElement("div", {
|
|
238
428
|
className: styles.title
|
|
@@ -242,7 +432,7 @@ export default function ResourceOverview(props) {
|
|
|
242
432
|
className: styles.body
|
|
243
433
|
}, /*#__PURE__*/React.createElement("div", {
|
|
244
434
|
className: styles.indicator
|
|
245
|
-
}, indicatorRander(indicator)))), /*#__PURE__*/React.createElement("div", {
|
|
435
|
+
}, indicatorRander(type, indicator)))), /*#__PURE__*/React.createElement("div", {
|
|
246
436
|
className: styles['block-box']
|
|
247
437
|
}, /*#__PURE__*/React.createElement("div", {
|
|
248
438
|
className: styles.title
|
|
@@ -255,7 +445,7 @@ export default function ResourceOverview(props) {
|
|
|
255
445
|
}, /*#__PURE__*/React.createElement(_Table, {
|
|
256
446
|
hasBorder: false,
|
|
257
447
|
columns: columns,
|
|
258
|
-
dataSource:
|
|
448
|
+
dataSource: alarmRiskList,
|
|
259
449
|
emptyContent: /*#__PURE__*/React.createElement(NoDataPage, {
|
|
260
450
|
type: "table"
|
|
261
451
|
})
|
package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss
CHANGED
|
@@ -67,7 +67,18 @@
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
.alarm{
|
|
70
|
+
.alarm {
|
|
71
71
|
margin-top: 12px;
|
|
72
|
+
.alarm-color-icon {
|
|
73
|
+
width: 12px;
|
|
74
|
+
height: 12px;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
margin-right: 4px;
|
|
77
|
+
}
|
|
78
|
+
:global {
|
|
79
|
+
.#{$css-prefix}btn-helper{
|
|
80
|
+
vertical-align: baseline;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
72
83
|
}
|
|
73
84
|
}
|
|
@@ -56,7 +56,8 @@ function BaseInfo(props) {
|
|
|
56
56
|
name: '',
|
|
57
57
|
type: '',
|
|
58
58
|
// 类型: node、link
|
|
59
|
-
ciType: ''
|
|
59
|
+
ciType: '',
|
|
60
|
+
ciName: ''
|
|
60
61
|
}),
|
|
61
62
|
activeData = _useState2[0],
|
|
62
63
|
setActiveData = _useState2[1];
|
|
@@ -74,12 +75,14 @@ function BaseInfo(props) {
|
|
|
74
75
|
var id = data.id,
|
|
75
76
|
name = data.name,
|
|
76
77
|
type = data.type,
|
|
77
|
-
ciType = data.ciType
|
|
78
|
+
ciType = data.ciType,
|
|
79
|
+
ciName = data.ciName;
|
|
78
80
|
setActiveData({
|
|
79
81
|
id: id,
|
|
80
82
|
name: name,
|
|
81
83
|
type: type,
|
|
82
|
-
ciType: ciType
|
|
84
|
+
ciType: ciType,
|
|
85
|
+
ciName: ciName
|
|
83
86
|
});
|
|
84
87
|
|
|
85
88
|
var _topo$ciTyeCache$getC = topo.ciTyeCache.getCiType(ciType),
|
|
@@ -123,5 +126,4 @@ function BaseInfo(props) {
|
|
|
123
126
|
}, /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData))))));
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
;
|
|
127
129
|
export default BaseInfo;
|