@riil-frontend/component-topology 3.1.10 → 3.1.13
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.js +40 -40
- package/demo/1/345/237/272/346/234/254//345/210/207/346/215/242/345/233/276/346/240/207.md +11 -0
- package/demo/CHANGELOG/CHANGELOG.md +15 -1
- package/demo-mock/basic/topo/v1/api/attributes/once +95 -0
- package/demo-mock/basic/topo/v1/api/attributes/once.json +96 -1
- package/es/components/BatchAttrMetric/index.js +1 -0
- package/es/core/common/icons/icon.js +20 -6
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +10 -5
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +6 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +660 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +2 -637
- package/es/utils/topoData.js +66 -40
- package/lib/components/BatchAttrMetric/index.js +1 -0
- package/lib/core/common/icons/icon.js +25 -6
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +11 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +6 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +691 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +4 -663
- package/lib/utils/topoData.js +68 -40
- package/package.json +2 -2
- package/CHANGELOG.md +0 -23
package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js
CHANGED
|
@@ -1,637 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import _Button from "@alifd/next/es/button";
|
|
5
|
-
import _Icon from "@alifd/next/es/icon";
|
|
6
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
9
|
-
import { Link } from 'react-router-dom';
|
|
10
|
-
import moment from 'moment';
|
|
11
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
|
12
|
-
import { findItem } from "../../../../../../../utils/topoData";
|
|
13
|
-
import service from "../../../../../../services/overview";
|
|
14
|
-
import alarmService from "../../../../../../services/alarm";
|
|
15
|
-
import { queryCisByIds } from "../../../../../../services";
|
|
16
|
-
import styles from "./index.module.scss";
|
|
17
|
-
import SingleResourceStrategyLink from "./SingleResourceStrategyLink";
|
|
18
|
-
import BlockBox from "./BlockBox";
|
|
19
|
-
import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
|
|
20
|
-
import ResourceOverviewMetric from "./ResourceOverviewMetric";
|
|
21
|
-
import BaseInfo from "./BaseInfo";
|
|
22
|
-
import BaseInfoBlock from "./BaseInfoBlock"; // url 处理,UICBB 的地址需截取前缀
|
|
23
|
-
|
|
24
|
-
function formatUrl(url) {
|
|
25
|
-
var _window, _window$location;
|
|
26
|
-
|
|
27
|
-
var prefix = '/default/pagecenter';
|
|
28
|
-
|
|
29
|
-
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) === 0 && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) === 0) {
|
|
30
|
-
return url.split(prefix)[1];
|
|
31
|
-
} else {
|
|
32
|
-
return url;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 资源概览
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export default function ResourceOverview(props) {
|
|
41
|
-
var _viewerProps$resource, _baseInfo$resource;
|
|
42
|
-
|
|
43
|
-
var topo = props.topo,
|
|
44
|
-
id = props.id,
|
|
45
|
-
type = props.type,
|
|
46
|
-
ciType = props.ciType,
|
|
47
|
-
userId = props.userId,
|
|
48
|
-
viewerProps = props.viewerProps;
|
|
49
|
-
var resourceOverviewProps = (viewerProps === null || viewerProps === void 0 ? void 0 : (_viewerProps$resource = viewerProps.resourceDetailProps) === null || _viewerProps$resource === void 0 ? void 0 : _viewerProps$resource.resourceOverviewProps) || {};
|
|
50
|
-
var ciAttrAndMetricData = useCiAttrAndMetricData({
|
|
51
|
-
topo: topo,
|
|
52
|
-
id: id
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
var _useState = useState({
|
|
56
|
-
// 资源
|
|
57
|
-
resource: {
|
|
58
|
-
display_name: '',
|
|
59
|
-
// 资源名称/显示名称
|
|
60
|
-
link: '' // 资源跳转链接
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
ipv4_address: '',
|
|
64
|
-
// IP地址
|
|
65
|
-
asset_number: '',
|
|
66
|
-
// 资产编号
|
|
67
|
-
ciName: '',
|
|
68
|
-
// 资源类型
|
|
69
|
-
res_address: '',
|
|
70
|
-
// 资源位置
|
|
71
|
-
// principal: '', // 负责人
|
|
72
|
-
// 链路
|
|
73
|
-
rated_bandwidth: '',
|
|
74
|
-
// 链路带宽
|
|
75
|
-
source_ipv4: '',
|
|
76
|
-
// 源IP地址
|
|
77
|
-
destination_ipv4: '',
|
|
78
|
-
// 目的IP地址
|
|
79
|
-
source_Interface: '',
|
|
80
|
-
// 源端口
|
|
81
|
-
destination_Interface: '' // 目的端口
|
|
82
|
-
|
|
83
|
-
}),
|
|
84
|
-
baseInfo = _useState[0],
|
|
85
|
-
setBaseInfo = _useState[1];
|
|
86
|
-
|
|
87
|
-
var _useState2 = useState([]),
|
|
88
|
-
indicator = _useState2[0],
|
|
89
|
-
setIndicator = _useState2[1];
|
|
90
|
-
|
|
91
|
-
var _useState3 = useState([]),
|
|
92
|
-
alarmRiskList = _useState3[0],
|
|
93
|
-
setAlarmRiskList = _useState3[1];
|
|
94
|
-
|
|
95
|
-
var _useState4 = useState(false),
|
|
96
|
-
isAppTopo = _useState4[0],
|
|
97
|
-
setIsAppTopo = _useState4[1];
|
|
98
|
-
|
|
99
|
-
var ciTypeMeta = useMemo(function () {
|
|
100
|
-
var typeMeta;
|
|
101
|
-
|
|
102
|
-
if (ciType === 'network_link') {
|
|
103
|
-
// 网络链路要按链路类型查询属性、指标
|
|
104
|
-
var link = topo.dataModel.getDataById(id);
|
|
105
|
-
var linkConnectType = link.attributes['network_link.connect_type'];
|
|
106
|
-
typeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
107
|
-
} else {
|
|
108
|
-
typeMeta = topo.ciTyeCache.getCiType(ciType);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return typeMeta;
|
|
112
|
-
}, [id]);
|
|
113
|
-
useEffect(function () {
|
|
114
|
-
if (ciAttrAndMetricData) {
|
|
115
|
-
init();
|
|
116
|
-
}
|
|
117
|
-
}, [ciAttrAndMetricData, ciTypeMeta, id]);
|
|
118
|
-
|
|
119
|
-
function init() {
|
|
120
|
-
return _init.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function _init() {
|
|
124
|
-
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
125
|
-
var _topo$options$resourc, _modelAttributeMap$ow, _modelAttributeMap$, _modelAttributeMap$2, _modelAttributeMap$3, _modelAttributeMap$di, _modelAttributeMap$ip, _modelAttributeMap$as, _modelAttributeMap$5, _modelAttributeMap$6, _modelAttributeMap$so, _attributeMap$source_, _modelAttributeMap$de, _attributeMap$destina;
|
|
126
|
-
|
|
127
|
-
var modelMetrics, ciName, modelAttributeMap, domain, topModelMetrics, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4;
|
|
128
|
-
|
|
129
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
130
|
-
while (1) {
|
|
131
|
-
switch (_context.prev = _context.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
console.log('初始化/更新概览 props', props); // 指标模型
|
|
134
|
-
|
|
135
|
-
modelMetrics = ciTypeMeta.metrics, ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain;
|
|
136
|
-
topModelMetrics = modelMetrics.slice(0, 6); // 应用拓扑处理
|
|
137
|
-
|
|
138
|
-
isAppTopoFlag = !!((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData);
|
|
139
|
-
console.log('应用拓扑判断', topo, isAppTopoFlag);
|
|
140
|
-
setIsAppTopo(isAppTopoFlag);
|
|
141
|
-
|
|
142
|
-
if (!isAppTopoFlag) {
|
|
143
|
-
_context.next = 9;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
initAppTopo(topModelMetrics, modelAttributeMap, ciName, domain);
|
|
148
|
-
return _context.abrupt("return");
|
|
149
|
-
|
|
150
|
-
case 9:
|
|
151
|
-
// 拓扑(默认) ---------------------------
|
|
152
|
-
// 基本信息
|
|
153
|
-
attributeMap = ciAttrAndMetricData.attributeMap, metrics = ciAttrAndMetricData.metrics;
|
|
154
|
-
console.log('基本信息', attributeMap, modelAttributeMap); // userVisible
|
|
155
|
-
// 位置
|
|
156
|
-
|
|
157
|
-
res_address = false;
|
|
158
|
-
|
|
159
|
-
if (!((_modelAttributeMap$ow = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow !== void 0 && _modelAttributeMap$ow.userVisible)) {
|
|
160
|
-
_context.next = 18;
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
_context.next = 15;
|
|
165
|
-
return getAddressFormat(attributeMap);
|
|
166
|
-
|
|
167
|
-
case 15:
|
|
168
|
-
res_address = _context.sent;
|
|
169
|
-
_context.next = 19;
|
|
170
|
-
break;
|
|
171
|
-
|
|
172
|
-
case 18:
|
|
173
|
-
if ((_modelAttributeMap$ = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$ !== void 0 && _modelAttributeMap$.userVisible || (_modelAttributeMap$2 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$2 !== void 0 && _modelAttributeMap$2.userVisible) {
|
|
174
|
-
res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$ = attributeMap[ciType + ".area_object"]) === null || _attributeMap$ === void 0 ? void 0 : _attributeMap$.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
case 19:
|
|
178
|
-
// 链路带宽(取实际带宽)
|
|
179
|
-
rated_bandwidth = false;
|
|
180
|
-
|
|
181
|
-
if ((_modelAttributeMap$3 = modelAttributeMap[ciType + ".actual_bandwidth"]) !== null && _modelAttributeMap$3 !== void 0 && _modelAttributeMap$3.userVisible) {
|
|
182
|
-
rated_bandwidth = attributeMap[ciType + ".actual_bandwidth"] ? attributeMap[ciType + ".actual_bandwidth"] + " " + ((_modelAttributeMap$4 = modelAttributeMap[ciType + ".actual_bandwidth"]) === null || _modelAttributeMap$4 === void 0 ? void 0 : _modelAttributeMap$4.unit) : '';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
setBaseInfo({
|
|
186
|
-
// 资源
|
|
187
|
-
// display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
|
|
188
|
-
resource: (_modelAttributeMap$di = modelAttributeMap.display_name) !== null && _modelAttributeMap$di !== void 0 && _modelAttributeMap$di.userVisible ? {
|
|
189
|
-
display_name: attributeMap.display_name,
|
|
190
|
-
// 资源名称/显示名称
|
|
191
|
-
link: "/default/pagecenter/resDetail/view/" + id + "?resId=" + id + "&domainCode=" + domain + "&title=" + attributeMap.display_name + "&ciCode=" + ciType // 资源跳转链接
|
|
192
|
-
|
|
193
|
-
} : false,
|
|
194
|
-
ipv4_address: (_modelAttributeMap$ip = modelAttributeMap.ipv4_address) !== null && _modelAttributeMap$ip !== void 0 && _modelAttributeMap$ip.userVisible ? attributeMap.ipv4_address : false,
|
|
195
|
-
asset_number: (_modelAttributeMap$as = modelAttributeMap.asset_number) !== null && _modelAttributeMap$as !== void 0 && _modelAttributeMap$as.userVisible ? attributeMap.asset_number : false,
|
|
196
|
-
ciName: ciName,
|
|
197
|
-
res_address: res_address,
|
|
198
|
-
// principal: modelAttributeMap[`${ciType}.principal`] ? attributeMap[`${ciType}.principal`] : false,
|
|
199
|
-
// 链路
|
|
200
|
-
rated_bandwidth: rated_bandwidth,
|
|
201
|
-
source_ipv4: (_modelAttributeMap$5 = modelAttributeMap[ciType + ".source_ipv4"]) !== null && _modelAttributeMap$5 !== void 0 && _modelAttributeMap$5.userVisible ? attributeMap[ciType + ".source_ipv4"] : false,
|
|
202
|
-
destination_ipv4: (_modelAttributeMap$6 = modelAttributeMap[ciType + ".destination_ipv4"]) !== null && _modelAttributeMap$6 !== void 0 && _modelAttributeMap$6.userVisible ? attributeMap[ciType + ".destination_ipv4"] : false,
|
|
203
|
-
source_Interface: (_modelAttributeMap$so = modelAttributeMap.source_id) !== null && _modelAttributeMap$so !== void 0 && _modelAttributeMap$so.userVisible ? (_attributeMap$source_ = attributeMap.source_id_object) === null || _attributeMap$source_ === void 0 ? void 0 : _attributeMap$source_.displayName : false,
|
|
204
|
-
destination_Interface: (_modelAttributeMap$de = modelAttributeMap.destination_id) !== null && _modelAttributeMap$de !== void 0 && _modelAttributeMap$de.userVisible ? (_attributeMap$destina = attributeMap.destination_id_object) === null || _attributeMap$destina === void 0 ? void 0 : _attributeMap$destina.displayName : false
|
|
205
|
-
}); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
|
|
206
|
-
|
|
207
|
-
setIndicator(topModelMetrics.map(function (item) {
|
|
208
|
-
var _findItem;
|
|
209
|
-
|
|
210
|
-
return _extends({}, item, {
|
|
211
|
-
value: ((_findItem = findItem(metrics, 'code', item.code)) === null || _findItem === void 0 ? void 0 : _findItem.value) || ''
|
|
212
|
-
});
|
|
213
|
-
})); // 资源-告警/风险
|
|
214
|
-
|
|
215
|
-
getAlarmRiskData(id);
|
|
216
|
-
|
|
217
|
-
case 24:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context.stop();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}, _callee);
|
|
223
|
-
}));
|
|
224
|
-
return _init.apply(this, arguments);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function initAppTopo(_x, _x2, _x3, _x4) {
|
|
228
|
-
return _initAppTopo.apply(this, arguments);
|
|
229
|
-
} // 获取属性信息(应用拓扑)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
function _initAppTopo() {
|
|
233
|
-
_initAppTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(topModelMetrics, modelAttributeMap, ciName, domain) {
|
|
234
|
-
var _topo$options$resourc2, _modelAttributeMap$ow2, _modelAttributeMap$7, _modelAttributeMap$8, _modelAttributeMap$di2, _modelAttributeMap$ip2, _modelAttributeMap$as2, _alarmList;
|
|
235
|
-
|
|
236
|
-
var _yield$topo$options$r, metrics, alarmList, attributeMap, res_address, _attributeMap$2;
|
|
237
|
-
|
|
238
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
239
|
-
while (1) {
|
|
240
|
-
switch (_context2.prev = _context2.next) {
|
|
241
|
-
case 0:
|
|
242
|
-
topo.resourceOverviewDrawer = {
|
|
243
|
-
refreshData: function refreshData() {
|
|
244
|
-
init();
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
_context2.next = 3;
|
|
248
|
-
return (_topo$options$resourc2 = topo.options.resourceOverviewDrawer) === null || _topo$options$resourc2 === void 0 ? void 0 : _topo$options$resourc2.getData({
|
|
249
|
-
id: id,
|
|
250
|
-
metrics: topModelMetrics
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
case 3:
|
|
254
|
-
_yield$topo$options$r = _context2.sent;
|
|
255
|
-
metrics = _yield$topo$options$r.metrics;
|
|
256
|
-
alarmList = _yield$topo$options$r.alarms;
|
|
257
|
-
console.log('应用拓扑 参数获取', metrics, alarmList);
|
|
258
|
-
_context2.next = 9;
|
|
259
|
-
return getAttribute(id);
|
|
260
|
-
|
|
261
|
-
case 9:
|
|
262
|
-
attributeMap = _context2.sent;
|
|
263
|
-
// 位置
|
|
264
|
-
res_address = false;
|
|
265
|
-
|
|
266
|
-
if (!((_modelAttributeMap$ow2 = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow2 !== void 0 && _modelAttributeMap$ow2.userVisible)) {
|
|
267
|
-
_context2.next = 17;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
_context2.next = 14;
|
|
272
|
-
return getAddressFormat(attributeMap);
|
|
273
|
-
|
|
274
|
-
case 14:
|
|
275
|
-
res_address = _context2.sent;
|
|
276
|
-
_context2.next = 18;
|
|
277
|
-
break;
|
|
278
|
-
|
|
279
|
-
case 17:
|
|
280
|
-
if ((_modelAttributeMap$7 = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$7 !== void 0 && _modelAttributeMap$7.userVisible || (_modelAttributeMap$8 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$8 !== void 0 && _modelAttributeMap$8.userVisible) {
|
|
281
|
-
res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$2 = attributeMap[ciType + ".area_object"]) === null || _attributeMap$2 === void 0 ? void 0 : _attributeMap$2.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
case 18:
|
|
285
|
-
setBaseInfo({
|
|
286
|
-
// 资源
|
|
287
|
-
// display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
|
|
288
|
-
resource: (_modelAttributeMap$di2 = modelAttributeMap.display_name) !== null && _modelAttributeMap$di2 !== void 0 && _modelAttributeMap$di2.userVisible ? {
|
|
289
|
-
display_name: attributeMap.display_name,
|
|
290
|
-
// 资源名称/显示名称
|
|
291
|
-
link: "/default/pagecenter/resDetail/view/" + id + "?resId=" + id + "&domainCode=" + domain + "&title=" + attributeMap.display_name + "&ciCode=" + ciType // 资源跳转链接
|
|
292
|
-
|
|
293
|
-
} : false,
|
|
294
|
-
ipv4_address: (_modelAttributeMap$ip2 = modelAttributeMap.ipv4_address) !== null && _modelAttributeMap$ip2 !== void 0 && _modelAttributeMap$ip2.userVisible ? attributeMap.ipv4_address : false,
|
|
295
|
-
asset_number: (_modelAttributeMap$as2 = modelAttributeMap.asset_number) !== null && _modelAttributeMap$as2 !== void 0 && _modelAttributeMap$as2.userVisible ? attributeMap.asset_number : false,
|
|
296
|
-
ciName: ciName,
|
|
297
|
-
res_address: res_address // principal: modelAttributeMap[`${ciType}.principal`] ? attributeMap[`${ciType}.principal`] : false,
|
|
298
|
-
|
|
299
|
-
});
|
|
300
|
-
setIndicator(topModelMetrics.map(function (item) {
|
|
301
|
-
return _extends({}, item, {
|
|
302
|
-
value: metrics[item.code] || ''
|
|
303
|
-
});
|
|
304
|
-
}));
|
|
305
|
-
alarmList = ((_alarmList = alarmList) === null || _alarmList === void 0 ? void 0 : _alarmList.map(function (item) {
|
|
306
|
-
return {
|
|
307
|
-
type: 'alarm',
|
|
308
|
-
icon: 'gaojing-3',
|
|
309
|
-
className: "alarm-color-icon-lv" + item.alertLevel,
|
|
310
|
-
title: "[" + item.alertObject + "] " + item.alertTitle,
|
|
311
|
-
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + item.alertObject + "&ruleId=" + item.ruleId,
|
|
312
|
-
time: item.createTime,
|
|
313
|
-
status: item.status,
|
|
314
|
-
params: [{
|
|
315
|
-
alertId: item.alertId,
|
|
316
|
-
status: 'dealing',
|
|
317
|
-
userId: userId,
|
|
318
|
-
isBaseAlert: false
|
|
319
|
-
}]
|
|
320
|
-
};
|
|
321
|
-
})) || [];
|
|
322
|
-
setAlarmRiskList(alarmList);
|
|
323
|
-
|
|
324
|
-
case 22:
|
|
325
|
-
case "end":
|
|
326
|
-
return _context2.stop();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}, _callee2);
|
|
330
|
-
}));
|
|
331
|
-
return _initAppTopo.apply(this, arguments);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function getAttribute(_x5) {
|
|
335
|
-
return _getAttribute.apply(this, arguments);
|
|
336
|
-
} // 获取地址信息:机房 机柜 起始U-结束U
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
function _getAttribute() {
|
|
340
|
-
_getAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
|
341
|
-
var res, _ref2, attributes, attributeMap;
|
|
342
|
-
|
|
343
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
344
|
-
while (1) {
|
|
345
|
-
switch (_context3.prev = _context3.next) {
|
|
346
|
-
case 0:
|
|
347
|
-
_context3.next = 2;
|
|
348
|
-
return topoService.ciInfo.batchQueryCiInfo({
|
|
349
|
-
ciId: [{
|
|
350
|
-
ciId: id,
|
|
351
|
-
operation: 'delete'
|
|
352
|
-
}],
|
|
353
|
-
codes: [],
|
|
354
|
-
relationId: []
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
case 2:
|
|
358
|
-
res = _context3.sent;
|
|
359
|
-
_ref2 = res[0] || {}, attributes = _ref2.attributes;
|
|
360
|
-
attributeMap = {};
|
|
361
|
-
attributes.forEach(function (item) {
|
|
362
|
-
attributeMap[item.code] = item.value;
|
|
363
|
-
});
|
|
364
|
-
return _context3.abrupt("return", attributeMap);
|
|
365
|
-
|
|
366
|
-
case 7:
|
|
367
|
-
case "end":
|
|
368
|
-
return _context3.stop();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, _callee3);
|
|
372
|
-
}));
|
|
373
|
-
return _getAttribute.apply(this, arguments);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function getAddressFormat(_x6) {
|
|
377
|
-
return _getAddressFormat.apply(this, arguments);
|
|
378
|
-
} // 获取告警/风险信息
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
function _getAddressFormat() {
|
|
382
|
-
_getAddressFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref) {
|
|
383
|
-
var owned_computer_room, owned_cabinet, start_u_location, end_u_location, address, _res$find, _res$find$attributes, _res$find2, _res$find2$attributes, res, u;
|
|
384
|
-
|
|
385
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
386
|
-
while (1) {
|
|
387
|
-
switch (_context4.prev = _context4.next) {
|
|
388
|
-
case 0:
|
|
389
|
-
owned_computer_room = _ref.owned_computer_room, owned_cabinet = _ref.owned_cabinet, start_u_location = _ref.start_u_location, end_u_location = _ref.end_u_location;
|
|
390
|
-
console.log('获取地址信息:', {
|
|
391
|
-
owned_computer_room: owned_computer_room,
|
|
392
|
-
owned_cabinet: owned_cabinet,
|
|
393
|
-
start_u_location: start_u_location,
|
|
394
|
-
end_u_location: end_u_location
|
|
395
|
-
});
|
|
396
|
-
address = '';
|
|
397
|
-
|
|
398
|
-
if (!(owned_computer_room && owned_cabinet)) {
|
|
399
|
-
_context4.next = 8;
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
_context4.next = 6;
|
|
404
|
-
return queryCisByIds([owned_computer_room, owned_cabinet]);
|
|
405
|
-
|
|
406
|
-
case 6:
|
|
407
|
-
res = _context4.sent;
|
|
408
|
-
address = (((_res$find = res.find(function (item) {
|
|
409
|
-
return item.id === owned_computer_room;
|
|
410
|
-
})) === null || _res$find === void 0 ? void 0 : (_res$find$attributes = _res$find.attributes) === null || _res$find$attributes === void 0 ? void 0 : _res$find$attributes.display_name) || '') + " " + (((_res$find2 = res.find(function (item) {
|
|
411
|
-
return item.id === owned_cabinet;
|
|
412
|
-
})) === null || _res$find2 === void 0 ? void 0 : (_res$find2$attributes = _res$find2.attributes) === null || _res$find2$attributes === void 0 ? void 0 : _res$find2$attributes.display_name) || '');
|
|
413
|
-
|
|
414
|
-
case 8:
|
|
415
|
-
u = '';
|
|
416
|
-
|
|
417
|
-
if (start_u_location || end_u_location) {
|
|
418
|
-
u = (start_u_location || '') + "-" + (end_u_location || '');
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
return _context4.abrupt("return", address || u ? "" + (address || '') + (u ? " " + u : '') : '');
|
|
422
|
-
|
|
423
|
-
case 11:
|
|
424
|
-
case "end":
|
|
425
|
-
return _context4.stop();
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}, _callee4);
|
|
429
|
-
}));
|
|
430
|
-
return _getAddressFormat.apply(this, arguments);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function getAlarmRiskData(_x7) {
|
|
434
|
-
return _getAlarmRiskData.apply(this, arguments);
|
|
435
|
-
} // 告警table列配置
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
function _getAlarmRiskData() {
|
|
439
|
-
_getAlarmRiskData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
|
|
440
|
-
var _yield$alarmService$g, alarmList, _yield$service$getRis, riskList;
|
|
441
|
-
|
|
442
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
443
|
-
while (1) {
|
|
444
|
-
switch (_context5.prev = _context5.next) {
|
|
445
|
-
case 0:
|
|
446
|
-
_context5.next = 2;
|
|
447
|
-
return alarmService.getAlarmByIds([id], {
|
|
448
|
-
alertStatusList: ['toDeal', 'dealing'],
|
|
449
|
-
// toDeal: 待处理, dealing:处理中
|
|
450
|
-
pageNum: 1,
|
|
451
|
-
pageSize: 999,
|
|
452
|
-
sortField: 'alertLevel',
|
|
453
|
-
sortOrder: 'desc'
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
case 2:
|
|
457
|
-
_yield$alarmService$g = _context5.sent;
|
|
458
|
-
alarmList = _yield$alarmService$g.datas;
|
|
459
|
-
alarmList = alarmList.map(function (item) {
|
|
460
|
-
return {
|
|
461
|
-
type: 'alarm',
|
|
462
|
-
icon: 'gaojing-3',
|
|
463
|
-
className: "alarm-color-icon-lv" + item.alertLevel,
|
|
464
|
-
title: "[" + item.alertObject + "] " + item.alertTitle,
|
|
465
|
-
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + item.alertObject + "&ruleId=" + item.ruleId,
|
|
466
|
-
time: item.createTime,
|
|
467
|
-
status: item.status,
|
|
468
|
-
params: [{
|
|
469
|
-
alertId: item.alertId,
|
|
470
|
-
status: 'dealing',
|
|
471
|
-
userId: userId,
|
|
472
|
-
isBaseAlert: false
|
|
473
|
-
}]
|
|
474
|
-
};
|
|
475
|
-
});
|
|
476
|
-
_context5.next = 7;
|
|
477
|
-
return service.getRiskByIds({
|
|
478
|
-
ciIdList: [id],
|
|
479
|
-
statusList: ['toDeal', 'dealing'],
|
|
480
|
-
current: 1,
|
|
481
|
-
pageSize: 999
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
case 7:
|
|
485
|
-
_yield$service$getRis = _context5.sent;
|
|
486
|
-
riskList = _yield$service$getRis.content;
|
|
487
|
-
riskList = riskList.map(function (item) {
|
|
488
|
-
return {
|
|
489
|
-
type: 'risk',
|
|
490
|
-
icon: 'Overall_risk_full',
|
|
491
|
-
className: 'risk-icon',
|
|
492
|
-
title: item.itemName,
|
|
493
|
-
link: "/default/inspectionTaskList/inspectionReport?title=" + item.ciName + "&reportId=" + item.executeId + "&reportTime=" + item.executeTime + "&reportType=" + item.viewType + "&reportName=" + item.ciName,
|
|
494
|
-
time: item.firstFoundTime
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
console.log('告警和风险', alarmList, riskList);
|
|
498
|
-
setAlarmRiskList([].concat(alarmList, riskList));
|
|
499
|
-
|
|
500
|
-
case 12:
|
|
501
|
-
case "end":
|
|
502
|
-
return _context5.stop();
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}, _callee5);
|
|
506
|
-
}));
|
|
507
|
-
return _getAlarmRiskData.apply(this, arguments);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
var columns = [{
|
|
511
|
-
title: '描述',
|
|
512
|
-
dataIndex: 'title',
|
|
513
|
-
key: 'title',
|
|
514
|
-
cell: function cell(value, index, record) {
|
|
515
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
516
|
-
className: styles['alarm-title'],
|
|
517
|
-
title: value
|
|
518
|
-
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
519
|
-
type: record.icon,
|
|
520
|
-
size: "xs",
|
|
521
|
-
className: styles['alarm-color-icon'] + " " + record.className
|
|
522
|
-
}), /*#__PURE__*/React.createElement(Link, {
|
|
523
|
-
className: styles.link,
|
|
524
|
-
to: formatUrl(record.link)
|
|
525
|
-
}, value));
|
|
526
|
-
}
|
|
527
|
-
}, {
|
|
528
|
-
title: '时间',
|
|
529
|
-
dataIndex: 'time',
|
|
530
|
-
key: 'time',
|
|
531
|
-
width: 144,
|
|
532
|
-
cell: function cell(value, index, record) {
|
|
533
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
534
|
-
title: moment(value).format('YYYY-MM-DD HH:mm:ss')
|
|
535
|
-
}, moment(value).format('YYYY-MM-DD HH:mm:ss'));
|
|
536
|
-
}
|
|
537
|
-
}, {
|
|
538
|
-
title: '操作',
|
|
539
|
-
dataIndex: 'status',
|
|
540
|
-
key: 'status',
|
|
541
|
-
width: 64,
|
|
542
|
-
cell: function cell(status, index, record) {
|
|
543
|
-
if (record.type === 'alarm') {
|
|
544
|
-
return status === 'toDeal' ? /*#__PURE__*/React.createElement(_Button, {
|
|
545
|
-
text: true,
|
|
546
|
-
type: "primary",
|
|
547
|
-
onClick: function onClick() {
|
|
548
|
-
return alarmRiskOperation(record.type, record.params);
|
|
549
|
-
}
|
|
550
|
-
}, "\u53D7\u7406") : /*#__PURE__*/React.createElement(_Button, {
|
|
551
|
-
disabled: true,
|
|
552
|
-
text: true,
|
|
553
|
-
type: "primary"
|
|
554
|
-
}, "\u5DF2\u53D7\u7406");
|
|
555
|
-
} else {
|
|
556
|
-
// return <Button text type="primary" onClick={() => alarmRiskOperation(record.type, record)}>受理</Button>
|
|
557
|
-
return '';
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}]; // 告警/风险 操作 (受理)
|
|
561
|
-
|
|
562
|
-
function alarmRiskOperation(_x8, _x9) {
|
|
563
|
-
return _alarmRiskOperation.apply(this, arguments);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
function _alarmRiskOperation() {
|
|
567
|
-
_alarmRiskOperation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(type, params) {
|
|
568
|
-
var res, _topo$ciTyeCache$getC, modelMetrics, ciName, modelAttributeMap, domain, topModelMetrics;
|
|
569
|
-
|
|
570
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
571
|
-
while (1) {
|
|
572
|
-
switch (_context6.prev = _context6.next) {
|
|
573
|
-
case 0:
|
|
574
|
-
if (!(type === 'alarm')) {
|
|
575
|
-
_context6.next = 6;
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
_context6.next = 3;
|
|
580
|
-
return service.handleAlarm(params);
|
|
581
|
-
|
|
582
|
-
case 3:
|
|
583
|
-
res = _context6.sent;
|
|
584
|
-
|
|
585
|
-
_Message.success('受理成功');
|
|
586
|
-
|
|
587
|
-
if (isAppTopo) {
|
|
588
|
-
_topo$ciTyeCache$getC = topo.ciTyeCache.getCiType(ciType), modelMetrics = _topo$ciTyeCache$getC.metrics, ciName = _topo$ciTyeCache$getC.displayName, modelAttributeMap = _topo$ciTyeCache$getC.attributeMap, domain = _topo$ciTyeCache$getC.domain;
|
|
589
|
-
topModelMetrics = modelMetrics.slice(0, 6);
|
|
590
|
-
initAppTopo(topModelMetrics, modelAttributeMap, ciName, domain);
|
|
591
|
-
} else {
|
|
592
|
-
getAlarmRiskData(id);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
case 6:
|
|
596
|
-
case "end":
|
|
597
|
-
return _context6.stop();
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}, _callee6);
|
|
601
|
-
}));
|
|
602
|
-
return _alarmRiskOperation.apply(this, arguments);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
var elementData = {
|
|
606
|
-
id: id,
|
|
607
|
-
ciType: ciType,
|
|
608
|
-
type: type,
|
|
609
|
-
name: baseInfo === null || baseInfo === void 0 ? void 0 : (_baseInfo$resource = baseInfo.resource) === null || _baseInfo$resource === void 0 ? void 0 : _baseInfo$resource.display_name
|
|
610
|
-
};
|
|
611
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
612
|
-
className: styles['resource-overview']
|
|
613
|
-
}, /*#__PURE__*/React.createElement(BaseInfoBlock, _extends({
|
|
614
|
-
data: elementData,
|
|
615
|
-
ciTypeMeta: ciTypeMeta,
|
|
616
|
-
baseInfo: baseInfo
|
|
617
|
-
}, resourceOverviewProps === null || resourceOverviewProps === void 0 ? void 0 : resourceOverviewProps.baseInfoProps)), /*#__PURE__*/React.createElement(BlockBox, {
|
|
618
|
-
headerTitle: "\u5173\u952E\u6307\u6807"
|
|
619
|
-
}, /*#__PURE__*/React.createElement(ResourceOverviewMetric, {
|
|
620
|
-
topo: topo,
|
|
621
|
-
type: type,
|
|
622
|
-
data: indicator
|
|
623
|
-
})), /*#__PURE__*/React.createElement(BlockBox, {
|
|
624
|
-
headerTitle: "\u6700\u8FD1\u7684\u544A\u8B66\u548C\u98CE\u9669"
|
|
625
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
626
|
-
className: styles.alarm
|
|
627
|
-
}, /*#__PURE__*/React.createElement(_Table, {
|
|
628
|
-
hasBorder: false,
|
|
629
|
-
fixedHeader: true,
|
|
630
|
-
columns: columns,
|
|
631
|
-
maxBodyHeight: "auto",
|
|
632
|
-
dataSource: alarmRiskList,
|
|
633
|
-
emptyContent: /*#__PURE__*/React.createElement("div", {
|
|
634
|
-
className: styles['no-data']
|
|
635
|
-
}, "\u6682\u65E0\u6570\u636E")
|
|
636
|
-
}))));
|
|
637
|
-
}
|
|
1
|
+
import ResourceOverview from "./ResourceOverview";
|
|
2
|
+
export default ResourceOverview;
|