@riil-frontend/component-topology 11.0.24 → 11.0.26

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.
@@ -11,11 +11,13 @@ var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
15
+
14
16
  var _dialog = _interopRequireDefault(require("@alifd/next/lib/dialog"));
15
17
 
16
18
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
19
 
18
- var _react = require("react");
20
+ var _react = _interopRequireWildcard(require("react"));
19
21
 
20
22
  var _lodash = _interopRequireDefault(require("lodash"));
21
23
 
@@ -41,6 +43,10 @@ var _linkUtils = require("../models/utils/linkUtils");
41
43
 
42
44
  var _exitLinkUtil = require("../../networkTopo/utils/exitLinkUtil");
43
45
 
46
+ 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); }
47
+
48
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
+
44
50
  var useTopoEdit = function useTopoEdit(params) {
45
51
  var topo = params.topo,
46
52
  topoId = params.topoId,
@@ -231,7 +237,48 @@ var useTopoEdit = function useTopoEdit(params) {
231
237
  return onOk;
232
238
  }()
233
239
  });
234
- };
240
+ }; // const deleteGroupFooterBtn = () => {
241
+ // return (
242
+ // <div>
243
+ // <Button type="primary" onClick={doDeleteOnlyGroup()}>
244
+ // 仅删除区域
245
+ // </Button>
246
+ // <Button type="primary" onClick={doDeleteOnlyGroup()}>
247
+ // 确定
248
+ // </Button>
249
+ // </div>
250
+ // );
251
+ // };
252
+ // const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
253
+ // function doDeleteOnlyGroup(data,group) {
254
+ // topo.historyManager.beginTransaction();
255
+ // console.log("仅删除区域", topo.view.topoClient, data);
256
+ // const children = getGroupChildren(group);
257
+ // children.map((child) => {
258
+ // child.setParent(null);
259
+ // // var viewRect = topo.getGraphView().getViewRect();
260
+ // // var nodeRect = child.getRect();
261
+ // // child.setPosition(
262
+ // // viewRect.x + nodeRect.width + 2,
263
+ // // viewRect.y + nodeRect.height + 4
264
+ // // ); // 解决集群从区域内移出时,连线位置未更新的问题
265
+ // setTimeout(function () {
266
+ // child.iv();
267
+ // topo.historyManager.endTransaction();
268
+ // }, 50);
269
+ // });
270
+ // topo.view.topoClient.deleteGroup(data);
271
+ // topo.historyManager.endTransaction();
272
+ // setGroupDeleteVisible(false);
273
+ // // console.log("仅删除区域", children, group);
274
+ // }
275
+ // function doDelete(data) {
276
+ // topo.historyManager.beginTransaction();
277
+ // // FIXME 。如果命中其他的动态条件,则立即显示
278
+ // topo.view.topoClient.deleteGroup(data);
279
+ // setGroupDeleteVisible(false);
280
+ // }
281
+
235
282
  /**
236
283
  * 删除容器。
237
284
  *
@@ -252,75 +299,39 @@ var useTopoEdit = function useTopoEdit(params) {
252
299
  }
253
300
 
254
301
  if (!(0, _htElementUtils.getGroupChildren)(group).filter(_htElementDataUtil.isResourceElement).length || (0, _clusterUtil.isClusterHtElement)(group)) {
255
- doDelete();
302
+ doDelete(data);
256
303
  return;
257
304
  } // 有子节点时需要确认
258
305
 
259
306
 
260
- _dialog["default"].confirm({
307
+ var gdialog = _dialog["default"].show({
261
308
  title: "删除",
262
309
  // content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
263
310
  content: "是否仅删除区域或将区域包含的内容一同删除?",
264
- //footer:()=>{return <><Button type="primary" onClick={doDeleteOnlyGroup}>仅删除区域</Button><Button type="primary" onClick={doDeleteOnlyGroup}>确定</Button></>},
265
- okProps: {
266
- children: "仅删除区域",
267
- type: "normal"
268
- },
269
- cancelProps: {
270
- children: "全部删除"
271
- },
311
+ footer: [/*#__PURE__*/_react["default"].createElement(_button["default"], {
312
+ type: "normal",
313
+ onClick: doDeleteOnlyGroup,
314
+ style: {
315
+ marginRight: "15px"
316
+ }
317
+ }, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
318
+ type: "normal",
319
+ onClick: doDelete
320
+ }, "\u5168\u90E8\u5220\u9664")],
321
+ // okProps: {
322
+ // children: "仅删除区域",
323
+ // type: "normal",
324
+ // className: "next-btn-normal",
325
+ // },
326
+ // cancelProps: { children: "全部删除" },
272
327
  messageProps: {
273
328
  type: "warning"
274
- },
275
- onOk: function () {
276
- var _onOk2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
277
- return _regenerator["default"].wrap(function _callee4$(_context4) {
278
- while (1) {
279
- switch (_context4.prev = _context4.next) {
280
- case 0:
281
- doDeleteOnlyGroup();
282
-
283
- case 1:
284
- case "end":
285
- return _context4.stop();
286
- }
287
- }
288
- }, _callee4);
289
- }));
290
-
291
- function onOk() {
292
- return _onOk2.apply(this, arguments);
293
- }
294
-
295
- return onOk;
296
- }(),
297
- onCancel: function () {
298
- var _onCancel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
299
- return _regenerator["default"].wrap(function _callee5$(_context5) {
300
- while (1) {
301
- switch (_context5.prev = _context5.next) {
302
- case 0:
303
- doDelete();
304
-
305
- case 1:
306
- case "end":
307
- return _context5.stop();
308
- }
309
- }
310
- }, _callee5);
311
- }));
312
-
313
- function onCancel() {
314
- return _onCancel.apply(this, arguments);
315
- }
316
-
317
- return onCancel;
318
- }()
329
+ }
319
330
  });
