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