@riil-frontend/component-topology 9.0.0-a.12 → 9.0.0-a.15
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 +9 -9
- package/es/core/editor/components/settings/core/updateElementProperty.js +1 -6
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -27
- package/es/core/hooks/useTopoEdit.js +16 -133
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +0 -18
- package/es/core/store/models/topoConfig.js +7 -36
- package/es/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +3 -4
- package/es/networkTopo/services/topo/networkLink.js +3 -45
- package/es/utils/htElementUtils.js +21 -43
- package/lib/core/editor/components/settings/core/updateElementProperty.js +1 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -28
- package/lib/core/hooks/useTopoEdit.js +15 -133
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +1 -21
- package/lib/core/store/models/topoConfig.js +7 -37
- package/lib/networkTopo/services/topo/basic.js +3 -5
- package/lib/networkTopo/services/topo/networkLink.js +3 -45
- package/lib/utils/htElementUtils.js +21 -45
- package/package.json +2 -2
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -61
- package/es/networkTopo/utils/exitLinkUtil.js +0 -110
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -74
- package/lib/networkTopo/utils/exitLinkUtil.js +0 -115
@@ -15,7 +15,7 @@ function getElementData(element) {
|
|
15
15
|
styleMap: element.getStyleMap()
|
16
16
|
};
|
17
17
|
|
18
|
-
if (className ===
|
18
|
+
if (className === 'ht.Edge') {
|
19
19
|
return _extends({}, commonData);
|
20
20
|
}
|
21
21
|
|
@@ -27,7 +27,7 @@ function getElementData(element) {
|
|
27
27
|
export function isNode(element) {
|
28
28
|
// HT为了支持区域内无节点可展开增加了站位节点,因此 节点的layer等于container_blank的过滤掉就可以了
|
29
29
|
// eslint-disable-next-line no-underscore-dangle
|
30
|
-
return element instanceof ht.Node && !isLayer(element) && element._layer !==
|
30
|
+
return element instanceof ht.Node && !isLayer(element) && element._layer !== 'container_blank';
|
31
31
|
}
|
32
32
|
export function isEdge(element) {
|
33
33
|
return element instanceof ht.Edge;
|
@@ -38,7 +38,7 @@ export function isValidEdge(element) {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
if (!element.getSource() || !element.getTarget()) {
|
41
|
-
rlog.error(
|
41
|
+
rlog.error('isValidEdge 连线异常:源或目的为空', element);
|
42
42
|
return false;
|
43
43
|
}
|
44
44
|
|
@@ -51,29 +51,7 @@ export function isLayer(element) {
|
|
51
51
|
return element instanceof ht.Grid;
|
52
52
|
}
|
53
53
|
export function isText(element) {
|
54
|
-
return element instanceof ht.Text && element.a(
|
55
|
-
}
|
56
|
-
export function isUniqueIp(dataModel, ip) {
|
57
|
-
console.log("isUniqueIp", ip);
|
58
|
-
var nodes = getNodes(dataModel);
|
59
|
-
var isUnique = true;
|
60
|
-
|
61
|
-
for (var i = 0; i < nodes.length; i++) {
|
62
|
-
var element = nodes[i];
|
63
|
-
var tagTxt = element.getTag();
|
64
|
-
console.log("isUniqueIp-element", tagTxt, ip);
|
65
|
-
|
66
|
-
if (tagTxt !== null && tagTxt !== void 0 && tagTxt.startsWith("ip_")) {
|
67
|
-
var ipTxt = tagTxt.replace("ip_", '');
|
68
|
-
|
69
|
-
if (ipTxt === ip) {
|
70
|
-
isUnique = false;
|
71
|
-
break;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
return isUnique;
|
54
|
+
return element instanceof ht.Text && element.a('isText');
|
77
55
|
}
|
78
56
|
export function getElements(dataModel) {
|
79
57
|
// console.error(111, dataModel.getDatas().getArray())
|
@@ -94,7 +72,7 @@ export function getGroupDatas(dataModel) {
|
|
94
72
|
}
|
95
73
|
export function getGroupElementByTag(dataModel, tag) {
|
96
74
|
return dataModel.getDataByTag(tag) || dataModel.getDatas().toArray().filter(function (item) {
|
97
|
-
return item.a(
|
75
|
+
return item.a('tag') === tag;
|
98
76
|
})[0];
|
99
77
|
}
|
100
78
|
export function getGroupData(element) {
|
@@ -105,14 +83,14 @@ export function getGroupData(element) {
|
|
105
83
|
var parent = element.getParent();
|
106
84
|
var groupInfo = parent ? {
|
107
85
|
groupId: parent.getTag(),
|
108
|
-
groupTag: parent.a(
|
86
|
+
groupTag: parent.a('tag') // 父容器
|
109
87
|
|
110
88
|
} : {};
|
111
89
|
return _extends({
|
112
90
|
name: element.getStyleMap().label
|
113
91
|
}, element.getAttrObject(), {
|
114
92
|
id: element.getTag(),
|
115
|
-
tag: element.a(
|
93
|
+
tag: element.a('tag'),
|
116
94
|
image: element.getImage()
|
117
95
|
}, groupInfo);
|
118
96
|
}
|
@@ -126,7 +104,7 @@ export function getNodeData(element) {
|
|
126
104
|
var parent = element.getParent();
|
127
105
|
var groupInfo = parent ? {
|
128
106
|
groupId: parent.getTag(),
|
129
|
-
groupTag: parent.a(
|
107
|
+
groupTag: parent.a('tag') // 父容器
|
130
108
|
|
131
109
|
} : {};
|
132
110
|
return _extends({}, element.getAttrObject(), {
|
@@ -138,12 +116,12 @@ export function getEdges(dataModel) {
|
|
138
116
|
return getElements(dataModel).filter(isValidEdge);
|
139
117
|
}
|
140
118
|
export function isEdgeGroupExpanded(edge) {
|
141
|
-
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s(
|
119
|
+
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s('edge.expanded');
|
142
120
|
}
|
143
121
|
/**
|
144
122
|
* 是否连线组代理
|
145
|
-
* @param {*} edge
|
146
|
-
* @returns
|
123
|
+
* @param {*} edge
|
124
|
+
* @returns
|
147
125
|
*/
|
148
126
|
|
149
127
|
export function isEdgeGroupAgent(edge) {
|
@@ -151,9 +129,9 @@ export function isEdgeGroupAgent(edge) {
|
|
151
129
|
}
|
152
130
|
/**
|
153
131
|
* 获得两个节点间的连线列表
|
154
|
-
* @param {*} node1
|
155
|
-
* @param {*} node2
|
156
|
-
* @returns
|
132
|
+
* @param {*} node1
|
133
|
+
* @param {*} node2
|
134
|
+
* @returns
|
157
135
|
*/
|
158
136
|
|
159
137
|
export function getEdgesBetweenNodes(node1, node2) {
|
@@ -175,7 +153,7 @@ export function getEdgesBetweenNodes(node1, node2) {
|
|
175
153
|
}
|
176
154
|
/**
|
177
155
|
* 获得节点间的连线组,连线<=1时返回null
|
178
|
-
* @returns
|
156
|
+
* @returns
|
179
157
|
*/
|
180
158
|
|
181
159
|
export function getEdgeGroupByNodes(node1, node2) {
|
@@ -194,7 +172,7 @@ export function getEdgeGroupByNodes(node1, node2) {
|
|
194
172
|
}
|
195
173
|
/**
|
196
174
|
* 获得节点间的连线组,连线<=1时返回null
|
197
|
-
* @returns
|
175
|
+
* @returns
|
198
176
|
*/
|
199
177
|
|
200
178
|
export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
@@ -202,7 +180,7 @@ export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
|
202
180
|
var node2 = dataModel.getDataByTag(nodeTag2);
|
203
181
|
|
204
182
|
if (!node1 || !node2) {
|
205
|
-
console.warn(
|
183
|
+
console.warn('getEdgeGroupByNodes 未找到节点', {
|
206
184
|
node1: node1,
|
207
185
|
node2: node2,
|
208
186
|
nodeTag1: nodeTag1,
|
@@ -283,7 +261,7 @@ export function getGroupChildren(group) {
|
|
283
261
|
|
284
262
|
|
285
263
|
return group.getChildren().getArray().filter(function (node) {
|
286
|
-
return node._layer !==
|
264
|
+
return node._layer !== 'container_blank';
|
287
265
|
});
|
288
266
|
}
|
289
267
|
/**
|
@@ -313,7 +291,7 @@ export function getGroupChildrenData(group) {
|
|
313
291
|
export function setElementRuntimeStyle(element, name, value) {
|
314
292
|
var _extends2;
|
315
293
|
|
316
|
-
var prevRuntimeStyle = element.a(
|
294
|
+
var prevRuntimeStyle = element.a('runtimeStyles') || {};
|
317
295
|
|
318
296
|
var runtimeStyle = _extends({}, prevRuntimeStyle, (_extends2 = {}, _extends2[name] = value, _extends2)); // if (prevRuntimeStyle[name] === undefined && value === undefined) {
|
319
297
|
// return
|
@@ -324,7 +302,7 @@ export function setElementRuntimeStyle(element, name, value) {
|
|
324
302
|
runtimeStyle[name] = undefined; // delete runtimeStyle[name]
|
325
303
|
}
|
326
304
|
|
327
|
-
element.a(
|
305
|
+
element.a('runtimeStyles', runtimeStyle);
|
328
306
|
}
|
329
307
|
/**
|
330
308
|
* 判断拓扑图是否存在元素
|
@@ -337,7 +315,7 @@ export function isExistedElement(htTopo, dataModel, data) {
|
|
337
315
|
|
338
316
|
|
339
317
|
var element = getElements(dataModel).find(function (item) {
|
340
|
-
return data.tag && item.a(
|
318
|
+
return data.tag && item.a('tag') === data.tag;
|
341
319
|
});
|
342
320
|
|
343
321
|
if (element) {
|
@@ -5,12 +5,7 @@ exports["default"] = updateElementProperty;
|
|
5
5
|
|
6
6
|
function updateElementProperty(topo, name, value) {
|
7
7
|
// const element = topo.getDataModel().getDataById(selection[0].id);
|
8
|
-
var element = topo.getSelectionModel().getFirstData();
|
9
|
-
console.info("updateElementProperty", topo.getSelectionModel().getSelection(), {
|
10
|
-
element: element,
|
11
|
-
name: name,
|
12
|
-
value: value
|
13
|
-
});
|
8
|
+
var element = topo.getSelectionModel().getFirstData(); // console.info("updateElementProperty",topo.getSelectionModel().getSelection(), { selection, element, name, value });
|
14
9
|
|
15
10
|
if (name.startsWith('attrObject.')) {
|
16
11
|
element.setAttr(name.replace('attrObject.', ''), value);
|
@@ -27,8 +27,6 @@ var _NodeRelateResourceButton = _interopRequireDefault(require("./NodeRelateReso
|
|
27
27
|
|
28
28
|
var _PlatformDisplay = _interopRequireDefault(require("./PlatformDisplay"));
|
29
29
|
|
30
|
-
var _BindIpInput = _interopRequireDefault(require("./BindIpInput"));
|
31
|
-
|
32
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
33
31
|
|
34
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -39,14 +37,13 @@ var CollapsePanel = _collapse["default"].Panel;
|
|
39
37
|
function parseValues(values) {
|
40
38
|
return (0, _extends2["default"])({}, values, {
|
41
39
|
"attrObject.customName": values["attrObject.customName"] || values["attrObject.name"],
|
42
|
-
"attrObject.bindTopo": values["attrObject.bindTopo"] || ""
|
43
|
-
|
44
|
-
"attrObject.ipv4": values["attrObject.ipv4"] || ""
|
40
|
+
"attrObject.bindTopo": values["attrObject.bindTopo"] || "" // 解决切换节点时关联拓扑选项未重置
|
41
|
+
|
45
42
|
});
|
46
43
|
}
|
47
44
|
|
48
45
|
function getBindType(values) {
|
49
|
-
if (values.tag
|
46
|
+
if (values.tag) {
|
50
47
|
return "resource";
|
51
48
|
}
|
52
49
|
|
@@ -65,7 +62,6 @@ function Data(props) {
|
|
65
62
|
_onChange = props.onChange,
|
66
63
|
editorProps = props.editorProps;
|
67
64
|
var bindType = getBindType(values);
|
68
|
-
console.log("node, values", node, values);
|
69
65
|
|
70
66
|
var field = _field["default"].useField({
|
71
67
|
autoUnmount: false,
|
@@ -133,7 +129,7 @@ function Data(props) {
|
|
133
129
|
}, /*#__PURE__*/_react["default"].createElement(_form["default"], {
|
134
130
|
field: field,
|
135
131
|
labelAlign: "top"
|
136
|
-
},
|
132
|
+
}, !values.tag && /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
137
133
|
label: "\u5173\u8054\u7C7B\u578B"
|
138
134
|
}, /*#__PURE__*/_react["default"].createElement(_select["default"], {
|
139
135
|
name: "bindType",
|
@@ -147,9 +143,7 @@ function Data(props) {
|
|
147
143
|
value: "none"
|
148
144
|
}, "\u672A\u5173\u8054"), /*#__PURE__*/_react["default"].createElement(Option, {
|
149
145
|
value: "resource"
|
150
|
-
}, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/_react["default"].createElement(Option, {
|
151
|
-
value: "ip"
|
152
|
-
}, "\u5173\u8054IP"), RelateTopoTree && /*#__PURE__*/_react["default"].createElement(Option, {
|
146
|
+
}, "\u5173\u8054\u8D44\u6E90"), RelateTopoTree && /*#__PURE__*/_react["default"].createElement(Option, {
|
153
147
|
value: "topo"
|
154
148
|
}, "\u5173\u8054\u62D3\u6251"))), bindType === "resource" && /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
155
149
|
label: "\u5173\u8054\u8D44\u6E90"
|
@@ -163,7 +157,7 @@ function Data(props) {
|
|
163
157
|
flex: 1,
|
164
158
|
paddingRight: 16,
|
165
159
|
color: "#4D6277",
|
166
|
-
lineHeight:
|
160
|
+
lineHeight: '20px'
|
167
161
|
},
|
168
162
|
title: values.tag ? values.name : null
|
169
163
|
}, values.tag ? values.name : "—"), /*#__PURE__*/_react["default"].createElement(_NodeRelateResourceButton["default"], {
|
@@ -172,27 +166,13 @@ function Data(props) {
|
|
172
166
|
topo: topo,
|
173
167
|
topoEditApi: topoEditApi,
|
174
168
|
nodeBindResourceDrawerComponent: editorProps.nodeBindResourceDrawerComponent
|
175
|
-
}))), bindType === "
|
176
|
-
label: "\u5173\u8054IP" // style={{ display: "flex" }}
|
177
|
-
,
|
178
|
-
pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
|
179
|
-
patternTrigger: "onBlur",
|
180
|
-
patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
|
181
|
-
}, /*#__PURE__*/_react["default"].createElement(_BindIpInput["default"], {
|
182
|
-
nodeElement: node,
|
183
|
-
node: values,
|
184
|
-
topo: topo,
|
185
|
-
topoEditApi: topoEditApi,
|
186
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
187
|
-
name: "attrObject.ipv4",
|
188
|
-
maxLength: 128
|
189
|
-
})), bindType === "topo" && RelateTopoTree && /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
169
|
+
}))), bindType === "topo" && RelateTopoTree && /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
190
170
|
label: "\u5173\u8054\u62D3\u6251"
|
191
171
|
}, /*#__PURE__*/_react["default"].createElement(RelateTopoTree, {
|
192
172
|
name: "attrObject.bindTopo",
|
193
173
|
topo: topo,
|
194
174
|
onChange: handleBindTopoChange
|
195
|
-
})), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) ===
|
175
|
+
})), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) === 'cmpTopo' && node.getTag() && /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
196
176
|
label: "\u6240\u5C5E\u5E73\u53F0"
|
197
177
|
}, /*#__PURE__*/_react["default"].createElement(_PlatformDisplay["default"], props)))));
|
198
178
|
}
|
@@ -37,8 +37,6 @@ var _htElementDataUtil = require("../../utils/htElementDataUtil");
|
|
37
37
|
|
38
38
|
var _clusterUtil = require("../../utils/clusterUtil");
|
39
39
|
|
40
|
-
var _linkUtils = require("../models/utils/linkUtils");
|
41
|
-
|
42
40
|
var useTopoEdit = function useTopoEdit(params) {
|
43
41
|
var topo = params.topo,
|
44
42
|
topoId = params.topoId,
|
@@ -344,7 +342,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
344
342
|
|
345
343
|
edges.map(function (edge) {
|
346
344
|
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
347
|
-
// exLink.push(edge);
|
345
|
+
// exLink.push(edge);
|
348
346
|
topo.getGraphView().dm().remove(edge);
|
349
347
|
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
350
348
|
}
|
@@ -408,8 +406,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
408
406
|
};
|
409
407
|
/**
|
410
408
|
* 获得未存在的连线元素
|
411
|
-
* @param {*} elements
|
412
|
-
* @returns
|
409
|
+
* @param {*} elements
|
410
|
+
* @returns
|
413
411
|
*/
|
414
412
|
|
415
413
|
|
@@ -422,8 +420,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
422
420
|
}
|
423
421
|
/**
|
424
422
|
* 获得未存在的元素
|
425
|
-
* @param {Array} elements
|
426
|
-
* @returns
|
423
|
+
* @param {Array} elements
|
424
|
+
* @returns
|
427
425
|
*/
|
428
426
|
|
429
427
|
|
@@ -602,7 +600,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
602
600
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
603
601
|
newElements = findUNExistedElements(elements);
|
604
602
|
|
605
|
-
_rlog["default"].debug(
|
603
|
+
_rlog["default"].debug('添加分层资源', {
|
606
604
|
layer: group,
|
607
605
|
newElements: newElements
|
608
606
|
});
|
@@ -676,8 +674,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
676
674
|
}
|
677
675
|
/**
|
678
676
|
* 未选中元素添加资源
|
679
|
-
*
|
680
|
-
* @param {*} data
|
677
|
+
*
|
678
|
+
* @param {*} data
|
681
679
|
*/
|
682
680
|
|
683
681
|
|
@@ -837,7 +835,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
837
835
|
newLinkElements = findUNExistedLinkElements(elements);
|
838
836
|
createElementsData = null;
|
839
837
|
|
840
|
-
if (newData.type ===
|
838
|
+
if (newData.type === 'group') {
|
841
839
|
groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
|
842
840
|
newGroupChildren = [];
|
843
841
|
existedGroupChildren = [];
|
@@ -854,10 +852,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
854
852
|
groups: [newData],
|
855
853
|
nodes: newGroupChildren,
|
856
854
|
links: newLinkElements.filter(function (item) {
|
857
|
-
return item.type ===
|
855
|
+
return item.type === 'link';
|
858
856
|
}),
|
859
857
|
linkGroups: newLinkElements.filter(function (item) {
|
860
|
-
return item.type ===
|
858
|
+
return item.type === 'linkGroup';
|
861
859
|
})
|
862
860
|
};
|
863
861
|
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
@@ -872,16 +870,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
872
870
|
groups: [],
|
873
871
|
nodes: [newData],
|
874
872
|
links: newLinkElements.filter(function (item) {
|
875
|
-
return item.type ===
|
873
|
+
return item.type === 'link';
|
876
874
|
}),
|
877
875
|
linkGroups: newLinkElements.filter(function (item) {
|
878
|
-
return item.type ===
|
876
|
+
return item.type === 'linkGroup';
|
879
877
|
})
|
880
878
|
};
|
881
879
|
htTopo.createElements(createElementsData);
|
882
880
|
}
|
883
881
|
|
884
|
-
_rlog["default"].debug(
|
882
|
+
_rlog["default"].debug('批量创建元素', createElementsData); // 恢复图标、大小、位置
|
885
883
|
|
886
884
|
|
887
885
|
newElement = dm.getDataByTag(newData.id);
|
@@ -1001,117 +999,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1001
999
|
return _ref8.apply(this, arguments);
|
1002
1000
|
};
|
1003
1001
|
}();
|
1004
|
-
/**
|
1005
|
-
* 关联IP的图片节点
|
1006
|
-
*/
|
1007
|
-
|
1008
|
-
|
1009
|
-
function relateNodeIp(_x15, _x16) {
|
1010
|
-
return _relateNodeIp.apply(this, arguments);
|
1011
|
-
}
|
1012
|
-
|
1013
|
-
function _relateNodeIp() {
|
1014
|
-
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
|
1015
|
-
var dm, htTopo, elements, _yield$editDispatcher5, elementDatas, isUnique, ipTxt, ids, ip, re, config, linksData, createElementsData;
|
1016
|
-
|
1017
|
-
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
1018
|
-
while (1) {
|
1019
|
-
switch (_context16.prev = _context16.next) {
|
1020
|
-
case 0:
|
1021
|
-
// console.log("bindIPtoNode", data);
|
1022
|
-
// 根据配置查询拓扑数据
|
1023
|
-
dm = topo.getDataModel();
|
1024
|
-
htTopo = topo.getHtTopo();
|
1025
|
-
elements = (0, _htElementUtils.getNodes)(dm);
|
1026
|
-
_context16.next = 5;
|
1027
|
-
return editDispatchers.fetchDataByConfig();
|
1028
|
-
|
1029
|
-
case 5:
|
1030
|
-
_yield$editDispatcher5 = _context16.sent;
|
1031
|
-
elementDatas = _yield$editDispatcher5.elementDatas;
|
1032
|
-
console.log("bindIPtoNode", txtValue, nodeElement, elements);
|
1033
|
-
console.log("elementDatas", elementDatas);
|
1034
|
-
isUnique = true;
|
1035
|
-
ipTxt = txtValue;
|
1036
|
-
ids = []; // 执行唯一性验证
|
1037
|
-
|
1038
|
-
elements.map(function (element) {
|
1039
|
-
// if (node.getId() !== element.getId()) {
|
1040
|
-
// }
|
1041
|
-
if (element.getTag()) {
|
1042
|
-
ids.push(element.getTag());
|
1043
|
-
}
|
1044
|
-
});
|
1045
|
-
ip = {
|
1046
|
-
id: "ip_1.1.1.1",
|
1047
|
-
name: "1.1.1.1",
|
1048
|
-
customName: null,
|
1049
|
-
// 'groupId': null,
|
1050
|
-
// 'groupTag': null,
|
1051
|
-
ipAddress: "1.1.1.1",
|
1052
|
-
// 'attributes': [],
|
1053
|
-
// 'metrics': [],
|
1054
|
-
type: "node" // 'dtype': 'device'
|
1055
|
-
|
1056
|
-
}; // 获取关联链路
|
1057
|
-
|
1058
|
-
if (!isUnique) {
|
1059
|
-
_context16.next = 27;
|
1060
|
-
break;
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
nodeElement.a(ip);
|
1064
|
-
nodeElement.setName(txtValue);
|
1065
|
-
nodeElement.a("name", txtValue);
|
1066
|
-
nodeElement.a("customName", null);
|
1067
|
-
nodeElement.setTag("ip_" + txtValue);
|
1068
|
-
_context16.next = 22;
|
1069
|
-
return editDispatchers.queryAllLinkByIp({
|
1070
|
-
ids: ids,
|
1071
|
-
ip: txtValue
|
1072
|
-
});
|
1073
|
-
|
1074
|
-
case 22:
|
1075
|
-
re = _context16.sent;
|
1076
|
-
console.log("queryAllLinkByIp", re);
|
1077
|
-
config = resourceConfig.getConfig();
|
1078
|
-
console.log("resourceConfig.getConfig", config);
|
1079
|
-
|
1080
|
-
if (re && re.length > 0) {
|
1081
|
-
linksData = [];
|
1082
|
-
re.map(function (link) {
|
1083
|
-
var sourceId = link.attributes["network_link.source_device_id"];
|
1084
|
-
var source = dm.getDataByTag(sourceId);
|
1085
|
-
var target = nodeElement; // console.log("source, nodeElement, link", source, target, link);
|
1086
|
-
|
1087
|
-
if (source && target) {
|
1088
|
-
var linkData = (0, _linkUtils.mergeExportLinkData)({
|
1089
|
-
source: source,
|
1090
|
-
target: target,
|
1091
|
-
link: link
|
1092
|
-
});
|
1093
|
-
console.log("linkData", linkData);
|
1094
|
-
linksData.push(linkData); // htTopo.createEdge(source, target, link);
|
1095
|
-
}
|
1096
|
-
});
|
1097
|
-
createElementsData = {
|
1098
|
-
groups: [],
|
1099
|
-
nodes: [],
|
1100
|
-
links: [].concat(linksData),
|
1101
|
-
linkGroups: []
|
1102
|
-
};
|
1103
|
-
htTopo.createElements(createElementsData); // htTopo.addElements({ lines: [...re] });
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
case 27:
|
1107
|
-
case "end":
|
1108
|
-
return _context16.stop();
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
}, _callee16);
|
1112
|
-
}));
|
1113
|
-
return _relateNodeIp.apply(this, arguments);
|
1114
|
-
}
|
1115
1002
|
|
1116
1003
|
var onEvent = function onEvent(e) {
|
1117
1004
|
var map = {};
|
@@ -1129,7 +1016,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1129
1016
|
*/
|
1130
1017
|
|
1131
1018
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
1132
|
-
_rlog["default"].debug(
|
1019
|
+
_rlog["default"].debug('设置视图鼠标模式', mode);
|
1133
1020
|
|
1134
1021
|
topo.getHtTopo().setViewMouseMode(mode);
|
1135
1022
|
topoEditDispatchers.update({
|
@@ -1208,11 +1095,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1208
1095
|
*/
|
1209
1096
|
onDeleteElement: onDeleteElement,
|
1210
1097
|
|
1211
|
-
/**
|
1212
|
-
* 绑定图片ip
|
1213
|
-
*/
|
1214
|
-
relateNodeIp: relateNodeIp,
|
1215
|
-
|
1216
1098
|
/**
|
1217
1099
|
* 拓扑图保存回调
|
1218
1100
|
*/
|
@@ -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.15" === 'string' ? "9.0.0-a.15" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -8,7 +8,6 @@ exports.compatibleWith = void 0;
|
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
9
|
exports.isCrucialLink = isCrucialLink;
|
10
10
|
exports.isExitLink = isExitLink;
|
11
|
-
exports.mergeExportLinkData = void 0;
|
12
11
|
exports.mergeLinksData = mergeLinksData;
|
13
12
|
exports.showLinkByConfig = exports.plurals = void 0;
|
14
13
|
|
@@ -219,23 +218,4 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
219
218
|
}
|
220
219
|
};
|
221
220
|
|
222
|
-
exports.showLinkByConfig = showLinkByConfig;
|
223
|
-
|
224
|
-
var mergeExportLinkData = function mergeExportLinkData(props) {
|
225
|
-
var source = props.source,
|
226
|
-
target = props.target,
|
227
|
-
link = props.link;
|
228
|
-
var attrObj = link.attributes;
|
229
|
-
var linkData = (0, _extends2["default"])({}, link, {
|
230
|
-
name: attrObj.name,
|
231
|
-
source: attrObj["network_link.source_device_id"],
|
232
|
-
target: attrObj.destination_type === 'ip' ? target.getTag() : attrObj["network_link.destination_device_id"],
|
233
|
-
operation: attrObj.operation,
|
234
|
-
interfaceSource: attrObj["source_id"],
|
235
|
-
interfaceTarget: attrObj["destination_id"],
|
236
|
-
ciType: link.typeCode
|
237
|
-
});
|
238
|
-
return linkData;
|
239
|
-
};
|
240
|
-
|
241
|
-
exports.mergeExportLinkData = mergeExportLinkData;
|
221
|
+
exports.showLinkByConfig = showLinkByConfig;
|
@@ -27,8 +27,6 @@ var _topoData = require("../../../utils/topoData");
|
|
27
27
|
|
28
28
|
var _topoData2 = require("../../../core/models/topoData");
|
29
29
|
|
30
|
-
var _networkLink = _interopRequireDefault(require("../../../networkTopo/services/topo/networkLink"));
|
31
|
-
|
32
30
|
var _getTopoData = require("../../../networkTopo/getTopoData");
|
33
31
|
|
34
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -266,20 +264,19 @@ function _default(topoApp) {
|
|
266
264
|
var _this2 = this;
|
267
265
|
|
268
266
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
269
|
-
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList,
|
267
|
+
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
|
270
268
|
|
271
269
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
272
270
|
while (1) {
|
273
271
|
switch (_context2.prev = _context2.next) {
|
274
272
|
case 0:
|
275
273
|
editState = rootState.topoConfig;
|
276
|
-
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
|
274
|
+
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;
|
277
275
|
query = {
|
278
276
|
id: rootState.topoMod.topoId,
|
279
277
|
resources: resources,
|
280
278
|
groups: groups,
|
281
|
-
exportLinkIdList: exportLinkIdList
|
282
|
-
ipNodes: ipNodes
|
279
|
+
exportLinkIdList: exportLinkIdList
|
283
280
|
};
|
284
281
|
_context2.next = 5;
|
285
282
|
return _this2.getTopoByConditions(query);
|
@@ -333,14 +330,14 @@ function _default(topoApp) {
|
|
333
330
|
var _this4 = this;
|
334
331
|
|
335
332
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
336
|
-
var topoId, resources, groups, exportLinkIdList,
|
333
|
+
var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
337
334
|
|
338
335
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
339
336
|
while (1) {
|
340
337
|
switch (_context4.prev = _context4.next) {
|
341
338
|
case 0:
|
342
339
|
// rlog.debug("getTopoByConditions--------", params);
|
343
|
-
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList
|
340
|
+
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
|
344
341
|
viewConditions = (0, _topoData2.resToConditions)(resources);
|
345
342
|
groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
|
346
343
|
return (0, _extends2["default"])({}, group, {
|
@@ -350,7 +347,7 @@ function _default(topoApp) {
|
|
350
347
|
}); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
351
348
|
|
352
349
|
_context4.next = 5;
|
353
|
-
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList
|
350
|
+
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
|
354
351
|
|
355
352
|
case 5:
|
356
353
|
data = _context4.sent;
|
@@ -419,7 +416,7 @@ function _default(topoApp) {
|
|
419
416
|
}))
|
420
417
|
};
|
421
418
|
|
422
|
-
_rlog["default"].debug(
|
419
|
+
_rlog["default"].debug('saveGlobalConfig', config);
|
423
420
|
|
424
421
|
_context5.next = 5;
|
425
422
|
return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
|
@@ -488,33 +485,6 @@ function _default(topoApp) {
|
|
488
485
|
switchToViewMode: function switchToViewMode() {
|
489
486
|
this.reset();
|
490
487
|
dispatch.topoMod.switchToViewMode();
|
491
|
-
},
|
492
|
-
queryAllLinkByIp: function queryAllLinkByIp(data) {
|
493
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
494
|
-
var _result$data;
|
495
|
-
|
496
|
-
var ids, ip, result;
|
497
|
-
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
498
|
-
while (1) {
|
499
|
-
switch (_context8.prev = _context8.next) {
|
500
|
-
case 0:
|
501
|
-
ids = data.ids, ip = data.ip;
|
502
|
-
console.log("queryAllLinkByIp", ids, ip);
|
503
|
-
_context8.next = 4;
|
504
|
-
return _networkLink["default"].queryLinksByIp(ids, ip);
|
505
|
-
|
506
|
-
case 4:
|
507
|
-
result = _context8.sent;
|
508
|
-
console.log("queryAllLinkByIp-result", result);
|
509
|
-
return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
|
510
|
-
|
511
|
-
case 7:
|
512
|
-
case "end":
|
513
|
-
return _context8.stop();
|
514
|
-
}
|
515
|
-
}
|
516
|
-
}, _callee8);
|
517
|
-
}))();
|
518
488
|
}
|
519
489
|
};
|
520
490
|
}
|