320
331
 
321
332
  function doDeleteOnlyGroup() {
322
- topo.historyManager.beginTransaction(); // console.log("仅删除区域", topo.view.topoClient, data);
323
-
333
+ topo.historyManager.beginTransaction();
334
+ console.log("仅删除区域", topo.view.topoClient, data);
324
335
  var children = (0, _htElementUtils.getGroupChildren)(group);
325
336
  children.map(function (child) {
326
337
  child.setParent(null); // var viewRect = topo.getGraphView().getViewRect();
@@ -336,13 +347,15 @@ var useTopoEdit = function useTopoEdit(params) {
336
347
  }, 50);
337
348
  });
338
349
  topo.view.topoClient.deleteGroup(data);
339
- topo.historyManager.endTransaction(); // console.log("仅删除区域", children, group);
350
+ topo.historyManager.endTransaction();
351
+ gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide(); // console.log("仅删除区域", children, group);
340
352
  }
341
353
 
342
354
  function doDelete() {
343
355
  topo.historyManager.beginTransaction(); // FIXME 。如果命中其他的动态条件,则立即显示
344
356
 
345
357
  topo.view.topoClient.deleteGroup(data);
358
+ gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
346
359
  }
347
360
  };
348
361
 
@@ -373,20 +386,20 @@ var useTopoEdit = function useTopoEdit(params) {
373
386
 
374
387
 
375
388
  var deleteExLink = /*#__PURE__*/function () {
376
- var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(node) {
389
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(node) {
377
390
  var _node$getEdges$toArra, _node$getEdges;
378
391
 
379
392
  var config, edges, exportLinkIdList;
380
- return _regenerator["default"].wrap(function _callee6$(_context6) {
393
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
381
394
  while (1) {
382
- switch (_context6.prev = _context6.next) {
395
+ switch (_context4.prev = _context4.next) {
383
396
  case 0:
384
397
  config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
385
398
 
386
399
  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 = [];
387
400
 
388
401
  if (!(edges.length > 0)) {
389
- _context6.next = 8;
402
+ _context4.next = 8;
390
403
  break;
391
404
  }
392
405
 
@@ -400,15 +413,15 @@ var useTopoEdit = function useTopoEdit(params) {
400
413
  }
401
414
  });
402
415
  config.exportLinkIdList = exportLinkIdList;
403
- _context6.next = 8;
416
+ _context4.next = 8;
404
417
  return resourceConfig.updateConfig(config);
405
418
 
406
419
  case 8:
407
420
  case "end":
408
- return _context6.stop();
421
+ return _context4.stop();
409
422
  }
410
423
  }
411
- }, _callee6);
424
+ }, _callee4);
412
425
  }));
413
426
 
