@riil-frontend/component-topology 4.0.1 → 4.0.4
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/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
- package/es/hooks/useTopoEdit.js +64 -41
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +71 -34
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
- package/es/utils/clusterUtil.js +1 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
- package/lib/hooks/useTopoEdit.js +63 -41
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +73 -37
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
- package/lib/utils/clusterUtil.js +1 -1
- package/package.json +2 -2
|
@@ -21,7 +21,7 @@ import PluginManager from "./PluginManager";
|
|
|
21
21
|
import topoFactory from "./topoFactory";
|
|
22
22
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig"; // eslint-disable-next-line no-undef
|
|
23
23
|
|
|
24
|
-
var version = typeof "4.0.
|
|
24
|
+
var version = typeof "4.0.4" === 'string' ? "4.0.4" : null;
|
|
25
25
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
26
26
|
/**
|
|
27
27
|
* 拓扑显示和编辑
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -864,7 +864,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
864
864
|
|
|
865
865
|
var bindNodeResource = /*#__PURE__*/function () {
|
|
866
866
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params) {
|
|
867
|
-
var id, oldResId, newResId, node,
|
|
867
|
+
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm, replaceOrAddRes;
|
|
868
868
|
|
|
869
869
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
870
870
|
while (1) {
|
|
@@ -882,15 +882,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
882
882
|
rlog.debug("bindNodeResource", params);
|
|
883
883
|
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
|
884
884
|
|
|
885
|
-
|
|
885
|
+
parentGroupElement = node.getParent();
|
|
886
886
|
htTopo = topo.getHtTopo();
|
|
887
887
|
config = resourceConfig.getConfig();
|
|
888
888
|
|
|
889
|
-
if (
|
|
889
|
+
if (parentGroupElement) {
|
|
890
890
|
// 在容器中
|
|
891
|
-
groupId =
|
|
891
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
|
892
892
|
|
|
893
|
-
groupTag =
|
|
893
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
|
894
894
|
|
|
895
895
|
config.groups = config.groups.map(function (g) {
|
|
896
896
|
// 匹配到容器,替换资源或增加
|
|
@@ -922,19 +922,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
922
922
|
return item.id === newResId;
|
|
923
923
|
});
|
|
924
924
|
|
|
925
|
-
if (newData
|
|
926
|
-
|
|
927
|
-
} else {
|
|
928
|
-
newNodeElements = [newData];
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
newLinkElements = findUNExistedLinkElements(elements); // 过滤出关联的节点和连线,通知ht更新
|
|
932
|
-
// const newDatas = filterElementsByNodeId(elements, newResId);
|
|
933
|
-
|
|
934
|
-
newDatas = [].concat(newNodeElements, newLinkElements);
|
|
935
|
-
|
|
936
|
-
if (newDatas.length) {
|
|
937
|
-
_context8.next = 22;
|
|
925
|
+
if (newData) {
|
|
926
|
+
_context8.next = 19;
|
|
938
927
|
break;
|
|
939
928
|
}
|
|
940
929
|
|
|
@@ -943,25 +932,57 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
943
932
|
rlog.warn("关联资源失败");
|
|
944
933
|
return _context8.abrupt("return", false);
|
|
945
934
|
|
|
946
|
-
case
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
935
|
+
case 19:
|
|
936
|
+
dm = htTopo.getGraphView().dm(); // 创建
|
|
937
|
+
|
|
938
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
|
939
|
+
createElementsData = null;
|
|
940
|
+
|
|
941
|
+
if (newData.type === 'group') {
|
|
942
|
+
groupChildren = findGroupChildren(elements, newData);
|
|
943
|
+
newGroupChildren = [];
|
|
944
|
+
existedGroupChildren = [];
|
|
945
|
+
groupChildren.forEach(function (groupChildData) {
|
|
946
|
+
var ele = dm.getDataByTag(groupChildData.id);
|
|
947
|
+
|
|
948
|
+
if (ele) {
|
|
949
|
+
existedGroupChildren.push(groupChildData);
|
|
950
|
+
} else {
|
|
951
|
+
newGroupChildren.push(groupChildData);
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
createElementsData = {
|
|
955
|
+
groups: [newData],
|
|
956
|
+
nodes: newGroupChildren,
|
|
957
|
+
links: newLinkElements.filter(function (item) {
|
|
958
|
+
return item.type === 'link';
|
|
959
|
+
}),
|
|
960
|
+
linkGroups: newLinkElements.filter(function (item) {
|
|
961
|
+
return item.type === 'linkGroup';
|
|
962
|
+
})
|
|
963
|
+
};
|
|
964
|
+
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
|
965
|
+
|
|
966
|
+
groupElement = dm.getDataByTag(newData.id);
|
|
967
|
+
existedGroupChildren.forEach(function (groupChildData) {
|
|
968
|
+
var nodeElement = dm.getDataByTag(groupChildData.id);
|
|
969
|
+
nodeElement.setParent(groupElement);
|
|
970
|
+
});
|
|
971
|
+
} else {
|
|
972
|
+
createElementsData = {
|
|
973
|
+
groups: [],
|
|
974
|
+
nodes: [newData],
|
|
975
|
+
links: newLinkElements.filter(function (item) {
|
|
976
|
+
return item.type === 'link';
|
|
977
|
+
}),
|
|
978
|
+
linkGroups: newLinkElements.filter(function (item) {
|
|
979
|
+
return item.type === 'linkGroup';
|
|
980
|
+
})
|
|
981
|
+
};
|
|
982
|
+
htTopo.createElements(createElementsData);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
rlog.debug('批量创建元素', createElementsData); // 恢复图标、大小、位置
|
|
965
986
|
|
|
966
987
|
newElement = dm.getDataByTag(newData.id);
|
|
967
988
|
|
|
@@ -969,24 +990,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
969
990
|
newElement.setSize(node.getSize());
|
|
970
991
|
newElement.setPosition(node.getPosition());
|
|
971
992
|
newElement.setImage(node.getImage());
|
|
972
|
-
}
|
|
993
|
+
} // 选中
|
|
994
|
+
|
|
973
995
|
|
|
996
|
+
sm = htTopo.getGraphView().sm();
|
|
974
997
|
sm.setSelection([newElement]); // 移除旧节点
|
|
975
998
|
|
|
976
999
|
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
|
977
1000
|
// node.a("customName", null);
|
|
978
1001
|
// 删除关联在节点上的出口链路
|
|
979
1002
|
|
|
980
|
-
_context8.next =
|
|
1003
|
+
_context8.next = 31;
|
|
981
1004
|
return deleteExLink(node);
|
|
982
1005
|
|
|
983
|
-
case
|
|
1006
|
+
case 31:
|
|
984
1007
|
// 临时放这里,仅拓扑中心有
|
|
985
1008
|
if (topo.linkDynamicStyleExecutor) {
|
|
986
1009
|
topo.linkDynamicStyleExecutor.execute();
|
|
987
1010
|
}
|
|
988
1011
|
|
|
989
|
-
case
|
|
1012
|
+
case 32:
|
|
990
1013
|
case "end":
|
|
991
1014
|
return _context8.stop();
|
|
992
1015
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _Drawer from "@alifd/next/es/drawer";
|
|
2
|
+
import _Loading from "@alifd/next/es/loading";
|
|
2
3
|
import _Message from "@alifd/next/es/message";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
import _Collapse from "@alifd/next/es/collapse";
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useState, useEffect, useRef } from "react";
|
|
8
8
|
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
9
|
-
import { RESOURCE_LIMIT_TYPES } from "../../../../../../constants/ResourceTypeLimit";
|
|
10
9
|
import _ from "lodash";
|
|
11
10
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
12
11
|
import TopoCenterEvent from "../../../../../event";
|
|
@@ -17,7 +16,6 @@ import { clone } from "../../../../../../utils/copyUtil";
|
|
|
17
16
|
import { getInterfaceObject } from "../../../../../../core/models/utils/linkUtils";
|
|
18
17
|
import { getEdgesBetweenNodes, getNodes, isGroup } from "../../../../../../utils/htElementUtils";
|
|
19
18
|
import { getCiTypes } from "../../../../../../utils/topoData";
|
|
20
|
-
var CollapsePanel = _Collapse.Panel;
|
|
21
19
|
|
|
22
20
|
function AddLinkDrawer(props) {
|
|
23
21
|
var topo = props.topo,
|
|
@@ -51,18 +49,26 @@ function AddLinkDrawer(props) {
|
|
|
51
49
|
loading = _useState3[0],
|
|
52
50
|
setLoading = _useState3[1];
|
|
53
51
|
|
|
54
|
-
var _useState4 = useState(),
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
var _useState4 = useState(false),
|
|
53
|
+
loadingConnectableNodes = _useState4[0],
|
|
54
|
+
setLoadingConnectableNodes = _useState4[1];
|
|
57
55
|
|
|
58
|
-
var _useState5 = useState(),
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
var _useState5 = useState(false),
|
|
57
|
+
loadingFormData = _useState5[0],
|
|
58
|
+
setLoadingFormData = _useState5[1];
|
|
61
59
|
|
|
60
|
+
var _useState6 = useState(),
|
|
61
|
+
sourceIFDoc = _useState6[0],
|
|
62
|
+
setSourceIFDoc = _useState6[1];
|
|
62
63
|
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
var _useState7 = useState(),
|
|
65
|
+
targetIFDoc = _useState7[0],
|
|
66
|
+
setTargetIFDoc = _useState7[1]; // 保存后更新拓扑图状态
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
var _useState8 = useState([]),
|
|
70
|
+
ciIdsConnectable = _useState8[0],
|
|
71
|
+
setCiIdsConnectable = _useState8[1];
|
|
66
72
|
|
|
67
73
|
var linkNodesRef = useRef();
|
|
68
74
|
|
|
@@ -149,10 +155,15 @@ function AddLinkDrawer(props) {
|
|
|
149
155
|
return _ref.apply(this, arguments);
|
|
150
156
|
};
|
|
151
157
|
}();
|
|
158
|
+
/**
|
|
159
|
+
* 连线第二个节点时的处理
|
|
160
|
+
* @param {*} e
|
|
161
|
+
*/
|
|
162
|
+
|
|
152
163
|
|
|
153
164
|
var handleEvent = /*#__PURE__*/function () {
|
|
154
165
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
|
|
155
|
-
var sourcePorts, targetPorts, source, target, connect_type;
|
|
166
|
+
var sourcePorts, targetPorts, source, target, targetDisableCreatePhyAggLink, connect_type;
|
|
156
167
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
157
168
|
while (1) {
|
|
158
169
|
switch (_context2.prev = _context2.next) {
|
|
@@ -162,26 +173,28 @@ function AddLinkDrawer(props) {
|
|
|
162
173
|
rlog.debug("接到打开创建链路抽屉信息", e);
|
|
163
174
|
setIsAddMode(true); // setTrue();
|
|
164
175
|
|
|
165
|
-
|
|
166
|
-
_context2.
|
|
176
|
+
setLoadingFormData(true);
|
|
177
|
+
_context2.prev = 4;
|
|
178
|
+
_context2.next = 7;
|
|
167
179
|
return getPortsById(e.source._attrObject.id);
|
|
168
180
|
|
|
169
|
-
case
|
|
181
|
+
case 7:
|
|
170
182
|
sourcePorts = _context2.sent;
|
|
171
|
-
_context2.next =
|
|
183
|
+
_context2.next = 10;
|
|
172
184
|
return getPortsById(e.target._attrObject.id);
|
|
173
185
|
|
|
174
|
-
case
|
|
186
|
+
case 10:
|
|
175
187
|
targetPorts = _context2.sent;
|
|
176
188
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
177
189
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
178
190
|
source = translationNode(e.source, sourcePorts);
|
|
179
191
|
target = translationNode(e.target, targetPorts);
|
|
192
|
+
targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
|
|
180
193
|
editDispatchers.update({
|
|
181
194
|
addLinkIsOpen: true,
|
|
182
195
|
currentLink: null
|
|
183
196
|
});
|
|
184
|
-
connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 ? "phy" : "exit";
|
|
197
|
+
connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
|
|
185
198
|
setLink({
|
|
186
199
|
source: source,
|
|
187
200
|
target: target,
|
|
@@ -200,20 +213,23 @@ function AddLinkDrawer(props) {
|
|
|
200
213
|
connect_type: connect_type
|
|
201
214
|
}
|
|
202
215
|
});
|
|
203
|
-
_context2.next =
|
|
216
|
+
_context2.next = 24;
|
|
204
217
|
break;
|
|
205
218
|
|
|
206
|
-
case
|
|
207
|
-
_context2.prev =
|
|
208
|
-
_context2.t0 = _context2["catch"](
|
|
219
|
+
case 21:
|
|
220
|
+
_context2.prev = 21;
|
|
221
|
+
_context2.t0 = _context2["catch"](4);
|
|
209
222
|
rlog.error("出现异常", _context2.t0);
|
|
210
223
|
|
|
211
|
-
case
|
|
224
|
+
case 24:
|
|
225
|
+
setLoadingFormData(false);
|
|
226
|
+
|
|
227
|
+
case 25:
|
|
212
228
|
case "end":
|
|
213
229
|
return _context2.stop();
|
|
214
230
|
}
|
|
215
231
|
}
|
|
216
|
-
}, _callee2, null, [[
|
|
232
|
+
}, _callee2, null, [[4, 21]]);
|
|
217
233
|
}));
|
|
218
234
|
|
|
219
235
|
return function handleEvent(_x3) {
|
|
@@ -254,6 +270,7 @@ function AddLinkDrawer(props) {
|
|
|
254
270
|
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
255
271
|
setLink({
|
|
256
272
|
source: {
|
|
273
|
+
ciData: topo.dataModel.getDataById(currentLink.source),
|
|
257
274
|
id: currentLink.source,
|
|
258
275
|
name: currentLink.attributes["network_link.source_device_id_object"].displayName,
|
|
259
276
|
ciId: currentLink.attributes["network_link.source_device_id"],
|
|
@@ -265,6 +282,7 @@ function AddLinkDrawer(props) {
|
|
|
265
282
|
portsDoc: sourcePorts.portsDoc
|
|
266
283
|
},
|
|
267
284
|
target: {
|
|
285
|
+
ciData: topo.dataModel.getDataById(currentLink.target),
|
|
268
286
|
id: currentLink.target,
|
|
269
287
|
name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
|
|
270
288
|
ciId: currentLink.attributes["network_link.destination_device_id"],
|
|
@@ -309,20 +327,22 @@ function AddLinkDrawer(props) {
|
|
|
309
327
|
|
|
310
328
|
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
311
329
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
312
|
-
var ciTypes, ciTypesConnectable, nodes, ciIds,
|
|
330
|
+
var ciNodes, ciTypes, ciTypesConnectable, nodes, ciIds, isWriteable;
|
|
313
331
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
314
332
|
while (1) {
|
|
315
333
|
switch (_context4.prev = _context4.next) {
|
|
316
334
|
case 0:
|
|
335
|
+
ciNodes = [];
|
|
336
|
+
setLoadingConnectableNodes(true);
|
|
337
|
+
_context4.prev = 2;
|
|
317
338
|
ciTypes = getCiTypes(topo.dataModel.getData());
|
|
318
|
-
_context4.next =
|
|
339
|
+
_context4.next = 6;
|
|
319
340
|
return topoService.networkLink.getCiTypesConnectable(ciTypes);
|
|
320
341
|
|
|
321
|
-
case
|
|
342
|
+
case 6:
|
|
322
343
|
ciTypesConnectable = _context4.sent;
|
|
323
344
|
nodes = getNodes(topo.getDataModel());
|
|
324
345
|
ciIds = [];
|
|
325
|
-
ciNodes = [];
|
|
326
346
|
|
|
327
347
|
isWriteable = function isWriteable(node) {
|
|
328
348
|
var _node$a;
|
|
@@ -330,7 +350,7 @@ function AddLinkDrawer(props) {
|
|
|
330
350
|
return ["delete", "write"].indexOf(node.a("operation")) >= 0 || ((_node$a = node.a('permission')) === null || _node$a === void 0 ? void 0 : _node$a.writeable);
|
|
331
351
|
};
|
|
332
352
|
|
|
333
|
-
nodes.
|
|
353
|
+
nodes.forEach(function (node) {
|
|
334
354
|
// rlog.debug("过滤属性", node.a("operation"));
|
|
335
355
|
if (ciTypesConnectable[node.a("ciType")] && isWriteable(node)) {
|
|
336
356
|
ciIds.push(node.id);
|
|
@@ -341,14 +361,24 @@ function AddLinkDrawer(props) {
|
|
|
341
361
|
ciConnectable: ciIds
|
|
342
362
|
});
|
|
343
363
|
setCiIdsConnectable(ciIds);
|
|
364
|
+
_context4.next = 18;
|
|
365
|
+
break;
|
|
366
|
+
|
|
367
|
+
case 15:
|
|
368
|
+
_context4.prev = 15;
|
|
369
|
+
_context4.t0 = _context4["catch"](2);
|
|
370
|
+
rlog.error('查询可创建链路节点失败', _context4.t0);
|
|
371
|
+
|
|
372
|
+
case 18:
|
|
373
|
+
setLoadingConnectableNodes(false);
|
|
344
374
|
return _context4.abrupt("return", ciNodes);
|
|
345
375
|
|
|
346
|
-
case
|
|
376
|
+
case 20:
|
|
347
377
|
case "end":
|
|
348
378
|
return _context4.stop();
|
|
349
379
|
}
|
|
350
380
|
}
|
|
351
|
-
}, _callee4);
|
|
381
|
+
}, _callee4, null, [[2, 15]]);
|
|
352
382
|
}));
|
|
353
383
|
|
|
354
384
|
return function getCiTypesConnectable() {
|
|
@@ -384,6 +414,7 @@ function AddLinkDrawer(props) {
|
|
|
384
414
|
|
|
385
415
|
var attrObject = node._attrObject;
|
|
386
416
|
return {
|
|
417
|
+
ciData: topo.dataModel.getDataById(attrObject.id),
|
|
387
418
|
id: attrObject.id,
|
|
388
419
|
name: attrObject.name,
|
|
389
420
|
ciId: attrObject.id,
|
|
@@ -636,7 +667,13 @@ function AddLinkDrawer(props) {
|
|
|
636
667
|
};
|
|
637
668
|
}();
|
|
638
669
|
|
|
639
|
-
return /*#__PURE__*/React.createElement(
|
|
670
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Loading, {
|
|
671
|
+
visible: loadingConnectableNodes,
|
|
672
|
+
fullScreen: true
|
|
673
|
+
}), /*#__PURE__*/React.createElement(_Loading, {
|
|
674
|
+
visible: loadingFormData,
|
|
675
|
+
fullScreen: true
|
|
676
|
+
}), /*#__PURE__*/React.createElement(_Drawer, {
|
|
640
677
|
closeMode: ["close", "esc"],
|
|
641
678
|
visible: addLinkIsOpen,
|
|
642
679
|
onClose: closeDrawer,
|
|
@@ -650,7 +687,7 @@ function AddLinkDrawer(props) {
|
|
|
650
687
|
onSave: onSave,
|
|
651
688
|
loading: loading,
|
|
652
689
|
isAdd: isAddMode
|
|
653
|
-
}));
|
|
690
|
+
})));
|
|
654
691
|
}
|
|
655
692
|
|
|
656
693
|
export default AddLinkDrawer;
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -23,6 +23,13 @@ import styles from "./index.module.scss";
|
|
|
23
23
|
function parseValues(values) {
|
|
24
24
|
return _extends({}, values);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* 两端都有编辑/删除权限才能创建物理和聚合链路。
|
|
28
|
+
* 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
|
|
29
|
+
* @param {*} props
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
|
|
26
33
|
|
|
27
34
|
export default function EditLinkInfo(props) {
|
|
28
35
|
var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
|
|
@@ -257,8 +264,10 @@ export default function EditLinkInfo(props) {
|
|
|
257
264
|
name: "network_link.destination_ipv4",
|
|
258
265
|
maxLength: 128
|
|
259
266
|
});
|
|
260
|
-
};
|
|
267
|
+
}; // 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
|
|
268
|
+
|
|
261
269
|
|
|
270
|
+
var disableCreatePhyAggLink = target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0 || !lineData.target || isAdd && !(lineData.target.ciData.permission.writeable || lineData.target.ciData.permission.deleteable);
|
|
262
271
|
return /*#__PURE__*/React.createElement("div", {
|
|
263
272
|
className: styles.editForm
|
|
264
273
|
}, /*#__PURE__*/React.createElement(_Form, {
|
|
@@ -378,7 +387,7 @@ export default function EditLinkInfo(props) {
|
|
|
378
387
|
}, /*#__PURE__*/React.createElement(_Radio, {
|
|
379
388
|
id: "phy",
|
|
380
389
|
value: "phy",
|
|
381
|
-
disabled:
|
|
390
|
+
disabled: disableCreatePhyAggLink
|
|
382
391
|
}, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
|
|
383
392
|
id: "exit",
|
|
384
393
|
value: "exit"
|
package/es/utils/clusterUtil.js
CHANGED
|
@@ -82,7 +82,7 @@ export function handleClusterNoPermission(topo) {
|
|
|
82
82
|
var dm = topo.getHtTopo().getGraphView().dm();
|
|
83
83
|
var groups = getGroups(dm);
|
|
84
84
|
groups.forEach(function (group) {
|
|
85
|
-
if (isClusterHtElement(group) && !group.a('operation')) {
|
|
85
|
+
if (isClusterHtElement(group) && !group.a('operation') && group.isExpanded()) {
|
|
86
86
|
group.setExpanded(false);
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -50,7 +50,7 @@ var _topoFactory = _interopRequireDefault(require("./topoFactory"));
|
|
|
50
50
|
var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTagTipConfig"));
|
|
51
51
|
|
|
52
52
|
// eslint-disable-next-line no-undef
|
|
53
|
-
var version = typeof "4.0.
|
|
53
|
+
var version = typeof "4.0.4" === 'string' ? "4.0.4" : null;
|
|
54
54
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
55
55
|
/**
|
|
56
56
|
* 拓扑显示和编辑
|
package/lib/hooks/useTopoEdit.js
CHANGED
|
@@ -901,7 +901,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
901
901
|
|
|
902
902
|
var bindNodeResource = /*#__PURE__*/function () {
|
|
903
903
|
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(params) {
|
|
904
|
-
var id, oldResId, newResId, node,
|
|
904
|
+
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm, replaceOrAddRes;
|
|
905
905
|
|
|
906
906
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
907
907
|
while (1) {
|
|
@@ -921,15 +921,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
921
921
|
|
|
922
922
|
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
|
923
923
|
|
|
924
|
-
|
|
924
|
+
parentGroupElement = node.getParent();
|
|
925
925
|
htTopo = topo.getHtTopo();
|
|
926
926
|
config = resourceConfig.getConfig();
|
|
927
927
|
|
|
928
|
-
if (
|
|
928
|
+
if (parentGroupElement) {
|
|
929
929
|
// 在容器中
|
|
930
|
-
groupId =
|
|
930
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
|
931
931
|
|
|
932
|
-
groupTag =
|
|
932
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
|
933
933
|
|
|
934
934
|
config.groups = config.groups.map(function (g) {
|
|
935
935
|
// 匹配到容器,替换资源或增加
|
|
@@ -961,19 +961,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
961
961
|
return item.id === newResId;
|
|
962
962
|
});
|
|
963
963
|
|
|
964
|
-
if (newData
|
|
965
|
-
|
|
966
|
-
} else {
|
|
967
|
-
newNodeElements = [newData];
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
newLinkElements = findUNExistedLinkElements(elements); // 过滤出关联的节点和连线,通知ht更新
|
|
971
|
-
// const newDatas = filterElementsByNodeId(elements, newResId);
|
|
972
|
-
|
|
973
|
-
newDatas = [].concat(newNodeElements, newLinkElements);
|
|
974
|
-
|
|
975
|
-
if (newDatas.length) {
|
|
976
|
-
_context8.next = 22;
|
|
964
|
+
if (newData) {
|
|
965
|
+
_context8.next = 19;
|
|
977
966
|
break;
|
|
978
967
|
}
|
|
979
968
|
|
|
@@ -983,27 +972,58 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
983
972
|
|
|
984
973
|
return _context8.abrupt("return", false);
|
|
985
974
|
|
|
986
|
-
case
|
|
987
|
-
|
|
988
|
-
groups: newDatas.filter(function (item) {
|
|
989
|
-
return item.type === 'group';
|
|
990
|
-
}),
|
|
991
|
-
nodes: newDatas.filter(function (item) {
|
|
992
|
-
return item.type === 'node';
|
|
993
|
-
}),
|
|
994
|
-
links: newDatas.filter(function (item) {
|
|
995
|
-
return item.type === 'link';
|
|
996
|
-
}),
|
|
997
|
-
linkGroups: newDatas.filter(function (item) {
|
|
998
|
-
return item.type === 'linkGroup';
|
|
999
|
-
})
|
|
1000
|
-
};
|
|
975
|
+
case 19:
|
|
976
|
+
dm = htTopo.getGraphView().dm(); // 创建
|
|
1001
977
|
|
|
1002
|
-
|
|
978
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
|
979
|
+
createElementsData = null;
|
|
980
|
+
|
|
981
|
+
if (newData.type === 'group') {
|
|
982
|
+
groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
|
|
983
|
+
newGroupChildren = [];
|
|
984
|
+
existedGroupChildren = [];
|
|
985
|
+
groupChildren.forEach(function (groupChildData) {
|
|
986
|
+
var ele = dm.getDataByTag(groupChildData.id);
|
|
987
|
+
|
|
988
|
+
if (ele) {
|
|
989
|
+
existedGroupChildren.push(groupChildData);
|
|
990
|
+
} else {
|
|
991
|
+
newGroupChildren.push(groupChildData);
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
createElementsData = {
|
|
995
|
+
groups: [newData],
|
|
996
|
+
nodes: newGroupChildren,
|
|
997
|
+
links: newLinkElements.filter(function (item) {
|
|
998
|
+
return item.type === 'link';
|
|
999
|
+
}),
|
|
1000
|
+
linkGroups: newLinkElements.filter(function (item) {
|
|
1001
|
+
return item.type === 'linkGroup';
|
|
1002
|
+
})
|
|
1003
|
+
};
|
|
1004
|
+
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
|
1005
|
+
|
|
1006
|
+
groupElement = dm.getDataByTag(newData.id);
|
|
1007
|
+
existedGroupChildren.forEach(function (groupChildData) {
|
|
1008
|
+
var nodeElement = dm.getDataByTag(groupChildData.id);
|
|
1009
|
+
nodeElement.setParent(groupElement);
|
|
1010
|
+
});
|
|
1011
|
+
} else {
|
|
1012
|
+
createElementsData = {
|
|
1013
|
+
groups: [],
|
|
1014
|
+
nodes: [newData],
|
|
1015
|
+
links: newLinkElements.filter(function (item) {
|
|
1016
|
+
return item.type === 'link';
|
|
1017
|
+
}),
|
|
1018
|
+
linkGroups: newLinkElements.filter(function (item) {
|
|
1019
|
+
return item.type === 'linkGroup';
|
|
1020
|
+
})
|
|
1021
|
+
};
|
|
1022
|
+
htTopo.createElements(createElementsData);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
_rlog["default"].debug('批量创建元素', createElementsData); // 恢复图标、大小、位置
|
|
1003
1026
|
|
|
1004
|
-
htTopo.createElements(createElementsData);
|
|
1005
|
-
sm = htTopo.getGraphView().sm();
|
|
1006
|
-
dm = htTopo.getGraphView().dm(); // 恢复图标、大小、位置
|
|
1007
1027
|
|
|
1008
1028
|
newElement = dm.getDataByTag(newData.id);
|
|
1009
1029
|
|
|
@@ -1011,24 +1031,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1011
1031
|
newElement.setSize(node.getSize());
|
|
1012
1032
|
newElement.setPosition(node.getPosition());
|
|
1013
1033
|
newElement.setImage(node.getImage());
|
|
1014
|
-
}
|
|
1034
|
+
} // 选中
|
|
1035
|
+
|
|
1015
1036
|
|
|
1037
|
+
sm = htTopo.getGraphView().sm();
|
|
1016
1038
|
sm.setSelection([newElement]); // 移除旧节点
|
|
1017
1039
|
|
|
1018
1040
|
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
|
1019
1041
|
// node.a("customName", null);
|
|
1020
1042
|
// 删除关联在节点上的出口链路
|
|
1021
1043
|
|
|
1022
|
-
_context8.next =
|
|
1044
|
+
_context8.next = 31;
|
|
1023
1045
|
return deleteExLink(node);
|
|
1024
1046
|
|
|
1025
|
-
case
|
|
1047
|
+
case 31:
|
|
1026
1048
|
// 临时放这里,仅拓扑中心有
|
|
1027
1049
|
if (topo.linkDynamicStyleExecutor) {
|
|
1028
1050
|
topo.linkDynamicStyleExecutor.execute();
|
|
1029
1051
|
}
|
|
1030
1052
|
|
|
1031
|
-
case
|
|
1053
|
+
case 32:
|
|
1032
1054
|
case "end":
|
|
1033
1055
|
return _context8.stop();
|
|
1034
1056
|
}
|