@riil-frontend/component-topology 8.0.0-a.8 → 8.0.1
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 +11 -11
- package/es/core/hooks/usePolling.js +3 -3
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +31 -63
- package/es/core/services/overview.js +33 -9
- package/es/core/store/models/topoAlarm.js +9 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +124 -251
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +171 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
- package/es/networkTopo/services/link.js +11 -12
- package/lib/core/hooks/usePolling.js +3 -3
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +32 -67
- package/lib/core/services/overview.js +32 -8
- package/lib/core/store/models/topoAlarm.js +10 -4
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +125 -251
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +184 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
- package/lib/networkTopo/services/link.js +11 -12
- package/package.json +2 -2
@@ -21,9 +21,9 @@ var usePolling = function usePolling(props) {
|
|
21
21
|
var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
|
22
22
|
|
23
23
|
var _useRequest = useRequest(refresh, {
|
24
|
-
pollingInterval:
|
25
|
-
|
26
|
-
// debounceInterval:
|
24
|
+
pollingInterval: 60 * 1000,
|
25
|
+
pollingWhenHidden: false,
|
26
|
+
// debounceInterval: 200,
|
27
27
|
manual: true,
|
28
28
|
onSuccess: function onSuccess(result) {
|
29
29
|
if (result) {
|
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
|
|
23
23
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
24
24
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
25
25
|
|
26
|
-
var version = typeof "8.0.
|
26
|
+
var version = typeof "8.0.1" === 'string' ? "8.0.1" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
5
4
|
import keyBy from 'lodash/keyBy';
|
6
5
|
import _ from 'lodash';
|
7
6
|
import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
|
8
7
|
|
9
|
-
import { getEdges } from "../../../utils/htElementUtils";
|
8
|
+
import { getEdges } from "../../../utils/htElementUtils";
|
9
|
+
import CiTypeCache from "../cache/CiTypeCache"; // const interfaceTypeMap = {
|
10
10
|
// "network.interface": {
|
11
11
|
// displayName: "网络接口",
|
12
12
|
// },
|
@@ -33,40 +33,6 @@ export function isCrucialLink(link) {
|
|
33
33
|
export function isExitLink(link) {
|
34
34
|
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
|
35
35
|
}
|
36
|
-
export var getInterfaceObject = /*#__PURE__*/function () {
|
37
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
|
38
|
-
var query, promises, result, ifDoc;
|
39
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
40
|
-
while (1) {
|
41
|
-
switch (_context.prev = _context.next) {
|
42
|
-
case 0:
|
43
|
-
query = _.compact(_.uniq(codes));
|
44
|
-
promises = query.map(queryModelAsset);
|
45
|
-
_context.next = 4;
|
46
|
-
return Promise.all(promises);
|
47
|
-
|
48
|
-
case 4:
|
49
|
-
result = _context.sent;
|
50
|
-
ifDoc = {};
|
51
|
-
result.map(function (ifItem) {
|
52
|
-
ifDoc[ifItem.code] = {
|
53
|
-
displayName: ifItem.displayName
|
54
|
-
};
|
55
|
-
});
|
56
|
-
return _context.abrupt("return", ifDoc);
|
57
|
-
|
58
|
-
case 8:
|
59
|
-
case "end":
|
60
|
-
return _context.stop();
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}, _callee);
|
64
|
-
}));
|
65
|
-
|
66
|
-
return function getInterfaceObject(_x) {
|
67
|
-
return _ref.apply(this, arguments);
|
68
|
-
};
|
69
|
-
}();
|
70
36
|
export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
|
71
37
|
var linkCiMap = keyBy(links, 'id');
|
72
38
|
return links.map(function (link) {
|
@@ -110,57 +76,59 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
|
|
110
76
|
});
|
111
77
|
});
|
112
78
|
}
|
113
|
-
export function getLinksDetail(
|
79
|
+
export function getLinksDetail(_x, _x2) {
|
114
80
|
return _getLinksDetail.apply(this, arguments);
|
115
81
|
}
|
116
82
|
|
117
83
|
function _getLinksDetail() {
|
118
|
-
_getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
84
|
+
_getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
|
119
85
|
var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
|
120
|
-
return _regeneratorRuntime.wrap(function
|
86
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
121
87
|
while (1) {
|
122
|
-
switch (
|
88
|
+
switch (_context.prev = _context.next) {
|
123
89
|
case 0:
|
124
90
|
if (!(!links || !links.length)) {
|
125
|
-
|
91
|
+
_context.next = 2;
|
126
92
|
break;
|
127
93
|
}
|
128
94
|
|
129
|
-
return
|
95
|
+
return _context.abrupt("return", []);
|
130
96
|
|
131
97
|
case 2:
|
132
98
|
// const linkCis = await topoService.relation.batchQueryRelation(
|
133
99
|
// links.map((link) => link.id)
|
134
100
|
// );
|
135
101
|
linkCis = links;
|
136
|
-
interfaceIds = []
|
137
|
-
|
138
|
-
linkCis.
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
102
|
+
interfaceIds = [].concat(linkCis.map(function (item) {
|
103
|
+
return item.attributes.source_id;
|
104
|
+
}), linkCis.map(function (item) {
|
105
|
+
return item.attributes.destination_id;
|
106
|
+
}));
|
107
|
+
interfaceTypes = _.compact(_.uniq([].concat(linkCis.map(function (item) {
|
108
|
+
return item.attributes.source_type;
|
109
|
+
}), linkCis.map(function (item) {
|
110
|
+
return item.attributes.destination_type;
|
111
|
+
})))).filter(function (item) {
|
112
|
+
return item !== 'ip';
|
143
113
|
});
|
144
|
-
|
114
|
+
_context.next = 7;
|
145
115
|
return queryCisByIds(interfaceIds);
|
146
116
|
|
147
|
-
case
|
148
|
-
interfaceCis =
|
149
|
-
|
150
|
-
return
|
151
|
-
return item !== 'ip';
|
152
|
-
}));
|
117
|
+
case 7:
|
118
|
+
interfaceCis = _context.sent;
|
119
|
+
_context.next = 10;
|
120
|
+
return CiTypeCache.getCiTypeMap(interfaceTypes);
|
153
121
|
|
154
|
-
case
|
155
|
-
interfaceDoc =
|
156
|
-
return
|
122
|
+
case 10:
|
123
|
+
interfaceDoc = _context.sent;
|
124
|
+
return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
|
157
125
|
|
158
|
-
case
|
126
|
+
case 12:
|
159
127
|
case "end":
|
160
|
-
return
|
128
|
+
return _context.stop();
|
161
129
|
}
|
162
130
|
}
|
163
|
-
},
|
131
|
+
}, _callee);
|
164
132
|
}));
|
165
133
|
return _getLinksDetail.apply(this, arguments);
|
166
134
|
}
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
3
3
|
import { request } from '@riil-frontend/component-topology-utils';
|
4
|
-
import { commonQueryCiDataByIds } from "./cmdb";
|
4
|
+
import { commonQueryCiDataByIds } from "./cmdb"; // 机房可上架设备类型缓存数据
|
5
|
+
|
6
|
+
var roomDeviceTypeList = null; // 资源子组件缓存
|
7
|
+
|
8
|
+
var ciComponentsMap = {};
|
5
9
|
export default {
|
6
10
|
/**
|
7
11
|
* 根据资源id获取风险
|
@@ -35,19 +39,31 @@ export default {
|
|
35
39
|
*/
|
36
40
|
queryAllComponentsByCiId: function queryAllComponentsByCiId(id) {
|
37
41
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
42
|
+
var components;
|
38
43
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
39
44
|
while (1) {
|
40
45
|
switch (_context2.prev = _context2.next) {
|
41
46
|
case 0:
|
42
|
-
|
47
|
+
components = ciComponentsMap[id];
|
48
|
+
|
49
|
+
if (components) {
|
50
|
+
_context2.next = 6;
|
51
|
+
break;
|
52
|
+
}
|
53
|
+
|
54
|
+
_context2.next = 4;
|
43
55
|
return request.post('/mdc/v1/api/cmdb/queryAllComponentsByCiId', {
|
44
56
|
id: id
|
45
57
|
});
|
46
58
|
|
47
|
-
case
|
48
|
-
|
59
|
+
case 4:
|
60
|
+
components = _context2.sent;
|
61
|
+
ciComponentsMap[id] = components;
|
49
62
|
|
50
|
-
case
|
63
|
+
case 6:
|
64
|
+
return _context2.abrupt("return", components);
|
65
|
+
|
66
|
+
case 7:
|
51
67
|
case "end":
|
52
68
|
return _context2.stop();
|
53
69
|
}
|
@@ -186,13 +202,21 @@ export default {
|
|
186
202
|
while (1) {
|
187
203
|
switch (_context8.prev = _context8.next) {
|
188
204
|
case 0:
|
189
|
-
|
190
|
-
|
205
|
+
if (roomDeviceTypeList) {
|
206
|
+
_context8.next = 4;
|
207
|
+
break;
|
208
|
+
}
|
191
209
|
|
192
|
-
|
193
|
-
return
|
210
|
+
_context8.next = 3;
|
211
|
+
return request.post("/room/v1/api/device/type/list", {});
|
194
212
|
|
195
213
|
case 3:
|
214
|
+
roomDeviceTypeList = _context8.sent;
|
215
|
+
|
216
|
+
case 4:
|
217
|
+
return _context8.abrupt("return", roomDeviceTypeList);
|
218
|
+
|
219
|
+
case 5:
|
196
220
|
case "end":
|
197
221
|
return _context8.stop();
|
198
222
|
}
|
@@ -7,8 +7,16 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
*/
|
8
8
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
9
9
|
import _ from "lodash";
|
10
|
-
import { sortList } from "../../../utils/topoData";
|
11
10
|
var showAlarmStatus = ["toDeal", "dealing", "change", "woDealing"];
|
11
|
+
|
12
|
+
var sortList = function sortList(a, b) {
|
13
|
+
if (a.level === b.level) {
|
14
|
+
return a.obj.createTime - b.obj.createTime;
|
15
|
+
} else {
|
16
|
+
return a.level - b.level;
|
17
|
+
}
|
18
|
+
};
|
19
|
+
|
12
20
|
export default function (topo) {
|
13
21
|
return {
|
14
22
|
// 定义 model 的初始 state
|