414
427
  return function deleteExLink(_x3) {
@@ -494,27 +507,27 @@ var useTopoEdit = function useTopoEdit(params) {
494
507
  }
495
508
 
496
509
  function _bindGroupResources() {
497
- _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(group, resources) {
510
+ _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(group, resources) {
498
511
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
499
512
 
500
- return _regenerator["default"].wrap(function _callee12$(_context12) {
513
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
501
514
  while (1) {
502
- switch (_context12.prev = _context12.next) {
515
+ switch (_context10.prev = _context10.next) {
503
516
  case 0:
504
517
  id = group.id, tag = group.tag;
505
518
 
506
519
  _rlog["default"].debug("bindGroupResources--id, tag", id, tag);
507
520
 
508
521
  topo.historyManager.beginTransaction();
509
- _context12.next = 5;
522
+ _context10.next = 5;
510
523
  return resourceConfig.updateGroupResources(group, resources);
511
524
 
512
525
  case 5:
513
- _context12.next = 7;
526
+ _context10.next = 7;
514
527
  return editDispatchers.fetchDataByConfig();
515
528
 
516
529
  case 7:
517
- _yield$editDispatcher2 = _context12.sent;
530
+ _yield$editDispatcher2 = _context10.sent;
518
531
  elements = _yield$editDispatcher2.elements;
519
532
  // 区域里的子区域及子区域的节点、新增的链路
520
533
  nodeElements = (0, _topoData.findGroupChildren)(elements, group);
@@ -533,10 +546,10 @@ var useTopoEdit = function useTopoEdit(params) {
533
546
 
534
547
  case 14:
535
548
  case "end":
536
- return _context12.stop();
549
+ return _context10.stop();
537
550
  }
538
551
  }
539
- }, _callee12);
552
+ }, _callee10);
540
553
  }));
541
554
  return _bindGroupResources.apply(this, arguments);
542
555
  }
@@ -550,11 +563,11 @@ var useTopoEdit = function useTopoEdit(params) {
550
563
 
551
564
 
552
565
  function _addGroupResources() {
553
- _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
566
+ _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
554
567
  var groupConfig, resources, groupData;
555
- return _regenerator["default"].wrap(function _callee13$(_context13) {
568
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
556
569
  while (1) {
557
- switch (_context13.prev = _context13.next) {
570
+ switch (_context11.prev = _context11.next) {
558
571
  case 0:
559
572
  groupConfig = resourceConfig.getGroupConfigByElement(group);
560
573
  resources = {
@@ -564,15 +577,15 @@ var useTopoEdit = function useTopoEdit(params) {
564
577
  id: group.getTag(),
565
578
  tag: group.a("tag")
566
579
  };
567
- _context13.next = 5;
580
+ _context11.next = 5;
568
581
  return bindGroupResources(groupData, resources, newResourceIds);
569
582
 
570
583
  case 5:
571
584
  case "end":
572
- return _context13.stop();
585
+ return _context11.stop();
573
586
  }
574
587
  }
575
- }, _callee13);
588
+ }, _callee11);
576
589
  }));
577
590
  return _addGroupResources.apply(this, arguments);
578
591
  }
@@ -589,25 +602,25 @@ var useTopoEdit = function useTopoEdit(params) {
589
602
 
590
603
 
591
604
  function _bindViewResources() {
592
- _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
605
+ _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
593
606
  var config, _yield$editDispatcher3, elements;
594
607
 
595
- return _regenerator["default"].wrap(function _callee14$(_context14) {
608
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
596
609
  while (1) {
597
- switch (_context14.prev = _context14.next) {
610
+ switch (_context12.prev = _context12.next) {
598
611
  case 0:
599
612
  // console.log("关联视图的资源", data);
600
613
  config = resourceConfig.getConfig();
601
614
  config.resources = data;
602
- _context14.next = 4;
615
+ _context12.next = 4;
603
616
  return resourceConfig.updateConfig(config);
604
617
 
605
618
  case 4:
606
- _context14.next = 6;
619
+ _context12.next = 6;
607
620
  return editDispatchers.fetchDataByConfig();
608
621
 
609
622
  case 6:
610
- _yield$editDispatcher3 = _context14.sent;
623
+ _yield$editDispatcher3 = _context12.sent;
611
624
  elements = _yield$editDispatcher3.elements;
612
625
  saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
613
626
 
@@ -617,10 +630,10 @@ var useTopoEdit = function useTopoEdit(params) {
617
630
 
618
631
  case 10:
619
632
  case "end":
620
- return _context14.stop();
633
+ return _context12.stop();
621
634
  }
622
635
  }
623
- }, _callee14);
636
+ }, _callee12);
624
637
  }));
625
638
  return _bindViewResources.apply(this, arguments);
626
639
  }
