@riil-frontend/component-topology 5.0.0-alpha.21 → 5.0.0-alpha.22

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.
@@ -110,47 +110,99 @@ var useTopoEdit = function useTopoEdit(params) {
110
110
  setShowComboResDrawer(true);
111
111
  };
112
112
 
113
- var onLayerAdded = function onLayerAdded(_ref2) {
114
- var target = _ref2.target,
115
- direction = _ref2.direction;
116
- // 从拓扑图获取分层和资源配置
117
- var config = resourceConfig.getConfigFromHt(topo.getDataModel());
113
+ var onLayerAdded = /*#__PURE__*/function () {
114
+ var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref2) {
115
+ var target, direction, config;
116
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
117
+ while (1) {
118
+ switch (_context2.prev = _context2.next) {
119
+ case 0:
120
+ target = _ref2.target, direction = _ref2.direction;
121
+ topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
118
122
 
119
- _rlog["default"].info("onLayerAdd", {
120
- config: config
121
- }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
123
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
122
124
 
125
+ _rlog["default"].info("onLayerAdd", {
126
+ config: config
127
+ }); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
123
128
 
124
- if (!isLayerTopo && config.layers.length) {
125
- topoDispatchers.setTopoType(_template.TPL_TREE);
126
- } // 更新配置
127
- // resourceConfig.updateConfig(config);
128
- // 更新配置对应的资源、链路
129
- // editDispatchers.fetchDataByConfig();
130
129
 
131
- };
130
+ if (!(!isLayerTopo && config.layers.length)) {
131
+ _context2.next = 7;
132
+ break;
133
+ }
132
134
 
133
- var deleteLayer = function deleteLayer(layerElement) {
134
- topo.historyManager.beginTransaction();
135
- emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
135
+ _context2.next = 7;
136
+ return topoDispatchers.setTopoType(_template.TPL_TREE);
137
+
138
+ case 7:
139
+ // 更新配置
140
+ // resourceConfig.updateConfig(config);
141
+ // 更新配置对应的资源、链路
142
+ // editDispatchers.fetchDataByConfig();
143
+ topo.historyManager.endTransaction();
144
+
145
+ case 8:
146
+ case "end":
147
+ return _context2.stop();
148
+ }
149
+ }
150
+ }, _callee2);
151
+ }));
136
152
 
137
- var config = resourceConfig.getConfigFromHt(topo.getDataModel());
153
+ return function onLayerAdded(_x) {
154
+ return _ref3.apply(this, arguments);
155
+ };
156
+ }();
138
157
 
139
- _rlog["default"].info("deleteLayer", {
140
- config: config
141
- }); // 如果没有分层,将拓扑类型切换为空白模板
158
+ var deleteLayer = /*#__PURE__*/function () {
159
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(layerElement) {
160
+ var config;
161
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
162
+ while (1) {
163
+ switch (_context3.prev = _context3.next) {
164
+ case 0:
165
+ topo.historyManager.beginTransaction();
166
+ emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
142
167
 
168
+ config = resourceConfig.getConfigFromHt(topo.getDataModel());
143
169
 
144
- if (!config.layers.length) {
145
- topoDispatchers.setTopoType(_template.TPL_BLANK);
146
- } // 更新配置
170
+ _rlog["default"].info("deleteLayer", {
171
+ config: config
172
+ }); // 如果没有分层,将拓扑类型切换为空白模板
147
173
 
148
174
 
149
- resourceConfig.updateConfig(config); // 更新配置对应的资源、链路
175
+ if (config.layers.length) {
176
+ _context3.next = 7;
177
+ break;
178
+ }
150
179
 
151
- editDispatchers.fetchDataByConfig();
152
- topo.historyManager.endTransaction();
153
- };
180
+ _context3.next = 7;
181
+ return topoDispatchers.setTopoType(_template.TPL_BLANK);
182
+
183
+ case 7:
184
+ _context3.next = 9;
185
+ return resourceConfig.updateConfig(config);
186
+
187
+ case 9:
188
+ _context3.next = 11;
189
+ return editDispatchers.fetchDataByConfig();
190
+
191
+ case 11:
192
+ topo.historyManager.endTransaction();
193
+
194
+ case 12:
195
+ case "end":
196
+ return _context3.stop();
197
+ }
198
+ }
199
+ }, _callee3);
200
+ }));
201
+
202
+ return function deleteLayer(_x2) {
203
+ return _ref4.apply(this, arguments);
204
+ };
205
+ }();
154
206
 
