@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
@@ -38,7 +38,7 @@ export default function BindIpInput(props) {
|
|
38
38
|
if (errors) {
|
39
39
|
console.error("saveIp-error", errors, vals);
|
40
40
|
} else {
|
41
|
-
console.log("saveIp", txtValue);
|
41
|
+
// console.log("saveIp", txtValue);
|
42
42
|
setError("");
|
43
43
|
onChange(txtValue);
|
44
44
|
topoEditApi.relateNodeIp(txtValue, nodeElement);
|
@@ -65,8 +65,7 @@ export default function BindIpInput(props) {
|
|
65
65
|
return callback();
|
66
66
|
}
|
67
67
|
|
68
|
-
var isUnique = isUniqueIp(dm, value, nodeElement);
|
69
|
-
console.log("checkIp", isUnique);
|
68
|
+
var isUnique = isUniqueIp(dm, value, nodeElement); // console.log("checkIp", isUnique);
|
70
69
|
|
71
70
|
if (!isUnique) {
|
72
71
|
return callback("ip不能重复");
|
@@ -49,8 +49,7 @@ export default function Data(props) {
|
|
49
49
|
values: parseValues(values),
|
50
50
|
onChange: function onChange(name, value) {
|
51
51
|
field.validate(function (errors, vals) {
|
52
|
-
if (errors) {
|
53
|
-
console.error("field-Data", errors, vals);
|
52
|
+
if (errors) {// console.error("field-Data", errors, vals);
|
54
53
|
} else {
|
55
54
|
var newValues = field.getValues();
|
56
55
|
|
@@ -45,7 +45,8 @@ export default function (props) {
|
|
45
45
|
resources: config.resources,
|
46
46
|
groups: config.groups,
|
47
47
|
exportLinkIdList: config.exportLinkIdList,
|
48
|
-
relateTopoIdList: config.relateTopoIdList
|
48
|
+
relateTopoIdList: config.relateTopoIdList //linkIps: config.linkIps,
|
49
|
+
|
49
50
|
};
|
50
51
|
};
|
51
52
|
|
@@ -974,9 +974,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
974
974
|
|
975
975
|
function _relateNodeIp() {
|
976
976
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
|
977
|
-
var
|
978
|
-
|
979
|
-
var dm, htTopo, elements, configObj, _yield$editDispatcher5, elementDatas, isUnique, ids, ip, re, config, linksData, createElementsData;
|
977
|
+
var dm, htTopo, elementNodes, isUnique, ids, ip, configObj, configData, _elements, newLinkElements, createElementsData;
|
980
978
|
|
981
979
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
982
980
|
while (1) {
|
@@ -986,28 +984,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
986
984
|
// 根据配置查询拓扑数据
|
987
985
|
dm = topo.getDataModel();
|
988
986
|
htTopo = topo.getHtTopo();
|
989
|
-
|
990
|
-
|
991
|
-
configObj = topo.resourceConfig.getConfig();
|
992
|
-
console.log("configObj", configObj);
|
993
|
-
configObj.linkIps = [].concat((_configObj$linkIps = configObj.linkIps) !== null && _configObj$linkIps !== void 0 ? _configObj$linkIps : [], [txtValue]);
|
994
|
-
console.log("configObj---over", configObj);
|
995
|
-
_context16.next = 9;
|
996
|
-
return resourceConfig.updateConfig(configObj);
|
997
|
-
|
998
|
-
case 9:
|
999
|
-
_context16.next = 11;
|
1000
|
-
return editDispatchers.fetchDataByConfig();
|
1001
|
-
|
1002
|
-
case 11:
|
1003
|
-
_yield$editDispatcher5 = _context16.sent;
|
1004
|
-
elementDatas = _yield$editDispatcher5.elementDatas;
|
1005
|
-
console.log("bindIPtoNode", txtValue, nodeElement, elements);
|
1006
|
-
console.log("elementDatas", elementDatas); // 执行唯一性验证
|
987
|
+
elementNodes = getNodes(dm); // 执行唯一性验证
|
1007
988
|
|
1008
989
|
isUnique = isUniqueIp(dm, txtValue, nodeElement);
|
1009
990
|
ids = [];
|
1010
|
-
|
991
|
+
elementNodes.map(function (element) {
|
1011
992
|
if (element.getTag()) {
|
1012
993
|
ids.push(element.getTag());
|
1013
994
|
}
|
@@ -1016,6 +997,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1016
997
|
id: "ip:" + txtValue,
|
1017
998
|
name: txtValue,
|
1018
999
|
customName: null,
|
1000
|
+
bindType: "ip",
|
1019
1001
|
// 'groupId': null,
|
1020
1002
|
// 'groupTag': null,
|
1021
1003
|
ipAddress: txtValue,
|
@@ -1027,54 +1009,44 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1027
1009
|
}; // 获取关联链路
|
1028
1010
|
|
1029
1011
|
if (!isUnique) {
|
1030
|
-
_context16.next =
|
1012
|
+
_context16.next = 23;
|
1031
1013
|
break;
|
1032
1014
|
}
|
1033
1015
|
|
1016
|
+
deleteExLink(nodeElement);
|
1034
1017
|
nodeElement.a(ip);
|
1035
|
-
nodeElement.setName(txtValue);
|
1036
|
-
|
1037
|
-
|
1038
|
-
nodeElement.setTag("ip:" + txtValue);
|
1039
|
-
_context16.next = 25;
|
1040
|
-
return editDispatchers.queryAllLinkByIp({
|
1041
|
-
ids: ids,
|
1042
|
-
ip: txtValue
|
1043
|
-
});
|
1018
|
+
nodeElement.setName(txtValue);
|
1019
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1044
1020
|
|
1045
|
-
|
1046
|
-
|
1047
|
-
console.log("
|
1048
|
-
config = resourceConfig.getConfig();
|
1049
|
-
console.log("resourceConfig.getConfig", config);
|
1050
|
-
|
1051
|
-
if (re && re.length > 0) {
|
1052
|
-
linksData = [];
|
1053
|
-
re.map(function (link) {
|
1054
|
-
var sourceId = link.attributes["network_link.source_device_id"];
|
1055
|
-
var source = dm.getDataByTag(sourceId);
|
1056
|
-
var target = nodeElement; // console.log("source, nodeElement, link", source, target, link);
|
1057
|
-
|
1058
|
-
if (source && target) {
|
1059
|
-
var linkData = mergeExportLinkData({
|
1060
|
-
source: source,
|
1061
|
-
target: target,
|
1062
|
-
link: link
|
1063
|
-
});
|
1064
|
-
console.log("linkData", linkData);
|
1065
|
-
linksData.push(linkData); // htTopo.createEdge(source, target, link);
|
1066
|
-
}
|
1067
|
-
});
|
1068
|
-
createElementsData = {
|
1069
|
-
groups: [],
|
1070
|
-
nodes: [],
|
1071
|
-
links: [].concat(linksData),
|
1072
|
-
linkGroups: []
|
1073
|
-
};
|
1074
|
-
htTopo.createElements(createElementsData); // htTopo.addElements({ lines: [...re] });
|
1075
|
-
}
|
1021
|
+
configObj = topo.resourceConfig.getConfig(); // console.log("configObj", configObj);
|
1022
|
+
// configObj.linkIps = [...(configObj.linkIps ?? []), txtValue];
|
1023
|
+
// console.log("configObj---over", configObj);
|
1076
1024
|
|
1077
|
-
|
1025
|
+
_context16.next = 15;
|
1026
|
+
return resourceConfig.updateConfig(configObj);
|
1027
|
+
|
1028
|
+
case 15:
|
1029
|
+
_context16.next = 17;
|
1030
|
+
return editDispatchers.fetchDataByConfig();
|
1031
|
+
|
1032
|
+
case 17:
|
1033
|
+
configData = _context16.sent;
|
1034
|
+
_elements = configData.elements;
|
1035
|
+
newLinkElements = findUNExistedLinkElements(_elements);
|
1036
|
+
createElementsData = {
|
1037
|
+
groups: [],
|
1038
|
+
nodes: [],
|
1039
|
+
links: newLinkElements.filter(function (item) {
|
1040
|
+
return item.type === "link";
|
1041
|
+
}),
|
1042
|
+
linkGroups: newLinkElements.filter(function (item) {
|
1043
|
+
return item.type === "linkGroup";
|
1044
|
+
})
|
1045
|
+
};
|
1046
|
+
console.log("createElementsData", createElementsData);
|
1047
|
+
htTopo.createElements(createElementsData);
|
1048
|
+
|
1049
|
+
case 23:
|
1078
1050
|
case "end":
|
1079
1051
|
return _context16.stop();
|
1080
1052
|
}
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "9.0.0-a.
|
27
|
+
var version = typeof "9.0.0-a.24" === 'string' ? "9.0.0-a.24" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -11,8 +11,8 @@ export function getLayoutId(layout) {
|
|
11
11
|
|
12
12
|
if (typeof layout === "string") {
|
13
13
|
return {
|
14
|
-
v:
|
15
|
-
h:
|
14
|
+
v: "towardeast",
|
15
|
+
h: "towardsouth"
|
16
16
|
}[layout] || layout;
|
17
17
|
}
|
18
18
|
|
@@ -41,7 +41,7 @@ export function saveTopo(_x) {
|
|
41
41
|
|
42
42
|
function _saveTopo() {
|
43
43
|
_saveTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
44
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
44
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources, linkIps;
|
45
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
46
46
|
while (1) {
|
47
47
|
switch (_context.prev = _context.next) {
|
@@ -73,7 +73,7 @@ function _saveTopo() {
|
|
73
73
|
|
74
74
|
case 8:
|
75
75
|
if (!(resources || groups)) {
|
76
|
-
_context.next =
|
76
|
+
_context.next = 16;
|
77
77
|
break;
|
78
78
|
}
|
79
79
|
|
@@ -95,24 +95,31 @@ function _saveTopo() {
|
|
95
95
|
});
|
96
96
|
}
|
97
97
|
|
98
|
+
linkIps = []; // resources?.static.map((nodeId) => {
|
99
|
+
// if (nodeId.startsWith("ip_")) {
|
100
|
+
// linkIps.push(nodeId.replace("ip_", ""));
|
101
|
+
// }
|
102
|
+
// });
|
103
|
+
|
98
104
|
rlog.debug("saveTopo-groupInfo", groupInfo);
|
99
|
-
_context.next =
|
105
|
+
_context.next = 16;
|
100
106
|
return topoService.bindResourceToTopo(topoId, {
|
101
107
|
groups: groupInfo,
|
108
|
+
linkIps: linkIps,
|
102
109
|
exportLinkIdList: exportLinkIdList,
|
103
110
|
relateTopoIdList: relateTopoIdList
|
104
111
|
});
|
105
112
|
|
106
|
-
case
|
113
|
+
case 16:
|
107
114
|
if (!serialize) {
|
108
|
-
_context.next =
|
115
|
+
_context.next = 19;
|
109
116
|
break;
|
110
117
|
}
|
111
118
|
|
112
|
-
_context.next =
|
119
|
+
_context.next = 19;
|
113
120
|
return topoService.saveSerializeData(topoId, serialize);
|
114
121
|
|
115
|
-
case
|
122
|
+
case 19:
|
116
123
|
case "end":
|
117
124
|
return _context.stop();
|
118
125
|
}
|
@@ -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,25 +172,25 @@ 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
|
});
|
@@ -198,7 +205,7 @@ export var mergeExportLinkData = function mergeExportLinkData(props) {
|
|
198
205
|
var linkData = _extends({}, link, {
|
199
206
|
name: attrObj.name,
|
200
207
|
source: attrObj["network_link.source_device_id"],
|
201
|
-
target: attrObj.destination_type ===
|
208
|
+
target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
|
202
209
|
operation: attrObj.operation,
|
203
210
|
interfaceSource: attrObj["source_id"],
|
204
211
|
interfaceTarget: attrObj["destination_id"],
|
@@ -324,22 +324,23 @@ export default function (topoApp) {
|
|
324
324
|
layout: getLayoutId(group.layout),
|
325
325
|
resources: resToConditions(group.resources)
|
326
326
|
});
|
327
|
-
});
|
328
|
-
|
329
|
-
_context4.next =
|
327
|
+
});
|
328
|
+
rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
329
|
+
_context4.next = 6;
|
330
330
|
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
|
331
331
|
|
332
|
-
case
|
332
|
+
case 6:
|
333
333
|
data = _context4.sent;
|
334
|
-
|
334
|
+
rlog.debug("getTopoByConditions--------data", data);
|
335
|
+
_context4.next = 10;
|
335
336
|
return buildTopoData(data);
|
336
337
|
|
337
|
-
case
|
338
|
+
case 10:
|
338
339
|
data = _context4.sent;
|
339
|
-
_context4.next =
|
340
|
+
_context4.next = 13;
|
340
341
|
return Promise.all([addLinkData(data), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
|
341
342
|
|
342
|
-
case
|
343
|
+
case 13:
|
343
344
|
_yield$Promise$all = _context4.sent;
|
344
345
|
dataWithLinkDetail = _yield$Promise$all[0];
|
345
346
|
_combTopoData = combTopoData({
|
@@ -366,7 +367,7 @@ export default function (topoApp) {
|
|
366
367
|
topoDataTrans: topoDataTrans
|
367
368
|
});
|
368
369
|
|
369
|
-
case
|
370
|
+
case 21:
|
370
371
|
case "end":
|
371
372
|
return _context4.stop();
|
372
373
|
}
|
@@ -77,6 +77,7 @@ function _addLinkData() {
|
|
77
77
|
|
78
78
|
case 4:
|
79
79
|
networkLinks = _context.sent;
|
80
|
+
console.log("如果是网络链路,补充详情信息", networkLinks);
|
80
81
|
otherLinks = links.filter(function (link) {
|
81
82
|
return link.ciType !== 'network_link';
|
82
83
|
});
|
@@ -85,7 +86,7 @@ function _addLinkData() {
|
|
85
86
|
linkGroups: []
|
86
87
|
}));
|
87
88
|
|
88
|
-
case
|
89
|
+
case 8:
|
89
90
|
case "end":
|
90
91
|
return _context.stop();
|
91
92
|
}
|
@@ -477,7 +477,7 @@ export default _extends({
|
|
477
477
|
ciType: 'network_link'
|
478
478
|
});
|
479
479
|
})
|
480
|
-
})));
|
480
|
+
}), obj.groups));
|
481
481
|
|
482
482
|
case 7:
|
483
483
|
case "end":
|
@@ -516,10 +516,7 @@ export default _extends({
|
|
516
516
|
|
517
517
|
obj = prepareGroupParams(newGroups);
|
518
518
|
_context14.next = 6;
|
519
|
-
return request.post(API_ROOT + "/resource/" + id, _extends({}, otherConfig, obj
|
520
|
-
exportLinkIdList: [] // 传空数组清空
|
521
|
-
|
522
|
-
}));
|
519
|
+
return request.post(API_ROOT + "/resource/" + id, _extends({}, otherConfig, obj));
|
523
520
|
|
524
521
|
case 6:
|
525
522
|
return _context14.abrupt("return", _context14.sent);
|
@@ -79,12 +79,12 @@ export function processExitLink(topoData) {
|
|
79
79
|
|
80
80
|
links.filter(isExitLink) // 升级V1.4前配置的出口链路目的端节点为IP节点
|
81
81
|
.forEach(function (link) {
|
82
|
-
return upgradeExitLinkTarget(link);
|
82
|
+
return upgradeExitLinkTarget(link, serialize);
|
83
83
|
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
84
84
|
|
85
85
|
newLinks = upgradeLinkTargetNotExisted(links); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
86
86
|
|
87
|
-
var ipNodes = getIpNodes();
|
87
|
+
var ipNodes = getIpNodes(serialize, nodes);
|
88
88
|
return _extends({}, topoData, {
|
89
89
|
nodes: [].concat(nodes, ipNodes),
|
90
90
|
links: newLinks,
|
@@ -129,7 +129,7 @@ export function processExitLink(topoData) {
|
|
129
129
|
return newLinks;
|
130
130
|
}
|
131
131
|
|
132
|
-
function getIpNodes() {
|
132
|
+
function getIpNodes(serialize, nodes) {
|
133
133
|
// 从序列化获取关联的IP
|
134
134
|
var ips = serialize.d.filter(function (item) {
|
135
135
|
return item.a.bindType === 'ip';
|
@@ -137,10 +137,10 @@ export function processExitLink(topoData) {
|
|
137
137
|
return item.a.bindIp;
|
138
138
|
}).filter(function (item) {
|
139
139
|
return !!item;
|
140
|
-
})
|
140
|
+
}) // 过滤ping资源对应的ip
|
141
|
+
.filter(function (ip) {
|
141
142
|
return !findPingNode(nodes, ip);
|
142
|
-
});
|
143
|
-
|
143
|
+
});
|
144
144
|
return ips.map(buildIpNode);
|
145
145
|
}
|
146
146
|
|
@@ -161,7 +161,7 @@ export function processExitLink(topoData) {
|
|
161
161
|
*/
|
162
162
|
|
163
163
|
|
164
|
-
function upgradeExitLinkTarget(link) {
|
164
|
+
function upgradeExitLinkTarget(link, serialize) {
|
165
165
|
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
166
166
|
var linkSerialize = findElementSerializeById(serialize, link.id);
|
167
167
|
|
@@ -209,30 +209,34 @@ function updateLinkTarget(links, nodes) {
|
|
209
209
|
}
|
210
210
|
/**
|
211
211
|
* 编辑模式按资源查询拓扑数据处理出口链路target
|
212
|
+
* 1. 出口链路目的端设置为IP节点或者ping资源节点id
|
213
|
+
* 2. IP构造为node节点
|
212
214
|
* FIXME 移到frontend 网络拓扑编辑
|
213
215
|
* @param {*} topoData
|
214
216
|
* @returns
|
215
217
|
*/
|
216
218
|
|
217
219
|
|
218
|
-
export function processByConditionResult(topoData) {
|
220
|
+
export function processByConditionResult(topoData, groupConfigs) {
|
219
221
|
var nodes = topoData.nodes,
|
220
222
|
links = topoData.links;
|
221
|
-
var ipNodes = getIpNodes();
|
222
|
-
|
223
|
-
function getIpNodes() {
|
224
|
-
// 从序列化获取关联的IP
|
225
|
-
var ips = [].filter(function (ip) {
|
226
|
-
return !findPingNode(nodes, ip);
|
227
|
-
}); // TODO 过滤ping资源对应的ip
|
228
|
-
|
229
|
-
return ips.map(buildIpNode);
|
230
|
-
} // 出口链路目的端设置为IP节点或者ping资源节点id
|
231
|
-
|
223
|
+
var ipNodes = getIpNodes(groupConfigs, nodes); // 出口链路目的端设置为IP节点或者ping资源节点id
|
232
224
|
|
233
225
|
var newLinks = updateLinkTarget(links, nodes);
|
234
226
|
return _extends({}, topoData, {
|
235
227
|
nodes: [].concat(nodes, ipNodes),
|
236
228
|
links: newLinks
|
237
229
|
});
|
230
|
+
|
231
|
+
function getIpNodes(groupConfigs, nodes) {
|
232
|
+
var ips = groupConfigs.map(function (g) {
|
233
|
+
return g.condition.linkIps;
|
234
|
+
}).reduce(function (result, groupIps) {
|
235
|
+
return [].concat(result, groupIps);
|
236
|
+
}, []) // 过滤ping资源对应的ip节点
|
237
|
+
.filter(function (ip) {
|
238
|
+
return !findPingNode(nodes, ip);
|
239
|
+
});
|
240
|
+
return ips.map(buildIpNode);
|
241
|
+
}
|
238
242
|
}
|
@@ -2,8 +2,7 @@ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
2
2
|
import sortBy from 'lodash/sortBy';
|
3
3
|
import { isExitLink } from "../core/models/utils/linkUtils";
|
4
4
|
import { isClusterHtElement } from "./clusterUtil";
|
5
|
-
import {
|
6
|
-
import { getEdges, getGroups, getLayers, getNodes } from "./htElementUtils";
|
5
|
+
import { getEdges, getGroupChildren, getGroups, getLayerChildren, getLayers, getNodes } from "./htElementUtils";
|
7
6
|
/**
|
8
7
|
* 从拓扑图解析出拓扑资源配置
|
9
8
|
*
|
@@ -104,7 +103,9 @@ function getLayerDatas(dataModel) {
|
|
104
103
|
name: layerElement.s('label'),
|
105
104
|
order: layerElement.a('order'),
|
106
105
|
resources: {
|
107
|
-
"static":
|
106
|
+
"static": getLayerChildren(layerElement).filter(function (item) {
|
107
|
+
return !!item.getTag();
|
108
|
+
}).map(function (node) {
|
108
109
|
return node.getTag();
|
109
110
|
})
|
110
111
|
}
|
@@ -133,7 +134,7 @@ function getGroupConfigByElement(groupElement) {
|
|
133
134
|
name: groupElement.a('name'),
|
134
135
|
order: groupElement.a('order'),
|
135
136
|
resources: {
|
136
|
-
"static":
|
137
|
+
"static": getGroupChildren(groupElement).filter(function (node) {
|
137
138
|
return !!node.getTag();
|
138
139
|
}).map(function (node) {
|
139
140
|
return node.getTag();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getEdges
|
1
|
+
import { getEdges } from "./htElementUtils";
|
2
2
|
import * as htElementUtils from "./htElementUtils";
|
3
3
|
export function isLayer(element) {
|
4
4
|
return element.className === 'ht.Grid';
|
@@ -21,12 +21,6 @@ export function isResourceElement(element) {
|
|
21
21
|
export function isResourceNodeElement(element) {
|
22
22
|
return (htElementUtils.isGroup(element) || htElementUtils.isNode(element)) && isResourceElement(element);
|
23
23
|
}
|
24
|
-
export function getGroupChildrenResourceElements(element) {
|
25
|
-
return getGroupChildren(element).filter(isResourceElement);
|
26
|
-
}
|
27
|
-
export function getLayerChildrenResourceElements(layerElement) {
|
28
|
-
return getLayerChildren(layerElement).filter(isResourceElement);
|
29
|
-
}
|
30
24
|
export var getAllEdgeResourceIds = function getAllEdgeResourceIds(dm) {
|
31
25
|
return getEdges(dm).filter(function (node) {
|
32
26
|
return !!node.getTag();
|
@@ -54,7 +54,7 @@ function BindIpInput(props) {
|
|
54
54
|
if (errors) {
|
55
55
|
console.error("saveIp-error", errors, vals);
|
56
56
|
} else {
|
57
|
-
console.log("saveIp", txtValue);
|
57
|
+
// console.log("saveIp", txtValue);
|
58
58
|
setError("");
|
59
59
|
onChange(txtValue);
|
60
60
|
topoEditApi.relateNodeIp(txtValue, nodeElement);
|
@@ -81,8 +81,7 @@ function BindIpInput(props) {
|
|
81
81
|
return callback();
|
82
82
|
}
|
83
83
|
|
84
|
-
var isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, value, nodeElement);
|
85
|
-
console.log("checkIp", isUnique);
|
84
|
+
var isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, value, nodeElement); // console.log("checkIp", isUnique);
|
86
85
|
|
87
86
|
if (!isUnique) {
|
88
87
|
return callback("ip不能重复");
|
@@ -73,8 +73,7 @@ function Data(props) {
|
|
73
73
|
values: parseValues(values),
|
74
74
|
onChange: function onChange(name, value) {
|
75
75
|
field.validate(function (errors, vals) {
|
76
|
-
if (errors) {
|
77
|
-
console.error("field-Data", errors, vals);
|
76
|
+
if (errors) {// console.error("field-Data", errors, vals);
|
78
77
|
} else {
|
79
78
|
var newValues = field.getValues();
|
80
79
|
|