@@ -630,24 +643,24 @@ var useTopoEdit = function useTopoEdit(params) {
630
643
  }
631
644
 
632
645
  function _addLayerResources() {
633
- _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(group, newResourceIds) {
646
+ _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
634
647
  var _yield$editDispatcher4, elements, newElements;
635
648
 
636
- return _regenerator["default"].wrap(function _callee15$(_context15) {
649
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
637
650
  while (1) {
638
- switch (_context15.prev = _context15.next) {
651
+ switch (_context13.prev = _context13.next) {
639
652
  case 0:
640
653
  topo.historyManager.beginTransaction(); // 构造新的配置
641
654
 
642
- _context15.next = 3;
655
+ _context13.next = 3;
643
656
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
644
657
 
645
658
  case 3:
646
- _context15.next = 5;
659
+ _context13.next = 5;
647
660
  return editDispatchers.fetchDataByConfig();
648
661
 
649
662
  case 5:
650
- _yield$editDispatcher4 = _context15.sent;
663
+ _yield$editDispatcher4 = _context13.sent;
651
664
  elements = _yield$editDispatcher4.elements;
652
665
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
653
666
  newElements = findUNExistedElements(elements);
@@ -672,10 +685,10 @@ var useTopoEdit = function useTopoEdit(params) {
672
685
 
673
686
  case 14:
674
687
  case "end":
675
- return _context15.stop();
688
+ return _context13.stop();
676
689
  }
677
690
  }
678
- }, _callee15);
691
+ }, _callee13);
679
692
  }));
680
693
  return _addLayerResources.apply(this, arguments);
681
694
  }
@@ -685,22 +698,22 @@ var useTopoEdit = function useTopoEdit(params) {
685
698
  }
686
699
 
687
700
  function _addResourceToFirstLayer() {
688
- _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(data) {
701
+ _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
689
702
  var group;
690
- return _regenerator["default"].wrap(function _callee16$(_context16) {
703
+ return _regenerator["default"].wrap(function _callee14$(_context14) {
691
704
  while (1) {
692
- switch (_context16.prev = _context16.next) {
705
+ switch (_context14.prev = _context14.next) {
693
706
  case 0:
694
707
  group = resourceConfig.getGroups()[0];
695
- _context16.next = 3;
708
+ _context14.next = 3;
696
709
  return addLayerResources(group, data);
697
710
 
698
711
  case 3:
699
712
  case "end":
700
- return _context16.stop();
713
+ return _context14.stop();
701
714
  }
702
715
  }
703
- }, _callee16);
716
+ }, _callee14);
704
717
  }));
705
718
  return _addResourceToFirstLayer.apply(this, arguments);
706
719
  }
@@ -732,29 +745,29 @@ var useTopoEdit = function useTopoEdit(params) {
732
745
 
733
746
 
734
747
  var onSaveComboRes = /*#__PURE__*/function () {
735
- var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(data) {
736
- return _regenerator["default"].wrap(function _callee7$(_context7) {
748
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
749
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
737
750
  while (1) {
738
- switch (_context7.prev = _context7.next) {
751
+ switch (_context5.prev = _context5.next) {
739
752
  case 0:
740
753
  _rlog["default"].debug("关联资源-----onSaveComboRes", data);
741
754
 
742
755
  topo.historyManager.beginTransaction();
743
756
 
744
757
  if (!(getAddResourceType() === "addToFirstLayer")) {
745
- _context7.next = 7;
758
+ _context5.next = 7;
746
759
  break;
747
760
  }
748
761
 
749
- _context7.next = 5;
762
+ _context5.next = 5;
750
763
  return addResourceToFirstLayer(data);
751
764
 
752
765
  case 5:
753
- _context7.next = 9;
766
+ _context5.next = 9;
754
767
  break;
755
768
 
756
769
  case 7:
757
- _context7.next = 9;
770
+ _context5.next = 9;
758
771
  return bindViewResources(data);
759
772
 
760
773
  case 9:
@@ -766,10 +779,10 @@ var useTopoEdit = function useTopoEdit(params) {
766
779
 
767
780
  case 12:
768
781
  case "end":
769
- return _context7.stop();
782
+ return _context5.stop();
770
783
  }
771
784
  }
772
- }, _callee7);
785
+ }, _callee5);
773
786
  }));
774
787
 
