@riil-frontend/component-topology 3.5.2 → 3.5.5
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/hooks/useTopoEdit.js +7 -7
- 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/hooks/useTopoEdit.js +7 -7
- 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
|
@@ -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
|
}();
|
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
|
-
console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
111
|
+
// console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
112
112
|
var connect = "phy";
|
|
113
113
|
var support = "m.physical_link";
|
|
114
114
|
|
|
@@ -162,16 +162,15 @@ function EditLinkInfo(props) {
|
|
|
162
162
|
var links = topo.getEdges();
|
|
163
163
|
var usedNames = [];
|
|
164
164
|
links.map(function (link) {
|
|
165
|
-
console.log('checkName',
|
|
166
|
-
|
|
165
|
+
// console.log('checkName',link.id,lineData)
|
|
167
166
|
if (link.dtype === "link" && link.name && link.id !== lineData.attributes.linkId) {
|
|
168
167
|
usedNames.push(link.name);
|
|
169
168
|
}
|
|
170
169
|
});
|
|
171
170
|
|
|
172
171
|
if (usedNames.indexOf(displayName) >= 0) {
|
|
173
|
-
console.log("setError", checkName, usedNames, displayName);
|
|
174
|
-
|
|
172
|
+
// console.log("setError", checkName, usedNames, displayName);
|
|
173
|
+
// field.setError("display_name", "链路名称重复");
|
|
175
174
|
return callback("链路名称重复");
|
|
176
175
|
} else {
|
|
177
176
|
return callback();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riil-frontend/component-topology",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"description": "拓扑",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "build-scripts start",
|
|
@@ -110,6 +110,6 @@
|
|
|
110
110
|
"access": "public"
|
|
111
111
|
},
|
|
112
112
|
"license": "MIT",
|
|
113
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.
|
|
113
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.5/build/index.html",
|
|
114
114
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
|
115
115
|
}
|