155
207
  var handleDeleteLayer = function handleDeleteLayer(layerElement) {
156
208
  var hasChildren = !!layerElement.getChildren().toArray().length;
@@ -171,19 +223,19 @@ var useTopoEdit = function useTopoEdit(params) {
171
223
  type: "warning"
172
224
  },
173
225
  onOk: function () {
174
- var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
175
- return _regenerator["default"].wrap(function _callee2$(_context2) {
226
+ var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
227
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
176
228
  while (1) {
177
- switch (_context2.prev = _context2.next) {
229
+ switch (_context4.prev = _context4.next) {
178
230
  case 0:
179
231
  deleteLayer(layerElement);
180
232
 
181
233
  case 1:
182
234
  case "end":
183
- return _context2.stop();
235
+ return _context4.stop();
184
236
  }
185
237
  }
186
- }, _callee2);
238
+ }, _callee4);
187
239
  }));
188
240
 
189
241
  function onOk() {
@@ -229,19 +281,19 @@ var useTopoEdit = function useTopoEdit(params) {
229
281
  type: "warning"
230
282
  },
231
283
  onOk: function () {
232
- var _onOk2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
233
- return _regenerator["default"].wrap(function _callee3$(_context3) {
284
+ var _onOk2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
285
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
234
286
  while (1) {
235
- switch (_context3.prev = _context3.next) {
287
+ switch (_context5.prev = _context5.next) {
236
288
  case 0:
237
289
  doDelete();
238
290
 
239
291
  case 1:
240
292
  case "end":
241
- return _context3.stop();
293
+ return _context5.stop();
242
294
  }
243
295
  }
244
- }, _callee3);
296
+ }, _callee5);
245
297
  }));
246
298
 
247
299
  function onOk() {
@@ -338,20 +390,20 @@ var useTopoEdit = function useTopoEdit(params) {
338
390
 
339
391
 
340
392
  var deleteExLink = /*#__PURE__*/function () {
341
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(node) {
393
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(node) {
342
394
  var _node$getEdges$toArra, _node$getEdges;
343
395
 
344
396
  var config, edges, exportLinkIdList;
345
- return _regenerator["default"].wrap(function _callee4$(_context4) {
397
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
346
398
  while (1) {
347
- switch (_context4.prev = _context4.next) {
399
+ switch (_context6.prev = _context6.next) {
348
400
  case 0:
349
401
  config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
350
402
 
351
403
  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 = [];
352
404
 
353
405
  if (!(edges.length > 0)) {
354
- _context4.next = 8;
406
+ _context6.next = 8;
355
407
  break;
356
408
  }
357
409
 
@@ -365,19 +417,19 @@ var useTopoEdit = function useTopoEdit(params) {
365
417
  }
366
418
  });
367
419
  config.exportLinkIdList = exportLinkIdList;
368
- _context4.next = 8;
420
+ _context6.next = 8;
369
421
  return resourceConfig.updateConfig(config);
370
422
 
371
423
  case 8:
372
424
  case "end":
373
- return _context4.stop();
425
+ return _context6.stop();
374
426
  }
375
427
  }
376
- }, _callee4);
428
+ }, _callee6);
377
429
  }));
378
430
 
379
- return function deleteExLink(_x) {
380
- return _ref3.apply(this, arguments);
431
+ return function deleteExLink(_x3) {
432
+ return _ref5.apply(this, arguments);
381
433
  };
382
434
  }();
383
435
 
