@riil-frontend/component-topology 9.0.0-a.31 → 9.0.0-a.32
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 +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +17 -17
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +10 -11
- package/es/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/es/core/editor/utils/edgeTypeStyleUtil.js +38 -0
- package/es/core/hooks/useTopoEdit.js +28 -17
- package/es/core/hooks/useTopoFullscreen.js +1 -2
- package/es/core/models/TopoApp.js +1 -1
- package/es/networkTopo/utils/exitLinkUtil.js +2 -7
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +9 -10
- package/lib/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +39 -0
- package/lib/core/hooks/useTopoEdit.js +28 -17
- package/lib/core/hooks/useTopoFullscreen.js +1 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/networkTopo/utils/exitLinkUtil.js +2 -7
- package/package.json +2 -2
@@ -3,7 +3,7 @@ import _Field from "@alifd/next/es/field";
|
|
3
3
|
import _Select from "@alifd/next/es/select";
|
4
4
|
import _Form from "@alifd/next/es/form";
|
5
5
|
import React, { useEffect, useState } from 'react';
|
6
|
-
import { getEdgesBySelection, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
|
6
|
+
import { getEdgesBySelection, loopEdgesAndChildren, isNodeAllEdges } from "../../../../utils/edgeTypeStyleUtil";
|
7
7
|
import styles from "./EdgeType.module.scss";
|
8
8
|
import LineType from "./LineType";
|
9
9
|
var FormItem = _Form.Item;
|
@@ -77,12 +77,12 @@ function getValuesByEdges(topo) {
|
|
77
77
|
})[0] || 'nil';
|
78
78
|
}
|
79
79
|
|
80
|
-
function getEdgesValues(edges
|
80
|
+
function getEdgesValues(edges) {
|
81
81
|
var edgeValues = [];
|
82
|
-
var htTopo = topo.getHtTopo();
|
83
82
|
edges.forEach(function (edge) {
|
84
83
|
edgeValues.push({
|
85
|
-
baseAgreement:
|
84
|
+
baseAgreement: false,
|
85
|
+
//,
|
86
86
|
lineButton: edge.s('edge.type'),
|
87
87
|
startPoint: getStartPoint(edge),
|
88
88
|
endPoint: getEndPoint(edge),
|
@@ -123,16 +123,12 @@ function EdgeType(props) {
|
|
123
123
|
|
124
124
|
var _useState = useState(false),
|
125
125
|
disable = _useState[0],
|
126
|
-
|
126
|
+
setDisable = _useState[1];
|
127
127
|
|
128
128
|
var field = _Field.useField({
|
129
129
|
autoUnmount: false,
|
130
130
|
values: getValuesByEdges(topo),
|
131
131
|
onChange: function onChange(name, value) {
|
132
|
-
if (name == 'baseAgreement') {
|
133
|
-
setDisabel(value);
|
134
|
-
}
|
135
|
-
|
136
132
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
137
133
|
_onChange(name, null);
|
138
134
|
} else {
|
@@ -143,6 +139,8 @@ function EdgeType(props) {
|
|
143
139
|
|
144
140
|
useEffect(function () {
|
145
141
|
field.setValues(getValuesByEdges(topo));
|
142
|
+
field.setValue('baseAgreement', topo.getHtTopo().getEdgeMultarc(getEdgesBySelection(topo)));
|
143
|
+
setDisable(isNodeAllEdges(topo));
|
146
144
|
}, [selection]);
|
147
145
|
return /*#__PURE__*/React.createElement("div", {
|
148
146
|
className: styles.lineBox
|
@@ -152,10 +150,11 @@ function EdgeType(props) {
|
|
152
150
|
labelAlign: "top"
|
153
151
|
}, /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(LineType, {
|
154
152
|
name: "lineButton",
|
155
|
-
disable:
|
153
|
+
disable: !!field.getValue('baseAgreement')
|
156
154
|
})), /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(_Checkbox, {
|
157
155
|
name: "baseAgreement",
|
158
|
-
onChange: _onChange
|
156
|
+
onChange: _onChange,
|
157
|
+
disabled: disable
|
159
158
|
}, "\u81EA\u52A8\u8C03\u6574")), /*#__PURE__*/React.createElement(FormItem, {
|
160
159
|
label: "\u8D77\u70B9"
|
161
160
|
}, /*#__PURE__*/React.createElement(_Select, {
|
@@ -8,6 +8,9 @@ function getPropertyViewType(selection) {
|
|
8
8
|
if (!selectionSize) {
|
9
9
|
// 未选
|
10
10
|
viewType = 'view';
|
11
|
+
} else if ((selectionElement === null || selectionElement === void 0 ? void 0 : selectionElement.getLayer()) === 'backgroundImage') {
|
12
|
+
// 背景图
|
13
|
+
viewType = 'view';
|
11
14
|
} else if (selectionSize >= 2) {
|
12
15
|
// 多选
|
13
16
|
viewType = 'multiple';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getEdges } from "../../../utils/htElementUtils";
|
2
|
+
import { getEdgesBetweenNodes } from "../../../utils/htElementUtils";
|
2
3
|
var ht = window.ht;
|
3
4
|
export function getEdgesBySelection(topo) {
|
4
5
|
var getChildrenNodeIds = function getChildrenNodeIds(nodes) {
|
@@ -42,6 +43,43 @@ export function getEdgesBySelection(topo) {
|
|
42
43
|
|
43
44
|
return getSelectedEdges(topo.getGraphView());
|
44
45
|
}
|
46
|
+
/**
|
47
|
+
* 根据选中的线查找对应节点下所有的线是否都选中
|
48
|
+
* @param {*} topo
|
49
|
+
* @param {*} edges
|
50
|
+
* @param {*} operateEdgeFn
|
51
|
+
*/
|
52
|
+
|
53
|
+
export function isNodeAllEdges(topo) {
|
54
|
+
var selection = topo.getSelectionModel().getSelection().toArray(); // 选中的连线
|
55
|
+
|
56
|
+
var edges = selection.filter(function (element) {
|
57
|
+
return element instanceof ht.Edge;
|
58
|
+
});
|
59
|
+
var inEdges = false;
|
60
|
+
edges.forEach(function (edge) {
|
61
|
+
//根据两边节点查询到所有节点有关的线,过滤出相同的线(两个节点间的线)
|
62
|
+
var sourceNode = edge.getSource();
|
63
|
+
var targetNode = edge.getTarget();
|
64
|
+
var nodeLineList = getEdgesBetweenNodes(sourceNode, targetNode);
|
65
|
+
|
66
|
+
var _loop = function _loop(i) {
|
67
|
+
if (edges.filter(function (edge) {
|
68
|
+
return nodeLineList[i]._id == edge._id;
|
69
|
+
}).length == 0) {
|
70
|
+
inEdges = true;
|
71
|
+
return "break";
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
for (var i = 0; i < nodeLineList.length; i++) {
|
76
|
+
var _ret = _loop(i);
|
77
|
+
|
78
|
+
if (_ret === "break") break;
|
79
|
+
}
|
80
|
+
});
|
81
|
+
return inEdges;
|
82
|
+
}
|
45
83
|
/**
|
46
84
|
* 遍历连线及子连线
|
47
85
|
* @param {*} topo
|
@@ -973,7 +973,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
973
973
|
|
974
974
|
function _relateNodeIp() {
|
975
975
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
|
976
|
-
var dm,
|
976
|
+
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
977
977
|
|
978
978
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
979
979
|
while (1) {
|
@@ -989,55 +989,66 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
989
989
|
return _context16.abrupt("return");
|
990
990
|
|
991
991
|
case 3:
|
992
|
+
if (!(txtValue === nodeElement.a('bindIp'))) {
|
993
|
+
_context16.next = 5;
|
994
|
+
break;
|
995
|
+
}
|
996
|
+
|
997
|
+
return _context16.abrupt("return");
|
998
|
+
|
999
|
+
case 5:
|
992
1000
|
// 根据配置查询拓扑数据
|
993
|
-
dm = topo.getDataModel();
|
994
|
-
htTopo = topo.getHtTopo();
|
995
|
-
elementNodes = getNodes(dm); // 执行唯一性验证
|
1001
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
996
1002
|
|
997
|
-
isUnique = isUniqueIp(dm, txtValue, nodeElement);
|
998
|
-
ip = buildIpNode(txtValue); // 获取关联链路
|
1003
|
+
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
999
1004
|
|
1000
1005
|
if (!isUnique) {
|
1001
1006
|
_context16.next = 26;
|
1002
1007
|
break;
|
1003
1008
|
}
|
1004
1009
|
|
1005
|
-
|
1010
|
+
ip = buildIpNode(txtValue);
|
1011
|
+
_context16.next = 11;
|
1012
|
+
return deleteExLink(nodeElement);
|
1013
|
+
|
1014
|
+
case 11:
|
1006
1015
|
nodeElement.a(ip);
|
1007
1016
|
nodeElement.setName(txtValue);
|
1008
1017
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1009
1018
|
|
1010
1019
|
configObj = topo.resourceConfig.getConfig();
|
1011
|
-
_context16.next =
|
1020
|
+
_context16.next = 17;
|
1012
1021
|
return resourceConfig.updateConfig(configObj);
|
1013
1022
|
|
1014
|
-
case
|
1015
|
-
_context16.next =
|
1023
|
+
case 17:
|
1024
|
+
_context16.next = 19;
|
1016
1025
|
return editDispatchers.fetchDataByConfig();
|
1017
1026
|
|
1018
|
-
case
|
1027
|
+
case 19:
|
1019
1028
|
configData = _context16.sent;
|
1020
|
-
// console.log("configData", configData);
|
1029
|
+
// console.log("configData",configObj, configData);
|
1021
1030
|
_elements = configData.elements;
|
1022
|
-
newLinkElements = findUNExistedLinkElements(_elements);
|
1031
|
+
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1032
|
+
|
1023
1033
|
newLink = newLinkElements.filter(function (item) {
|
1024
1034
|
return item.type === "link";
|
1025
1035
|
});
|
1026
1036
|
newLinkGroup = newLinkElements.filter(function (item) {
|
1027
1037
|
return item.type === "linkGroup";
|
1028
1038
|
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1039
|
+
// console.log("newData",newLinkElements, newLink);
|
1029
1040
|
|
1030
|
-
console.log("newData", newLink);
|
1031
1041
|
createElementsData = {
|
1032
1042
|
groups: [],
|
1033
1043
|
nodes: [],
|
1034
1044
|
links: newLink,
|
1035
1045
|
linkGroups: newLinkGroup
|
1036
|
-
};
|
1037
|
-
console.log("createElementsData", createElementsData);
|
1046
|
+
}; // console.log("createElementsData", createElementsData);
|
1038
1047
|
|
1039
1048
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1040
|
-
|
1049
|
+
_htTopo = topo.getHtTopo();
|
1050
|
+
|
1051
|
+
_htTopo.createElements(createElementsData);
|
1041
1052
|
}
|
1042
1053
|
|
1043
1054
|
case 26:
|
@@ -10,8 +10,7 @@ export default function useTopoFullscreen(props) {
|
|
10
10
|
var htTopo = topo.getHtTopo();
|
11
11
|
|
12
12
|
if ((graphLoaded || graphLoaded2) && topoData && htTopo.setFullScreenFunc) {
|
13
|
-
htTopo.setFullScreenFunc(function () {
|
14
|
-
panelRef.current.requestFullscreen();
|
13
|
+
htTopo.setFullScreenFunc(function () {// panelRef.current.requestFullscreen()
|
15
14
|
});
|
16
15
|
}
|
17
16
|
}, [topoData, graphLoaded, graphLoaded2]); // 监听退出全屏
|
@@ -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.32" === 'string' ? "9.0.0-a.32" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -50,20 +50,15 @@ function isExitLink(link) {
|
|
50
50
|
|
51
51
|
export function isUniqueIp(dataModel, ip, nodeElement) {
|
52
52
|
var nodes = getNodes(dataModel);
|
53
|
-
var isUnique = true;
|
54
|
-
console.log("nodes-nodeElement", nodes, nodeElement);
|
53
|
+
var isUnique = true; // console.log("nodes-nodeElement", nodes, nodeElement);
|
55
54
|
|
56
55
|
if (nodeElement) {
|
57
|
-
console.log("nodes-nodeElement---filter", nodes.filter(function (node) {
|
58
|
-
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
59
|
-
}));
|
60
56
|
var arr = nodes.filter(function (node) {
|
61
57
|
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
62
58
|
}).filter(function (node) {
|
63
59
|
return isPingHtNode(node, ip) || isIpHtNode(node, ip);
|
64
60
|
});
|
65
61
|
isUnique = arr.length === 0;
|
66
|
-
console.log("nodes-nodeElement---filter", arr, isUnique);
|
67
62
|
} else {
|
68
63
|
isUnique = nodes.filter(function (node) {
|
69
64
|
return node.a("ipAddress") === ip;
|
@@ -98,7 +93,7 @@ export function processExitLink(topoData) {
|
|
98
93
|
return upgradeExitLinkTarget(link, serialize);
|
99
94
|
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
100
95
|
|
101
|
-
newLinks = upgradeLinkTargetNotExisted(
|
96
|
+
newLinks = upgradeLinkTargetNotExisted(newLinks); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
102
97
|
|
103
98
|
var ipNodes = getIpNodes(serialize, nodes);
|
104
99
|
return _extends({}, topoData, {
|
@@ -96,12 +96,12 @@ function getValuesByEdges(topo) {
|
|
96
96
|
})[0] || 'nil';
|
97
97
|
}
|
98
98
|
|
99
|
-
function getEdgesValues(edges
|
99
|
+
function getEdgesValues(edges) {
|
100
100
|
var edgeValues = [];
|
101
|
-
var htTopo = topo.getHtTopo();
|
102
101
|
edges.forEach(function (edge) {
|
103
102
|
edgeValues.push({
|
104
|
-
baseAgreement:
|
103
|
+
baseAgreement: false,
|
104
|
+
//,
|
105
105
|
lineButton: edge.s('edge.type'),
|
106
106
|
startPoint: getStartPoint(edge),
|
107
107
|
endPoint: getEndPoint(edge),
|
@@ -142,16 +142,12 @@ function EdgeType(props) {
|
|
142
142
|
|
143
143
|
var _useState = (0, _react.useState)(false),
|
144
144
|
disable = _useState[0],
|
145
|
-
|
145
|
+
setDisable = _useState[1];
|
146
146
|
|
147
147
|
var field = _field["default"].useField({
|
148
148
|
autoUnmount: false,
|
149
149
|
values: getValuesByEdges(topo),
|
150
150
|
onChange: function onChange(name, value) {
|
151
|
-
if (name == 'baseAgreement') {
|
152
|
-
setDisabel(value);
|
153
|
-
}
|
154
|
-
|
155
151
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
156
152
|
_onChange(name, null);
|
157
153
|
} else {
|
@@ -162,6 +158,8 @@ function EdgeType(props) {
|
|
162
158
|
|
163
159
|
(0, _react.useEffect)(function () {
|
164
160
|
field.setValues(getValuesByEdges(topo));
|
161
|
+
field.setValue('baseAgreement', topo.getHtTopo().getEdgeMultarc((0, _edgeTypeStyleUtil.getEdgesBySelection)(topo)));
|
162
|
+
setDisable((0, _edgeTypeStyleUtil.isNodeAllEdges)(topo));
|
165
163
|
}, [selection]);
|
166
164
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
167
165
|
className: _EdgeTypeModule["default"].lineBox
|
@@ -171,10 +169,11 @@ function EdgeType(props) {
|
|
171
169
|
labelAlign: "top"
|
172
170
|
}, /*#__PURE__*/_react["default"].createElement(FormItem, null, /*#__PURE__*/_react["default"].createElement(_LineType["default"], {
|
173
171
|
name: "lineButton",
|
174
|
-
disable:
|
172
|
+
disable: !!field.getValue('baseAgreement')
|
175
173
|
})), /*#__PURE__*/_react["default"].createElement(FormItem, null, /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
176
174
|
name: "baseAgreement",
|
177
|
-
onChange: _onChange
|
175
|
+
onChange: _onChange,
|
176
|
+
disabled: disable
|
178
177
|
}, "\u81EA\u52A8\u8C03\u6574")), /*#__PURE__*/_react["default"].createElement(FormItem, {
|
179
178
|
label: "\u8D77\u70B9"
|
180
179
|
}, /*#__PURE__*/_react["default"].createElement(_select["default"], {
|
@@ -13,6 +13,9 @@ function getPropertyViewType(selection) {
|
|
13
13
|
if (!selectionSize) {
|
14
14
|
// 未选
|
15
15
|
viewType = 'view';
|
16
|
+
} else if ((selectionElement === null || selectionElement === void 0 ? void 0 : selectionElement.getLayer()) === 'backgroundImage') {
|
17
|
+
// 背景图
|
18
|
+
viewType = 'view';
|
16
19
|
} else if (selectionSize >= 2) {
|
17
20
|
// 多选
|
18
21
|
viewType = 'multiple';
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getEdgesBySelection = getEdgesBySelection;
|
5
|
+
exports.isNodeAllEdges = isNodeAllEdges;
|
5
6
|
exports.loopEdgesAndChildren = loopEdgesAndChildren;
|
6
7
|
exports.setEdgesAndChildren = setEdgesAndChildren;
|
7
8
|
exports.setEdgesType = setEdgesType;
|
@@ -52,6 +53,44 @@ function getEdgesBySelection(topo) {
|
|
52
53
|
|
53
54
|
return getSelectedEdges(topo.getGraphView());
|
54
55
|
}
|
56
|
+
/**
|
57
|
+
* 根据选中的线查找对应节点下所有的线是否都选中
|
58
|
+
* @param {*} topo
|
59
|
+
* @param {*} edges
|
60
|
+
* @param {*} operateEdgeFn
|
61
|
+
*/
|
62
|
+
|
63
|
+
|
64
|
+
function isNodeAllEdges(topo) {
|
65
|
+
var selection = topo.getSelectionModel().getSelection().toArray(); // 选中的连线
|
66
|
+
|
67
|
+
var edges = selection.filter(function (element) {
|
68
|
+
return element instanceof ht.Edge;
|
69
|
+
});
|
70
|
+
var inEdges = false;
|
71
|
+
edges.forEach(function (edge) {
|
72
|
+
//根据两边节点查询到所有节点有关的线,过滤出相同的线(两个节点间的线)
|
73
|
+
var sourceNode = edge.getSource();
|
74
|
+
var targetNode = edge.getTarget();
|
75
|
+
var nodeLineList = (0, _htElementUtils.getEdgesBetweenNodes)(sourceNode, targetNode);
|
76
|
+
|
77
|
+
var _loop = function _loop(i) {
|
78
|
+
if (edges.filter(function (edge) {
|
79
|
+
return nodeLineList[i]._id == edge._id;
|
80
|
+
}).length == 0) {
|
81
|
+
inEdges = true;
|
82
|
+
return "break";
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
for (var i = 0; i < nodeLineList.length; i++) {
|
87
|
+
var _ret = _loop(i);
|
88
|
+
|
89
|
+
if (_ret === "break") break;
|
90
|
+
}
|
91
|
+
});
|
92
|
+
return inEdges;
|
93
|
+
}
|
55
94
|
/**
|
56
95
|
* 遍历连线及子连线
|
57
96
|
* @param {*} topo
|
@@ -1014,7 +1014,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1014
1014
|
|
1015
1015
|
function _relateNodeIp() {
|
1016
1016
|
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
|
1017
|
-
var dm,
|
1017
|
+
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1018
1018
|
|
1019
1019
|
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
1020
1020
|
while (1) {
|
@@ -1030,55 +1030,66 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1030
1030
|
return _context16.abrupt("return");
|
1031
1031
|
|
1032
1032
|
case 3:
|
1033
|
+
if (!(txtValue === nodeElement.a('bindIp'))) {
|
1034
|
+
_context16.next = 5;
|
1035
|
+
break;
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
return _context16.abrupt("return");
|
1039
|
+
|
1040
|
+
case 5:
|
1033
1041
|
// 根据配置查询拓扑数据
|
1034
|
-
dm = topo.getDataModel();
|
1035
|
-
htTopo = topo.getHtTopo();
|
1036
|
-
elementNodes = (0, _htElementUtils.getNodes)(dm); // 执行唯一性验证
|
1042
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1037
1043
|
|
1038
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
1039
|
-
ip = (0, _exitLinkUtil.buildIpNode)(txtValue); // 获取关联链路
|
1044
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1040
1045
|
|
1041
1046
|
if (!isUnique) {
|
1042
1047
|
_context16.next = 26;
|
1043
1048
|
break;
|
1044
1049
|
}
|
1045
1050
|
|
1046
|
-
|
1051
|
+
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1052
|
+
_context16.next = 11;
|
1053
|
+
return deleteExLink(nodeElement);
|
1054
|
+
|
1055
|
+
case 11:
|
1047
1056
|
nodeElement.a(ip);
|
1048
1057
|
nodeElement.setName(txtValue);
|
1049
1058
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1050
1059
|
|
1051
1060
|
configObj = topo.resourceConfig.getConfig();
|
1052
|
-
_context16.next =
|
1061
|
+
_context16.next = 17;
|
1053
1062
|
return resourceConfig.updateConfig(configObj);
|
1054
1063
|
|
1055
|
-
case
|
1056
|
-
_context16.next =
|
1064
|
+
case 17:
|
1065
|
+
_context16.next = 19;
|
1057
1066
|
return editDispatchers.fetchDataByConfig();
|
1058
1067
|
|
1059
|
-
case
|
1068
|
+
case 19:
|
1060
1069
|
configData = _context16.sent;
|
1061
|
-
// console.log("configData", configData);
|
1070
|
+
// console.log("configData",configObj, configData);
|
1062
1071
|
_elements = configData.elements;
|
1063
|
-
newLinkElements = findUNExistedLinkElements(_elements);
|
1072
|
+
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1073
|
+
|
1064
1074
|
newLink = newLinkElements.filter(function (item) {
|
1065
1075
|
return item.type === "link";
|
1066
1076
|
});
|
1067
1077
|
newLinkGroup = newLinkElements.filter(function (item) {
|
1068
1078
|
return item.type === "linkGroup";
|
1069
1079
|
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1080
|
+
// console.log("newData",newLinkElements, newLink);
|
1070
1081
|
|
1071
|
-
console.log("newData", newLink);
|
1072
1082
|
createElementsData = {
|
1073
1083
|
groups: [],
|
1074
1084
|
nodes: [],
|
1075
1085
|
links: newLink,
|
1076
1086
|
linkGroups: newLinkGroup
|
1077
|
-
};
|
1078
|
-
console.log("createElementsData", createElementsData);
|
1087
|
+
}; // console.log("createElementsData", createElementsData);
|
1079
1088
|
|
1080
1089
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1081
|
-
|
1090
|
+
_htTopo = topo.getHtTopo();
|
1091
|
+
|
1092
|
+
_htTopo.createElements(createElementsData);
|
1082
1093
|
}
|
1083
1094
|
|
1084
1095
|
case 26:
|
@@ -20,8 +20,7 @@ function useTopoFullscreen(props) {
|
|
20
20
|
var htTopo = topo.getHtTopo();
|
21
21
|
|
22
22
|
if ((graphLoaded || graphLoaded2) && topoData && htTopo.setFullScreenFunc) {
|
23
|
-
htTopo.setFullScreenFunc(function () {
|
24
|
-
panelRef.current.requestFullscreen();
|
23
|
+
htTopo.setFullScreenFunc(function () {// panelRef.current.requestFullscreen()
|
25
24
|
});
|
26
25
|
}
|
27
26
|
}, [topoData, graphLoaded, graphLoaded2]); // 监听退出全屏
|
@@ -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.32" === 'string' ? "9.0.0-a.32" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -61,20 +61,15 @@ function isExitLink(link) {
|
|
61
61
|
|
62
62
|
function isUniqueIp(dataModel, ip, nodeElement) {
|
63
63
|
var nodes = (0, _htElementUtils.getNodes)(dataModel);
|
64
|
-
var isUnique = true;
|
65
|
-
console.log("nodes-nodeElement", nodes, nodeElement);
|
64
|
+
var isUnique = true; // console.log("nodes-nodeElement", nodes, nodeElement);
|
66
65
|
|
67
66
|
if (nodeElement) {
|
68
|
-
console.log("nodes-nodeElement---filter", nodes.filter(function (node) {
|
69
|
-
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
70
|
-
}));
|
71
67
|
var arr = nodes.filter(function (node) {
|
72
68
|
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
73
69
|
}).filter(function (node) {
|
74
70
|
return isPingHtNode(node, ip) || isIpHtNode(node, ip);
|
75
71
|
});
|
76
72
|
isUnique = arr.length === 0;
|
77
|
-
console.log("nodes-nodeElement---filter", arr, isUnique);
|
78
73
|
} else {
|
79
74
|
isUnique = nodes.filter(function (node) {
|
80
75
|
return node.a("ipAddress") === ip;
|
@@ -109,7 +104,7 @@ function processExitLink(topoData) {
|
|
109
104
|
return upgradeExitLinkTarget(link, serialize);
|
110
105
|
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
111
106
|
|
112
|
-
newLinks = upgradeLinkTargetNotExisted(
|
107
|
+
newLinks = upgradeLinkTargetNotExisted(newLinks); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
113
108
|
|
114
109
|
var ipNodes = getIpNodes(serialize, nodes);
|
115
110
|
return (0, _extends2["default"])({}, topoData, {
|
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.32",
|
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.32/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|