@riil-frontend/component-topology 9.0.0-a.23 → 9.0.0-a.24
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 +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +2 -3
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +1 -2
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useTopoEdit.js +36 -64
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +16 -9
- package/es/core/models/utils/linkUtils.js +35 -28
- package/es/core/store/models/topoConfig.js +10 -9
- package/es/networkTopo/getTopoData.js +2 -1
- package/es/networkTopo/services/topo/basic.js +2 -5
- package/es/networkTopo/utils/exitLinkUtil.js +23 -19
- package/es/utils/ResourceConfigUtil.js +5 -4
- package/es/utils/htElementDataUtil.js +1 -7
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +2 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +1 -2
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +36 -64
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +16 -9
- package/lib/core/models/utils/linkUtils.js +33 -26
- package/lib/core/store/models/topoConfig.js +13 -8
- package/lib/networkTopo/getTopoData.js +2 -1
- package/lib/networkTopo/services/topo/basic.js +2 -5
- package/lib/networkTopo/utils/exitLinkUtil.js +23 -19
- package/lib/utils/ResourceConfigUtil.js +4 -4
- package/lib/utils/htElementDataUtil.js +0 -10
- package/package.json +2 -2
@@ -59,7 +59,8 @@ function _default(props) {
|
|
59
59
|
resources: config.resources,
|
60
60
|
groups: config.groups,
|
61
61
|
exportLinkIdList: config.exportLinkIdList,
|
62
|
-
relateTopoIdList: config.relateTopoIdList
|
62
|
+
relateTopoIdList: config.relateTopoIdList //linkIps: config.linkIps,
|
63
|
+
|
63
64
|
};
|
64
65
|
};
|
65
66
|
|
@@ -1016,9 +1016,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1016
1016
|
|
1017
1017
|
function _relateNodeIp() {
|
1018
1018
|
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
|
1019
|
-
var
|
1020
|
-
|
1021
|
-
var dm, htTopo, elements, configObj, _yield$editDispatcher5, elementDatas, isUnique, ids, ip, re, config, linksData, createElementsData;
|
1019
|
+
var dm, htTopo, elementNodes, isUnique, ids, ip, configObj, configData, _elements, newLinkElements, createElementsData;
|
1022
1020
|
|
1023
1021
|
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
1024
1022
|
while (1) {
|
@@ -1028,28 +1026,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1028
1026
|
// 根据配置查询拓扑数据
|
1029
1027
|
dm = topo.getDataModel();
|
1030
1028
|
htTopo = topo.getHtTopo();
|
1031
|
-
|
1032
|
-
|
1033
|
-
configObj = topo.resourceConfig.getConfig();
|
1034
|
-
console.log("configObj", configObj);
|
1035
|
-
configObj.linkIps = [].concat((_configObj$linkIps = configObj.linkIps) !== null && _configObj$linkIps !== void 0 ? _configObj$linkIps : [], [txtValue]);
|
1036
|
-
console.log("configObj---over", configObj);
|
1037
|
-
_context16.next = 9;
|
1038
|
-
return resourceConfig.updateConfig(configObj);
|
1039
|
-
|
1040
|
-
case 9:
|
1041
|
-
_context16.next = 11;
|
1042
|
-
return editDispatchers.fetchDataByConfig();
|
1043
|
-
|
1044
|
-
case 11:
|
1045
|
-
_yield$editDispatcher5 = _context16.sent;
|
1046
|
-
elementDatas = _yield$editDispatcher5.elementDatas;
|
1047
|
-
console.log("bindIPtoNode", txtValue, nodeElement, elements);
|
1048
|
-
console.log("elementDatas", elementDatas); // 执行唯一性验证
|
1029
|
+
elementNodes = (0, _htElementUtils.getNodes)(dm); // 执行唯一性验证
|
1049
1030
|
|
1050
1031
|
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
1051
1032
|
ids = [];
|
1052
|
-
|
1033
|
+
elementNodes.map(function (element) {
|
1053
1034
|
if (element.getTag()) {
|
1054
1035
|
ids.push(element.getTag());
|
1055
1036
|
}
|
@@ -1058,6 +1039,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1058
1039
|
id: "ip:" + txtValue,
|
1059
1040
|
name: txtValue,
|
1060
1041
|
customName: null,
|
1042
|
+
bindType: "ip",
|
1061
1043
|
// 'groupId': null,
|
1062
1044
|
// 'groupTag': null,
|
1063
1045
|
ipAddress: txtValue,
|
@@ -1069,54 +1051,44 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1069
1051
|
}; // 获取关联链路
|
1070
1052
|
|
1071
1053
|
if (!isUnique) {
|
1072
|
-
_context16.next =
|
1054
|
+
_context16.next = 23;
|
1073
1055
|
break;
|
1074
1056
|
}
|
1075
1057
|
|
1058
|
+
deleteExLink(nodeElement);
|
1076
1059
|
nodeElement.a(ip);
|
1077
|
-
nodeElement.setName(txtValue);
|
1078
|
-
|
1079
|
-
|
1080
|
-
nodeElement.setTag("ip:" + txtValue);
|
1081
|
-
_context16.next = 25;
|
1082
|
-
return editDispatchers.queryAllLinkByIp({
|
1083
|
-
ids: ids,
|
1084
|
-
ip: txtValue
|
1085
|
-
});
|
1060
|
+
nodeElement.setName(txtValue);
|
1061
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1086
1062
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
console.log("
|
1090
|
-
config = resourceConfig.getConfig();
|
1091
|
-
console.log("resourceConfig.getConfig", config);
|
1092
|
-
|
1093
|
-
if (re && re.length > 0) {
|
1094
|
-
linksData = [];
|
1095
|
-
re.map(function (link) {
|
1096
|
-
var sourceId = link.attributes["network_link.source_device_id"];
|
1097
|
-
var source = dm.getDataByTag(sourceId);
|
1098
|
-
var target = nodeElement; // console.log("source, nodeElement, link", source, target, link);
|
1099
|
-
|
1100
|
-
if (source && target) {
|
1101
|
-
var linkData = (0, _linkUtils.mergeExportLinkData)({
|
1102
|
-
source: source,
|
1103
|
-
target: target,
|
1104
|
-
link: link
|
1105
|
-
});
|
1106
|
-
console.log("linkData", linkData);
|
1107
|
-
linksData.push(linkData); // htTopo.createEdge(source, target, link);
|
1108
|
-
}
|
1109
|
-
});
|
1110
|
-
createElementsData = {
|
1111
|
-
groups: [],
|
1112
|
-
nodes: [],
|
1113
|
-
links: [].concat(linksData),
|
1114
|
-
linkGroups: []
|
1115
|
-
};
|
1116
|
-
htTopo.createElements(createElementsData); // htTopo.addElements({ lines: [...re] });
|
1117
|
-
}
|
1063
|
+
configObj = topo.resourceConfig.getConfig(); // console.log("configObj", configObj);
|
1064
|
+
// configObj.linkIps = [...(configObj.linkIps ?? []), txtValue];
|
1065
|
+
// console.log("configObj---over", configObj);
|
1118
1066
|
|
1119
|
-
|
1067
|
+
_context16.next = 15;
|
1068
|
+
return resourceConfig.updateConfig(configObj);
|
1069
|
+
|
1070
|
+
case 15:
|
1071
|
+
_context16.next = 17;
|
1072
|
+
return editDispatchers.fetchDataByConfig();
|
1073
|
+
|
1074
|
+
case 17:
|
1075
|
+
configData = _context16.sent;
|
1076
|
+
_elements = configData.elements;
|
1077
|
+
newLinkElements = findUNExistedLinkElements(_elements);
|
1078
|
+
createElementsData = {
|
1079
|
+
groups: [],
|
1080
|
+
nodes: [],
|
1081
|
+
links: newLinkElements.filter(function (item) {
|
1082
|
+
return item.type === "link";
|
1083
|
+
}),
|
1084
|
+
linkGroups: newLinkElements.filter(function (item) {
|
1085
|
+
return item.type === "linkGroup";
|
1086
|
+
})
|
1087
|
+
};
|
1088
|
+
console.log("createElementsData", createElementsData);
|
1089
|
+
htTopo.createElements(createElementsData);
|
1090
|
+
|
1091
|
+
case 23:
|
1120
1092
|
case "end":
|
1121
1093
|
return _context16.stop();
|
1122
1094
|
}
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "9.0.0-a.
|
59
|
+
var version = typeof "9.0.0-a.24" === 'string' ? "9.0.0-a.24" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -25,8 +25,8 @@ function getLayoutId(layout) {
|
|
25
25
|
|
26
26
|
if (typeof layout === "string") {
|
27
27
|
return {
|
28
|
-
v:
|
29
|
-
h:
|
28
|
+
v: "towardeast",
|
29
|
+
h: "towardsouth"
|
30
30
|
}[layout] || layout;
|
31
31
|
}
|
32
32
|
|
@@ -57,7 +57,7 @@ function saveTopo(_x) {
|
|
57
57
|
|
58
58
|
function _saveTopo() {
|
59
59
|
_saveTopo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
60
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
60
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources, linkIps;
|
61
61
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
62
62
|
while (1) {
|
63
63
|
switch (_context.prev = _context.next) {
|
@@ -91,7 +91,7 @@ function _saveTopo() {
|
|
91
91
|
|
92
92
|
case 8:
|
93
93
|
if (!(resources || groups)) {
|
94
|
-
_context.next =
|
94
|
+
_context.next = 16;
|
95
95
|
break;
|
96
96
|
}
|
97
97
|
|
@@ -113,25 +113,32 @@ function _saveTopo() {
|
|
113
113
|
});
|
114
114
|
}
|
115
115
|
|
116
|
+
linkIps = []; // resources?.static.map((nodeId) => {
|
117
|
+
// if (nodeId.startsWith("ip_")) {
|
118
|
+
// linkIps.push(nodeId.replace("ip_", ""));
|
119
|
+
// }
|
120
|
+
// });
|
121
|
+
|
116
122
|
_rlog["default"].debug("saveTopo-groupInfo", groupInfo);
|
117
123
|
|
118
|
-
_context.next =
|
124
|
+
_context.next = 16;
|
119
125
|
return topoService.bindResourceToTopo(topoId, {
|
120
126
|
groups: groupInfo,
|
127
|
+
linkIps: linkIps,
|
121
128
|
exportLinkIdList: exportLinkIdList,
|
122
129
|
relateTopoIdList: relateTopoIdList
|
123
130
|
});
|
124
131
|
|
125
|
-
case
|
132
|
+
case 16:
|
126
133
|
if (!serialize) {
|
127
|
-
_context.next =
|
134
|
+
_context.next = 19;
|
128
135
|
break;
|
129
136
|
}
|
130
137
|
|
131
|
-
_context.next =
|
138
|
+
_context.next = 19;
|
132
139
|
return topoService.saveSerializeData(topoId, serialize);
|
133
140
|
|
134
|
-
case
|
141
|
+
case 19:
|
135
142
|
case "end":
|
136
143
|
return _context.stop();
|
137
144
|
}
|
@@ -42,44 +42,51 @@ var _CiCache = _interopRequireDefault(require("../cache/CiCache"));
|
|
42
42
|
|
43
43
|
/**
|
44
44
|
* 是否关键链路
|
45
|
-
* @param {*} link
|
46
|
-
* @returns
|
45
|
+
* @param {*} link
|
46
|
+
* @returns
|
47
47
|
*/
|
48
48
|
function isCrucialLink(link) {
|
49
|
-
return !!link.attributes[
|
49
|
+
return !!link.attributes["network_link.is_crucial"];
|
50
50
|
}
|
51
51
|
/**
|
52
52
|
* 是否出口链路
|
53
|
-
* @param {*} link
|
54
|
-
* @returns
|
53
|
+
* @param {*} link
|
54
|
+
* @returns
|
55
55
|
*/
|
56
56
|
|
57
57
|
|
58
58
|
function isExitLink(link) {
|
59
|
-
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes[
|
59
|
+
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
|
60
60
|
}
|
61
61
|
|
62
62
|
function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
63
|
-
var linkCiMap = (0, _keyBy["default"])(links,
|
63
|
+
var linkCiMap = (0, _keyBy["default"])(links, "id");
|
64
64
|
return links.map(function (link) {
|
65
65
|
var _interfaceCiMap$attri, _interfaceCiMap$attri2;
|
66
66
|
|
67
67
|
var linkCi = linkCiMap[link.id];
|
68
68
|
var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
|
69
69
|
var sourceNode = nodes.find(function (node) {
|
70
|
-
return node.id === attributes[
|
70
|
+
return node.id === attributes["network_link.source_device_id"];
|
71
71
|
});
|
72
72
|
var targetNode = nodes.find(function (node) {
|
73
|
-
return node.id === attributes[
|
74
|
-
});
|
73
|
+
return node.id === attributes["network_link.destination_device_id"];
|
74
|
+
});
|
75
|
+
var target = link.target; // 目的端为ip节点
|
76
|
+
|
77
|
+
if (attributes["destination_type"] === "ip") {
|
78
|
+
target = "ip:" + attributes["network_link.destination_ipv4"];
|
79
|
+
} // 翻译
|
80
|
+
|
75
81
|
|
76
82
|
return (0, _extends2["default"])({}, link, {
|
83
|
+
target: target,
|
77
84
|
attributes: (0, _extends2["default"])({}, attributes, {
|
78
85
|
// 源/目的设备
|
79
|
-
|
86
|
+
"network_link.source_device_id_object": {
|
80
87
|
displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
|
81
88
|
},
|
82
|
-
|
89
|
+
"network_link.destination_device_id_object": {
|
83
90
|
displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
|
84
91
|
},
|
85
92
|
// 源/目的接口类型
|
@@ -87,10 +94,10 @@ function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
|
87
94
|
destination_type_object: interfaceDoc[attributes.destination_type],
|
88
95
|
// 源/目的接口
|
89
96
|
source_id_object: {
|
90
|
-
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes[
|
97
|
+
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
|
91
98
|
},
|
92
99
|
destination_id_object: {
|
93
|
-
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes[
|
100
|
+
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
|
94
101
|
}
|
95
102
|
})
|
96
103
|
});
|
@@ -130,7 +137,7 @@ function _getLinksDetail() {
|
|
130
137
|
}), linkCis.map(function (item) {
|
131
138
|
return item.attributes.destination_type;
|
132
139
|
})))).filter(function (item) {
|
133
|
-
return item !==
|
140
|
+
return item !== "ip";
|
134
141
|
});
|
135
142
|
_context.next = 7;
|
136
143
|
return _CiCache["default"].load(interfaceIds);
|
@@ -174,10 +181,10 @@ var compatibleWith = function compatibleWith(value) {
|
|
174
181
|
exports.compatibleWith = compatibleWith;
|
175
182
|
var plurals = {
|
176
183
|
0: [],
|
177
|
-
1: [
|
178
|
-
2: [
|
179
|
-
3: [
|
180
|
-
4: [
|
184
|
+
1: ["phy"],
|
185
|
+
2: ["phy"],
|
186
|
+
3: ["agg"],
|
187
|
+
4: ["phy", "agg"]
|
181
188
|
};
|
182
189
|
exports.plurals = plurals;
|
183
190
|
|
@@ -194,25 +201,25 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
194
201
|
var dm = gv.getDataModel();
|
195
202
|
var edges = (0, _htElementUtils.getEdges)(dm); // console.log("edges", edges);
|
196
203
|
|
197
|
-
var showPhy = types.indexOf(
|
198
|
-
var showAgg = types.indexOf(
|
204
|
+
var showPhy = types.indexOf("phy") >= 0;
|
205
|
+
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
199
206
|
|
200
207
|
if (Array.isArray(edges) && edges.length > 0) {
|
201
208
|
edges.map(function (edge) {
|
202
209
|
if (showType === 1 || showType === true) {
|
203
210
|
// 单链路全部显示
|
204
211
|
// console.log("单链路全部显示", edge);
|
205
|
-
edge.s(
|
212
|
+
edge.s("2d.visible", true);
|
206
213
|
} else {
|
207
214
|
var _d$attributes, _d$attributes2;
|
208
215
|
|
209
216
|
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
210
217
|
|
211
|
-
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) ===
|
212
|
-
edge.s(
|
218
|
+
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") {
|
219
|
+
edge.s("2d.visible", showAgg);
|
213
220
|
} else {
|
214
221
|
// console.log("edge", edge, d, showAgg);
|
215
|
-
edge.s(
|
222
|
+
edge.s("2d.visible", showPhy);
|
216
223
|
}
|
217
224
|
}
|
218
225
|
});
|
@@ -229,7 +236,7 @@ var mergeExportLinkData = function mergeExportLinkData(props) {
|
|
229
236
|
var linkData = (0, _extends2["default"])({}, link, {
|
230
237
|
name: attrObj.name,
|
231
238
|
source: attrObj["network_link.source_device_id"],
|
232
|
-
target: attrObj.destination_type ===
|
239
|
+
target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
|
233
240
|
operation: attrObj.operation,
|
234
241
|
interfaceSource: attrObj["source_id"],
|
235
242
|
interfaceTarget: attrObj["destination_id"],
|
@@ -347,22 +347,27 @@ function _default(topoApp) {
|
|
347
347
|
layout: (0, _topoData2.getLayoutId)(group.layout),
|
348
348
|
resources: (0, _topoData2.resToConditions)(group.resources)
|
349
349
|
});
|
350
|
-
});
|
350
|
+
});
|
351
|
+
|
352
|
+
_rlog["default"].debug("getTopoByConditions--------", viewConditions, groupInfo);
|
351
353
|
|
352
|
-
_context4.next =
|
354
|
+
_context4.next = 6;
|
353
355
|
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
|
354
356
|
|
355
|
-
case
|
357
|
+
case 6:
|
356
358
|
data = _context4.sent;
|
357
|
-
|
359
|
+
|
360
|
+
_rlog["default"].debug("getTopoByConditions--------data", data);
|
361
|
+
|
362
|
+
_context4.next = 10;
|
358
363
|
return (0, _getTopoData.buildData)(data);
|
359
364
|
|
360
|
-
case
|
365
|
+
case 10:
|
361
366
|
data = _context4.sent;
|
362
|
-
_context4.next =
|
367
|
+
_context4.next = 13;
|
363
368
|
return Promise.all([(0, _getTopoData.addLinkData)(data), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(data)), dispatch.customIcon.loadCustomIcons()]);
|
364
369
|
|
365
|
-
case
|
370
|
+
case 13:
|
366
371
|
_yield$Promise$all = _context4.sent;
|
367
372
|
dataWithLinkDetail = _yield$Promise$all[0];
|
368
373
|
_combTopoData = (0, _topoData.combTopoData)({
|
@@ -389,7 +394,7 @@ function _default(topoApp) {
|
|
389
394
|
topoDataTrans: topoDataTrans
|
390
395
|
});
|
391
396
|
|
392
|
-
case
|
397
|
+
case 21:
|
393
398
|
case "end":
|
394
399
|
return _context4.stop();
|
395
400
|
}
|
@@ -92,6 +92,7 @@ function _addLinkData() {
|
|
92
92
|
|
93
93
|
case 4:
|
94
94
|
networkLinks = _context.sent;
|
95
|
+
console.log("如果是网络链路,补充详情信息", networkLinks);
|
95
96
|
otherLinks = links.filter(function (link) {
|
96
97
|
return link.ciType !== 'network_link';
|
97
98
|
});
|
@@ -100,7 +101,7 @@ function _addLinkData() {
|
|
100
101
|
linkGroups: []
|
101
102
|
}));
|
102
103
|
|
103
|
-
case
|
104
|
+
case 8:
|
104
105
|
case "end":
|
105
106
|
return _context.stop();
|
106
107
|
}
|
@@ -497,7 +497,7 @@ var _default = (0, _extends2["default"])({
|
|
497
497
|
ciType: 'network_link'
|
498
498
|
});
|
499
499
|
})
|
500
|
-
})));
|
500
|
+
}), obj.groups));
|
501
501
|
|
502
502
|
case 7:
|
503
503
|
case "end":
|
@@ -536,10 +536,7 @@ var _default = (0, _extends2["default"])({
|
|
536
536
|
|
537
537
|
obj = prepareGroupParams(newGroups);
|
538
538
|
_context14.next = 6;
|
539
|
-
return _componentTopologyUtils.request.post(API_ROOT + "/resource/" + id, (0, _extends2["default"])({}, otherConfig, obj
|
540
|
-
exportLinkIdList: [] // 传空数组清空
|
541
|
-
|
542
|
-
}));
|
539
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/resource/" + id, (0, _extends2["default"])({}, otherConfig, obj));
|
543
540
|
|
544
541
|
case 6:
|
545
542
|
return _context14.abrupt("return", _context14.sent);
|
@@ -89,12 +89,12 @@ function processExitLink(topoData) {
|
|
89
89
|
|
90
90
|
links.filter(isExitLink) // 升级V1.4前配置的出口链路目的端节点为IP节点
|
91
91
|
.forEach(function (link) {
|
92
|
-
return upgradeExitLinkTarget(link);
|
92
|
+
return upgradeExitLinkTarget(link, serialize);
|
93
93
|
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
94
94
|
|
95
95
|
newLinks = upgradeLinkTargetNotExisted(links); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
96
96
|
|
97
|
-
var ipNodes = getIpNodes();
|
97
|
+
var ipNodes = getIpNodes(serialize, nodes);
|
98
98
|
return (0, _extends2["default"])({}, topoData, {
|
99
99
|
nodes: [].concat(nodes, ipNodes),
|
100
100
|
links: newLinks,
|
@@ -139,7 +139,7 @@ function processExitLink(topoData) {
|
|
139
139
|
return newLinks;
|
140
140
|
}
|
141
141
|
|
142
|
-
function getIpNodes() {
|
142
|
+
function getIpNodes(serialize, nodes) {
|
143
143
|
// 从序列化获取关联的IP
|
144
144
|
var ips = serialize.d.filter(function (item) {
|
145
145
|
return item.a.bindType === 'ip';
|
@@ -147,10 +147,10 @@ function processExitLink(topoData) {
|
|
147
147
|
return item.a.bindIp;
|
148
148
|
}).filter(function (item) {
|
149
149
|
return !!item;
|
150
|
-
})
|
150
|
+
}) // 过滤ping资源对应的ip
|
151
|
+
.filter(function (ip) {
|
151
152
|
return !findPingNode(nodes, ip);
|
152
|
-
});
|
153
|
-
|
153
|
+
});
|
154
154
|
return ips.map(buildIpNode);
|
155
155
|
}
|
156
156
|
|
@@ -171,7 +171,7 @@ function processExitLink(topoData) {
|
|
171
171
|
*/
|
172
172
|
|
173
173
|
|
174
|
-
function upgradeExitLinkTarget(link) {
|
174
|
+
function upgradeExitLinkTarget(link, serialize) {
|
175
175
|
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
176
176
|
var linkSerialize = findElementSerializeById(serialize, link.id);
|
177
177
|
|
@@ -220,30 +220,34 @@ function updateLinkTarget(links, nodes) {
|
|
220
220
|
}
|
221
221
|
/**
|
222
222
|
* 编辑模式按资源查询拓扑数据处理出口链路target
|
223
|
+
* 1. 出口链路目的端设置为IP节点或者ping资源节点id
|
224
|
+
* 2. IP构造为node节点
|
223
225
|
* FIXME 移到frontend 网络拓扑编辑
|
224
226
|
* @param {*} topoData
|
225
227
|
* @returns
|
226
228
|
*/
|
227
229
|
|
228
230
|
|
229
|
-
function processByConditionResult(topoData) {
|
231
|
+
function processByConditionResult(topoData, groupConfigs) {
|
230
232
|
var nodes = topoData.nodes,
|
231
233
|
links = topoData.links;
|
232
|
-
var ipNodes = getIpNodes();
|
233
|
-
|
234
|
-
function getIpNodes() {
|
235
|
-
// 从序列化获取关联的IP
|
236
|
-
var ips = [].filter(function (ip) {
|
237
|
-
return !findPingNode(nodes, ip);
|
238
|
-
}); // TODO 过滤ping资源对应的ip
|
239
|
-
|
240
|
-
return ips.map(buildIpNode);
|
241
|
-
} // 出口链路目的端设置为IP节点或者ping资源节点id
|
242
|
-
|
234
|
+
var ipNodes = getIpNodes(groupConfigs, nodes); // 出口链路目的端设置为IP节点或者ping资源节点id
|
243
235
|
|
244
236
|
var newLinks = updateLinkTarget(links, nodes);
|
245
237
|
return (0, _extends2["default"])({}, topoData, {
|
246
238
|
nodes: [].concat(nodes, ipNodes),
|
247
239
|
links: newLinks
|
248
240
|
});
|
241
|
+
|
242
|
+
function getIpNodes(groupConfigs, nodes) {
|
243
|
+
var ips = groupConfigs.map(function (g) {
|
244
|
+
return g.condition.linkIps;
|
245
|
+
}).reduce(function (result, groupIps) {
|
246
|
+
return [].concat(result, groupIps);
|
247
|
+
}, []) // 过滤ping资源对应的ip节点
|
248
|
+
.filter(function (ip) {
|
249
|
+
return !findPingNode(nodes, ip);
|
250
|
+
});
|
251
|
+
return ips.map(buildIpNode);
|
252
|
+
}
|
249
253
|
}
|
@@ -13,8 +13,6 @@ var _linkUtils = require("../core/models/utils/linkUtils");
|
|
13
13
|
|
14
14
|
var _clusterUtil = require("./clusterUtil");
|
15
15
|
|
16
|
-
var _htElementDataUtil = require("./htElementDataUtil");
|
17
|
-
|
18
16
|
var _htElementUtils = require("./htElementUtils");
|
19
17
|
|
20
18
|
/**
|
@@ -118,7 +116,9 @@ function getLayerDatas(dataModel) {
|
|
118
116
|
name: layerElement.s('label'),
|
119
117
|
order: layerElement.a('order'),
|
120
118
|
resources: {
|
121
|
-
"static": (0,
|
119
|
+
"static": (0, _htElementUtils.getLayerChildren)(layerElement).filter(function (item) {
|
120
|
+
return !!item.getTag();
|
121
|
+
}).map(function (node) {
|
122
122
|
return node.getTag();
|
123
123
|
})
|
124
124
|
}
|
@@ -147,7 +147,7 @@ function getGroupConfigByElement(groupElement) {
|
|
147
147
|
name: groupElement.a('name'),
|
148
148
|
order: groupElement.a('order'),
|
149
149
|
resources: {
|
150
|
-
"static": (0,
|
150
|
+
"static": (0, _htElementUtils.getGroupChildren)(groupElement).filter(function (node) {
|
151
151
|
return !!node.getTag();
|
152
152
|
}).map(function (node) {
|
153
153
|
return node.getTag();
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getAllEdgeResourceIds = void 0;
|
5
|
-
exports.getGroupChildrenResourceElements = getGroupChildrenResourceElements;
|
6
|
-
exports.getLayerChildrenResourceElements = getLayerChildrenResourceElements;
|
7
5
|
exports.isEdge = isEdge;
|
8
6
|
exports.isGroup = isGroup;
|
9
7
|
exports.isLayer = isLayer;
|
@@ -46,14 +44,6 @@ function isResourceNodeElement(element) {
|
|
46
44
|
return (htElementUtils.isGroup(element) || htElementUtils.isNode(element)) && isResourceElement(element);
|
47
45
|
}
|
48
46
|
|
49
|
-
function getGroupChildrenResourceElements(element) {
|
50
|
-
return (0, htElementUtils.getGroupChildren)(element).filter(isResourceElement);
|
51
|
-
}
|
52
|
-
|
53
|
-
function getLayerChildrenResourceElements(layerElement) {
|
54
|
-
return (0, htElementUtils.getLayerChildren)(layerElement).filter(isResourceElement);
|
55
|
-
}
|
56
|
-
|
57
47
|
var getAllEdgeResourceIds = function getAllEdgeResourceIds(dm) {
|
58
48
|
return (0, htElementUtils.getEdges)(dm).filter(function (node) {
|
59
49
|
return !!node.getTag();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "9.0.0-a.
|
3
|
+
"version": "9.0.0-a.24",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -116,6 +116,6 @@
|
|
116
116
|
"access": "public"
|
117
117
|
},
|
118
118
|
"license": "MIT",
|
119
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.24/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|