@@ -440,31 +492,31 @@ var useTopoEdit = function useTopoEdit(params) {
440
492
  */
441
493
 
442
494
 
443
- function bindGroupResources(_x2, _x3) {
495
+ function bindGroupResources(_x4, _x5) {
444
496
  return _bindGroupResources.apply(this, arguments);
445
497
  }
446
498
 
447
499
  function _bindGroupResources() {
448
- _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(group, resources) {
500
+ _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(group, resources) {
449
501
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
450
502
 
451
- return _regenerator["default"].wrap(function _callee10$(_context10) {
503
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
452
504
  while (1) {
453
- switch (_context10.prev = _context10.next) {
505
+ switch (_context12.prev = _context12.next) {
454
506
  case 0:
455
507
  id = group.id, tag = group.tag;
456
508
 
457
509
  _rlog["default"].debug("bindGroupResources--id, tag", id, tag);
458
510
 
459
- _context10.next = 4;
511
+ _context12.next = 4;
460
512
  return resourceConfig.updateGroupResources(group, resources);
461
513
 
462
514
  case 4:
463
- _context10.next = 6;
515
+ _context12.next = 6;
464
516
  return editDispatchers.fetchDataByConfig();
465
517
 
466
518
  case 6:
467
- _yield$editDispatcher2 = _context10.sent;
519
+ _yield$editDispatcher2 = _context12.sent;
468
520
  elements = _yield$editDispatcher2.elements;
469
521
  // 区域里的子区域及子区域的节点、新增的链路
470
522
  nodeElements = (0, _topoData.findGroupChildren)(elements, group);
@@ -481,15 +533,15 @@ var useTopoEdit = function useTopoEdit(params) {
481
533
 
482
534
  case 12:
483
535
  case "end":
484
- return _context10.stop();
536
+ return _context12.stop();
485
537
  }
486
538
  }
487
- }, _callee10);
539
+ }, _callee12);
488
540
  }));
489
541
  return _bindGroupResources.apply(this, arguments);
490
542
  }
491
543
 
492
- function addGroupResources(_x4, _x5) {
544
+ function addGroupResources(_x6, _x7) {
493
545
  return _addGroupResources.apply(this, arguments);
494
546
  }
495
547
  /**
@@ -498,11 +550,11 @@ var useTopoEdit = function useTopoEdit(params) {
498
550
 
499
551
 
500
552
  function _addGroupResources() {
501
- _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
553
+ _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
502
554
  var groupConfig, resources, groupData;
503
- return _regenerator["default"].wrap(function _callee11$(_context11) {
555
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
504
556
  while (1) {
505
- switch (_context11.prev = _context11.next) {
557
+ switch (_context13.prev = _context13.next) {
506
558
  case 0:
507
559
  groupConfig = resourceConfig.getGroupConfigByElement(group);
508
560
  resources = {
@@ -512,20 +564,20 @@ var useTopoEdit = function useTopoEdit(params) {
512
564
  id: group.getTag(),
513
565
  tag: group.a("tag")
514
566
  };
515
- _context11.next = 5;
567
+ _context13.next = 5;
516
568
  return bindGroupResources(groupData, resources, newResourceIds);
517
569
 
518
570
  case 5:
519
571
  case "end":
520
- return _context11.stop();
572
+ return _context13.stop();
521
573
  }
522
574
  }
523
- }, _callee11);
575
+ }, _callee13);
524
576
  }));
525
577
  return _addGroupResources.apply(this, arguments);
526
578
  }
527
579
 
528
- function bindViewResources(_x6) {
580
+ function bindViewResources(_x8) {
529
581
  return _bindViewResources.apply(this, arguments);
530
582
  }
531
583
  /**
@@ -537,25 +589,25 @@ var useTopoEdit = function useTopoEdit(params) {
537
589
 
538
590
 
539
591
  function _bindViewResources() {
540
- _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
592
+ _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
541
593
  var config, _yield$editDispatcher3, elements;
542
594
 
543
- return _regenerator["default"].wrap(function _callee12$(_context12) {
595
+ return _regenerator["default"].wrap(function _callee14$(_context14) {
544
596
  while (1) {
545
- switch (_context12.prev = _context12.next) {
597
+ switch (_context14.prev = _context14.next) {
546
598
  case 0:
547
599
  console.log("关联视图的资源", data);
548
600
  config = resourceConfig.getConfig();
549
601
  config.resources = data;
550
- _context12.next = 5;
602
+ _context14.next = 5;
551
603
  return resourceConfig.updateConfig(config);
552
604
 
553
605
  case 5:
554
- _context12.next = 7;
606
+ _context14.next = 7;
555
607
  return editDispatchers.fetchDataByConfig();
556
608
 
557
609
  case 7:
558
- _yield$editDispatcher3 = _context12.sent;
610
+ _yield$editDispatcher3 = _context14.sent;
559
611
  elements = _yield$editDispatcher3.elements;
560
612
  saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
561
613
 
@@ -565,37 +617,37 @@ var useTopoEdit = function useTopoEdit(params) {
565
617
 
566
618
  case 11:
567
619
  case "end":
568
- return _context12.stop();
620
+ return _context14.stop();
569
621
  }
570
622
  }
571
- }, _callee12);
623
+ }, _callee14);
572
624
  }));
573
625
  return _bindViewResources.apply(this, arguments);
574
626
  }
575
627
 
576
- function addLayerResources(_x7, _x8) {
628
+ function addLayerResources(_x9, _x10) {
577
629
  return _addLayerResources.apply(this, arguments);
578
630
  }
579
631
 
580
632
  function _addLayerResources() {
581
- _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
633
+ _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(group, newResourceIds) {
582
634
  var _yield$editDispatcher4, elements, data;
583
635
 
584
- return _regenerator["default"].wrap(function _callee13$(_context13) {
636
+ return _regenerator["default"].wrap(function _callee15$(_context15) {
585
637
  while (1) {
586
- switch (_context13.prev = _context13.next) {
638
+ switch (_context15.prev = _context15.next) {
587
639
  case 0:
588
640
  topo.historyManager.beginTransaction(); // 构造新的配置
589
641
 
590
- _context13.next = 3;
642
+ _context15.next = 3;
591
643
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
592
644
 
593
645
  case 3:
594
- _context13.next = 5;
646
+ _context15.next = 5;
595
647
  return editDispatchers.fetchDataByConfig();
596
648
 
597
649
  case 5:
598
- _yield$editDispatcher4 = _context13.sent;
650
+ _yield$editDispatcher4 = _context15.sent;
599
651
  elements = _yield$editDispatcher4.elements;
600
652
  // 过滤出新增的资源和链路
601
653
  data = {
@@ -610,7 +662,7 @@ var useTopoEdit = function useTopoEdit(params) {
610
662
  })
611
663
  }; // 添加到分层
612
664
 
613
- _context13.next = 10;
665
+ _context15.next = 10;
614
666
  return topo.updateElements(data);
615
667
 
616
668
  case 10:
@@ -623,35 +675,35 @@ var useTopoEdit = function useTopoEdit(params) {
623
675
 
624
676
  case 12:
625
677
  case "end":
626
- return _context13.stop();
678
+ return _context15.stop();
627
679
  }
628
680
  }
629
- }, _callee13);
681
+ }, _callee15);
630
682
  }));
631
683
  return _addLayerResources.apply(this, arguments);
632
684
  }
633
685
 
634
- function addResourceToFirstLayer(_x9) {
686
+ function addResourceToFirstLayer(_x11) {
635
687
  return _addResourceToFirstLayer.apply(this, arguments);
636
688
  }
637
689
 
638
690
  function _addResourceToFirstLayer() {
639
- _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
691
+ _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(data) {
640
692
  var group;
641
- return _regenerator["default"].wrap(function _callee14$(_context14) {
693
+ return _regenerator["default"].wrap(function _callee16$(_context16) {
642
694
  while (1) {
643
- switch (_context14.prev = _context14.next) {
695
+ switch (_context16.prev = _context16.next) {
644
696
  case 0:
645
697
  group = resourceConfig.getGroups()[0];
646
- _context14.next = 3;
698
+ _context16.next = 3;
647
699
  return addLayerResources(group, data);
648
700
 
649
701
  case 3:
650
702
  case "end":
651
- return _context14.stop();
703
+ return _context16.stop();
652
704
  }
653
705
  }
654
- }, _callee14);
706
+ }, _callee16);
655
707
  }));
656
708
  return _addResourceToFirstLayer.apply(this, arguments);
657
709
  }
@@ -677,29 +729,29 @@ var useTopoEdit = function useTopoEdit(params) {
677
729
  }
678
730
 
679
731
  var onSaveComboRes = /*#__PURE__*/function () {
680
- var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
681
- return _regenerator["default"].wrap(function _callee5$(_context5) {
732
+ var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(data) {
733
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
682
734
  while (1) {
683
- switch (_context5.prev = _context5.next) {
735
+ switch (_context7.prev = _context7.next) {
684
736
  case 0:
685
737
  _rlog["default"].debug("关联资源-----onSaveComboRes", data);
686
738
 
687
739
  topo.historyManager.beginTransaction();
688
740
 
689
741
  if (!(getAddResourceType() === "addToFirstLayer")) {
690
- _context5.next = 7;
742
+ _context7.next = 7;
691
743
  break;
692
744
  }
693
745
 
694
- _context5.next = 5;
746
+ _context7.next = 5;
695
747
  return addResourceToFirstLayer(data);
696
748
 
697
749
  case 5:
698
- _context5.next = 9;
750
+ _context7.next = 9;
699
751
  break;
700
752
 
701
753
  case 7:
702
- _context5.next = 9;
754
+ _context7.next = 9;
703
755
  return bindViewResources(data);
704
756
 
705
757
  case 9:
@@ -707,43 +759,43 @@ var useTopoEdit = function useTopoEdit(params) {
707
759
 
708
760
  case 10:
709
761
  case "end":
710
- return _context5.stop();
762
+ return _context7.stop();
711
763
  }
712
764
  }
713
- }, _callee5);
765
+ }, _callee7);
714
766
  }));
715
767
 
716
- return function onSaveComboRes(_x10) {
717
- return _ref4.apply(this, arguments);
768
+ return function onSaveComboRes(_x12) {
769
+ return _ref6.apply(this, arguments);
718
770
  };
719
771
  }();
720
772
 
721
- function checkSavePermission(_x11) {
773
+ function checkSavePermission(_x13) {
722
774
  return _checkSavePermission.apply(this, arguments);
723
775
  }
724
776
 
725
777
  function _checkSavePermission() {
726
- _checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(id) {
778
+ _checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(id) {
727
779
  var permission;
728
- return _regenerator["default"].wrap(function _callee15$(_context15) {
780
+ return _regenerator["default"].wrap(function _callee17$(_context17) {
729
781
  while (1) {
730
- switch (_context15.prev = _context15.next) {
782
+ switch (_context17.prev = _context17.next) {
731
783
  case 0:
732
- _context15.next = 2;
784
+ _context17.next = 2;
733
785
  return topoDispatchers.getTopoPermission({
734
786
  id: id,
735
787
  update: false
736
788
  });
737
789
 
738
790
  case 2:
739
- permission = _context15.sent;
791
+ permission = _context17.sent;
740
792
 
741
793
  if (!_topoPermissionUtil["default"].isEditable(permission)) {
742
- _context15.next = 5;
794
+ _context17.next = 5;
743
795
  break;
744
796
  }
745
797
 
746
- return _context15.abrupt("return", true);
798
+ return _context17.abrupt("return", true);
747
799
 
748
800
  case 5:
749
801
  _dialog["default"].alert({
@@ -755,42 +807,42 @@ var useTopoEdit = function useTopoEdit(params) {
755
807
  onOk: function onOk() {}
756
808
  });
757
809
 
758
- return _context15.abrupt("return", false);
810
+ return _context17.abrupt("return", false);
759
811
 
760
812
  case 7:
761
813
  case "end":
762
- return _context15.stop();
814
+ return _context17.stop();
763
815
  }
764
816
  }
765
- }, _callee15);
817
+ }, _callee17);
766
818
  }));
767
819
  return _checkSavePermission.apply(this, arguments);
768
820
  }
769
821
 
770
822
  var onSaveTopo = /*#__PURE__*/function () {
771
- var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(data) {
823
+ var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data) {
772
824
  var id, config, serialize, _config$layout, template, layout, saveConfig, valid, saveData;
773
825
 
774
- return _regenerator["default"].wrap(function _callee7$(_context7) {
826
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
775
827
  while (1) {
776
- switch (_context7.prev = _context7.next) {
828
+ switch (_context9.prev = _context9.next) {
777
829
  case 0:
778
830
  id = data.id, config = data.config, serialize = data.serialize;
779
831
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
780
832
 
781
833
  if (!onSave) {
782
- _context7.next = 6;
834
+ _context9.next = 6;
783
835
  break;
784
836
  }
785
837
 
786
838
  // 自定义保存
787
839
  saveConfig = /*#__PURE__*/function () {
788
- var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
789
- return _regenerator["default"].wrap(function _callee6$(_context6) {
840
+ var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
841
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
790
842
  while (1) {
791
- switch (_context6.prev = _context6.next) {
843
+ switch (_context8.prev = _context8.next) {
792
844
  case 0:
793
- _context6.next = 2;
845
+ _context8.next = 2;
794
846
  return editDispatchers.saveTopo({
795
847
  id: id,
796
848
  layout: layout,
@@ -799,14 +851,14 @@ var useTopoEdit = function useTopoEdit(params) {
799
851
 
800
852
  case 2:
801
853
  case "end":
802
- return _context6.stop();
854
+ return _context8.stop();
803
855
  }
804
856
  }
805
- }, _callee6);
857
+ }, _callee8);
806
858
  }));
807
859
 
808
860
  return function saveConfig() {
809
- return _ref6.apply(this, arguments);
861
+ return _ref8.apply(this, arguments);
810
862
  };
811
863
  }();
812
864
 
@@ -814,7 +866,7 @@ var useTopoEdit = function useTopoEdit(params) {
814
866
  data: data,
815
867
  saveConfig: saveConfig
816
868
  });
817
- return _context7.abrupt("return");
869
+ return _context9.abrupt("return");
818
870
 
819
871
  case 6:
820
872
  // TODO 以下逻辑移到拓扑中心
@@ -822,21 +874,21 @@ var useTopoEdit = function useTopoEdit(params) {
822
874
  saving: true
823
875
  }); // 检查权限
824
876
 
825
- _context7.next = 9;
877
+ _context9.next = 9;
826
878
  return checkSavePermission(id);
827
879
 
828
880
  case 9:
829
- valid = _context7.sent;
881
+ valid = _context9.sent;
830
882
 
831
883
  if (valid) {
832
- _context7.next = 13;
884
+ _context9.next = 13;
833
885
  break;
834
886
  }
835
887
 
836
888
  topoEditDispatchers.update({
837
889
  saving: false
838
890
  });
839
- return _context7.abrupt("return");
891
+ return _context9.abrupt("return");
840
892
 
841
893
  case 13:
842
894
  // 保存
@@ -848,7 +900,7 @@ var useTopoEdit = function useTopoEdit(params) {
848
900
 
849
901
  _rlog["default"].info("保存", saveData);
850
902
 
851
- _context7.next = 17;
903
+ _context9.next = 17;
852
904
  return editDispatchers.saveTopo(saveData);
853
905
 
854
906
  case 17:
@@ -860,14 +912,14 @@ var useTopoEdit = function useTopoEdit(params) {
860
912
 
861
913
  case 19:
862
914
  case "end":
863
- return _context7.stop();
915
+ return _context9.stop();
864
916
  }
865
917
  }
866
- }, _callee7);
918
+ }, _callee9);
867
919
  }));
