@riil-frontend/component-topology 3.5.2 → 3.5.3
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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +12 -12
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +7 -3
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +82 -62
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +4 -5
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +8 -2
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +83 -64
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +4 -5
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.5.
|
|
23
|
+
var version = typeof "3.5.3" === 'string' ? "3.5.3" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { metricValueFormat } from '@riil-frontend/utils';
|
|
3
3
|
import NoDataPage from '@riil-frontend/component-no-data-page';
|
|
4
4
|
import styles from "./index.module.scss";
|
|
5
|
-
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import textStyles from "../../../../../../common/text.module.scss"; // 关键指标
|
|
7
|
+
|
|
6
8
|
export default function ResourceOverviewMetric(props) {
|
|
7
9
|
var topo = props.topo,
|
|
8
10
|
type = props.type,
|
|
@@ -30,7 +32,8 @@ export default function ResourceOverviewMetric(props) {
|
|
|
30
32
|
className: styles.item,
|
|
31
33
|
key: item.code
|
|
32
34
|
}, /*#__PURE__*/React.createElement("span", {
|
|
33
|
-
|
|
35
|
+
title: formatValue(item),
|
|
36
|
+
className: classNames(styles.content, textStyles.textEllipsis)
|
|
34
37
|
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
35
38
|
className: styles.label
|
|
36
39
|
}, item.name));
|
|
@@ -41,7 +44,8 @@ export default function ResourceOverviewMetric(props) {
|
|
|
41
44
|
className: styles.item,
|
|
42
45
|
key: item.code
|
|
43
46
|
}, /*#__PURE__*/React.createElement("span", {
|
|
44
|
-
|
|
47
|
+
title: formatValue(item),
|
|
48
|
+
className: classNames(styles.content, textStyles.textEllipsis)
|
|
45
49
|
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
46
50
|
className: styles.label
|
|
47
51
|
}, item.name));
|
|
@@ -66,7 +66,7 @@ function AddLinkDrawer(props) {
|
|
|
66
66
|
var linkNodesRef = useRef();
|
|
67
67
|
|
|
68
68
|
var getPortsById = /*#__PURE__*/function () {
|
|
69
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
69
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, currentLink) {
|
|
70
70
|
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
71
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
72
72
|
while (1) {
|
|
@@ -84,21 +84,24 @@ function AddLinkDrawer(props) {
|
|
|
84
84
|
links = _context.sent;
|
|
85
85
|
ifTypes = result.map(function (item) {
|
|
86
86
|
return item.type;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
_context.next =
|
|
87
|
+
}); // console.log("端口类型列表", ifTypes);
|
|
88
|
+
|
|
89
|
+
_context.next = 9;
|
|
90
90
|
return getInterfaceObject(ifTypes);
|
|
91
91
|
|
|
92
|
-
case
|
|
92
|
+
case 9:
|
|
93
93
|
ifDoc = _context.sent;
|
|
94
|
-
console.log("端口类型字典", ifDoc);
|
|
94
|
+
// console.log("端口类型字典", ifDoc);
|
|
95
95
|
usedPorts = [];
|
|
96
96
|
links.data.map(function (link) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
// console.log("getPortsById-去重", links, id);
|
|
98
|
+
if (link.id !== (currentLink === null || currentLink === void 0 ? void 0 : currentLink.id)) {
|
|
99
|
+
usedPorts.push(link.attributes.destination_id);
|
|
100
|
+
usedPorts.push(link.attributes.source_id);
|
|
101
|
+
}
|
|
99
102
|
});
|
|
100
|
-
usedPorts = _.uniq(usedPorts);
|
|
101
|
-
|
|
103
|
+
usedPorts = _.uniq(usedPorts); // rlog.debug("端口列表", result, links);
|
|
104
|
+
//const list = result[id];
|
|
102
105
|
|
|
103
106
|
portsDoc = {};
|
|
104
107
|
ports = result.map(function (item) {
|
|
@@ -120,7 +123,7 @@ function AddLinkDrawer(props) {
|
|
|
120
123
|
portsDoc: portsDoc
|
|
121
124
|
});
|
|
122
125
|
|
|
123
|
-
case
|
|
126
|
+
case 16:
|
|
124
127
|
case "end":
|
|
125
128
|
return _context.stop();
|
|
126
129
|
}
|
|
@@ -128,7 +131,7 @@ function AddLinkDrawer(props) {
|
|
|
128
131
|
}, _callee);
|
|
129
132
|
}));
|
|
130
133
|
|
|
131
|
-
return function getPortsById(_x) {
|
|
134
|
+
return function getPortsById(_x, _x2) {
|
|
132
135
|
return _ref.apply(this, arguments);
|
|
133
136
|
};
|
|
134
137
|
}();
|
|
@@ -199,7 +202,7 @@ function AddLinkDrawer(props) {
|
|
|
199
202
|
}, _callee2, null, [[3, 19]]);
|
|
200
203
|
}));
|
|
201
204
|
|
|
202
|
-
return function handleEvent(
|
|
205
|
+
return function handleEvent(_x3) {
|
|
203
206
|
return _ref2.apply(this, arguments);
|
|
204
207
|
};
|
|
205
208
|
}();
|
|
@@ -220,16 +223,15 @@ function AddLinkDrawer(props) {
|
|
|
220
223
|
while (1) {
|
|
221
224
|
switch (_context3.prev = _context3.next) {
|
|
222
225
|
case 0:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return getPortsById(currentLink.source);
|
|
226
|
+
_context3.next = 2;
|
|
227
|
+
return getPortsById(currentLink.source, currentLink);
|
|
226
228
|
|
|
227
|
-
case
|
|
229
|
+
case 2:
|
|
228
230
|
sourcePorts = _context3.sent;
|
|
229
|
-
_context3.next =
|
|
230
|
-
return getPortsById(currentLink.target);
|
|
231
|
+
_context3.next = 5;
|
|
232
|
+
return getPortsById(currentLink.target, currentLink);
|
|
231
233
|
|
|
232
|
-
case
|
|
234
|
+
case 5:
|
|
233
235
|
targetPorts = _context3.sent;
|
|
234
236
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
235
237
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
@@ -263,7 +265,7 @@ function AddLinkDrawer(props) {
|
|
|
263
265
|
})
|
|
264
266
|
});
|
|
265
267
|
|
|
266
|
-
case
|
|
268
|
+
case 10:
|
|
267
269
|
case "end":
|
|
268
270
|
return _context3.stop();
|
|
269
271
|
}
|
|
@@ -414,7 +416,9 @@ function AddLinkDrawer(props) {
|
|
|
414
416
|
};
|
|
415
417
|
|
|
416
418
|
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
417
|
-
|
|
419
|
+
var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
|
|
420
|
+
|
|
421
|
+
// console.log("mergeExportLinkData", data, attributes);
|
|
418
422
|
return _extends({}, attributes, {
|
|
419
423
|
id: data.id,
|
|
420
424
|
name: data.name,
|
|
@@ -435,10 +439,10 @@ function AddLinkDrawer(props) {
|
|
|
435
439
|
support_templates: data.support_templates,
|
|
436
440
|
use: data.use,
|
|
437
441
|
source_id_object: {
|
|
438
|
-
displayName: sourceIFDoc[data.source_id].label
|
|
442
|
+
displayName: (_sourceIFDoc$data$sou = sourceIFDoc[data.source_id]) === null || _sourceIFDoc$data$sou === void 0 ? void 0 : _sourceIFDoc$data$sou.label
|
|
439
443
|
},
|
|
440
444
|
destination_id_object: {
|
|
441
|
-
displayName: targetIFDoc[data.destination_id].label
|
|
445
|
+
displayName: (_targetIFDoc$data$des = targetIFDoc[data.destination_id]) === null || _targetIFDoc$data$des === void 0 ? void 0 : _targetIFDoc$data$des.label
|
|
442
446
|
}
|
|
443
447
|
})
|
|
444
448
|
});
|
|
@@ -446,14 +450,14 @@ function AddLinkDrawer(props) {
|
|
|
446
450
|
|
|
447
451
|
var onSave = /*#__PURE__*/function () {
|
|
448
452
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
449
|
-
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
|
|
453
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
|
|
450
454
|
|
|
451
455
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
452
456
|
while (1) {
|
|
453
457
|
switch (_context5.prev = _context5.next) {
|
|
454
458
|
case 0:
|
|
455
459
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
456
|
-
//
|
|
460
|
+
// console.log("保存链路信息", isAddMode, data);
|
|
457
461
|
setLoading(true);
|
|
458
462
|
parm = {
|
|
459
463
|
attributes: data
|
|
@@ -487,14 +491,14 @@ function AddLinkDrawer(props) {
|
|
|
487
491
|
_context5.prev = 15;
|
|
488
492
|
|
|
489
493
|
if (!result) {
|
|
490
|
-
_context5.next =
|
|
494
|
+
_context5.next = 55;
|
|
491
495
|
break;
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
495
499
|
|
|
496
500
|
if (!isAddMode) {
|
|
497
|
-
_context5.next =
|
|
501
|
+
_context5.next = 31;
|
|
498
502
|
break;
|
|
499
503
|
}
|
|
500
504
|
|
|
@@ -516,8 +520,8 @@ function AddLinkDrawer(props) {
|
|
|
516
520
|
elements = _yield$editDispatcher.elements;
|
|
517
521
|
linkData = elements.find(function (element) {
|
|
518
522
|
return element.id === result;
|
|
519
|
-
});
|
|
520
|
-
|
|
523
|
+
}); // console.log("创建成功-parm,linkData", parm, linkData);
|
|
524
|
+
|
|
521
525
|
addLinkToGraph({
|
|
522
526
|
linkData: clone(linkData),
|
|
523
527
|
linkType: linkType,
|
|
@@ -526,62 +530,78 @@ function AddLinkDrawer(props) {
|
|
|
526
530
|
|
|
527
531
|
_Message.success("创建成功");
|
|
528
532
|
|
|
529
|
-
_context5.next =
|
|
533
|
+
_context5.next = 53;
|
|
530
534
|
break;
|
|
531
535
|
|
|
532
|
-
case
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
edge.setAttrObject(_extends({}, aobj, data));
|
|
538
|
-
target = edge.getTarget();
|
|
536
|
+
case 31:
|
|
537
|
+
if (!(linkType === "exit")) {
|
|
538
|
+
_context5.next = 46;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
539
541
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
542
|
+
edge = topo.getGraphView().dm().sm().ld();
|
|
543
|
+
aobj = edge.getAttrObject();
|
|
544
|
+
edge.setAttrObject(_extends({}, aobj, data));
|
|
545
|
+
target = edge.getTarget();
|
|
543
546
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return item.id === aobj.id;
|
|
547
|
-
});
|
|
548
|
-
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
549
|
-
newLinks = clone(links);
|
|
550
|
-
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
551
|
-
newData = _extends({}, topoState.data, {
|
|
552
|
-
links: newLinks
|
|
553
|
-
});
|
|
554
|
-
topoDispatchers.update({
|
|
555
|
-
data: newData
|
|
556
|
-
});
|
|
547
|
+
if (target.getTag() === undefined) {
|
|
548
|
+
target.a("name", data["network_link.destination_ipv4"]);
|
|
557
549
|
}
|
|
558
550
|
|
|
551
|
+
links = topoState.data.links;
|
|
552
|
+
linkAttrKey = links.findIndex(function (item) {
|
|
553
|
+
return item.id === aobj.id;
|
|
554
|
+
});
|
|
555
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
556
|
+
newLinks = clone(links);
|
|
557
|
+
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
558
|
+
newData = _extends({}, topoState.data, {
|
|
559
|
+
links: newLinks
|
|
560
|
+
});
|
|
561
|
+
topoDispatchers.update({
|
|
562
|
+
data: newData
|
|
563
|
+
});
|
|
564
|
+
_context5.next = 52;
|
|
565
|
+
break;
|
|
566
|
+
|
|
567
|
+
case 46:
|
|
568
|
+
_config = topo.resourceConfig.getConfigFromHt();
|
|
569
|
+
topo.resourceConfig.updateConfig(_config);
|
|
570
|
+
_context5.next = 50;
|
|
571
|
+
return editDispatchers.fetchDataByConfig();
|
|
572
|
+
|
|
573
|
+
case 50:
|
|
574
|
+
_yield$editDispatcher2 = _context5.sent;
|
|
575
|
+
_elements = _yield$editDispatcher2.elements;
|
|
576
|
+
|
|
577
|
+
case 52:
|
|
559
578
|
_Message.success("保存成功");
|
|
560
579
|
|
|
561
|
-
case
|
|
580
|
+
case 53:
|
|
562
581
|
editDispatchers.update({
|
|
563
582
|
addLinkIsOpen: false,
|
|
564
583
|
currentLink: null
|
|
565
584
|
});
|
|
566
585
|
topo.linkDynamicStyleExecutor.execute();
|
|
567
586
|
|
|
568
|
-
case
|
|
569
|
-
_context5.next =
|
|
587
|
+
case 55:
|
|
588
|
+
_context5.next = 60;
|
|
570
589
|
break;
|
|
571
590
|
|
|
572
|
-
case
|
|
573
|
-
_context5.prev =
|
|
591
|
+
case 57:
|
|
592
|
+
_context5.prev = 57;
|
|
574
593
|
_context5.t0 = _context5["catch"](15);
|
|
594
|
+
rlog.debug("保存链路信息异常", _context5.t0);
|
|
575
595
|
|
|
576
|
-
case
|
|
596
|
+
case 60:
|
|
577
597
|
case "end":
|
|
578
598
|
return _context5.stop();
|
|
579
599
|
}
|
|
580
600
|
}
|
|
581
|
-
}, _callee5, null, [[15,
|
|
601
|
+
}, _callee5, null, [[15, 57]]);
|
|
582
602
|
}));
|
|
583
603
|
|
|
584
|
-
return function onSave(
|
|
604
|
+
return function onSave(_x4) {
|
|
585
605
|
return _ref6.apply(this, arguments);
|
|
586
606
|
};
|
|
587
607
|
}();
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -80,7 +80,7 @@ export default function EditLinkInfo(props) {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
var linkTypeJudge = function linkTypeJudge(sourceType, destinationType, type) {
|
|
83
|
-
console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
83
|
+
// console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
84
84
|
var connect = "phy";
|
|
85
85
|
var support = "m.physical_link";
|
|
86
86
|
|
|
@@ -134,16 +134,15 @@ export default function EditLinkInfo(props) {
|
|
|
134
134
|
var links = topo.getEdges();
|
|
135
135
|
var usedNames = [];
|
|
136
136
|
links.map(function (link) {
|
|
137
|
-
console.log('checkName',
|
|
138
|
-
|
|
137
|
+
// console.log('checkName',link.id,lineData)
|
|
139
138
|
if (link.dtype === "link" && link.name && link.id !== lineData.attributes.linkId) {
|
|
140
139
|
usedNames.push(link.name);
|
|
141
140
|
}
|
|
142
141
|
});
|
|
143
142
|
|
|
144
143
|
if (usedNames.indexOf(displayName) >= 0) {
|
|
145
|
-
console.log("setError", checkName, usedNames, displayName);
|
|
146
|
-
|
|
144
|
+
// console.log("setError", checkName, usedNames, displayName);
|
|
145
|
+
// field.setError("display_name", "链路名称重复");
|
|
147
146
|
return callback("链路名称重复");
|
|
148
147
|
} else {
|
|
149
148
|
return callback();
|
|
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
|
|
|
48
48
|
var _topoFactory = _interopRequireDefault(require("./topoFactory"));
|
|
49
49
|
|
|
50
50
|
// eslint-disable-next-line no-undef
|
|
51
|
-
var version = typeof "3.5.
|
|
51
|
+
var version = typeof "3.5.3" === 'string' ? "3.5.3" : null;
|
|
52
52
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
53
53
|
/**
|
|
54
54
|
* 拓扑显示和编辑
|
|
@@ -13,6 +13,10 @@ var _componentNoDataPage = _interopRequireDefault(require("@riil-frontend/compon
|
|
|
13
13
|
|
|
14
14
|
var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
|
15
15
|
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _textModule = _interopRequireDefault(require("../../../../../../common/text.module.scss"));
|
|
19
|
+
|
|
16
20
|
// 关键指标
|
|
17
21
|
function ResourceOverviewMetric(props) {
|
|
18
22
|
var topo = props.topo,
|
|
@@ -41,7 +45,8 @@ function ResourceOverviewMetric(props) {
|
|
|
41
45
|
className: _indexModule["default"].item,
|
|
42
46
|
key: item.code
|
|
43
47
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
44
|
-
|
|
48
|
+
title: formatValue(item),
|
|
49
|
+
className: (0, _classnames["default"])(_indexModule["default"].content, _textModule["default"].textEllipsis)
|
|
45
50
|
}, formatValue(item)), /*#__PURE__*/_react["default"].createElement("span", {
|
|
46
51
|
className: _indexModule["default"].label
|
|
47
52
|
}, item.name));
|
|
@@ -52,7 +57,8 @@ function ResourceOverviewMetric(props) {
|
|
|
52
57
|
className: _indexModule["default"].item,
|
|
53
58
|
key: item.code
|
|
54
59
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
55
|
-
|
|
60
|
+
title: formatValue(item),
|
|
61
|
+
className: (0, _classnames["default"])(_indexModule["default"].content, _textModule["default"].textEllipsis)
|
|
56
62
|
}, formatValue(item)), /*#__PURE__*/_react["default"].createElement("span", {
|
|
57
63
|
className: _indexModule["default"].label
|
|
58
64
|
}, item.name));
|
|
@@ -95,7 +95,7 @@ function AddLinkDrawer(props) {
|
|
|
95
95
|
var linkNodesRef = (0, _react.useRef)();
|
|
96
96
|
|
|
97
97
|
var getPortsById = /*#__PURE__*/function () {
|
|
98
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(id) {
|
|
98
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(id, currentLink) {
|
|
99
99
|
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
100
100
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
101
101
|
while (1) {
|
|
@@ -113,23 +113,24 @@ function AddLinkDrawer(props) {
|
|
|
113
113
|
links = _context.sent;
|
|
114
114
|
ifTypes = result.map(function (item) {
|
|
115
115
|
return item.type;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
_context.next =
|
|
116
|
+
}); // console.log("端口类型列表", ifTypes);
|
|
117
|
+
|
|
118
|
+
_context.next = 9;
|
|
119
119
|
return (0, _linkUtils.getInterfaceObject)(ifTypes);
|
|
120
120
|
|
|
121
|
-
case
|
|
121
|
+
case 9:
|
|
122
122
|
ifDoc = _context.sent;
|
|
123
|
-
console.log("端口类型字典", ifDoc);
|
|
123
|
+
// console.log("端口类型字典", ifDoc);
|
|
124
124
|
usedPorts = [];
|
|
125
125
|
links.data.map(function (link) {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
// console.log("getPortsById-去重", links, id);
|
|
127
|
+
if (link.id !== (currentLink === null || currentLink === void 0 ? void 0 : currentLink.id)) {
|
|
128
|
+
usedPorts.push(link.attributes.destination_id);
|
|
129
|
+
usedPorts.push(link.attributes.source_id);
|
|
130
|
+
}
|
|
128
131
|
});
|
|
129
|
-
usedPorts = _lodash["default"].uniq(usedPorts);
|
|
130
|
-
|
|
131
|
-
_rlog["default"].debug("端口列表", result, links); //const list = result[id];
|
|
132
|
-
|
|
132
|
+
usedPorts = _lodash["default"].uniq(usedPorts); // rlog.debug("端口列表", result, links);
|
|
133
|
+
//const list = result[id];
|
|
133
134
|
|
|
134
135
|
portsDoc = {};
|
|
135
136
|
ports = result.map(function (item) {
|
|
@@ -151,7 +152,7 @@ function AddLinkDrawer(props) {
|
|
|
151
152
|
portsDoc: portsDoc
|
|
152
153
|
});
|
|
153
154
|
|
|
154
|
-
case
|
|
155
|
+
case 16:
|
|
155
156
|
case "end":
|
|
156
157
|
return _context.stop();
|
|
157
158
|
}
|
|
@@ -159,7 +160,7 @@ function AddLinkDrawer(props) {
|
|
|
159
160
|
}, _callee);
|
|
160
161
|
}));
|
|
161
162
|
|
|
162
|
-
return function getPortsById(_x) {
|
|
163
|
+
return function getPortsById(_x, _x2) {
|
|
163
164
|
return _ref.apply(this, arguments);
|
|
164
165
|
};
|
|
165
166
|
}();
|
|
@@ -232,7 +233,7 @@ function AddLinkDrawer(props) {
|
|
|
232
233
|
}, _callee2, null, [[3, 19]]);
|
|
233
234
|
}));
|
|
234
235
|
|
|
235
|
-
return function handleEvent(
|
|
236
|
+
return function handleEvent(_x3) {
|
|
236
237
|
return _ref2.apply(this, arguments);
|
|
237
238
|
};
|
|
238
239
|
}();
|
|
@@ -253,16 +254,15 @@ function AddLinkDrawer(props) {
|
|
|
253
254
|
while (1) {
|
|
254
255
|
switch (_context3.prev = _context3.next) {
|
|
255
256
|
case 0:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return getPortsById(currentLink.source);
|
|
257
|
+
_context3.next = 2;
|
|
258
|
+
return getPortsById(currentLink.source, currentLink);
|
|
259
259
|
|
|
260
|
-
case
|
|
260
|
+
case 2:
|
|
261
261
|
sourcePorts = _context3.sent;
|
|
262
|
-
_context3.next =
|
|
263
|
-
return getPortsById(currentLink.target);
|
|
262
|
+
_context3.next = 5;
|
|
263
|
+
return getPortsById(currentLink.target, currentLink);
|
|
264
264
|
|
|
265
|
-
case
|
|
265
|
+
case 5:
|
|
266
266
|
targetPorts = _context3.sent;
|
|
267
267
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
268
268
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
@@ -296,7 +296,7 @@ function AddLinkDrawer(props) {
|
|
|
296
296
|
})
|
|
297
297
|
});
|
|
298
298
|
|
|
299
|
-
case
|
|
299
|
+
case 10:
|
|
300
300
|
case "end":
|
|
301
301
|
return _context3.stop();
|
|
302
302
|
}
|
|
@@ -447,7 +447,9 @@ function AddLinkDrawer(props) {
|
|
|
447
447
|
};
|
|
448
448
|
|
|
449
449
|
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
450
|
-
|
|
450
|
+
var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
|
|
451
|
+
|
|
452
|
+
// console.log("mergeExportLinkData", data, attributes);
|
|
451
453
|
return (0, _extends2["default"])({}, attributes, {
|
|
452
454
|
id: data.id,
|
|
453
455
|
name: data.name,
|
|
@@ -468,10 +470,10 @@ function AddLinkDrawer(props) {
|
|
|
468
470
|
support_templates: data.support_templates,
|
|
469
471
|
use: data.use,
|
|
470
472
|
source_id_object: {
|
|
471
|
-
displayName: sourceIFDoc[data.source_id].label
|
|
473
|
+
displayName: (_sourceIFDoc$data$sou = sourceIFDoc[data.source_id]) === null || _sourceIFDoc$data$sou === void 0 ? void 0 : _sourceIFDoc$data$sou.label
|
|
472
474
|
},
|
|
473
475
|
destination_id_object: {
|
|
474
|
-
displayName: targetIFDoc[data.destination_id].label
|
|
476
|
+
displayName: (_targetIFDoc$data$des = targetIFDoc[data.destination_id]) === null || _targetIFDoc$data$des === void 0 ? void 0 : _targetIFDoc$data$des.label
|
|
475
477
|
}
|
|
476
478
|
})
|
|
477
479
|
});
|
|
@@ -479,14 +481,14 @@ function AddLinkDrawer(props) {
|
|
|
479
481
|
|
|
480
482
|
var onSave = /*#__PURE__*/function () {
|
|
481
483
|
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
|
482
|
-
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
|
|
484
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
|
|
483
485
|
|
|
484
486
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
485
487
|
while (1) {
|
|
486
488
|
switch (_context5.prev = _context5.next) {
|
|
487
489
|
case 0:
|
|
488
490
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
489
|
-
//
|
|
491
|
+
// console.log("保存链路信息", isAddMode, data);
|
|
490
492
|
setLoading(true);
|
|
491
493
|
parm = {
|
|
492
494
|
attributes: data
|
|
@@ -520,14 +522,14 @@ function AddLinkDrawer(props) {
|
|
|
520
522
|
_context5.prev = 15;
|
|
521
523
|
|
|
522
524
|
if (!result) {
|
|
523
|
-
_context5.next =
|
|
525
|
+
_context5.next = 55;
|
|
524
526
|
break;
|
|
525
527
|
}
|
|
526
528
|
|
|
527
529
|
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
528
530
|
|
|
529
531
|
if (!isAddMode) {
|
|
530
|
-
_context5.next =
|
|
532
|
+
_context5.next = 31;
|
|
531
533
|
break;
|
|
532
534
|
}
|
|
533
535
|
|
|
@@ -549,8 +551,8 @@ function AddLinkDrawer(props) {
|
|
|
549
551
|
elements = _yield$editDispatcher.elements;
|
|
550
552
|
linkData = elements.find(function (element) {
|
|
551
553
|
return element.id === result;
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
+
}); // console.log("创建成功-parm,linkData", parm, linkData);
|
|
555
|
+
|
|
554
556
|
addLinkToGraph({
|
|
555
557
|
linkData: (0, _copyUtil.clone)(linkData),
|
|
556
558
|
linkType: linkType,
|
|
@@ -559,62 +561,79 @@ function AddLinkDrawer(props) {
|
|
|
559
561
|
|
|
560
562
|
_message["default"].success("创建成功");
|
|
561
563
|
|
|
562
|
-
_context5.next =
|
|
564
|
+
_context5.next = 53;
|
|
563
565
|
break;
|
|
564
566
|
|
|
565
|
-
case
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
edge.setAttrObject((0, _extends2["default"])({}, aobj, data));
|
|
571
|
-
target = edge.getTarget();
|
|
567
|
+
case 31:
|
|
568
|
+
if (!(linkType === "exit")) {
|
|
569
|
+
_context5.next = 46;
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
572
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
edge = topo.getGraphView().dm().sm().ld();
|
|
574
|
+
aobj = edge.getAttrObject();
|
|
575
|
+
edge.setAttrObject((0, _extends2["default"])({}, aobj, data));
|
|
576
|
+
target = edge.getTarget();
|
|
576
577
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
return item.id === aobj.id;
|
|
580
|
-
});
|
|
581
|
-
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
582
|
-
newLinks = (0, _copyUtil.clone)(links);
|
|
583
|
-
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
584
|
-
newData = (0, _extends2["default"])({}, topoState.data, {
|
|
585
|
-
links: newLinks
|
|
586
|
-
});
|
|
587
|
-
topoDispatchers.update({
|
|
588
|
-
data: newData
|
|
589
|
-
});
|
|
578
|
+
if (target.getTag() === undefined) {
|
|
579
|
+
target.a("name", data["network_link.destination_ipv4"]);
|
|
590
580
|
}
|
|
591
581
|
|
|
582
|
+
links = topoState.data.links;
|
|
583
|
+
linkAttrKey = links.findIndex(function (item) {
|
|
584
|
+
return item.id === aobj.id;
|
|
585
|
+
});
|
|
586
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
587
|
+
newLinks = (0, _copyUtil.clone)(links);
|
|
588
|
+
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
589
|
+
newData = (0, _extends2["default"])({}, topoState.data, {
|
|
590
|
+
links: newLinks
|
|
591
|
+
});
|
|
592
|
+
topoDispatchers.update({
|
|
593
|
+
data: newData
|
|
594
|
+
});
|
|
595
|
+
_context5.next = 52;
|
|
596
|
+
break;
|
|
597
|
+
|
|
598
|
+
case 46:
|
|
599
|
+
_config = topo.resourceConfig.getConfigFromHt();
|
|
600
|
+
topo.resourceConfig.updateConfig(_config);
|
|
601
|
+
_context5.next = 50;
|
|
602
|
+
return editDispatchers.fetchDataByConfig();
|
|
603
|
+
|
|
604
|
+
case 50:
|
|
605
|
+
_yield$editDispatcher2 = _context5.sent;
|
|
606
|
+
_elements = _yield$editDispatcher2.elements;
|
|
607
|
+
|
|
608
|
+
case 52:
|
|
592
609
|
_message["default"].success("保存成功");
|
|
593
610
|
|
|
594
|
-
case
|
|
611
|
+
case 53:
|
|
595
612
|
editDispatchers.update({
|
|
596
613
|
addLinkIsOpen: false,
|
|
597
614
|
currentLink: null
|
|
598
615
|
});
|
|
599
616
|
topo.linkDynamicStyleExecutor.execute();
|
|
600
617
|
|
|
601
|
-
case
|
|
602
|
-
_context5.next =
|
|
618
|
+
case 55:
|
|
619
|
+
_context5.next = 60;
|
|
603
620
|
break;
|
|
604
621
|
|
|
605
|
-
case
|
|
606
|
-
_context5.prev =
|
|
622
|
+
case 57:
|
|
623
|
+
_context5.prev = 57;
|
|
607
624
|
_context5.t0 = _context5["catch"](15);
|
|
608
625
|
|
|
609
|
-
|
|
626
|
+
_rlog["default"].debug("保存链路信息异常", _context5.t0);
|
|
627
|
+
|
|
628
|
+
case 60:
|
|
610
629
|
case "end":
|
|
611
630
|
return _context5.stop();
|
|
612
631
|
}
|
|
613
632
|
}
|
|
614
|
-
}, _callee5, null, [[15,
|
|
633
|
+
}, _callee5, null, [[15, 57]]);
|
|
615
634
|
}));
|
|
616
635
|
|
|
617
|
-
return function onSave(
|
|
636
|
+
return function onSave(_x4) {
|
|
618
637
|
return _ref6.apply(this, arguments);
|
|
619
638
|
};
|
|
620
639
|
}();
|