775
788
  return function onSaveComboRes(_x12) {
@@ -778,12 +791,12 @@ var useTopoEdit = function useTopoEdit(params) {
778
791
  }();
779
792
 
780
793
  var onSaveTopo = /*#__PURE__*/function () {
781
- var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data) {
794
+ var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(data) {
782
795
  var id, config, serialize, _config$layout, template, layout, saveConfig;
783
796
 
784
- return _regenerator["default"].wrap(function _callee9$(_context9) {
797
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
785
798
  while (1) {
786
- switch (_context9.prev = _context9.next) {
799
+ switch (_context7.prev = _context7.next) {
787
800
  case 0:
788
801
  id = data.id, config = data.config, serialize = data.serialize;
789
802
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
@@ -791,12 +804,12 @@ var useTopoEdit = function useTopoEdit(params) {
791
804
  if (onSave) {
792
805
  // 自定义保存
793
806
  saveConfig = /*#__PURE__*/function () {
794
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
795
- return _regenerator["default"].wrap(function _callee8$(_context8) {
807
+ var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
808
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
796
809
  while (1) {
797
- switch (_context8.prev = _context8.next) {
810
+ switch (_context6.prev = _context6.next) {
798
811
  case 0:
799
- _context8.next = 2;
812
+ _context6.next = 2;
800
813
  return editDispatchers.saveTopo({
801
814
  id: id,
802
815
  layout: layout,
@@ -805,10 +818,10 @@ var useTopoEdit = function useTopoEdit(params) {
805
818
 
806
819
  case 2:
807
820
  case "end":
808
- return _context8.stop();
821
+ return _context6.stop();
809
822
  }
810
823
  }
811
- }, _callee8);
824
+ }, _callee6);
812
825
  }));
813
826
 
814
827
  return function saveConfig() {
@@ -825,10 +838,10 @@ var useTopoEdit = function useTopoEdit(params) {
825
838
 
826
839
  case 3:
827
840
  case "end":
828
- return _context9.stop();
841
+ return _context7.stop();
829
842
  }
830
843
  }
831
- }, _callee9);
844
+ }, _callee7);
832
845
  }));
833
846
 
834
847
  return function onSaveTopo(_x13) {
@@ -860,12 +873,12 @@ var useTopoEdit = function useTopoEdit(params) {
860
873
 
861
874
 
862
875
  var bindNodeResource = /*#__PURE__*/function () {
863
- var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(params) {
876
+ var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(params) {
864
877
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
865
878
 
866
- return _regenerator["default"].wrap(function _callee11$(_context11) {
879
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
867
880
  while (1) {
868
- switch (_context11.prev = _context11.next) {
881
+ switch (_context9.prev = _context9.next) {
869
882
  case 0:
870
883
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
871
884
  return (0, _extends2["default"])({}, resources, {
@@ -876,11 +889,11 @@ var useTopoEdit = function useTopoEdit(params) {
876
889
  };
877
890
 
878
891
  _doBind = function _doBind3() {
879
- _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
892
+ _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
880
893
  var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
881
- return _regenerator["default"].wrap(function _callee10$(_context10) {
894
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
882
895
  while (1) {
883
- switch (_context10.prev = _context10.next) {
896
+ switch (_context8.prev = _context8.next) {
884
897
  case 0:
885
898
  dm = htTopo.getGraphView().dm(); // 创建
886
899
 
@@ -950,7 +963,7 @@ var useTopoEdit = function useTopoEdit(params) {
950
963
  // node.a("customName", null);
951
964
  // 删除关联在节点上的出口链路
952
965
 
953
- _context10.next = 12;
966
+ _context8.next = 12;
954
967
  return deleteExLink(node);
955
968
 
956
969
  case 12:
@@ -961,10 +974,10 @@ var useTopoEdit = function useTopoEdit(params) {
961
974
 
962
975
  case 13:
963
976
  case "end":
964
- return _context10.stop();
977
+ return _context8.stop();
965
978
  }
966
979
  }
967
- }, _callee10);
980
+ }, _callee8);
968
981
  }));
969
982
  return _doBind.apply(this, arguments);
970
983
  };
@@ -1006,22 +1019,22 @@ var useTopoEdit = function useTopoEdit(params) {
1006
1019
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
1007
1020
  }
1008
1021
 
1009
- _context11.next = 13;
1022
+ _context9.next = 13;
1010
1023
  return resourceConfig.updateConfig(config);
1011
1024
 
1012
1025
  case 13:
1013
- _context11.next = 15;
1026
+ _context9.next = 15;
1014
1027
  return editDispatchers.fetchDataByConfig();
1015
1028
 
1016
1029
  case 15:
1017
- _yield$editDispatcher = _context11.sent;
1030
+ _yield$editDispatcher = _context9.sent;
1018
1031
  elements = _yield$editDispatcher.elements;
1019
1032
  newData = elements.find(function (item) {
1020
1033
  return item.id === newResId;
1021
1034
  });
1022
1035
 
1023
1036
  if (newData) {
1024
- _context11.next = 23;
1037
+ _context9.next = 23;
1025
1038
  break;
1026
1039
  }
1027
1040
 
@@ -1030,10 +1043,10 @@ var useTopoEdit = function useTopoEdit(params) {
1030
1043
  _rlog["default"].warn("关联资源失败");
1031
1044
 
1032
1045
  topo.historyManager.endTransaction();
1033
- return _context11.abrupt("return", false);
1046
+ return _context9.abrupt("return", false);
1034
1047
 
1035
1048
  case 23:
1036
- _context11.next = 25;
1049
+ _context9.next = 25;
1037
1050
  return doBind();
1038
1051
 
1039
1052
  case 25:
@@ -1041,10 +1054,10 @@ var useTopoEdit = function useTopoEdit(params) {
1041
1054
 
1042
1055
  case 26:
1043
1056
  case "end":
1044
- return _context11.stop();
1057
+ return _context9.stop();
1045
1058
  }
1046
1059
  }
1047
- }, _callee11);
1060
+ }, _callee9);
1048
1061
  }));
1049
1062
 
1050
1063
  return function bindNodeResource(_x14) {
@@ -1061,19 +1074,19 @@ var useTopoEdit = function useTopoEdit(params) {
1061
1074
  }
1062
1075
 
1063
1076
  function _relateNodeIp() {
1064
- _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(txtValue, nodeElement) {
1077
+ _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
1065
1078
  var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
1066
1079
 
1067
- return _regenerator["default"].wrap(function _callee17$(_context17) {
1080
+ return _regenerator["default"].wrap(function _callee15$(_context15) {
1068
1081
  while (1) {
1069
- switch (_context17.prev = _context17.next) {
1082
+ switch (_context15.prev = _context15.next) {
1070
1083
  case 0:
1071
1084
  if (txtValue) {
1072
- _context17.next = 2;
1085
+ _context15.next = 2;
1073
1086
  break;
1074
1087
  }
1075
1088
 
1076
- return _context17.abrupt("return");
1089
+ return _context15.abrupt("return");
1077
1090
 
1078
1091
  case 2:
1079
1092
  // if (txtValue === nodeElement.a('bindIp')) {
@@ -1085,12 +1098,12 @@ var useTopoEdit = function useTopoEdit(params) {
1085
1098
  isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
1086
1099
 
1087
1100
  if (!isUnique) {
1088
- _context17.next = 23;
1101
+ _context15.next = 23;
1089
1102
  break;
1090
1103
  }
1091
1104
 
1092
1105
  ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
1093
- _context17.next = 8;
1106
+ _context15.next = 8;
1094
1107
  return deleteExLink(nodeElement);
1095
1108
 
1096
1109
  case 8:
@@ -1099,15 +1112,15 @@ var useTopoEdit = function useTopoEdit(params) {
1099
1112
  nodeElement.setTag("ip:" + txtValue); // 获取配置
1100
1113
 
1101
1114
  configObj = topo.resourceConfig.getConfig();
1102
- _context17.next = 14;
1115
+ _context15.next = 14;
1103
1116
  return resourceConfig.updateConfig(configObj);
1104
1117
 
1105
1118
  case 14:
1106
- _context17.next = 16;
1119
+ _context15.next = 16;
1107
1120
  return editDispatchers.fetchDataByConfig();
1108
1121
 
1109
1122
  case 16:
1110
- configData = _context17.sent;
1123
+ configData = _context15.sent;
1111
1124
  // console.log("configData",configObj, configData);
1112
1125
  _elements = configData.elements;
1113
1126
  newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
@@ -1135,10 +1148,10 @@ var useTopoEdit = function useTopoEdit(params) {
1135
1148
 
1136
1149
  case 23:
1137
1150
  case "end":
1138
- return _context17.stop();
1151
+ return _context15.stop();
1139
1152
  }
1140
1153
  }
1141
- }, _callee17);
1154
+ }, _callee15);
1142
1155
  }));
1143
1156
  return _relateNodeIp.apply(this, arguments);
1144
1157
  }