@riil-frontend/component-topology 3.5.4 → 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.
@@ -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.4" === 'string' ? "3.5.4" : null;
23
+ var version = typeof "3.5.5" === 'string' ? "3.5.5" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -321,24 +321,24 @@ var useTopoEdit = function useTopoEdit(params) {
321
321
  edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
322
322
 
323
323
  if (!(edges.length > 0)) {
324
- _context4.next = 9;
324
+ _context4.next = 8;
325
325
  break;
326
326
  }
327
327
 
328
- exportLinkIdList = [].concat(config.exportLinkIdList);
329
- console.log("删除关联在节点上的出口链路- edge", edges);
328
+ exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
329
+
330
330
  edges.map(function (edge) {
331
- if (edge.a("connect_type") === "exit" && exportLinkIdList.indexOf(edge.getTag() >= 0)) {
332
- // exLink.push(edge);
331
+ if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
332
+ // exLink.push(edge);
333
333
  topo.getGraphView().dm().remove(edge);
334
334
  exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
335
335
  }
336
336
  });
337
337
  config.exportLinkIdList = exportLinkIdList;
338
- _context4.next = 9;
338
+ _context4.next = 8;
339
339
  return resourceConfig.updateConfig(config);
340
340
 
341
- case 9:
341
+ case 8:
342
342
  case "end":
343
343
  return _context4.stop();
344
344
  }
@@ -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
- console.log("端口类型列表", ifTypes);
89
- _context.next = 10;
87
+ }); // console.log("端口类型列表", ifTypes);
88
+
89
+ _context.next = 9;
90
90
  return getInterfaceObject(ifTypes);
91
91
 
92
- case 10:
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
- usedPorts.push(link.attributes.destination_id);
98
- usedPorts.push(link.attributes.source_id);
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
- rlog.debug("端口列表", result, links); //const list = result[id];
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 19:
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(_x2) {
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
- console.log("编辑链路--当前链路", currentLink);
224
- _context3.next = 3;
225
- return getPortsById(currentLink.source);
226
+ _context3.next = 2;
227
+ return getPortsById(currentLink.source, currentLink);
226
228
 
227
- case 3:
229
+ case 2:
228
230
  sourcePorts = _context3.sent;
229
- _context3.next = 6;
230
- return getPortsById(currentLink.target);
231
+ _context3.next = 5;
232
+ return getPortsById(currentLink.target, currentLink);
231
233
 
232
- case 6:
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 11:
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
- console.log("mergeExportLinkData", data, attributes);
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
- // rlog.debug("保存链路信息", isAddMode, data);
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 = 36;
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 = 32;
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
- console.log("创建成功-parm,linkData", parm, linkData);
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 = 34;
533
+ _context5.next = 53;
530
534
  break;
531
535
 
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();
536
+ case 31:
537
+ if (!(linkType === "exit")) {
538
+ _context5.next = 46;
539
+ break;
540
+ }
539
541
 
540
- if (target.getTag() === undefined) {
541
- target.a("name", data["network_link.destination_ipv4"]);
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
- 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
- });
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 34:
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 36:
569
- _context5.next = 40;
587
+ case 55:
588
+ _context5.next = 60;
570
589
  break;
571
590
 
572
- case 38:
573
- _context5.prev = 38;
591
+ case 57:
592
+ _context5.prev = 57;
574
593
  _context5.t0 = _context5["catch"](15);
594
+ rlog.debug("保存链路信息异常", _context5.t0);
575
595
 
576
- case 40:
596
+ case 60:
577
597
  case "end":
578
598
  return _context5.stop();
579
599
  }
580
600
  }
581
- }, _callee5, null, [[15, 38]]);
601
+ }, _callee5, null, [[15, 57]]);
582
602
  }));
583
603
 
584
- return function onSave(_x3) {
604
+ return function onSave(_x4) {
585
605
  return _ref6.apply(this, arguments);
586
606
  };
587
607
  }();
@@ -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', link.id, lineData);
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); // field.setError("display_name", "链路名称重复");
146
-
144
+ // console.log("setError", checkName, usedNames, displayName);
145
+ // field.setError("display_name", "链路名称重复");
147
146
  return callback("链路名称重复");
148
147
  } else {
149
148
  return callback();
@@ -1,3 +1,12 @@
1
+ @import '~@alifd/next/variables.scss';
2
+
1
3
  .drawer {
2
4
  width: 504px;
5
+
6
+ :global {
7
+ .#{$css-prefix}drawer-body {
8
+ padding: 20px 24px 50px 20px;
9
+ }
10
+ }
11
+
3
12
  }
@@ -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.4" === 'string' ? "3.5.4" : null;
51
+ var version = typeof "3.5.5" === 'string' ? "3.5.5" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -348,24 +348,24 @@ var useTopoEdit = function useTopoEdit(params) {
348
348
  edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
349
349
 
350
350
  if (!(edges.length > 0)) {
351
- _context4.next = 9;
351
+ _context4.next = 8;
352
352
  break;
353
353
  }
354
354
 
355
- exportLinkIdList = [].concat(config.exportLinkIdList);
356
- console.log("删除关联在节点上的出口链路- edge", edges);
355
+ exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
356
+
357
357
  edges.map(function (edge) {
358
- if (edge.a("connect_type") === "exit" && exportLinkIdList.indexOf(edge.getTag() >= 0)) {
359
- // exLink.push(edge);
358
+ if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
359
+ // exLink.push(edge);
360
360
  topo.getGraphView().dm().remove(edge);
361
361
  exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
362
362
  }
363
363
  });
364
364
  config.exportLinkIdList = exportLinkIdList;
365
- _context4.next = 9;
365
+ _context4.next = 8;
366
366
  return resourceConfig.updateConfig(config);
367
367
 
368
- case 9:
368
+ case 8:
369
369
  case "end":
370
370
  return _context4.stop();
371
371
  }