@riil-frontend/component-topology 7.0.0-dev.3 → 7.0.0-dev.4
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/index.js +1 -1
- package/es/core/components/TopoView/topoView.js +1 -12
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +2 -1
- package/es/core/hooks/useTopoEdit.js +131 -169
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/components/TopoView/topoView.js +1 -12
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +131 -169
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -52,33 +52,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
52
52
|
comboResData = _useState2[0],
|
53
53
|
setComboResData = _useState2[1];
|
54
54
|
|
55
|
-
var onEnterEdit = /*#__PURE__*/function () {
|
56
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
57
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
58
|
-
while (1) {
|
59
|
-
switch (_context.prev = _context.next) {
|
60
|
-
case 0:
|
61
|
-
case "end":
|
62
|
-
return _context.stop();
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}, _callee);
|
66
|
-
}));
|
67
|
-
|
68
|
-
return function onEnterEdit() {
|
69
|
-
return _ref.apply(this, arguments);
|
70
|
-
};
|
71
|
-
}();
|
72
|
-
|
73
|
-
var onExitEdit = function onExitEdit() {// editDispatchers.switchToViewMode(topoId);
|
74
|
-
};
|
75
|
-
|
76
55
|
var reset = function reset() {
|
77
56
|
topoEditDispatchers.reset();
|
78
57
|
topo.historyManager.destroy();
|
79
58
|
};
|
80
|
-
|
81
|
-
var onBindData = function onBindData(eventData) {};
|
82
59
|
/**
|
83
60
|
* 增加资源到视图
|
84
61
|
*/
|
@@ -91,13 +68,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
91
68
|
};
|
92
69
|
|
93
70
|
var onLayerAdded = /*#__PURE__*/function () {
|
94
|
-
var
|
71
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
95
72
|
var target, direction, config;
|
96
|
-
return _regeneratorRuntime.wrap(function
|
73
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
97
74
|
while (1) {
|
98
|
-
switch (
|
75
|
+
switch (_context.prev = _context.next) {
|
99
76
|
case 0:
|
100
|
-
target =
|
77
|
+
target = _ref.target, direction = _ref.direction;
|
101
78
|
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
102
79
|
|
103
80
|
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
@@ -106,11 +83,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
106
83
|
}); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
|
107
84
|
|
108
85
|
if (!(!isLayerTopo && config.layers.length)) {
|
109
|
-
|
86
|
+
_context.next = 7;
|
110
87
|
break;
|
111
88
|
}
|
112
89
|
|
113
|
-
|
90
|
+
_context.next = 7;
|
114
91
|
return topoDispatchers.setTopoType(TPL_TREE);
|
115
92
|
|
116
93
|
case 7:
|
@@ -122,23 +99,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
122
99
|
|
123
100
|
case 8:
|
124
101
|
case "end":
|
125
|
-
return
|
102
|
+
return _context.stop();
|
126
103
|
}
|
127
104
|
}
|
128
|
-
},
|
105
|
+
}, _callee);
|
129
106
|
}));
|
130
107
|
|
131
108
|
return function onLayerAdded(_x) {
|
132
|
-
return
|
109
|
+
return _ref2.apply(this, arguments);
|
133
110
|
};
|
134
111
|
}();
|
135
112
|
|
136
113
|
var deleteLayer = /*#__PURE__*/function () {
|
137
|
-
var
|
114
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
|
138
115
|
var config;
|
139
|
-
return _regeneratorRuntime.wrap(function
|
116
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
140
117
|
while (1) {
|
141
|
-
switch (
|
118
|
+
switch (_context2.prev = _context2.next) {
|
142
119
|
case 0:
|
143
120
|
topo.historyManager.beginTransaction();
|
144
121
|
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
@@ -149,19 +126,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
149
126
|
}); // 如果没有分层,将拓扑类型切换为空白模板
|
150
127
|
|
151
128
|
if (config.layers.length) {
|
152
|
-
|
129
|
+
_context2.next = 7;
|
153
130
|
break;
|
154
131
|
}
|
155
132
|
|
156
|
-
|
133
|
+
_context2.next = 7;
|
157
134
|
return topoDispatchers.setTopoType(TPL_BLANK);
|
158
135
|
|
159
136
|
case 7:
|
160
|
-
|
137
|
+
_context2.next = 9;
|
161
138
|
return resourceConfig.updateConfig(config);
|
162
139
|
|
163
140
|
case 9:
|
164
|
-
|
141
|
+
_context2.next = 11;
|
165
142
|
return editDispatchers.fetchDataByConfig();
|
166
143
|
|
167
144
|
case 11:
|
@@ -169,14 +146,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
169
146
|
|
170
147
|
case 12:
|
171
148
|
case "end":
|
172
|
-
return
|
149
|
+
return _context2.stop();
|
173
150
|
}
|
174
151
|
}
|
175
|
-
},
|
152
|
+
}, _callee2);
|
176
153
|
}));
|
177
154
|
|
178
155
|
return function deleteLayer(_x2) {
|
179
|
-
return
|
156
|
+
return _ref3.apply(this, arguments);
|
180
157
|
};
|
181
158
|
}();
|
182
159
|
|
@@ -199,19 +176,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
199
176
|
type: "warning"
|
200
177
|
},
|
201
178
|
onOk: function () {
|
202
|
-
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
203
|
-
return _regeneratorRuntime.wrap(function
|
179
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
180
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
204
181
|
while (1) {
|
205
|
-
switch (
|
182
|
+
switch (_context3.prev = _context3.next) {
|
206
183
|
case 0:
|
207
184
|
deleteLayer(layerElement);
|
208
185
|
|
209
186
|
case 1:
|
210
187
|
case "end":
|
211
|
-
return
|
188
|
+
return _context3.stop();
|
212
189
|
}
|
213
190
|
}
|
214
|
-
},
|
191
|
+
}, _callee3);
|
215
192
|
}));
|
216
193
|
|
217
194
|
function onOk() {
|
@@ -257,19 +234,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
257
234
|
type: "warning"
|
258
235
|
},
|
259
236
|
onOk: function () {
|
260
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
261
|
-
return _regeneratorRuntime.wrap(function
|
237
|
+
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
238
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
262
239
|
while (1) {
|
263
|
-
switch (
|
240
|
+
switch (_context4.prev = _context4.next) {
|
264
241
|
case 0:
|
265
242
|
doDelete();
|
266
243
|
|
267
244
|
case 1:
|
268
245
|
case "end":
|
269
|
-
return
|
246
|
+
return _context4.stop();
|
270
247
|
}
|
271
248
|
}
|
272
|
-
},
|
249
|
+
}, _callee4);
|
273
250
|
}));
|
274
251
|
|
275
252
|
function onOk() {
|
@@ -315,20 +292,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
315
292
|
|
316
293
|
|
317
294
|
var deleteExLink = /*#__PURE__*/function () {
|
318
|
-
var
|
295
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(node) {
|
319
296
|
var _node$getEdges$toArra, _node$getEdges;
|
320
297
|
|
321
298
|
var config, edges, exportLinkIdList;
|
322
|
-
return _regeneratorRuntime.wrap(function
|
299
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
323
300
|
while (1) {
|
324
|
-
switch (
|
301
|
+
switch (_context5.prev = _context5.next) {
|
325
302
|
case 0:
|
326
303
|
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
327
304
|
|
328
305
|
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 = [];
|
329
306
|
|
330
307
|
if (!(edges.length > 0)) {
|
331
|
-
|
308
|
+
_context5.next = 8;
|
332
309
|
break;
|
333
310
|
}
|
334
311
|
|
@@ -342,19 +319,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
342
319
|
}
|
343
320
|
});
|
344
321
|
config.exportLinkIdList = exportLinkIdList;
|
345
|
-
|
322
|
+
_context5.next = 8;
|
346
323
|
return resourceConfig.updateConfig(config);
|
347
324
|
|
348
325
|
case 8:
|
349
326
|
case "end":
|
350
|
-
return
|
327
|
+
return _context5.stop();
|
351
328
|
}
|
352
329
|
}
|
353
|
-
},
|
330
|
+
}, _callee5);
|
354
331
|
}));
|
355
332
|
|
356
333
|
return function deleteExLink(_x3) {
|
357
|
-
return
|
334
|
+
return _ref4.apply(this, arguments);
|
358
335
|
};
|
359
336
|
}();
|
360
337
|
|
@@ -435,25 +412,25 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
435
412
|
}
|
436
413
|
|
437
414
|
function _bindGroupResources() {
|
438
|
-
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
415
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, resources) {
|
439
416
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
440
417
|
|
441
|
-
return _regeneratorRuntime.wrap(function
|
418
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
442
419
|
while (1) {
|
443
|
-
switch (
|
420
|
+
switch (_context11.prev = _context11.next) {
|
444
421
|
case 0:
|
445
422
|
id = group.id, tag = group.tag;
|
446
423
|
rlog.debug("bindGroupResources--id, tag", id, tag);
|
447
424
|
topo.historyManager.beginTransaction();
|
448
|
-
|
425
|
+
_context11.next = 5;
|
449
426
|
return resourceConfig.updateGroupResources(group, resources);
|
450
427
|
|
451
428
|
case 5:
|
452
|
-
|
429
|
+
_context11.next = 7;
|
453
430
|
return editDispatchers.fetchDataByConfig();
|
454
431
|
|
455
432
|
case 7:
|
456
|
-
_yield$editDispatcher2 =
|
433
|
+
_yield$editDispatcher2 = _context11.sent;
|
457
434
|
elements = _yield$editDispatcher2.elements;
|
458
435
|
// 区域里的子区域及子区域的节点、新增的链路
|
459
436
|
nodeElements = findGroupChildren(elements, group);
|
@@ -472,10 +449,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
472
449
|
|
473
450
|
case 14:
|
474
451
|
case "end":
|
475
|
-
return
|
452
|
+
return _context11.stop();
|
476
453
|
}
|
477
454
|
}
|
478
|
-
},
|
455
|
+
}, _callee11);
|
479
456
|
}));
|
480
457
|
return _bindGroupResources.apply(this, arguments);
|
481
458
|
}
|
@@ -489,11 +466,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
489
466
|
|
490
467
|
|
491
468
|
function _addGroupResources() {
|
492
|
-
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
469
|
+
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(group, newResourceIds) {
|
493
470
|
var groupConfig, resources, groupData;
|
494
|
-
return _regeneratorRuntime.wrap(function
|
471
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
495
472
|
while (1) {
|
496
|
-
switch (
|
473
|
+
switch (_context12.prev = _context12.next) {
|
497
474
|
case 0:
|
498
475
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
499
476
|
resources = {
|
@@ -503,15 +480,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
503
480
|
id: group.getTag(),
|
504
481
|
tag: group.a("tag")
|
505
482
|
};
|
506
|
-
|
483
|
+
_context12.next = 5;
|
507
484
|
return bindGroupResources(groupData, resources, newResourceIds);
|
508
485
|
|
509
486
|
case 5:
|
510
487
|
case "end":
|
511
|
-
return
|
488
|
+
return _context12.stop();
|
512
489
|
}
|
513
490
|
}
|
514
|
-
},
|
491
|
+
}, _callee12);
|
515
492
|
}));
|
516
493
|
return _addGroupResources.apply(this, arguments);
|
517
494
|
}
|
@@ -528,25 +505,25 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
528
505
|
|
529
506
|
|
530
507
|
function _bindViewResources() {
|
531
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
508
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(data) {
|
532
509
|
var config, _yield$editDispatcher3, elements;
|
533
510
|
|
534
|
-
return _regeneratorRuntime.wrap(function
|
511
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
535
512
|
while (1) {
|
536
|
-
switch (
|
513
|
+
switch (_context13.prev = _context13.next) {
|
537
514
|
case 0:
|
538
515
|
// console.log("关联视图的资源", data);
|
539
516
|
config = resourceConfig.getConfig();
|
540
517
|
config.resources = data;
|
541
|
-
|
518
|
+
_context13.next = 4;
|
542
519
|
return resourceConfig.updateConfig(config);
|
543
520
|
|
544
521
|
case 4:
|
545
|
-
|
522
|
+
_context13.next = 6;
|
546
523
|
return editDispatchers.fetchDataByConfig();
|
547
524
|
|
548
525
|
case 6:
|
549
|
-
_yield$editDispatcher3 =
|
526
|
+
_yield$editDispatcher3 = _context13.sent;
|
550
527
|
elements = _yield$editDispatcher3.elements;
|
551
528
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
552
529
|
|
@@ -556,10 +533,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
556
533
|
|
557
534
|
case 10:
|
558
535
|
case "end":
|
559
|
-
return
|
536
|
+
return _context13.stop();
|
560
537
|
}
|
561
538
|
}
|
562
|
-
},
|
539
|
+
}, _callee13);
|
563
540
|
}));
|
564
541
|
return _bindViewResources.apply(this, arguments);
|
565
542
|
}
|
@@ -569,24 +546,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
569
546
|
}
|
570
547
|
|
571
548
|
function _addLayerResources() {
|
572
|
-
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
549
|
+
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(group, newResourceIds) {
|
573
550
|
var _yield$editDispatcher4, elements, newElements;
|
574
551
|
|
575
|
-
return _regeneratorRuntime.wrap(function
|
552
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
576
553
|
while (1) {
|
577
|
-
switch (
|
554
|
+
switch (_context14.prev = _context14.next) {
|
578
555
|
case 0:
|
579
556
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
580
557
|
|
581
|
-
|
558
|
+
_context14.next = 3;
|
582
559
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
583
560
|
|
584
561
|
case 3:
|
585
|
-
|
562
|
+
_context14.next = 5;
|
586
563
|
return editDispatchers.fetchDataByConfig();
|
587
564
|
|
588
565
|
case 5:
|
589
|
-
_yield$editDispatcher4 =
|
566
|
+
_yield$editDispatcher4 = _context14.sent;
|
590
567
|
elements = _yield$editDispatcher4.elements;
|
591
568
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
592
569
|
newElements = findUNExistedElements(elements);
|
@@ -609,10 +586,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
609
586
|
|
610
587
|
case 14:
|
611
588
|
case "end":
|
612
|
-
return
|
589
|
+
return _context14.stop();
|
613
590
|
}
|
614
591
|
}
|
615
|
-
},
|
592
|
+
}, _callee14);
|
616
593
|
}));
|
617
594
|
return _addLayerResources.apply(this, arguments);
|
618
595
|
}
|
@@ -622,22 +599,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
622
599
|
}
|
623
600
|
|
624
601
|
function _addResourceToFirstLayer() {
|
625
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
602
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(data) {
|
626
603
|
var group;
|
627
|
-
return _regeneratorRuntime.wrap(function
|
604
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
628
605
|
while (1) {
|
629
|
-
switch (
|
606
|
+
switch (_context15.prev = _context15.next) {
|
630
607
|
case 0:
|
631
608
|
group = resourceConfig.getGroups()[0];
|
632
|
-
|
609
|
+
_context15.next = 3;
|
633
610
|
return addLayerResources(group, data);
|
634
611
|
|
635
612
|
case 3:
|
636
613
|
case "end":
|
637
|
-
return
|
614
|
+
return _context15.stop();
|
638
615
|
}
|
639
616
|
}
|
640
|
-
},
|
617
|
+
}, _callee15);
|
641
618
|
}));
|
642
619
|
return _addResourceToFirstLayer.apply(this, arguments);
|
643
620
|
}
|
@@ -669,28 +646,28 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
669
646
|
|
670
647
|
|
671
648
|
var onSaveComboRes = /*#__PURE__*/function () {
|
672
|
-
var
|
673
|
-
return _regeneratorRuntime.wrap(function
|
649
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
|
650
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
674
651
|
while (1) {
|
675
|
-
switch (
|
652
|
+
switch (_context6.prev = _context6.next) {
|
676
653
|
case 0:
|
677
654
|
rlog.debug("关联资源-----onSaveComboRes", data);
|
678
655
|
topo.historyManager.beginTransaction();
|
679
656
|
|
680
657
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
681
|
-
|
658
|
+
_context6.next = 7;
|
682
659
|
break;
|
683
660
|
}
|
684
661
|
|
685
|
-
|
662
|
+
_context6.next = 5;
|
686
663
|
return addResourceToFirstLayer(data);
|
687
664
|
|
688
665
|
case 5:
|
689
|
-
|
666
|
+
_context6.next = 9;
|
690
667
|
break;
|
691
668
|
|
692
669
|
case 7:
|
693
|
-
|
670
|
+
_context6.next = 9;
|
694
671
|
return bindViewResources(data);
|
695
672
|
|
696
673
|
case 9:
|
@@ -702,14 +679,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
702
679
|
|
703
680
|
case 12:
|
704
681
|
case "end":
|
705
|
-
return
|
682
|
+
return _context6.stop();
|
706
683
|
}
|
707
684
|
}
|
708
|
-
},
|
685
|
+
}, _callee6);
|
709
686
|
}));
|
710
687
|
|
711
688
|
return function onSaveComboRes(_x12) {
|
712
|
-
return
|
689
|
+
return _ref5.apply(this, arguments);
|
713
690
|
};
|
714
691
|
}();
|
715
692
|
|
@@ -718,27 +695,27 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
718
695
|
}
|
719
696
|
|
720
697
|
function _checkSavePermission() {
|
721
|
-
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
698
|
+
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(id) {
|
722
699
|
var permission;
|
723
|
-
return _regeneratorRuntime.wrap(function
|
700
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
724
701
|
while (1) {
|
725
|
-
switch (
|
702
|
+
switch (_context16.prev = _context16.next) {
|
726
703
|
case 0:
|
727
|
-
|
704
|
+
_context16.next = 2;
|
728
705
|
return topoDispatchers.getTopoPermission({
|
729
706
|
id: id,
|
730
707
|
update: false
|
731
708
|
});
|
732
709
|
|
733
710
|
case 2:
|
734
|
-
permission =
|
711
|
+
permission = _context16.sent;
|
735
712
|
|
736
713
|
if (!topoPermissonUtil.isEditable(permission)) {
|
737
|
-
|
714
|
+
_context16.next = 5;
|
738
715
|
break;
|
739
716
|
}
|
740
717
|
|
741
|
-
return
|
718
|
+
return _context16.abrupt("return", true);
|
742
719
|
|
743
720
|
case 5:
|
744
721
|
_Dialog.alert({
|
@@ -750,42 +727,42 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
750
727
|
onOk: function onOk() {}
|
751
728
|
});
|
752
729
|
|
753
|
-
return
|
730
|
+
return _context16.abrupt("return", false);
|
754
731
|
|
755
732
|
case 7:
|
756
733
|
case "end":
|
757
|
-
return
|
734
|
+
return _context16.stop();
|
758
735
|
}
|
759
736
|
}
|
760
|
-
},
|
737
|
+
}, _callee16);
|
761
738
|
}));
|
762
739
|
return _checkSavePermission.apply(this, arguments);
|
763
740
|
}
|
764
741
|
|
765
742
|
var onSaveTopo = /*#__PURE__*/function () {
|
766
|
-
var
|
743
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
|
767
744
|
var id, config, serialize, _config$layout, template, layout, saveConfig, valid, saveData;
|
768
745
|
|
769
|
-
return _regeneratorRuntime.wrap(function
|
746
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
770
747
|
while (1) {
|
771
|
-
switch (
|
748
|
+
switch (_context8.prev = _context8.next) {
|
772
749
|
case 0:
|
773
750
|
id = data.id, config = data.config, serialize = data.serialize;
|
774
751
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
775
752
|
|
776
753
|
if (!onSave) {
|
777
|
-
|
754
|
+
_context8.next = 6;
|
778
755
|
break;
|
779
756
|
}
|
780
757
|
|
781
758
|
// 自定义保存
|
782
759
|
saveConfig = /*#__PURE__*/function () {
|
783
|
-
var
|
784
|
-
return _regeneratorRuntime.wrap(function
|
760
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
761
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
785
762
|
while (1) {
|
786
|
-
switch (
|
763
|
+
switch (_context7.prev = _context7.next) {
|
787
764
|
case 0:
|
788
|
-
|
765
|
+
_context7.next = 2;
|
789
766
|
return editDispatchers.saveTopo({
|
790
767
|
id: id,
|
791
768
|
layout: layout,
|
@@ -794,14 +771,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
794
771
|
|
795
772
|
case 2:
|
796
773
|
case "end":
|
797
|
-
return
|
774
|
+
return _context7.stop();
|
798
775
|
}
|
799
776
|
}
|
800
|
-
},
|
777
|
+
}, _callee7);
|
801
778
|
}));
|
802
779
|
|
803
780
|
return function saveConfig() {
|
804
|
-
return
|
781
|
+
return _ref7.apply(this, arguments);
|
805
782
|
};
|
806
783
|
}();
|
807
784
|
|
@@ -809,7 +786,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
809
786
|
data: data,
|
810
787
|
saveConfig: saveConfig
|
811
788
|
});
|
812
|
-
return
|
789
|
+
return _context8.abrupt("return");
|
813
790
|
|
814
791
|
case 6:
|
815
792
|
// TODO 以下逻辑移到拓扑中心
|
@@ -817,21 +794,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
817
794
|
saving: true
|
818
795
|
}); // 检查权限
|
819
796
|
|
820
|
-
|
797
|
+
_context8.next = 9;
|
821
798
|
return checkSavePermission(id);
|
822
799
|
|
823
800
|
case 9:
|
824
|
-
valid =
|
801
|
+
valid = _context8.sent;
|
825
802
|
|
826
803
|
if (valid) {
|
827
|
-
|
804
|
+
_context8.next = 13;
|
828
805
|
break;
|
829
806
|
}
|
830
807
|
|
831
808
|
topoEditDispatchers.update({
|
832
809
|
saving: false
|
833
810
|
});
|
834
|
-
return
|
811
|
+
return _context8.abrupt("return");
|
835
812
|
|
836
813
|
case 13:
|
837
814
|
// 保存
|
@@ -841,7 +818,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
841
818
|
serialize: serialize
|
842
819
|
}, resourceConfig.getConfig());
|
843
820
|
rlog.info("保存", saveData);
|
844
|
-
|
821
|
+
_context8.next = 17;
|
845
822
|
return editDispatchers.saveTopo(saveData);
|
846
823
|
|
847
824
|
case 17:
|
@@ -853,14 +830,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
853
830
|
|
854
831
|
case 19:
|
855
832
|
case "end":
|
856
|
-
return
|
833
|
+
return _context8.stop();
|
857
834
|
}
|
858
835
|
}
|
859
|
-
},
|
836
|
+
}, _callee8);
|
860
837
|
}));
|
861
838
|
|
862
839
|
return function onSaveTopo(_x14) {
|
863
|
-
return
|
840
|
+
return _ref6.apply(this, arguments);
|
864
841
|
};
|
865
842
|
}();
|
866
843
|
|
@@ -886,12 +863,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
886
863
|
|
887
864
|
|
888
865
|
var bindNodeResource = /*#__PURE__*/function () {
|
889
|
-
var
|
866
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(params) {
|
890
867
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
891
868
|
|
892
|
-
return _regeneratorRuntime.wrap(function
|
869
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
893
870
|
while (1) {
|
894
|
-
switch (
|
871
|
+
switch (_context10.prev = _context10.next) {
|
895
872
|
case 0:
|
896
873
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
897
874
|
return _extends({}, resources, {
|
@@ -902,11 +879,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
902
879
|
};
|
903
880
|
|
904
881
|
_doBind = function _doBind3() {
|
905
|
-
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
882
|
+
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
906
883
|
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
907
|
-
return _regeneratorRuntime.wrap(function
|
884
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
908
885
|
while (1) {
|
909
|
-
switch (
|
886
|
+
switch (_context9.prev = _context9.next) {
|
910
887
|
case 0:
|
911
888
|
dm = htTopo.getGraphView().dm(); // 创建
|
912
889
|
|
@@ -975,7 +952,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
975
952
|
// node.a("customName", null);
|
976
953
|
// 删除关联在节点上的出口链路
|
977
954
|
|
978
|
-
|
955
|
+
_context9.next = 12;
|
979
956
|
return deleteExLink(node);
|
980
957
|
|
981
958
|
case 12:
|
@@ -986,10 +963,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
986
963
|
|
987
964
|
case 13:
|
988
965
|
case "end":
|
989
|
-
return
|
966
|
+
return _context9.stop();
|
990
967
|
}
|
991
968
|
}
|
992
|
-
},
|
969
|
+
}, _callee9);
|
993
970
|
}));
|
994
971
|
return _doBind.apply(this, arguments);
|
995
972
|
};
|
@@ -1029,22 +1006,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1029
1006
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
1030
1007
|
}
|
1031
1008
|
|
1032
|
-
|
1009
|
+
_context10.next = 13;
|
1033
1010
|
return resourceConfig.updateConfig(config);
|
1034
1011
|
|
1035
1012
|
case 13:
|
1036
|
-
|
1013
|
+
_context10.next = 15;
|
1037
1014
|
return editDispatchers.fetchDataByConfig();
|
1038
1015
|
|
1039
1016
|
case 15:
|
1040
|
-
_yield$editDispatcher =
|
1017
|
+
_yield$editDispatcher = _context10.sent;
|
1041
1018
|
elements = _yield$editDispatcher.elements;
|
1042
1019
|
newData = elements.find(function (item) {
|
1043
1020
|
return item.id === newResId;
|
1044
1021
|
});
|
1045
1022
|
|
1046
1023
|
if (newData) {
|
1047
|
-
|
1024
|
+
_context10.next = 23;
|
1048
1025
|
break;
|
1049
1026
|
}
|
1050
1027
|
|
@@ -1052,10 +1029,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1052
1029
|
|
1053
1030
|
rlog.warn("关联资源失败");
|
1054
1031
|
topo.historyManager.endTransaction();
|
1055
|
-
return
|
1032
|
+
return _context10.abrupt("return", false);
|
1056
1033
|
|
1057
1034
|
case 23:
|
1058
|
-
|
1035
|
+
_context10.next = 25;
|
1059
1036
|
return doBind();
|
1060
1037
|
|
1061
1038
|
case 25:
|
@@ -1063,14 +1040,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1063
1040
|
|
1064
1041
|
case 26:
|
1065
1042
|
case "end":
|
1066
|
-
return
|
1043
|
+
return _context10.stop();
|
1067
1044
|
}
|
1068
1045
|
}
|
1069
|
-
},
|
1046
|
+
}, _callee10);
|
1070
1047
|
}));
|
1071
1048
|
|
1072
1049
|
return function bindNodeResource(_x15) {
|
1073
|
-
return
|
1050
|
+
return _ref8.apply(this, arguments);
|
1074
1051
|
};
|
1075
1052
|
}();
|
1076
1053
|
|
@@ -1126,24 +1103,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1126
1103
|
*/
|
1127
1104
|
getAllNodeResourceIds: resourceConfig.getAllNodeResourceIds,
|
1128
1105
|
onEvent: onEvent,
|
1129
|
-
|
1130
|
-
/**
|
1131
|
-
* 进入编辑模式回调
|
1132
|
-
*/
|
1133
|
-
onEnterEdit: onEnterEdit,
|
1134
|
-
|
1135
|
-
/**
|
1136
|
-
* 退出编辑模式回调
|
1137
|
-
*/
|
1138
|
-
onExitEdit: onExitEdit,
|
1139
1106
|
reset: reset,
|
1140
1107
|
addLayerResources: addLayerResources,
|
1141
1108
|
|
1142
|
-
/**
|
1143
|
-
* 发起业务数据(资源、链路)绑定回调
|
1144
|
-
*/
|
1145
|
-
onBindData: onBindData,
|
1146
|
-
|
1147
1109
|
/**
|
1148
1110
|
* 显示全局添加资源抽屉
|
1149
1111
|
*/
|