@riil-frontend/component-topology 3.3.0 → 3.5.0-a.1
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.js +17 -17
- package/es/components/MultiResourceDrawer/index.js +2 -2
- package/es/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +9 -0
- package/es/components/NetworkTopoResourceSelectDrawer/index.js +2 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +9 -6
- package/es/components/SingleResourceDrawer/SelectDrawer.js +1 -1
- package/es/constants/ResourceTypeLimit.js +38 -1
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +29 -16
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
- package/es/core/editor/components/settings/propertyViews/index.js +1 -5
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +2 -1
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +29 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +15 -16
- package/es/hooks/useTopoEdit.js +0 -5
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +12 -10
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +19 -15
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/es/topoCenter/services/link.js +22 -14
- package/es/topoCenter/store/topoTreeMod.js +6 -19
- package/es/topoCenter/utils/linPermissionUtil.js +3 -4
- package/lib/components/MultiResourceDrawer/index.js +2 -2
- package/lib/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +20 -0
- package/lib/components/NetworkTopoResourceSelectDrawer/index.js +11 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +10 -5
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +2 -2
- package/lib/constants/ResourceTypeLimit.js +53 -2
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +30 -15
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
- package/lib/core/editor/components/settings/propertyViews/index.js +1 -5
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +3 -2
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +32 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +13 -14
- package/lib/hooks/useTopoEdit.js +0 -5
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +16 -12
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +17 -16
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/lib/topoCenter/services/link.js +22 -14
- package/lib/topoCenter/store/topoTreeMod.js +7 -20
- package/lib/topoCenter/utils/linPermissionUtil.js +3 -4
- package/package.json +3 -3
|
@@ -23,6 +23,10 @@ function AddLinkDrawer(props) {
|
|
|
23
23
|
lineData = props.lineData;
|
|
24
24
|
var store = topo.store;
|
|
25
25
|
|
|
26
|
+
var _topo$store$useModel = topo.store.useModel("topoMod"),
|
|
27
|
+
topoState = _topo$store$useModel[0],
|
|
28
|
+
topoDispatchers = _topo$store$useModel[1];
|
|
29
|
+
|
|
26
30
|
var _store$useModel = store.useModel("topoConfig"),
|
|
27
31
|
editState = _store$useModel[0],
|
|
28
32
|
editDispatchers = _store$useModel[1];
|
|
@@ -33,8 +37,6 @@ function AddLinkDrawer(props) {
|
|
|
33
37
|
|
|
34
38
|
var addLinkIsOpen = editState.addLinkIsOpen,
|
|
35
39
|
currentLink = editState.currentLink;
|
|
36
|
-
var ciConnectable = linkState.ciConnectable; // // rlog.debug("addLinkDrawer--init-addLinkIsOpen", addLinkIsOpen, currentLink);
|
|
37
|
-
// const [visible, { setTrue, setFalse }] = useBoolean();
|
|
38
40
|
|
|
39
41
|
var _useState = useState(),
|
|
40
42
|
link = _useState[0],
|
|
@@ -46,12 +48,16 @@ function AddLinkDrawer(props) {
|
|
|
46
48
|
|
|
47
49
|
var _useState3 = useState(false),
|
|
48
50
|
loading = _useState3[0],
|
|
49
|
-
setLoading = _useState3[1];
|
|
51
|
+
setLoading = _useState3[1];
|
|
52
|
+
|
|
53
|
+
var _useState4 = useState(),
|
|
54
|
+
sourceIFDoc = _useState4[0],
|
|
55
|
+
setSourceIFDoc = _useState4[1]; // 保存后更新拓扑图状态
|
|
50
56
|
|
|
51
57
|
|
|
52
|
-
var
|
|
53
|
-
ciIdsConnectable =
|
|
54
|
-
setCiIdsConnectable =
|
|
58
|
+
var _useState5 = useState([]),
|
|
59
|
+
ciIdsConnectable = _useState5[0],
|
|
60
|
+
setCiIdsConnectable = _useState5[1];
|
|
55
61
|
|
|
56
62
|
var linkNodesRef = useRef();
|
|
57
63
|
|
|
@@ -193,6 +199,7 @@ function AddLinkDrawer(props) {
|
|
|
193
199
|
|
|
194
200
|
case 6:
|
|
195
201
|
targetPorts = _context3.sent;
|
|
202
|
+
setSourceIFDoc(sourcePorts.portsDoc);
|
|
196
203
|
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
197
204
|
setLink({
|
|
198
205
|
source: {
|
|
@@ -220,7 +227,7 @@ function AddLinkDrawer(props) {
|
|
|
220
227
|
})
|
|
221
228
|
});
|
|
222
229
|
|
|
223
|
-
case
|
|
230
|
+
case 10:
|
|
224
231
|
case "end":
|
|
225
232
|
return _context3.stop();
|
|
226
233
|
}
|
|
@@ -243,23 +250,17 @@ function AddLinkDrawer(props) {
|
|
|
243
250
|
|
|
244
251
|
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
245
252
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
246
|
-
var
|
|
253
|
+
var ciTypesConnectable, nodes, ciIds, ciNodes;
|
|
247
254
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
248
255
|
while (1) {
|
|
249
256
|
switch (_context4.prev = _context4.next) {
|
|
250
257
|
case 0:
|
|
251
|
-
|
|
252
|
-
// 加载哪些ci类型可创建链路
|
|
253
|
-
|
|
254
|
-
_context4.next = 3;
|
|
258
|
+
_context4.next = 2;
|
|
255
259
|
return topoService.networkLink.getCiTypesConnectable(RESOURCE_LIMIT_TYPES);
|
|
256
260
|
|
|
257
|
-
case
|
|
261
|
+
case 2:
|
|
258
262
|
ciTypesConnectable = _context4.sent;
|
|
259
|
-
nodes = getNodes(topo.getDataModel());
|
|
260
|
-
// const tags = topo.getTag();
|
|
261
|
-
// rlog.debug("加载哪些ci类型可创建链路", ciTypesConnectable, topo, nodes);
|
|
262
|
-
|
|
263
|
+
nodes = getNodes(topo.getDataModel());
|
|
263
264
|
ciIds = [];
|
|
264
265
|
ciNodes = [];
|
|
265
266
|
nodes.map(function (node) {
|
|
@@ -275,7 +276,7 @@ function AddLinkDrawer(props) {
|
|
|
275
276
|
setCiIdsConnectable(ciIds);
|
|
276
277
|
return _context4.abrupt("return", ciNodes);
|
|
277
278
|
|
|
278
|
-
case
|
|
279
|
+
case 10:
|
|
279
280
|
case "end":
|
|
280
281
|
return _context4.stop();
|
|
281
282
|
}
|
|
@@ -342,15 +343,7 @@ function AddLinkDrawer(props) {
|
|
|
342
343
|
var htTopo = topo.getHtTopo();
|
|
343
344
|
var _linkNodesRef$current = linkNodesRef.current,
|
|
344
345
|
source = _linkNodesRef$current.source,
|
|
345
|
-
target = _linkNodesRef$current.target;
|
|
346
|
-
// "addLinkToGraph",
|
|
347
|
-
// source,
|
|
348
|
-
// source.getTag(),
|
|
349
|
-
// target,
|
|
350
|
-
// target.getTag(),
|
|
351
|
-
// linkData,
|
|
352
|
-
// htTopo
|
|
353
|
-
// );
|
|
346
|
+
target = _linkNodesRef$current.target;
|
|
354
347
|
|
|
355
348
|
try {
|
|
356
349
|
// 获取两个节点间的连线数据列表
|
|
@@ -375,10 +368,7 @@ function AddLinkDrawer(props) {
|
|
|
375
368
|
// rlog.debug("addLinkToGraph-exit-target", target, target.getTag());
|
|
376
369
|
target.a("name", targetName);
|
|
377
370
|
}
|
|
378
|
-
}
|
|
379
|
-
//console.log("选中", topo.getDataModel().getDataByTag(linkData.id));
|
|
380
|
-
// TODO 选中
|
|
381
|
-
|
|
371
|
+
}
|
|
382
372
|
|
|
383
373
|
topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
|
|
384
374
|
} catch (error) {
|
|
@@ -386,16 +376,43 @@ function AddLinkDrawer(props) {
|
|
|
386
376
|
}
|
|
387
377
|
};
|
|
388
378
|
|
|
379
|
+
var mergeExitLinkData = function mergeExitLinkData(data, attributes) {
|
|
380
|
+
return {
|
|
381
|
+
id: data.id,
|
|
382
|
+
name: data.name,
|
|
383
|
+
source: data["network_link.source_device_id"],
|
|
384
|
+
target: data["network_link.destination_device_id"],
|
|
385
|
+
operation: data.operation,
|
|
386
|
+
interfaceSource: data["source_id"],
|
|
387
|
+
interfaceTarget: data["destination_id"],
|
|
388
|
+
ciType: data.ciType,
|
|
389
|
+
attributes: _extends({}, attributes, {
|
|
390
|
+
display_name: data.display_name,
|
|
391
|
+
name: data.name,
|
|
392
|
+
"network_link.actual_bandwidth": data["network_link.actual_bandwidth"],
|
|
393
|
+
"network_link.connect_type": data["network_link.connect_type"],
|
|
394
|
+
"network_link.destination_ipv4": data["network_link.destination_ipv4"],
|
|
395
|
+
"network_link.source_device_id": data["network_link.source_device_id"],
|
|
396
|
+
source_id: data.source_id,
|
|
397
|
+
support_templates: data.support_templates,
|
|
398
|
+
use: data.use,
|
|
399
|
+
source_id_object: {
|
|
400
|
+
displayName: sourceIFDoc[data.source_id].label
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
|
|
389
406
|
var onSave = /*#__PURE__*/function () {
|
|
390
407
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
391
|
-
var parm, result, config, exportLinkIdList, _yield$editDispatcher, elements, linkData,
|
|
408
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
|
|
392
409
|
|
|
393
410
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
394
411
|
while (1) {
|
|
395
412
|
switch (_context5.prev = _context5.next) {
|
|
396
413
|
case 0:
|
|
397
414
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
398
|
-
// rlog.debug("保存链路信息", data);
|
|
415
|
+
// rlog.debug("保存链路信息", isAddMode, data);
|
|
399
416
|
setLoading(true);
|
|
400
417
|
parm = {
|
|
401
418
|
attributes: data
|
|
@@ -424,23 +441,19 @@ function AddLinkDrawer(props) {
|
|
|
424
441
|
result = _context5.sent;
|
|
425
442
|
|
|
426
443
|
case 13:
|
|
427
|
-
setLoading(false);
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
_context5.prev = 14;
|
|
444
|
+
setLoading(false);
|
|
445
|
+
linkType = data["network_link.connect_type"];
|
|
446
|
+
_context5.prev = 15;
|
|
432
447
|
|
|
433
448
|
if (!result) {
|
|
434
|
-
_context5.next =
|
|
449
|
+
_context5.next = 35;
|
|
435
450
|
break;
|
|
436
451
|
}
|
|
437
452
|
|
|
438
|
-
config = topo.resourceConfig.getConfigFromHt(); //
|
|
439
|
-
|
|
440
|
-
console.log("save success", data, result); // 新建后显示到图上
|
|
453
|
+
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
441
454
|
|
|
442
455
|
if (!isAddMode) {
|
|
443
|
-
_context5.next =
|
|
456
|
+
_context5.next = 31;
|
|
444
457
|
break;
|
|
445
458
|
}
|
|
446
459
|
|
|
@@ -452,7 +465,8 @@ function AddLinkDrawer(props) {
|
|
|
452
465
|
|
|
453
466
|
topo.resourceConfig.updateConfig(_extends({}, config, {
|
|
454
467
|
exportLinkIdList: exportLinkIdList
|
|
455
|
-
}));
|
|
468
|
+
})); // const linkType = data["network_link.connect_type"];
|
|
469
|
+
|
|
456
470
|
_context5.next = 24;
|
|
457
471
|
return editDispatchers.fetchDataByConfig();
|
|
458
472
|
|
|
@@ -462,46 +476,67 @@ function AddLinkDrawer(props) {
|
|
|
462
476
|
linkData = elements.find(function (element) {
|
|
463
477
|
return element.id === result;
|
|
464
478
|
});
|
|
465
|
-
linkType = data["network_link.connect_type"];
|
|
466
479
|
addLinkToGraph({
|
|
467
480
|
linkData: clone(linkData),
|
|
468
481
|
linkType: linkType,
|
|
469
482
|
targetName: data["network_link.destination_ipv4"]
|
|
470
483
|
});
|
|
471
484
|
|
|
472
|
-
if (data["network_link.connect_type"] === "exit") {
|
|
473
|
-
console.log("save success--- data, elements", data, elements);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
485
|
_Message.success("创建成功");
|
|
477
486
|
|
|
478
|
-
_context5.next =
|
|
487
|
+
_context5.next = 33;
|
|
479
488
|
break;
|
|
480
489
|
|
|
481
|
-
case
|
|
490
|
+
case 31:
|
|
491
|
+
// console.log("保存编辑信息", data, linkType);
|
|
492
|
+
if (linkType === "exit") {
|
|
493
|
+
edge = topo.getGraphView().dm().sm().ld();
|
|
494
|
+
aobj = edge.getAttrObject();
|
|
495
|
+
edge.setAttrObject(_extends({}, aobj, data));
|
|
496
|
+
target = edge.getTarget();
|
|
497
|
+
|
|
498
|
+
if (target.getTag() === undefined) {
|
|
499
|
+
target.a("name", data["network_link.destination_ipv4"]);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
links = topoState.data.links;
|
|
503
|
+
linkAttrKey = links.findIndex(function (item) {
|
|
504
|
+
return item.id === aobj.id;
|
|
505
|
+
});
|
|
506
|
+
newLinkData = mergeExitLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
507
|
+
newLinks = clone(links);
|
|
508
|
+
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
509
|
+
newData = _extends({}, topoState.data, {
|
|
510
|
+
links: newLinks
|
|
511
|
+
});
|
|
512
|
+
topoDispatchers.update({
|
|
513
|
+
data: newData
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
482
517
|
_Message.success("保存成功");
|
|
483
518
|
|
|
484
|
-
case
|
|
519
|
+
case 33:
|
|
485
520
|
editDispatchers.update({
|
|
486
521
|
addLinkIsOpen: false,
|
|
487
522
|
currentLink: null
|
|
488
523
|
});
|
|
489
524
|
topo.linkDynamicStyleExecutor.execute();
|
|
490
525
|
|
|
491
|
-
case
|
|
492
|
-
_context5.next =
|
|
526
|
+
case 35:
|
|
527
|
+
_context5.next = 39;
|
|
493
528
|
break;
|
|
494
529
|
|
|
495
|
-
case
|
|
496
|
-
_context5.prev =
|
|
497
|
-
_context5.t0 = _context5["catch"](
|
|
530
|
+
case 37:
|
|
531
|
+
_context5.prev = 37;
|
|
532
|
+
_context5.t0 = _context5["catch"](15);
|
|
498
533
|
|
|
499
|
-
case
|
|
534
|
+
case 39:
|
|
500
535
|
case "end":
|
|
501
536
|
return _context5.stop();
|
|
502
537
|
}
|
|
503
538
|
}
|
|
504
|
-
}, _callee5, null, [[
|
|
539
|
+
}, _callee5, null, [[15, 37]]);
|
|
505
540
|
}));
|
|
506
541
|
|
|
507
542
|
return function onSave(_x3) {
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -63,8 +63,8 @@ export default function EditLinkInfo(props) {
|
|
|
63
63
|
setConnectEnable = _useState4[1];
|
|
64
64
|
|
|
65
65
|
var fieldOnChange = function fieldOnChange(name, value) {
|
|
66
|
-
var newValues = field.getValues();
|
|
67
|
-
|
|
66
|
+
var newValues = field.getValues(); // rlog.debug("Field-onChange", newValues, name, value);
|
|
67
|
+
|
|
68
68
|
setValus(newValues);
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -111,7 +111,6 @@ export default function EditLinkInfo(props) {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
var connectHandleChange = function connectHandleChange(v) {
|
|
114
|
-
console.log("connectHandleChange", v);
|
|
115
114
|
field.setValue("connect_type", v);
|
|
116
115
|
};
|
|
117
116
|
|
|
@@ -129,9 +128,9 @@ export default function EditLinkInfo(props) {
|
|
|
129
128
|
actualBandwidth = Math.min(sourceRb, targetRb);
|
|
130
129
|
} else {
|
|
131
130
|
actualBandwidth = sourceRb || targetRb;
|
|
132
|
-
}
|
|
131
|
+
} // rlog.debug("network_link.actual_bandwidth", actualBandwidth);
|
|
132
|
+
|
|
133
133
|
|
|
134
|
-
rlog.debug("network_link.actual_bandwidth", actualBandwidth);
|
|
135
134
|
field.setValue("network_link.actual_bandwidth", actualBandwidth);
|
|
136
135
|
};
|
|
137
136
|
|
|
@@ -140,14 +139,15 @@ export default function EditLinkInfo(props) {
|
|
|
140
139
|
if (errors) {
|
|
141
140
|
rlog.debug("saveHandleChange-error", errors, values);
|
|
142
141
|
} else {
|
|
143
|
-
var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4,
|
|
142
|
+
var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _targetValue$ipAddres, _sourceValue$ipAddres, _targetValue$id;
|
|
144
143
|
|
|
145
144
|
rlog.debug("saveHandleChange", valus, source, target);
|
|
146
145
|
var sourceId = valus["source_id"];
|
|
147
146
|
var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
|
|
148
147
|
var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
|
|
149
148
|
var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
|
|
150
|
-
var typeJudge = linkTypeJudge(sourceType, destinationType, valus["connect_type"]);
|
|
149
|
+
var typeJudge = linkTypeJudge(sourceType, destinationType, valus["network_link.connect_type"]);
|
|
150
|
+
var destination_ipv4 = valus["network_link.connect_type"] !== "exit" ? (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"] : valus["network_link.destination_ipv4"];
|
|
151
151
|
var obj = {
|
|
152
152
|
display_name: valus["display_name"],
|
|
153
153
|
// 链路名称
|
|
@@ -155,7 +155,7 @@ export default function EditLinkInfo(props) {
|
|
|
155
155
|
// 链路名称
|
|
156
156
|
"network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
|
|
157
157
|
// 源IP
|
|
158
|
-
"network_link.destination_ipv4":
|
|
158
|
+
"network_link.destination_ipv4": destination_ipv4,
|
|
159
159
|
// 目的IP
|
|
160
160
|
// source_id, // 源端口
|
|
161
161
|
// destination_id, // 目的端口
|
|
@@ -224,6 +224,16 @@ export default function EditLinkInfo(props) {
|
|
|
224
224
|
});
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
+
var targetIpComp = function targetIpComp(targetValue) {
|
|
228
|
+
return targetValue.ipAddress && targetValue.ciType !== "customNode" ? /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: styles.label
|
|
230
|
+
}, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
231
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
232
|
+
name: "network_link.destination_ipv4",
|
|
233
|
+
maxLength: 128
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
|
|
227
237
|
return /*#__PURE__*/React.createElement("div", {
|
|
228
238
|
className: styles.editForm
|
|
229
239
|
}, /*#__PURE__*/React.createElement(_Form, {
|
|
@@ -262,13 +272,7 @@ export default function EditLinkInfo(props) {
|
|
|
262
272
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
263
273
|
labelAlign: labelAlign,
|
|
264
274
|
label: "\u76EE\u7684\u8282\u70B9IP"
|
|
265
|
-
}),
|
|
266
|
-
className: styles.label
|
|
267
|
-
}, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
268
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
269
|
-
name: "network_link.destination_ipv4",
|
|
270
|
-
maxLength: 128
|
|
271
|
-
})))), /*#__PURE__*/React.createElement(Row, {
|
|
275
|
+
}), targetIpComp(target)))), /*#__PURE__*/React.createElement(Row, {
|
|
272
276
|
gutter: "16"
|
|
273
277
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
274
278
|
span: "12"
|
|
@@ -146,41 +146,49 @@ export default {
|
|
|
146
146
|
*
|
|
147
147
|
* @param {array} ciIds
|
|
148
148
|
*/
|
|
149
|
-
queryAssociatedlinks: function queryAssociatedlinks(ids) {
|
|
149
|
+
queryAssociatedlinks: function queryAssociatedlinks(ids, type) {
|
|
150
150
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
151
|
-
var
|
|
151
|
+
var stag, ttag, condition, parm, jsonParm, result;
|
|
152
152
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
153
153
|
while (1) {
|
|
154
154
|
switch (_context5.prev = _context5.next) {
|
|
155
155
|
case 0:
|
|
156
|
-
idtxt =
|
|
156
|
+
// const idtxt = `'${ids[0]}','${ids[1]}'`;
|
|
157
|
+
stag = ids[0];
|
|
158
|
+
ttag = ids[1];
|
|
159
|
+
condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "'";
|
|
160
|
+
|
|
161
|
+
if (ttag) {
|
|
162
|
+
condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "' && network_link.destination_device_id='" + ttag + "'";
|
|
163
|
+
}
|
|
164
|
+
|
|
157
165
|
parm = {
|
|
158
|
-
condition:
|
|
166
|
+
condition: condition,
|
|
159
167
|
sort: "name asc",
|
|
160
168
|
currentPage: 1,
|
|
161
|
-
pageSize:
|
|
169
|
+
pageSize: 99
|
|
162
170
|
};
|
|
163
171
|
jsonParm = JSON.stringify(parm);
|
|
164
|
-
console.log("queryAssociatedlinks", ids,
|
|
165
|
-
_context5.prev =
|
|
166
|
-
_context5.next =
|
|
172
|
+
console.log("queryAssociatedlinks", ids, parm, jsonParm);
|
|
173
|
+
_context5.prev = 7;
|
|
174
|
+
_context5.next = 10;
|
|
167
175
|
return getRequest().post("/mdc/v1/api/cmdb/commonQueryCiData", jsonParm);
|
|
168
176
|
|
|
169
|
-
case
|
|
177
|
+
case 10:
|
|
170
178
|
result = _context5.sent;
|
|
171
179
|
return _context5.abrupt("return", result);
|
|
172
180
|
|
|
173
|
-
case
|
|
174
|
-
_context5.prev =
|
|
175
|
-
_context5.t0 = _context5["catch"](
|
|
181
|
+
case 14:
|
|
182
|
+
_context5.prev = 14;
|
|
183
|
+
_context5.t0 = _context5["catch"](7);
|
|
176
184
|
rlog.error("查询可关联链路", _context5.t0);
|
|
177
185
|
|
|
178
|
-
case
|
|
186
|
+
case 17:
|
|
179
187
|
case "end":
|
|
180
188
|
return _context5.stop();
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
|
-
}, _callee5, null, [[
|
|
191
|
+
}, _callee5, null, [[7, 14]]);
|
|
184
192
|
}))();
|
|
185
193
|
}
|
|
186
194
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _Message from "@alifd/next/es/message";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
6
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
|
-
import { treeMockData, topoInteData } from "../../utils/topoMocks";
|
|
7
7
|
import { formatTree, loopTree, loopTreeFun, findParentIdsById, treeNodeCount } from "../../utils/tree";
|
|
8
8
|
|
|
9
9
|
var clone = function clone(data) {
|
|
@@ -20,7 +20,6 @@ export default function (topoApp) {
|
|
|
20
20
|
treeData: [],
|
|
21
21
|
// 是否加载数据
|
|
22
22
|
loaded: false,
|
|
23
|
-
topoInteData: topoInteData,
|
|
24
23
|
selectedNode: [],
|
|
25
24
|
defId: '',
|
|
26
25
|
drawVisible: false,
|
|
@@ -263,25 +262,13 @@ export default function (topoApp) {
|
|
|
263
262
|
|
|
264
263
|
case 4:
|
|
265
264
|
resTreeData = _context5.sent;
|
|
265
|
+
_context5.next = 7;
|
|
266
|
+
return _this4.refreshTree();
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
// treeData,
|
|
270
|
-
// conditions,
|
|
271
|
-
// (parent, index, arr) => {
|
|
272
|
-
// arr[index].showDefault = true;
|
|
273
|
-
// }
|
|
274
|
-
// );
|
|
275
|
-
//
|
|
276
|
-
// treeData = formatTree(treeData, state.functionAuth.permissions);
|
|
277
|
-
//
|
|
278
|
-
// this.update({
|
|
279
|
-
// treeData,
|
|
280
|
-
// defId: conditions,
|
|
281
|
-
// });
|
|
282
|
-
|
|
268
|
+
case 7:
|
|
269
|
+
_Message.success('设置成功');
|
|
283
270
|
|
|
284
|
-
case
|
|
271
|
+
case 8:
|
|
285
272
|
case "end":
|
|
286
273
|
return _context5.stop();
|
|
287
274
|
}
|
|
@@ -18,14 +18,13 @@ var isWriteable = function isWriteable(link, source, target, linkType) {
|
|
|
18
18
|
|
|
19
19
|
export function getLinkPermission(edge, nodes, link) {
|
|
20
20
|
var source = nodes.find(function (node) {
|
|
21
|
-
return node.id === edge.
|
|
21
|
+
return node.id === edge.getSource().getTag();
|
|
22
22
|
});
|
|
23
23
|
var target = nodes.find(function (node) {
|
|
24
|
-
return node.id === edge.
|
|
24
|
+
return node.id === edge.getTarget().getTag();
|
|
25
25
|
}); // console.log("getLinkPermission", edge, source, target, link);
|
|
26
26
|
|
|
27
|
-
var linkType = link.attributes["network_link.connect_type"]
|
|
28
|
-
|
|
27
|
+
var linkType = link ? link.attributes["network_link.connect_type"] : edge.a("network_link.connect_type");
|
|
29
28
|
return {
|
|
30
29
|
readable: (source === null || source === void 0 ? void 0 : source.operation) || (target === null || target === void 0 ? void 0 : target.operation),
|
|
31
30
|
writeable: isWriteable(edge, source, target, linkType),
|
|
@@ -11,7 +11,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _NetworkTopoResourceSelectDrawer = _interopRequireDefault(require("../NetworkTopoResourceSelectDrawer"));
|
|
15
15
|
|
|
16
16
|
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); }
|
|
17
17
|
|
|
@@ -56,7 +56,7 @@ var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
|
56
56
|
};
|
|
57
57
|
}();
|
|
58
58
|
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement(_NetworkTopoResourceSelectDrawer["default"], {
|
|
60
60
|
visible: visible,
|
|
61
61
|
getExcludeIds: getExcludeIds,
|
|
62
62
|
onOk: onDrawerSave,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = NetworkTopoResourceSelectDrawer;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ResourceTypeLimit = require("../../constants/ResourceTypeLimit");
|
|
13
|
+
|
|
14
|
+
var _ResourceSelectDrawer = _interopRequireDefault(require("../ResourceSelectDrawer/ResourceSelectDrawer"));
|
|
15
|
+
|
|
16
|
+
function NetworkTopoResourceSelectDrawer(props) {
|
|
17
|
+
return /*#__PURE__*/_react["default"].createElement(_ResourceSelectDrawer["default"], (0, _extends2["default"])({
|
|
18
|
+
commonResListProps: (0, _ResourceTypeLimit.getNetworkTopoCommonResListProps)()
|
|
19
|
+
}, props));
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _NetworkTopoResourceSelectDrawer = _interopRequireDefault(require("./NetworkTopoResourceSelectDrawer"));
|
|
9
|
+
|
|
10
|
+
var _default = _NetworkTopoResourceSelectDrawer["default"];
|
|
11
|
+
exports["default"] = _default;
|
|
@@ -32,12 +32,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
32
|
*/
|
|
33
33
|
function ResourceSelectDrawer(props) {
|
|
34
34
|
var visible = props.visible,
|
|
35
|
+
title = props.title,
|
|
35
36
|
selectionMode = props.selectionMode,
|
|
36
37
|
limitTypes = props.limitTypes,
|
|
37
38
|
excludeIds = props.excludeIds,
|
|
38
39
|
getExcludeIds = props.getExcludeIds,
|
|
39
40
|
onOk = props.onOk,
|
|
40
|
-
onClose = props.onClose
|
|
41
|
+
onClose = props.onClose,
|
|
42
|
+
commonResListProps = props.commonResListProps;
|
|
41
43
|
var resourceSelectRef = (0, _react.useRef)();
|
|
42
44
|
|
|
43
45
|
var _useState = (0, _react.useState)(false),
|
|
@@ -101,7 +103,7 @@ function ResourceSelectDrawer(props) {
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
return /*#__PURE__*/_react["default"].createElement(_Drawer["default"], {
|
|
104
|
-
title:
|
|
106
|
+
title: title,
|
|
105
107
|
visible: visible,
|
|
106
108
|
loading: loading,
|
|
107
109
|
onSave: handleOk,
|
|
@@ -115,12 +117,14 @@ function ResourceSelectDrawer(props) {
|
|
|
115
117
|
ref: resourceSelectRef,
|
|
116
118
|
selectionMode: selectionMode,
|
|
117
119
|
limitTypes: limitTypes,
|
|
118
|
-
excludeIds: finalExcludeIds
|
|
120
|
+
excludeIds: finalExcludeIds,
|
|
121
|
+
commonResListProps: commonResListProps
|
|
119
122
|
}));
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
ResourceSelectDrawer.propTypes = {
|
|
123
126
|
visible: _propTypes["default"].bool,
|
|
127
|
+
title: _propTypes["default"].string,
|
|
124
128
|
limitTypes: _propTypes["default"].array,
|
|
125
129
|
excludeIds: _propTypes["default"].array,
|
|
126
130
|
selectionMode: _propTypes["default"].any,
|
|
@@ -129,6 +133,7 @@ ResourceSelectDrawer.propTypes = {
|
|
|
129
133
|
};
|
|
130
134
|
ResourceSelectDrawer.defaultProps = {
|
|
131
135
|
visible: true,
|
|
136
|
+
title: '添加资源',
|
|
132
137
|
excludeIds: [],
|
|
133
138
|
onOk: function onOk() {},
|
|
134
139
|
onClose: function onClose() {}
|