@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.
- package/build/1.js +1 -1
- package/build/index.js +11 -11
- package/es/core/hooks/useTopoEdit.js +160 -152
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +1 -1
- package/es/core/store/models/topoConfig.js +1 -1
- package/lib/core/hooks/useTopoEdit.js +165 -152
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +1 -1
- package/lib/core/store/models/topoConfig.js +1 -1
- package/package.json +2 -2
@@ -1,9 +1,10 @@
|
|
1
1
|
import _Message from "@alifd/next/es/message";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _Button from "@alifd/next/es/button";
|
3
4
|
import _Dialog from "@alifd/next/es/dialog";
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
5
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
6
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
7
8
|
import _ from "lodash";
|
8
9
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
9
10
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
@@ -202,7 +203,48 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
202
203
|
return onOk;
|
203
204
|
}()
|
204
205
|
});
|
205
|
-
};
|
206
|
+
}; // const deleteGroupFooterBtn = () => {
|
207
|
+
// return (
|
208
|
+
// <div>
|
209
|
+
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
210
|
+
// 仅删除区域
|
211
|
+
// </Button>
|
212
|
+
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
213
|
+
// 确定
|
214
|
+
// </Button>
|
215
|
+
// </div>
|
216
|
+
// );
|
217
|
+
// };
|
218
|
+
// const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
|
219
|
+
// function doDeleteOnlyGroup(data,group) {
|
220
|
+
// topo.historyManager.beginTransaction();
|
221
|
+
// console.log("仅删除区域", topo.view.topoClient, data);
|
222
|
+
// const children = getGroupChildren(group);
|
223
|
+
// children.map((child) => {
|
224
|
+
// child.setParent(null);
|
225
|
+
// // var viewRect = topo.getGraphView().getViewRect();
|
226
|
+
// // var nodeRect = child.getRect();
|
227
|
+
// // child.setPosition(
|
228
|
+
// // viewRect.x + nodeRect.width + 2,
|
229
|
+
// // viewRect.y + nodeRect.height + 4
|
230
|
+
// // ); // 解决集群从区域内移出时,连线位置未更新的问题
|
231
|
+
// setTimeout(function () {
|
232
|
+
// child.iv();
|
233
|
+
// topo.historyManager.endTransaction();
|
234
|
+
// }, 50);
|
235
|
+
// });
|
236
|
+
// topo.view.topoClient.deleteGroup(data);
|
237
|
+
// topo.historyManager.endTransaction();
|
238
|
+
// setGroupDeleteVisible(false);
|
239
|
+
// // console.log("仅删除区域", children, group);
|
240
|
+
// }
|
241
|
+
// function doDelete(data) {
|
242
|
+
// topo.historyManager.beginTransaction();
|
243
|
+
// // FIXME 。如果命中其他的动态条件,则立即显示
|
244
|
+
// topo.view.topoClient.deleteGroup(data);
|
245
|
+
// setGroupDeleteVisible(false);
|
246
|
+
// }
|
247
|
+
|
206
248
|
/**
|
207
249
|
* 删除容器。
|
208
250
|
*
|
@@ -223,75 +265,39 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
223
265
|
}
|
224
266
|
|
225
267
|
if (!getGroupChildren(group).filter(isResourceElement).length || isClusterHtElement(group)) {
|
226
|
-
doDelete();
|
268
|
+
doDelete(data);
|
227
269
|
return;
|
228
270
|
} // 有子节点时需要确认
|
229
271
|
|
230
272
|
|
231
|
-
_Dialog.
|
273
|
+
var gdialog = _Dialog.show({
|
232
274
|
title: "删除",
|
233
275
|
// content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
|
234
276
|
content: "是否仅删除区域或将区域包含的内容一同删除?",
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
277
|
+
footer: [/*#__PURE__*/React.createElement(_Button, {
|
278
|
+
type: "normal",
|
279
|
+
onClick: doDeleteOnlyGroup,
|
280
|
+
style: {
|
281
|
+
marginRight: "15px"
|
282
|
+
}
|
283
|
+
}, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/React.createElement(_Button, {
|
284
|
+
type: "normal",
|
285
|
+
onClick: doDelete
|
286
|
+
}, "\u5168\u90E8\u5220\u9664")],
|
287
|
+
// okProps: {
|
288
|
+
// children: "仅删除区域",
|
289
|
+
// type: "normal",
|
290
|
+
// className: "next-btn-normal",
|
291
|
+
// },
|
292
|
+
// cancelProps: { children: "全部删除" },
|
243
293
|
messageProps: {
|
244
294
|
type: "warning"
|
245
|
-
}
|
246
|
-
onOk: function () {
|
247
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
248
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
249
|
-
while (1) {
|
250
|
-
switch (_context4.prev = _context4.next) {
|
251
|
-
case 0:
|
252
|
-
doDeleteOnlyGroup();
|
253
|
-
|
254
|
-
case 1:
|
255
|
-
case "end":
|
256
|
-
return _context4.stop();
|
257
|
-
}
|
258
|
-
}
|
259
|
-
}, _callee4);
|
260
|
-
}));
|
261
|
-
|
262
|
-
function onOk() {
|
263
|
-
return _onOk2.apply(this, arguments);
|
264
|
-
}
|
265
|
-
|
266
|
-
return onOk;
|
267
|
-
}(),
|
268
|
-
onCancel: function () {
|
269
|
-
var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
270
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
271
|
-
while (1) {
|
272
|
-
switch (_context5.prev = _context5.next) {
|
273
|
-
case 0:
|
274
|
-
doDelete();
|
275
|
-
|
276
|
-
case 1:
|
277
|
-
case "end":
|
278
|
-
return _context5.stop();
|
279
|
-
}
|
280
|
-
}
|
281
|
-
}, _callee5);
|
282
|
-
}));
|
283
|
-
|
284
|
-
function onCancel() {
|
285
|
-
return _onCancel.apply(this, arguments);
|
286
|
-
}
|
287
|
-
|
288
|
-
return onCancel;
|
289
|
-
}()
|
295
|
+
}
|
290
296
|
});
|
291
297
|
|
292
298
|
function doDeleteOnlyGroup() {
|
293
|
-
topo.historyManager.beginTransaction();
|
294
|
-
|
299
|
+
topo.historyManager.beginTransaction();
|
300
|
+
console.log("仅删除区域", topo.view.topoClient, data);
|
295
301
|
var children = getGroupChildren(group);
|
296
302
|
children.map(function (child) {
|
297
303
|
child.setParent(null); // var viewRect = topo.getGraphView().getViewRect();
|
@@ -307,13 +313,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
307
313
|
}, 50);
|
308
314
|
});
|
309
315
|
topo.view.topoClient.deleteGroup(data);
|
310
|
-
topo.historyManager.endTransaction();
|
316
|
+
topo.historyManager.endTransaction();
|
317
|
+
gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide(); // console.log("仅删除区域", children, group);
|
311
318
|
}
|
312
319
|
|
313
320
|
function doDelete() {
|
314
321
|
topo.historyManager.beginTransaction(); // FIXME 。如果命中其他的动态条件,则立即显示
|
315
322
|
|
316
323
|
topo.view.topoClient.deleteGroup(data);
|
324
|
+
gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
|
317
325
|
}
|
318
326
|
};
|
319
327
|
|
@@ -344,20 +352,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
344
352
|
|
345
353
|
|
346
354
|
var deleteExLink = /*#__PURE__*/function () {
|
347
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
355
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
|
348
356
|
var _node$getEdges$toArra, _node$getEdges;
|
349
357
|
|
350
358
|
var config, edges, exportLinkIdList;
|
351
|
-
return _regeneratorRuntime.wrap(function
|
359
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
352
360
|
while (1) {
|
353
|
-
switch (
|
361
|
+
switch (_context4.prev = _context4.next) {
|
354
362
|
case 0:
|
355
363
|
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
356
364
|
|
357
365
|
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 = [];
|
358
366
|
|
359
367
|
if (!(edges.length > 0)) {
|
360
|
-
|
368
|
+
_context4.next = 8;
|
361
369
|
break;
|
362
370
|
}
|
363
371
|
|
@@ -371,15 +379,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
371
379
|
}
|
372
380
|
});
|
373
381
|
config.exportLinkIdList = exportLinkIdList;
|
374
|
-
|
382
|
+
_context4.next = 8;
|
375
383
|
return resourceConfig.updateConfig(config);
|
376
384
|
|
377
385
|
case 8:
|
378
386
|
case "end":
|
379
|
-
return
|
387
|
+
return _context4.stop();
|
380
388
|
}
|
381
389
|
}
|
382
|
-
},
|
390
|
+
}, _callee4);
|
383
391
|
}));
|
384
392
|
|
385
393
|
return function deleteExLink(_x3) {
|
@@ -464,25 +472,25 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
464
472
|
}
|
465
473
|
|
466
474
|
function _bindGroupResources() {
|
467
|
-
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
475
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(group, resources) {
|
468
476
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
469
477
|
|
470
|
-
return _regeneratorRuntime.wrap(function
|
478
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
471
479
|
while (1) {
|
472
|
-
switch (
|
480
|
+
switch (_context10.prev = _context10.next) {
|
473
481
|
case 0:
|
474
482
|
id = group.id, tag = group.tag;
|
475
483
|
rlog.debug("bindGroupResources--id, tag", id, tag);
|
476
484
|
topo.historyManager.beginTransaction();
|
477
|
-
|
485
|
+
_context10.next = 5;
|
478
486
|
return resourceConfig.updateGroupResources(group, resources);
|
479
487
|
|
480
488
|
case 5:
|
481
|
-
|
489
|
+
_context10.next = 7;
|
482
490
|
return editDispatchers.fetchDataByConfig();
|
483
491
|
|
484
492
|
case 7:
|
485
|
-
_yield$editDispatcher2 =
|
493
|
+
_yield$editDispatcher2 = _context10.sent;
|
486
494
|
elements = _yield$editDispatcher2.elements;
|
487
495
|
// 区域里的子区域及子区域的节点、新增的链路
|
488
496
|
nodeElements = findGroupChildren(elements, group);
|
@@ -501,10 +509,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
501
509
|
|
502
510
|
case 14:
|
503
511
|
case "end":
|
504
|
-
return
|
512
|
+
return _context10.stop();
|
505
513
|
}
|
506
514
|
}
|
507
|
-
},
|
515
|
+
}, _callee10);
|
508
516
|
}));
|
509
517
|
return _bindGroupResources.apply(this, arguments);
|
510
518
|
}
|
@@ -518,11 +526,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
518
526
|
|
519
527
|
|
520
528
|
function _addGroupResources() {
|
521
|
-
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
529
|
+
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, newResourceIds) {
|
522
530
|
var groupConfig, resources, groupData;
|
523
|
-
return _regeneratorRuntime.wrap(function
|
531
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
524
532
|
while (1) {
|
525
|
-
switch (
|
533
|
+
switch (_context11.prev = _context11.next) {
|
526
534
|
case 0:
|
527
535
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
528
536
|
resources = {
|
@@ -532,15 +540,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
532
540
|
id: group.getTag(),
|
533
541
|
tag: group.a("tag")
|
534
542
|
};
|
535
|
-
|
543
|
+
_context11.next = 5;
|
536
544
|
return bindGroupResources(groupData, resources, newResourceIds);
|
537
545
|
|
538
546
|
case 5:
|
539
547
|
case "end":
|
540
|
-
return
|
548
|
+
return _context11.stop();
|
541
549
|
}
|
542
550
|
}
|
543
|
-
},
|
551
|
+
}, _callee11);
|
544
552
|
}));
|
545
553
|
return _addGroupResources.apply(this, arguments);
|
546
554
|
}
|
@@ -557,25 +565,25 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
557
565
|
|
558
566
|
|
559
567
|
function _bindViewResources() {
|
560
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
568
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
|
561
569
|
var config, _yield$editDispatcher3, elements;
|
562
570
|
|
563
|
-
return _regeneratorRuntime.wrap(function
|
571
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
564
572
|
while (1) {
|
565
|
-
switch (
|
573
|
+
switch (_context12.prev = _context12.next) {
|
566
574
|
case 0:
|
567
575
|
// console.log("关联视图的资源", data);
|
568
576
|
config = resourceConfig.getConfig();
|
569
577
|
config.resources = data;
|
570
|
-
|
578
|
+
_context12.next = 4;
|
571
579
|
return resourceConfig.updateConfig(config);
|
572
580
|
|
573
581
|
case 4:
|
574
|
-
|
582
|
+
_context12.next = 6;
|
575
583
|
return editDispatchers.fetchDataByConfig();
|
576
584
|
|
577
585
|
case 6:
|
578
|
-
_yield$editDispatcher3 =
|
586
|
+
_yield$editDispatcher3 = _context12.sent;
|
579
587
|
elements = _yield$editDispatcher3.elements;
|
580
588
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
581
589
|
|
@@ -585,10 +593,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
585
593
|
|
586
594
|
case 10:
|
587
595
|
case "end":
|
588
|
-
return
|
596
|
+
return _context12.stop();
|
589
597
|
}
|
590
598
|
}
|
591
|
-
},
|
599
|
+
}, _callee12);
|
592
600
|
}));
|
593
601
|
return _bindViewResources.apply(this, arguments);
|
594
602
|
}
|
@@ -598,24 +606,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
598
606
|
}
|
599
607
|
|
600
608
|
function _addLayerResources() {
|
601
|
-
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
609
|
+
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
|
602
610
|
var _yield$editDispatcher4, elements, newElements;
|
603
611
|
|
604
|
-
return _regeneratorRuntime.wrap(function
|
612
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
605
613
|
while (1) {
|
606
|
-
switch (
|
614
|
+
switch (_context13.prev = _context13.next) {
|
607
615
|
case 0:
|
608
616
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
609
617
|
|
610
|
-
|
618
|
+
_context13.next = 3;
|
611
619
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
612
620
|
|
613
621
|
case 3:
|
614
|
-
|
622
|
+
_context13.next = 5;
|
615
623
|
return editDispatchers.fetchDataByConfig();
|
616
624
|
|
617
625
|
case 5:
|
618
|
-
_yield$editDispatcher4 =
|
626
|
+
_yield$editDispatcher4 = _context13.sent;
|
619
627
|
elements = _yield$editDispatcher4.elements;
|
620
628
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
621
629
|
newElements = findUNExistedElements(elements);
|
@@ -638,10 +646,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
638
646
|
|
639
647
|
case 14:
|
640
648
|
case "end":
|
641
|
-
return
|
649
|
+
return _context13.stop();
|
642
650
|
}
|
643
651
|
}
|
644
|
-
},
|
652
|
+
}, _callee13);
|
645
653
|
}));
|
646
654
|
return _addLayerResources.apply(this, arguments);
|
647
655
|
}
|
@@ -651,22 +659,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
651
659
|
}
|
652
660
|
|
653
661
|
function _addResourceToFirstLayer() {
|
654
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
662
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
|
655
663
|
var group;
|
656
|
-
return _regeneratorRuntime.wrap(function
|
664
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
657
665
|
while (1) {
|
658
|
-
switch (
|
666
|
+
switch (_context14.prev = _context14.next) {
|
659
667
|
case 0:
|
660
668
|
group = resourceConfig.getGroups()[0];
|
661
|
-
|
669
|
+
_context14.next = 3;
|
662
670
|
return addLayerResources(group, data);
|
663
671
|
|
664
672
|
case 3:
|
665
673
|
case "end":
|
666
|
-
return
|
674
|
+
return _context14.stop();
|
667
675
|
}
|
668
676
|
}
|
669
|
-
},
|
677
|
+
}, _callee14);
|
670
678
|
}));
|
671
679
|
return _addResourceToFirstLayer.apply(this, arguments);
|
672
680
|
}
|
@@ -698,28 +706,28 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
698
706
|
|
699
707
|
|
700
708
|
var onSaveComboRes = /*#__PURE__*/function () {
|
701
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
702
|
-
return _regeneratorRuntime.wrap(function
|
709
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
710
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
703
711
|
while (1) {
|
704
|
-
switch (
|
712
|
+
switch (_context5.prev = _context5.next) {
|
705
713
|
case 0:
|
706
714
|
rlog.debug("关联资源-----onSaveComboRes", data);
|
707
715
|
topo.historyManager.beginTransaction();
|
708
716
|
|
709
717
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
710
|
-
|
718
|
+
_context5.next = 7;
|
711
719
|
break;
|
712
720
|
}
|
713
721
|
|
714
|
-
|
722
|
+
_context5.next = 5;
|
715
723
|
return addResourceToFirstLayer(data);
|
716
724
|
|
717
725
|
case 5:
|
718
|
-
|
726
|
+
_context5.next = 9;
|
719
727
|
break;
|
720
728
|
|
721
729
|
case 7:
|
722
|
-
|
730
|
+
_context5.next = 9;
|
723
731
|
return bindViewResources(data);
|
724
732
|
|
725
733
|
case 9:
|
@@ -731,10 +739,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
731
739
|
|
732
740
|
case 12:
|
733
741
|
case "end":
|
734
|
-
return
|
742
|
+
return _context5.stop();
|
735
743
|
}
|
736
744
|
}
|
737
|
-
},
|
745
|
+
}, _callee5);
|
738
746
|
}));
|
739
747
|
|
740
748
|
return function onSaveComboRes(_x12) {
|
@@ -743,12 +751,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
743
751
|
}();
|
744
752
|
|
745
753
|
var onSaveTopo = /*#__PURE__*/function () {
|
746
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
754
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
747
755
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
748
756
|
|
749
|
-
return _regeneratorRuntime.wrap(function
|
757
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
750
758
|
while (1) {
|
751
|
-
switch (
|
759
|
+
switch (_context7.prev = _context7.next) {
|
752
760
|
case 0:
|
753
761
|
id = data.id, config = data.config, serialize = data.serialize;
|
754
762
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
@@ -756,12 +764,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
756
764
|
if (onSave) {
|
757
765
|
// 自定义保存
|
758
766
|
saveConfig = /*#__PURE__*/function () {
|
759
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
760
|
-
return _regeneratorRuntime.wrap(function
|
767
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
768
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
761
769
|
while (1) {
|
762
|
-
switch (
|
770
|
+
switch (_context6.prev = _context6.next) {
|
763
771
|
case 0:
|
764
|
-
|
772
|
+
_context6.next = 2;
|
765
773
|
return editDispatchers.saveTopo({
|
766
774
|
id: id,
|
767
775
|
layout: layout,
|
@@ -770,10 +778,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
770
778
|
|
771
779
|
case 2:
|
772
780
|
case "end":
|
773
|
-
return
|
781
|
+
return _context6.stop();
|
774
782
|
}
|
775
783
|
}
|
776
|
-
},
|
784
|
+
}, _callee6);
|
777
785
|
}));
|
778
786
|
|
779
787
|
return function saveConfig() {
|
@@ -790,10 +798,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
790
798
|
|
791
799
|
case 3:
|
792
800
|
case "end":
|
793
|
-
return
|
801
|
+
return _context7.stop();
|
794
802
|
}
|
795
803
|
}
|
796
|
-
},
|
804
|
+
}, _callee7);
|
797
805
|
}));
|
798
806
|
|
799
807
|
return function onSaveTopo(_x13) {
|
@@ -823,12 +831,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
823
831
|
|
824
832
|
|
825
833
|
var bindNodeResource = /*#__PURE__*/function () {
|
826
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
834
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(params) {
|
827
835
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
828
836
|
|
829
|
-
return _regeneratorRuntime.wrap(function
|
837
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
830
838
|
while (1) {
|
831
|
-
switch (
|
839
|
+
switch (_context9.prev = _context9.next) {
|
832
840
|
case 0:
|
833
841
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
834
842
|
return _extends({}, resources, {
|
@@ -839,11 +847,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
839
847
|
};
|
840
848
|
|
841
849
|
_doBind = function _doBind3() {
|
842
|
-
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
850
|
+
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
843
851
|
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
844
|
-
return _regeneratorRuntime.wrap(function
|
852
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
845
853
|
while (1) {
|
846
|
-
switch (
|
854
|
+
switch (_context8.prev = _context8.next) {
|
847
855
|
case 0:
|
848
856
|
dm = htTopo.getGraphView().dm(); // 创建
|
849
857
|
|
@@ -912,7 +920,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
912
920
|
// node.a("customName", null);
|
913
921
|
// 删除关联在节点上的出口链路
|
914
922
|
|
915
|
-
|
923
|
+
_context8.next = 12;
|
916
924
|
return deleteExLink(node);
|
917
925
|
|
918
926
|
case 12:
|
@@ -923,10 +931,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
923
931
|
|
924
932
|
case 13:
|
925
933
|
case "end":
|
926
|
-
return
|
934
|
+
return _context8.stop();
|
927
935
|
}
|
928
936
|
}
|
929
|
-
},
|
937
|
+
}, _callee8);
|
930
938
|
}));
|
931
939
|
return _doBind.apply(this, arguments);
|
932
940
|
};
|
@@ -966,22 +974,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
966
974
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
967
975
|
}
|
968
976
|
|
969
|
-
|
977
|
+
_context9.next = 13;
|
970
978
|
return resourceConfig.updateConfig(config);
|
971
979
|
|
972
980
|
case 13:
|
973
|
-
|
981
|
+
_context9.next = 15;
|
974
982
|
return editDispatchers.fetchDataByConfig();
|
975
983
|
|
976
984
|
case 15:
|
977
|
-
_yield$editDispatcher =
|
985
|
+
_yield$editDispatcher = _context9.sent;
|
978
986
|
elements = _yield$editDispatcher.elements;
|
979
987
|
newData = elements.find(function (item) {
|
980
988
|
return item.id === newResId;
|
981
989
|
});
|
982
990
|
|
983
991
|
if (newData) {
|
984
|
-
|
992
|
+
_context9.next = 23;
|
985
993
|
break;
|
986
994
|
}
|
987
995
|
|
@@ -989,10 +997,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
989
997
|
|
990
998
|
rlog.warn("关联资源失败");
|
991
999
|
topo.historyManager.endTransaction();
|
992
|
-
return
|
1000
|
+
return _context9.abrupt("return", false);
|
993
1001
|
|
994
1002
|
case 23:
|
995
|
-
|
1003
|
+
_context9.next = 25;
|
996
1004
|
return doBind();
|
997
1005
|
|
998
1006
|
case 25:
|
@@ -1000,10 +1008,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1000
1008
|
|
1001
1009
|
case 26:
|
1002
1010
|
case "end":
|
1003
|
-
return
|
1011
|
+
return _context9.stop();
|
1004
1012
|
}
|
1005
1013
|
}
|
1006
|
-
},
|
1014
|
+
}, _callee9);
|
1007
1015
|
}));
|
1008
1016
|
|
1009
1017
|
return function bindNodeResource(_x14) {
|
@@ -1020,19 +1028,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1020
1028
|
}
|
1021
1029
|
|
1022
1030
|
function _relateNodeIp() {
|
1023
|
-
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
1031
|
+
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
1024
1032
|
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1025
1033
|
|
1026
|
-
return _regeneratorRuntime.wrap(function
|
1034
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
1027
1035
|
while (1) {
|
1028
|
-
switch (
|
1036
|
+
switch (_context15.prev = _context15.next) {
|
1029
1037
|
case 0:
|
1030
1038
|
if (txtValue) {
|
1031
|
-
|
1039
|
+
_context15.next = 2;
|
1032
1040
|
break;
|
1033
1041
|
}
|
1034
1042
|
|
1035
|
-
return
|
1043
|
+
return _context15.abrupt("return");
|
1036
1044
|
|
1037
1045
|
case 2:
|
1038
1046
|
// if (txtValue === nodeElement.a('bindIp')) {
|
@@ -1044,12 +1052,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1044
1052
|
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1045
1053
|
|
1046
1054
|
if (!isUnique) {
|
1047
|
-
|
1055
|
+
_context15.next = 23;
|
1048
1056
|
break;
|
1049
1057
|
}
|
1050
1058
|
|
1051
1059
|
ip = buildIpNode(txtValue);
|
1052
|
-
|
1060
|
+
_context15.next = 8;
|
1053
1061
|
return deleteExLink(nodeElement);
|
1054
1062
|
|
1055
1063
|
case 8:
|
@@ -1058,15 +1066,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1058
1066
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1059
1067
|
|
1060
1068
|
configObj = topo.resourceConfig.getConfig();
|
1061
|
-
|
1069
|
+
_context15.next = 14;
|
1062
1070
|
return resourceConfig.updateConfig(configObj);
|
1063
1071
|
|
1064
1072
|
case 14:
|
1065
|
-
|
1073
|
+
_context15.next = 16;
|
1066
1074
|
return editDispatchers.fetchDataByConfig();
|
1067
1075
|
|
1068
1076
|
case 16:
|
1069
|
-
configData =
|
1077
|
+
configData = _context15.sent;
|
1070
1078
|
// console.log("configData",configObj, configData);
|
1071
1079
|
_elements = configData.elements;
|
1072
1080
|
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
@@ -1094,10 +1102,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1094
1102
|
|
1095
1103
|
case 23:
|
1096
1104
|
case "end":
|
1097
|
-
return
|
1105
|
+
return _context15.stop();
|
1098
1106
|
}
|
1099
1107
|
}
|
1100
|
-
},
|
1108
|
+
}, _callee15);
|
1101
1109
|
}));
|
1102
1110
|
return _relateNodeIp.apply(this, arguments);
|
1103
1111
|
}
|