868
920
 
869
- return function onSaveTopo(_x12) {
870
- return _ref5.apply(this, arguments);
921
+ return function onSaveTopo(_x14) {
922
+ return _ref7.apply(this, arguments);
871
923
  };
872
924
  }();
873
925
 
@@ -895,12 +947,12 @@ var useTopoEdit = function useTopoEdit(params) {
895
947
 
896
948
 
897
949
  var bindNodeResource = /*#__PURE__*/function () {
898
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(params) {
950
+ var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(params) {
899
951
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
900
952
 
901
- return _regenerator["default"].wrap(function _callee9$(_context9) {
953
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
902
954
  while (1) {
903
- switch (_context9.prev = _context9.next) {
955
+ switch (_context11.prev = _context11.next) {
904
956
  case 0:
905
957
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
906
958
  return (0, _extends2["default"])({}, resources, {
@@ -911,11 +963,11 @@ var useTopoEdit = function useTopoEdit(params) {
911
963
  };
912
964
 
913
965
  _doBind = function _doBind3() {
914
- _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
966
+ _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
915
967
  var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
916
- return _regenerator["default"].wrap(function _callee8$(_context8) {
968
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
917
969
  while (1) {
918
- switch (_context8.prev = _context8.next) {
970
+ switch (_context10.prev = _context10.next) {
919
971
  case 0:
920
972
  dm = htTopo.getGraphView().dm(); // 创建
921
973
 
@@ -985,7 +1037,7 @@ var useTopoEdit = function useTopoEdit(params) {
985
1037
  // node.a("customName", null);
986
1038
  // 删除关联在节点上的出口链路
987
1039
 
988
- _context8.next = 12;
1040
+ _context10.next = 12;
989
1041
  return deleteExLink(node);
990
1042
 
991
1043
  case 12:
@@ -996,10 +1048,10 @@ var useTopoEdit = function useTopoEdit(params) {
996
1048
 
997
1049
  case 13:
998
1050
  case "end":
999
- return _context8.stop();
1051
+ return _context10.stop();
1000
1052
  }
1001
1053
  }
1002
- }, _callee8);
1054
+ }, _callee10);
1003
1055
  }));
1004
1056
  return _doBind.apply(this, arguments);
1005
1057
  };
@@ -1041,22 +1093,22 @@ var useTopoEdit = function useTopoEdit(params) {
1041
1093
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
1042
1094
  }
1043
1095
 
1044
- _context9.next = 13;
1096
+ _context11.next = 13;
1045
1097
  return resourceConfig.updateConfig(config);
1046
1098
 
1047
1099
  case 13:
1048
- _context9.next = 15;
1100
+ _context11.next = 15;
1049
1101
  return editDispatchers.fetchDataByConfig();
1050
1102
 
1051
1103
  case 15:
1052
- _yield$editDispatcher = _context9.sent;
1104
+ _yield$editDispatcher = _context11.sent;
1053
1105
  elements = _yield$editDispatcher.elements;
1054
1106
  newData = elements.find(function (item) {
1055
1107
  return item.id === newResId;
1056
1108
  });
1057
1109
 
1058
1110
  if (newData) {
1059
- _context9.next = 23;
1111
+ _context11.next = 23;
1060
1112
  break;
1061
1113
  }
1062
1114
 
@@ -1065,10 +1117,10 @@ var useTopoEdit = function useTopoEdit(params) {
1065
1117
  _rlog["default"].warn("关联资源失败");
1066
1118
 
1067
1119
  topo.historyManager.endTransaction();
1068
- return _context9.abrupt("return", false);
1120
+ return _context11.abrupt("return", false);
1069
1121
 
1070
1122
  case 23:
1071
- _context9.next = 25;
1123
+ _context11.next = 25;
1072
1124
  return doBind();
1073
1125
 
1074
1126
  case 25:
@@ -1076,14 +1128,14 @@ var useTopoEdit = function useTopoEdit(params) {
1076
1128
 
1077
1129
  case 26:
1078
1130
  case "end":
1079
- return _context9.stop();
1131
+ return _context11.stop();
1080
1132
  }
1081
1133
  }
1082
- }, _callee9);
1134
+ }, _callee11);
1083
1135
  }));
1084
1136
 
1085
- return function bindNodeResource(_x13) {
1086
- return _ref7.apply(this, arguments);
1137
+ return function bindNodeResource(_x15) {
1138
+ return _ref9.apply(this, arguments);
1087
1139
  };
1088
1140
  }();
1089
1141