@riil-frontend/component-topology 9.0.0-a.3 → 9.0.0-a.31
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/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +12 -12
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/es/core/components/TopoView/GraphViewPanel.js +17 -4
- package/es/core/components/TopoView/TopoView.module.scss +17 -3
- package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -5
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
- package/es/core/editor/config/themes.js +53 -2
- package/es/core/event/topoEventListener.js +22 -0
- package/es/core/hooks/useAlarm.js +18 -12
- package/es/core/hooks/useCanvasTheme.js +12 -4
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useTopoEdit.js +113 -19
- package/es/core/hooks/useTopoEventListener.js +4 -18
- package/es/core/hooks/useTopoFullscreen.js +32 -0
- package/es/core/models/Alarm.js +4 -13
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +16 -9
- package/es/core/models/utils/linkUtils.js +52 -27
- package/es/core/store/models/topoConfig.js +51 -20
- package/es/core/test/Test.js +52 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +11 -35
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -56
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
- package/es/networkTopo/getTopoData.js +2 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
- package/es/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +27 -26
- package/es/networkTopo/services/topo/networkLink.js +45 -3
- package/es/networkTopo/utils/exitLinkUtil.js +262 -0
- package/es/utils/ResourceConfigUtil.js +5 -4
- package/es/utils/htElementDataUtil.js +1 -7
- package/es/utils/htElementUtils.js +21 -21
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
- package/lib/core/components/TopoView/TopoView.module.scss +17 -3
- package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -4
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
- package/lib/core/editor/config/themes.js +53 -2
- package/lib/core/event/topoEventListener.js +27 -0
- package/lib/core/hooks/useAlarm.js +19 -12
- package/lib/core/hooks/useCanvasTheme.js +12 -4
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +114 -18
- package/lib/core/hooks/useTopoEventListener.js +3 -17
- package/lib/core/hooks/useTopoFullscreen.js +42 -0
- package/lib/core/models/Alarm.js +5 -16
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +16 -9
- package/lib/core/models/utils/linkUtils.js +53 -26
- package/lib/core/store/models/topoConfig.js +56 -19
- package/lib/core/test/Test.js +52 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +10 -35
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -55
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
- package/lib/networkTopo/getTopoData.js +2 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
- package/lib/networkTopo/services/topo/basic.js +28 -28
- package/lib/networkTopo/services/topo/networkLink.js +45 -3
- package/lib/networkTopo/utils/exitLinkUtil.js +274 -0
- package/lib/utils/ResourceConfigUtil.js +4 -4
- package/lib/utils/htElementDataUtil.js +0 -10
- package/lib/utils/htElementUtils.js +21 -21
- package/package.json +3 -3
@@ -1,8 +1,8 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import keyBy from
|
5
|
-
import _ from
|
4
|
+
import keyBy from "lodash/keyBy";
|
5
|
+
import _ from "lodash";
|
6
6
|
import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
|
7
7
|
|
8
8
|
import { getEdges } from "../../../utils/htElementUtils";
|
@@ -18,24 +18,24 @@ import CiCache from "../cache/CiCache"; // const interfaceTypeMap = {
|
|
18
18
|
|
19
19
|
/**
|
20
20
|
* 是否关键链路
|
21
|
-
* @param {*} link
|
22
|
-
* @returns
|
21
|
+
* @param {*} link
|
22
|
+
* @returns
|
23
23
|
*/
|
24
24
|
|
25
25
|
export function isCrucialLink(link) {
|
26
|
-
return !!link.attributes[
|
26
|
+
return !!link.attributes["network_link.is_crucial"];
|
27
27
|
}
|
28
28
|
/**
|
29
29
|
* 是否出口链路
|
30
|
-
* @param {*} link
|
31
|
-
* @returns
|
30
|
+
* @param {*} link
|
31
|
+
* @returns
|
32
32
|
*/
|
33
33
|
|
34
34
|
export function isExitLink(link) {
|
35
|
-
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes[
|
35
|
+
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
|
36
36
|
}
|
37
37
|
export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
38
|
-
var linkCiMap = keyBy(links,
|
38
|
+
var linkCiMap = keyBy(links, "id");
|
39
39
|
return links.map(function (link) {
|
40
40
|
var _interfaceCiMap$attri, _interfaceCiMap$attri2;
|
41
41
|
|
@@ -44,19 +44,26 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceD
|
|
44
44
|
var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
|
45
45
|
|
46
46
|
var sourceNode = nodes.find(function (node) {
|
47
|
-
return node.id === attributes[
|
47
|
+
return node.id === attributes["network_link.source_device_id"];
|
48
48
|
});
|
49
49
|
var targetNode = nodes.find(function (node) {
|
50
|
-
return node.id === attributes[
|
51
|
-
});
|
50
|
+
return node.id === attributes["network_link.destination_device_id"];
|
51
|
+
});
|
52
|
+
var target = link.target; // 目的端为ip节点
|
53
|
+
|
54
|
+
if (attributes["destination_type"] === "ip") {
|
55
|
+
target = "ip:" + attributes["network_link.destination_ipv4"];
|
56
|
+
} // 翻译
|
57
|
+
|
52
58
|
|
53
59
|
return _extends({}, link, {
|
60
|
+
target: target,
|
54
61
|
attributes: _extends({}, attributes, {
|
55
62
|
// 源/目的设备
|
56
|
-
|
63
|
+
"network_link.source_device_id_object": {
|
57
64
|
displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
|
58
65
|
},
|
59
|
-
|
66
|
+
"network_link.destination_device_id_object": {
|
60
67
|
displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
|
61
68
|
},
|
62
69
|
// 源/目的接口类型
|
@@ -64,10 +71,10 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceD
|
|
64
71
|
destination_type_object: interfaceDoc[attributes.destination_type],
|
65
72
|
// 源/目的接口
|
66
73
|
source_id_object: {
|
67
|
-
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes[
|
74
|
+
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
|
68
75
|
},
|
69
76
|
destination_id_object: {
|
70
|
-
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes[
|
77
|
+
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
|
71
78
|
}
|
72
79
|
})
|
73
80
|
});
|
@@ -106,7 +113,7 @@ function _getLinksDetail() {
|
|
106
113
|
}), linkCis.map(function (item) {
|
107
114
|
return item.attributes.destination_type;
|
108
115
|
})))).filter(function (item) {
|
109
|
-
return item !==
|
116
|
+
return item !== "ip";
|
110
117
|
});
|
111
118
|
_context.next = 7;
|
112
119
|
return CiCache.load(interfaceIds);
|
@@ -147,10 +154,10 @@ export var compatibleWith = function compatibleWith(value) {
|
|
147
154
|
|
148
155
|
export var plurals = {
|
149
156
|
0: [],
|
150
|
-
1: [
|
151
|
-
2: [
|
152
|
-
3: [
|
153
|
-
4: [
|
157
|
+
1: ["phy"],
|
158
|
+
2: ["phy"],
|
159
|
+
3: ["agg"],
|
160
|
+
4: ["phy", "agg"]
|
154
161
|
};
|
155
162
|
export var showLinkByConfig = function showLinkByConfig(props) {
|
156
163
|
var _plurals$compatibleWi;
|
@@ -165,27 +172,45 @@ export var showLinkByConfig = function showLinkByConfig(props) {
|
|
165
172
|
var dm = gv.getDataModel();
|
166
173
|
var edges = getEdges(dm); // console.log("edges", edges);
|
167
174
|
|
168
|
-
var showPhy = types.indexOf(
|
169
|
-
var showAgg = types.indexOf(
|
175
|
+
var showPhy = types.indexOf("phy") >= 0;
|
176
|
+
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
170
177
|
|
171
178
|
if (Array.isArray(edges) && edges.length > 0) {
|
172
179
|
edges.map(function (edge) {
|
173
180
|
if (showType === 1 || showType === true) {
|
174
181
|
// 单链路全部显示
|
175
182
|
// console.log("单链路全部显示", edge);
|
176
|
-
edge.s(
|
183
|
+
edge.s("2d.visible", true);
|
177
184
|
} else {
|
178
185
|
var _d$attributes, _d$attributes2;
|
179
186
|
|
180
187
|
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
181
188
|
|
182
|
-
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) ===
|
183
|
-
edge.s(
|
189
|
+
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === "network.agg_interface" && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === "network.agg_interface") {
|
190
|
+
edge.s("2d.visible", showAgg);
|
184
191
|
} else {
|
185
192
|
// console.log("edge", edge, d, showAgg);
|
186
|
-
edge.s(
|
193
|
+
edge.s("2d.visible", showPhy);
|
187
194
|
}
|
188
195
|
}
|
189
196
|
});
|
190
197
|
}
|
198
|
+
};
|
199
|
+
export var mergeExportLinkData = function mergeExportLinkData(props) {
|
200
|
+
var source = props.source,
|
201
|
+
target = props.target,
|
202
|
+
link = props.link;
|
203
|
+
var attrObj = link.attributes;
|
204
|
+
|
205
|
+
var linkData = _extends({}, link, {
|
206
|
+
name: attrObj.name,
|
207
|
+
source: attrObj["network_link.source_device_id"],
|
208
|
+
target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
|
209
|
+
operation: attrObj.operation,
|
210
|
+
interfaceSource: attrObj["source_id"],
|
211
|
+
interfaceTarget: attrObj["destination_id"],
|
212
|
+
ciType: link.typeCode
|
213
|
+
});
|
214
|
+
|
215
|
+
return linkData;
|
191
216
|
};
|
@@ -13,6 +13,7 @@ import { removeFromArray } from "../../../utils/format";
|
|
13
13
|
import { DEFAULT_GROUP } from "../../../utils/template";
|
14
14
|
import { combTopoData, getCiTypes } from "../../../utils/topoData";
|
15
15
|
import { saveTopo as _saveTopo, resToConditions, getLayoutId } from "../../../core/models/topoData";
|
16
|
+
import networkLinkServer from "../../../networkTopo/services/topo/networkLink";
|
16
17
|
import { addLinkData, buildData as buildTopoData } from "../../../networkTopo/getTopoData";
|
17
18
|
|
18
19
|
var newGroupWithUUID = function newGroupWithUUID(group) {
|
@@ -244,24 +245,26 @@ export default function (topoApp) {
|
|
244
245
|
var _this2 = this;
|
245
246
|
|
246
247
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
247
|
-
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
|
248
|
+
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, _editState$ipNodes, ipNodes, query, data;
|
248
249
|
|
249
250
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
250
251
|
while (1) {
|
251
252
|
switch (_context2.prev = _context2.next) {
|
252
253
|
case 0:
|
253
254
|
editState = rootState.topoConfig;
|
254
|
-
resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink;
|
255
|
+
resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink, _editState$ipNodes = editState.ipNodes, ipNodes = _editState$ipNodes === void 0 ? [] : _editState$ipNodes;
|
256
|
+
console.log("editState", editState);
|
255
257
|
query = {
|
256
258
|
id: rootState.topoMod.topoId,
|
257
259
|
resources: resources,
|
258
260
|
groups: groups,
|
259
|
-
exportLinkIdList: exportLinkIdList
|
261
|
+
exportLinkIdList: exportLinkIdList,
|
262
|
+
ipNodes: ipNodes
|
260
263
|
};
|
261
|
-
_context2.next =
|
264
|
+
_context2.next = 6;
|
262
265
|
return _this2.getTopoByConditions(query);
|
263
266
|
|
264
|
-
case
|
267
|
+
case 6:
|
265
268
|
data = _context2.sent;
|
266
269
|
rlog.debug("按配置查询拓扑数据", {
|
267
270
|
config: {
|
@@ -272,7 +275,7 @@ export default function (topoApp) {
|
|
272
275
|
});
|
273
276
|
return _context2.abrupt("return", data);
|
274
277
|
|
275
|
-
case
|
278
|
+
case 9:
|
276
279
|
case "end":
|
277
280
|
return _context2.stop();
|
278
281
|
}
|
@@ -308,36 +311,37 @@ export default function (topoApp) {
|
|
308
311
|
var _this4 = this;
|
309
312
|
|
310
313
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
311
|
-
var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
314
|
+
var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
312
315
|
|
313
316
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
314
317
|
while (1) {
|
315
318
|
switch (_context4.prev = _context4.next) {
|
316
319
|
case 0:
|
317
|
-
|
318
|
-
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
|
320
|
+
rlog.debug("getTopoByConditions--------", params);
|
321
|
+
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
|
319
322
|
viewConditions = resToConditions(resources);
|
320
323
|
groupInfo = isAvailableArray(groups) && groups.map(function (group) {
|
321
324
|
return _extends({}, group, {
|
322
325
|
layout: getLayoutId(group.layout),
|
323
326
|
resources: resToConditions(group.resources)
|
324
327
|
});
|
325
|
-
});
|
326
|
-
|
327
|
-
_context4.next =
|
328
|
-
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
|
328
|
+
});
|
329
|
+
rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
330
|
+
_context4.next = 7;
|
331
|
+
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
|
329
332
|
|
330
|
-
case
|
333
|
+
case 7:
|
331
334
|
data = _context4.sent;
|
332
|
-
|
335
|
+
rlog.debug("getTopoByConditions--------data", data);
|
336
|
+
_context4.next = 11;
|
333
337
|
return buildTopoData(data);
|
334
338
|
|
335
|
-
case
|
339
|
+
case 11:
|
336
340
|
data = _context4.sent;
|
337
|
-
_context4.next =
|
341
|
+
_context4.next = 14;
|
338
342
|
return Promise.all([addLinkData(data), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
|
339
343
|
|
340
|
-
case
|
344
|
+
case 14:
|
341
345
|
_yield$Promise$all = _context4.sent;
|
342
346
|
dataWithLinkDetail = _yield$Promise$all[0];
|
343
347
|
_combTopoData = combTopoData({
|
@@ -364,7 +368,7 @@ export default function (topoApp) {
|
|
364
368
|
topoDataTrans: topoDataTrans
|
365
369
|
});
|
366
370
|
|
367
|
-
case
|
371
|
+
case 22:
|
368
372
|
case "end":
|
369
373
|
return _context4.stop();
|
370
374
|
}
|
@@ -393,7 +397,7 @@ export default function (topoApp) {
|
|
393
397
|
}].concat(displayConfig.saveHistories || [])
|
394
398
|
}))
|
395
399
|
};
|
396
|
-
rlog.debug(
|
400
|
+
rlog.debug("saveGlobalConfig", config);
|
397
401
|
_context5.next = 5;
|
398
402
|
return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
|
399
403
|
|
@@ -461,6 +465,33 @@ export default function (topoApp) {
|
|
461
465
|
switchToViewMode: function switchToViewMode() {
|
462
466
|
this.reset();
|
463
467
|
dispatch.topoMod.switchToViewMode();
|
468
|
+
},
|
469
|
+
queryAllLinkByIp: function queryAllLinkByIp(data) {
|
470
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
471
|
+
var _result$data;
|
472
|
+
|
473
|
+
var ids, ip, result;
|
474
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
475
|
+
while (1) {
|
476
|
+
switch (_context8.prev = _context8.next) {
|
477
|
+
case 0:
|
478
|
+
ids = data.ids, ip = data.ip;
|
479
|
+
console.log("queryAllLinkByIp", ids, ip);
|
480
|
+
_context8.next = 4;
|
481
|
+
return networkLinkServer.queryLinksByIp(ids, ip);
|
482
|
+
|
483
|
+
case 4:
|
484
|
+
result = _context8.sent;
|
485
|
+
console.log("queryAllLinkByIp-result", result);
|
486
|
+
return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
|
487
|
+
|
488
|
+
case 7:
|
489
|
+
case "end":
|
490
|
+
return _context8.stop();
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}, _callee8);
|
494
|
+
}))();
|
464
495
|
}
|
465
496
|
};
|
466
497
|
}
|
package/es/core/test/Test.js
CHANGED
@@ -22,6 +22,58 @@ var Test = /*#__PURE__*/function () {
|
|
22
22
|
_proto.onReady = function onReady() {// TODO 待移除测试代码
|
23
23
|
// this.iconManage.openUpload()
|
24
24
|
// this.topo.store.getModelDispatchers('linkDynamicStyleConfig').open({type: 'networkLink'});
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* 关联IP示例代码
|
28
|
+
*/
|
29
|
+
;
|
30
|
+
|
31
|
+
_proto.createExportLink = function createExportLink() {
|
32
|
+
var htTopo = this.topo.getHtTopo();
|
33
|
+
var dm = htTopo.getGraphView().dm(); // 设置节点关联IP
|
34
|
+
|
35
|
+
var nodeElement = htTopo.getGraphView().sm().fd();
|
36
|
+
var ip = {
|
37
|
+
'id': 'ip:1.1.1.1',
|
38
|
+
'name': '1.1.1.1',
|
39
|
+
customName: null,
|
40
|
+
// 'groupId': null,
|
41
|
+
// 'groupTag': null,
|
42
|
+
'ipAddress': '1.1.1.1',
|
43
|
+
// 'attributes': [],
|
44
|
+
// 'metrics': [],
|
45
|
+
'type': 'node' // 'dtype': 'device'
|
46
|
+
|
47
|
+
};
|
48
|
+
nodeElement.a(ip);
|
49
|
+
nodeElement.setTag('ip:1.1.1.1');
|
50
|
+
var link = {
|
51
|
+
'id': '0000000019b462d1',
|
52
|
+
'name': '172.17.160.116(Gi2/2/0/1) - 172.27.130.13(Gi 0/9)',
|
53
|
+
'source': '00000000029f9411',
|
54
|
+
'target': 'ip:1.1.1.1',
|
55
|
+
'operation': 'delete',
|
56
|
+
'interfaceSource': '0000000018080aee',
|
57
|
+
'interfaceTarget': '000000000341b015',
|
58
|
+
'ciType': 'network_link',
|
59
|
+
'attributes': [],
|
60
|
+
'manageStatus': 0,
|
61
|
+
'permission': {
|
62
|
+
'readable': true,
|
63
|
+
'writeable': true,
|
64
|
+
'deleteable': true
|
65
|
+
},
|
66
|
+
'metrics': [],
|
67
|
+
'type': 'link',
|
68
|
+
'dtype': 'link'
|
69
|
+
};
|
70
|
+
var createElementsData = {
|
71
|
+
groups: [],
|
72
|
+
nodes: [],
|
73
|
+
links: [link],
|
74
|
+
linkGroups: []
|
75
|
+
};
|
76
|
+
htTopo.createElements(createElementsData);
|
25
77
|
};
|
26
78
|
|
27
79
|
return Test;
|
@@ -29,8 +29,7 @@ import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
|
|
29
29
|
import Configurator from "./components/Configurator";
|
30
30
|
import { formatMetric } from "../../../../../../models/attributeFormatter";
|
31
31
|
import LinkTopoCard from "./components/LinkTopo/LinkTopoCard";
|
32
|
-
import EventsCard from "./EventsCard";
|
33
|
-
import { queryLastestValue } from "./components/LinkTopo/services"; // url 处理,UICBB 的地址需截取前缀
|
32
|
+
import EventsCard from "./EventsCard"; // url 处理,UICBB 的地址需截取前缀
|
34
33
|
|
35
34
|
function formatUrl(url) {
|
36
35
|
var _window, _window$location;
|
@@ -692,7 +691,7 @@ export default function ResourceOverview(props) {
|
|
692
691
|
_metricColChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(col) {
|
693
692
|
var _col2, _col3;
|
694
693
|
|
695
|
-
var codes, endTime, params, _ref5, times, metricList,
|
694
|
+
var codes, endTime, params, _ref5, times, metricList, metricLists;
|
696
695
|
|
697
696
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
698
697
|
while (1) {
|
@@ -740,14 +739,7 @@ export default function ResourceOverview(props) {
|
|
740
739
|
|
741
740
|
case 11:
|
742
741
|
metricList = _context8.sent;
|
743
|
-
|
744
|
-
return queryLastestValue({
|
745
|
-
'id': data.attributes.name
|
746
|
-
});
|
747
|
-
|
748
|
-
case 14:
|
749
|
-
newMetricList = _context8.sent;
|
750
|
-
metricLists = metricList.concat(getNewMetricList(newMetricList));
|
742
|
+
metricLists = metricList.concat(getNewMetricList());
|
751
743
|
rlog.debug('metricColChange', metricLists, monitorMetricModels);
|
752
744
|
setMetric(col.map(function (item, key) {
|
753
745
|
return {
|
@@ -773,7 +765,7 @@ export default function ResourceOverview(props) {
|
|
773
765
|
}, 60000);
|
774
766
|
}
|
775
767
|
|
776
|
-
case
|
768
|
+
case 17:
|
777
769
|
case "end":
|
778
770
|
return _context8.stop();
|
779
771
|
}
|
@@ -783,36 +775,20 @@ export default function ResourceOverview(props) {
|
|
783
775
|
return _metricColChange.apply(this, arguments);
|
784
776
|
}
|
785
777
|
|
786
|
-
var getNewMetricList = function getNewMetricList(
|
778
|
+
var getNewMetricList = function getNewMetricList() {
|
787
779
|
return [{
|
788
780
|
errorMsg: null,
|
789
|
-
mainCiId: "
|
790
|
-
metricCode: "
|
791
|
-
metricValue:
|
792
|
-
subCiId: '',
|
793
|
-
subCiType: null,
|
794
|
-
mainCiType: null
|
795
|
-
}, {
|
796
|
-
errorMsg: null,
|
797
|
-
mainCiId: "downRetansRatio",
|
798
|
-
metricCode: "downRetansRatio",
|
799
|
-
metricValue: data.downRetansRatio,
|
800
|
-
subCiId: '',
|
801
|
-
subCiType: null,
|
802
|
-
mainCiType: null
|
803
|
-
}, {
|
804
|
-
errorMsg: null,
|
805
|
-
mainCiId: "upNetDelayRatio",
|
806
|
-
metricCode: "upNetDelayRatio",
|
807
|
-
metricValue: data.upNetDelayRatio,
|
781
|
+
mainCiId: "netDelayRatio",
|
782
|
+
metricCode: "netDelayRatio",
|
783
|
+
metricValue: '0',
|
808
784
|
subCiId: '',
|
809
785
|
subCiType: null,
|
810
786
|
mainCiType: null
|
811
787
|
}, {
|
812
788
|
errorMsg: null,
|
813
|
-
mainCiId: "
|
814
|
-
metricCode: "
|
815
|
-
metricValue:
|
789
|
+
mainCiId: "retansRatio",
|
790
|
+
metricCode: "retansRatio",
|
791
|
+
metricValue: '0',
|
816
792
|
subCiId: '',
|
817
793
|
subCiType: null,
|
818
794
|
mainCiType: null
|
@@ -12,6 +12,20 @@ export default function LinkTopo(props) {
|
|
12
12
|
linkCi: data,
|
13
13
|
linkMetricCodes: linkMetricCodes
|
14
14
|
});
|
15
|
+
var linkMetrics = [].concat(metricData.linkMetrics, metricData.linkOther);
|
16
|
+
var linkMetricsList = [];
|
17
|
+
|
18
|
+
if (linkMetrics.length > 0) {
|
19
|
+
linkMetricCodes.forEach(function (e) {
|
20
|
+
var linkMetricsData = linkMetrics.filter(function (i) {
|
21
|
+
return e == i.code;
|
22
|
+
});
|
23
|
+
if (linkMetricsData.length > 0) linkMetricsList.push(linkMetricsData[0]);
|
24
|
+
});
|
25
|
+
metricData.linkMetrics = linkMetricsList;
|
26
|
+
metricData.linkOther = [];
|
27
|
+
}
|
28
|
+
|
15
29
|
return /*#__PURE__*/React.createElement("div", {
|
16
30
|
className: styles.container
|
17
31
|
}, /*#__PURE__*/React.createElement(CrucialLinkTopo, _extends({
|
@@ -17,9 +17,9 @@ export default function LinkTopoCard(props) {
|
|
17
17
|
|
18
18
|
var supportTemplates = (data === null || data === void 0 ? void 0 : (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.support_templates) || ''; // 该资源监控模板
|
19
19
|
|
20
|
-
var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
|
20
|
+
var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial']; //是不是关键链路
|
21
21
|
|
22
|
-
var _useState = useState(
|
22
|
+
var _useState = useState(null),
|
23
23
|
openFlow = _useState[0],
|
24
24
|
setOpenFlow = _useState[1];
|
25
25
|
|
@@ -39,7 +39,7 @@ export default function LinkTopoCard(props) {
|
|
39
39
|
case 2:
|
40
40
|
checkMenus = _context.sent;
|
41
41
|
|
42
|
-
if (!(checkMenus[0].passed == 'PASS')) {
|
42
|
+
if (!(checkMenus[0].passed == 'PASS' && isCrucial)) {
|
43
43
|
_context.next = 10;
|
44
44
|
break;
|
45
45
|
}
|
@@ -55,12 +55,12 @@ export default function LinkTopoCard(props) {
|
|
55
55
|
//判断是不是有流量分析
|
56
56
|
if (isOpen) {
|
57
57
|
setOpenFlow({
|
58
|
-
name: '
|
58
|
+
name: '查看流量构成',
|
59
59
|
url: linkDetailsUrl
|
60
60
|
});
|
61
61
|
} else {
|
62
62
|
setOpenFlow({
|
63
|
-
name: '
|
63
|
+
name: '配置流量分析',
|
64
64
|
url: analysisUrl
|
65
65
|
});
|
66
66
|
}
|
@@ -101,7 +101,9 @@ export default function LinkTopoCard(props) {
|
|
101
101
|
})
|
102
102
|
}, /*#__PURE__*/React.createElement(LinkTopo, {
|
103
103
|
data: data,
|
104
|
-
linkMetricCodes: metricCodes
|
104
|
+
linkMetricCodes: openFlow && openFlow.name == '查看流量构成' ? metricCodes : metricCodes.filter(function (i) {
|
105
|
+
return i != 'netDelayRatio' && i != 'retansRatio';
|
106
|
+
}),
|
105
107
|
openFlow: openFlow
|
106
108
|
}));
|
107
109
|
}
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useEffect, useState } from 'react';
|
3
3
|
import { useRequest } from 'ahooks';
|
4
|
-
import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics,
|
4
|
+
import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics, queryRetansRatioNetDelayRatio } from "../services";
|
5
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog'; // 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
|
6
6
|
|
7
7
|
export default function useMetricPolling(_ref) {
|
8
8
|
var linkCi = _ref.linkCi,
|
9
9
|
linkMetricCodes = _ref.linkMetricCodes;
|
10
10
|
var linkId = linkCi.id;
|
11
|
-
var arr = ['
|
12
|
-
var
|
13
|
-
var
|
11
|
+
var arr = ['netDelayRatio', 'retansRatio'];
|
12
|
+
var codes = [];
|
13
|
+
var retansRatioNetDelayRatioCodes = [];
|
14
14
|
linkMetricCodes.map(function (item) {
|
15
|
-
arr.indexOf(item) > -1 ?
|
15
|
+
arr.indexOf(item) > -1 ? retansRatioNetDelayRatioCodes.push(item) : codes.push(item);
|
16
16
|
});
|
17
17
|
|
18
18
|
var _useState = useState({
|
@@ -26,53 +26,15 @@ export default function useMetricPolling(_ref) {
|
|
26
26
|
data = _useState[0],
|
27
27
|
setData = _useState[1];
|
28
28
|
|
29
|
-
var queryLastestValues = useRequest(
|
29
|
+
var queryLastestValues = useRequest(queryRetansRatioNetDelayRatio, {
|
30
30
|
pollingInterval: 1000 * 15,
|
31
31
|
pollingWhenHidden: false,
|
32
32
|
debounceInterval: 200,
|
33
33
|
manual: true,
|
34
34
|
onSuccess: function onSuccess(result) {
|
35
|
-
|
36
|
-
linkOther:
|
37
|
-
};
|
38
|
-
|
39
|
-
if (newCodes.includes('downNetDelayRatio')) {
|
40
|
-
datas.linkOther.push({
|
41
|
-
'code': 'downNetDelayRatio',
|
42
|
-
'name': '下行RTT时延',
|
43
|
-
'ts': result.time,
|
44
|
-
'value': result.downNetDelayRatio + ' ms'
|
45
|
-
});
|
46
|
-
}
|
47
|
-
|
48
|
-
if (newCodes.includes('downRetansRatio')) {
|
49
|
-
datas.linkOther.push({
|
50
|
-
'code': 'downRetansRatio',
|
51
|
-
'name': '下行重传率',
|
52
|
-
'ts': result.time,
|
53
|
-
'value': result.downRetansRatio + ' %'
|
54
|
-
});
|
55
|
-
}
|
56
|
-
|
57
|
-
if (newCodes.includes('upNetDelayRatio')) {
|
58
|
-
datas.linkOther.push({
|
59
|
-
'code': 'upNetDelayRatio',
|
60
|
-
'name': '上行RTT时延',
|
61
|
-
'ts': result.time,
|
62
|
-
'value': result.upNetDelayRatio + ' ms'
|
63
|
-
});
|
64
|
-
}
|
65
|
-
|
66
|
-
if (newCodes.includes('upRetransRatio')) {
|
67
|
-
datas.linkOther.push({
|
68
|
-
'code': 'upRetransRatio',
|
69
|
-
'name': '上行重传率',
|
70
|
-
'ts': result.time,
|
71
|
-
'value': result.upRetransRatio + ' %'
|
72
|
-
});
|
73
|
-
}
|
74
|
-
|
75
|
-
setData(_extends({}, data, datas));
|
35
|
+
setData(_extends({}, data, {
|
36
|
+
linkOther: result
|
37
|
+
}));
|
76
38
|
}
|
77
39
|
}); // 轮询hooks
|
78
40
|
|
@@ -96,26 +58,36 @@ export default function useMetricPolling(_ref) {
|
|
96
58
|
rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
|
97
59
|
}
|
98
60
|
});
|
99
|
-
var linkMetricCodesStr =
|
61
|
+
var linkMetricCodesStr = codes.map(function (item) {
|
100
62
|
return item;
|
101
63
|
}).sort().join(',');
|
102
64
|
useEffect(function () {
|
103
65
|
if (linkId) {
|
104
66
|
rlog.info('链路拓扑指标轮询 切换', {
|
105
67
|
linkCi: linkCi,
|
106
|
-
|
68
|
+
codes: codes
|
107
69
|
});
|
108
|
-
queryLinkMetricsRequest.run(linkCi,
|
109
|
-
|
110
|
-
if (newCodes.length > 0) {
|
111
|
-
queryLastestValues.run({
|
112
|
-
'id': linkCi.attributes.name
|
113
|
-
});
|
114
|
-
}
|
70
|
+
queryLinkMetricsRequest.run(linkCi, codes);
|
115
71
|
}
|
116
72
|
|
117
73
|
return function () {};
|
118
74
|
}, [linkId, linkMetricCodesStr]);
|
75
|
+
var retansRatioNetDelayRatioCodesStr = retansRatioNetDelayRatioCodes.map(function (item) {
|
76
|
+
return item;
|
77
|
+
}).sort().join(',');
|
78
|
+
useEffect(function () {
|
79
|
+
if (linkId) {
|
80
|
+
rlog.info('链路拓扑指标勾选rtt|重传率 轮询', {
|
81
|
+
linkCi: linkCi,
|
82
|
+
retansRatioNetDelayRatioCodes: retansRatioNetDelayRatioCodes
|
83
|
+
});
|
84
|
+
queryLastestValues.run({
|
85
|
+
'id': linkCi.attributes.name
|
86
|
+
}, retansRatioNetDelayRatioCodes);
|
87
|
+
}
|
88
|
+
|
89
|
+
return function () {};
|
90
|
+
}, [linkId, retansRatioNetDelayRatioCodesStr]);
|
119
91
|
useEffect(function () {
|
120
92
|
if (linkId) {
|
121
93
|
rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
|