@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.
- package/build/index.js +12 -12
- package/es/core/hooks/useTopoEdit.js +205 -153
- package/es/core/models/HistoryManager.js +4 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -249
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +256 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +37 -21
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +40 -2
- package/lib/core/hooks/useTopoEdit.js +204 -152
- package/lib/core/models/HistoryManager.js +4 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -261
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +283 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +37 -21
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +41 -2
- package/package.json +2 -2
|
@@ -87,43 +87,95 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
87
87
|
setShowComboResDrawer(true);
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
var onLayerAdded = function
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!isLayerTopo && config.layers.length) {
|
|
100
|
-
topoDispatchers.setTopoType(TPL_TREE);
|
|
101
|
-
} // 更新配置
|
|
102
|
-
// resourceConfig.updateConfig(config);
|
|
103
|
-
// 更新配置对应的资源、链路
|
|
104
|
-
// editDispatchers.fetchDataByConfig();
|
|
90
|
+
var onLayerAdded = /*#__PURE__*/function () {
|
|
91
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
92
|
+
var target, direction, config;
|
|
93
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
94
|
+
while (1) {
|
|
95
|
+
switch (_context2.prev = _context2.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
target = _ref2.target, direction = _ref2.direction;
|
|
98
|
+
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
|
105
99
|
|
|
106
|
-
|
|
100
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
|
101
|
+
rlog.info("onLayerAdd", {
|
|
102
|
+
config: config
|
|
103
|
+
}); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
if (!(!isLayerTopo && config.layers.length)) {
|
|
106
|
+
_context2.next = 7;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_context2.next = 7;
|
|
111
|
+
return topoDispatchers.setTopoType(TPL_TREE);
|
|
112
|
+
|
|
113
|
+
case 7:
|
|
114
|
+
// 更新配置
|
|
115
|
+
// resourceConfig.updateConfig(config);
|
|
116
|
+
// 更新配置对应的资源、链路
|
|
117
|
+
// editDispatchers.fetchDataByConfig();
|
|
118
|
+
topo.historyManager.endTransaction();
|
|
119
|
+
|
|
120
|
+
case 8:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context2.stop();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, _callee2);
|
|
126
|
+
}));
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
return function onLayerAdded(_x) {
|
|
129
|
+
return _ref3.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}();
|
|
116
132
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
var deleteLayer = /*#__PURE__*/function () {
|
|
134
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(layerElement) {
|
|
135
|
+
var config;
|
|
136
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
137
|
+
while (1) {
|
|
138
|
+
switch (_context3.prev = _context3.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
topo.historyManager.beginTransaction();
|
|
141
|
+
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
|
120
142
|
|
|
143
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
|
144
|
+
rlog.info("deleteLayer", {
|
|
145
|
+
config: config
|
|
146
|
+
}); // 如果没有分层,将拓扑类型切换为空白模板
|
|
121
147
|
|
|
122
|
-
|
|
148
|
+
if (config.layers.length) {
|
|
149
|
+
_context3.next = 7;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
123
152
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
153
|
+
_context3.next = 7;
|
|
154
|
+
return topoDispatchers.setTopoType(TPL_BLANK);
|
|
155
|
+
|
|
156
|
+
case 7:
|
|
157
|
+
_context3.next = 9;
|
|
158
|
+
return resourceConfig.updateConfig(config);
|
|
159
|
+
|
|
160
|
+
case 9:
|
|
161
|
+
_context3.next = 11;
|
|
162
|
+
return editDispatchers.fetchDataByConfig();
|
|
163
|
+
|
|
164
|
+
case 11:
|
|
165
|
+
topo.historyManager.endTransaction();
|
|
166
|
+
|
|
167
|
+
case 12:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}, _callee3);
|
|
173
|
+
}));
|
|
174
|
+
|
|
175
|
+
return function deleteLayer(_x2) {
|
|
176
|
+
return _ref4.apply(this, arguments);
|
|
177
|
+
};
|
|
178
|
+
}();
|
|
127
179
|
|
|
128
180
|
var handleDeleteLayer = function handleDeleteLayer(layerElement) {
|
|
129
181
|
var hasChildren = !!layerElement.getChildren().toArray().length;
|
|
@@ -144,19 +196,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
144
196
|
type: "warning"
|
|
145
197
|
},
|
|
146
198
|
onOk: function () {
|
|
147
|
-
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
148
|
-
return _regeneratorRuntime.wrap(function
|
|
199
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
200
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
149
201
|
while (1) {
|
|
150
|
-
switch (
|
|
202
|
+
switch (_context4.prev = _context4.next) {
|
|
151
203
|
case 0:
|
|
152
204
|
deleteLayer(layerElement);
|
|
153
205
|
|
|
154
206
|
case 1:
|
|
155
207
|
case "end":
|
|
156
|
-
return
|
|
208
|
+
return _context4.stop();
|
|
157
209
|
}
|
|
158
210
|
}
|
|
159
|
-
},
|
|
211
|
+
}, _callee4);
|
|
160
212
|
}));
|
|
161
213
|
|
|
162
214
|
function onOk() {
|
|
@@ -202,19 +254,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
202
254
|
type: "warning"
|
|
203
255
|
},
|
|
204
256
|
onOk: function () {
|
|
205
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
206
|
-
return _regeneratorRuntime.wrap(function
|
|
257
|
+
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
258
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
207
259
|
while (1) {
|
|
208
|
-
switch (
|
|
260
|
+
switch (_context5.prev = _context5.next) {
|
|
209
261
|
case 0:
|
|
210
262
|
doDelete();
|
|
211
263
|
|
|
212
264
|
case 1:
|
|
213
265
|
case "end":
|
|
214
|
-
return
|
|
266
|
+
return _context5.stop();
|
|
215
267
|
}
|
|
216
268
|
}
|
|
217
|
-
},
|
|
269
|
+
}, _callee5);
|
|
218
270
|
}));
|
|
219
271
|
|
|
220
272
|
function onOk() {
|
|
@@ -309,20 +361,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
309
361
|
|
|
310
362
|
|
|
311
363
|
var deleteExLink = /*#__PURE__*/function () {
|
|
312
|
-
var
|
|
364
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(node) {
|
|
313
365
|
var _node$getEdges$toArra, _node$getEdges;
|
|
314
366
|
|
|
315
367
|
var config, edges, exportLinkIdList;
|
|
316
|
-
return _regeneratorRuntime.wrap(function
|
|
368
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
317
369
|
while (1) {
|
|
318
|
-
switch (
|
|
370
|
+
switch (_context6.prev = _context6.next) {
|
|
319
371
|
case 0:
|
|
320
372
|
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
|
321
373
|
|
|
322
374
|
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 = [];
|
|
323
375
|
|
|
324
376
|
if (!(edges.length > 0)) {
|
|
325
|
-
|
|
377
|
+
_context6.next = 8;
|
|
326
378
|
break;
|
|
327
379
|
}
|
|
328
380
|
|
|
@@ -336,19 +388,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
336
388
|
}
|
|
337
389
|
});
|
|
338
390
|
config.exportLinkIdList = exportLinkIdList;
|
|
339
|
-
|
|
391
|
+
_context6.next = 8;
|
|
340
392
|
return resourceConfig.updateConfig(config);
|
|
341
393
|
|
|
342
394
|
case 8:
|
|
343
395
|
case "end":
|
|
344
|
-
return
|
|
396
|
+
return _context6.stop();
|
|
345
397
|
}
|
|
346
398
|
}
|
|
347
|
-
},
|
|
399
|
+
}, _callee6);
|
|
348
400
|
}));
|
|
349
401
|
|
|
350
|
-
return function deleteExLink(
|
|
351
|
-
return
|
|
402
|
+
return function deleteExLink(_x3) {
|
|
403
|
+
return _ref5.apply(this, arguments);
|
|
352
404
|
};
|
|
353
405
|
}();
|
|
354
406
|
|
|
@@ -410,29 +462,29 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
410
462
|
*/
|
|
411
463
|
|
|
412
464
|
|
|
413
|
-
function bindGroupResources(
|
|
465
|
+
function bindGroupResources(_x4, _x5) {
|
|
414
466
|
return _bindGroupResources.apply(this, arguments);
|
|
415
467
|
}
|
|
416
468
|
|
|
417
469
|
function _bindGroupResources() {
|
|
418
|
-
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
470
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(group, resources) {
|
|
419
471
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
|
420
472
|
|
|
421
|
-
return _regeneratorRuntime.wrap(function
|
|
473
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
422
474
|
while (1) {
|
|
423
|
-
switch (
|
|
475
|
+
switch (_context12.prev = _context12.next) {
|
|
424
476
|
case 0:
|
|
425
477
|
id = group.id, tag = group.tag;
|
|
426
478
|
rlog.debug("bindGroupResources--id, tag", id, tag);
|
|
427
|
-
|
|
479
|
+
_context12.next = 4;
|
|
428
480
|
return resourceConfig.updateGroupResources(group, resources);
|
|
429
481
|
|
|
430
482
|
case 4:
|
|
431
|
-
|
|
483
|
+
_context12.next = 6;
|
|
432
484
|
return editDispatchers.fetchDataByConfig();
|
|
433
485
|
|
|
434
486
|
case 6:
|
|
435
|
-
_yield$editDispatcher2 =
|
|
487
|
+
_yield$editDispatcher2 = _context12.sent;
|
|
436
488
|
elements = _yield$editDispatcher2.elements;
|
|
437
489
|
// 区域里的子区域及子区域的节点、新增的链路
|
|
438
490
|
nodeElements = findGroupChildren(elements, group);
|
|
@@ -449,15 +501,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
449
501
|
|
|
450
502
|
case 12:
|
|
451
503
|
case "end":
|
|
452
|
-
return
|
|
504
|
+
return _context12.stop();
|
|
453
505
|
}
|
|
454
506
|
}
|
|
455
|
-
},
|
|
507
|
+
}, _callee12);
|
|
456
508
|
}));
|
|
457
509
|
return _bindGroupResources.apply(this, arguments);
|
|
458
510
|
}
|
|
459
511
|
|
|
460
|
-
function addGroupResources(
|
|
512
|
+
function addGroupResources(_x6, _x7) {
|
|
461
513
|
return _addGroupResources.apply(this, arguments);
|
|
462
514
|
}
|
|
463
515
|
/**
|
|
@@ -466,11 +518,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
466
518
|
|
|
467
519
|
|
|
468
520
|
function _addGroupResources() {
|
|
469
|
-
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
521
|
+
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
|
|
470
522
|
var groupConfig, resources, groupData;
|
|
471
|
-
return _regeneratorRuntime.wrap(function
|
|
523
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
472
524
|
while (1) {
|
|
473
|
-
switch (
|
|
525
|
+
switch (_context13.prev = _context13.next) {
|
|
474
526
|
case 0:
|
|
475
527
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
|
476
528
|
resources = {
|
|
@@ -480,20 +532,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
480
532
|
id: group.getTag(),
|
|
481
533
|
tag: group.a("tag")
|
|
482
534
|
};
|
|
483
|
-
|
|
535
|
+
_context13.next = 5;
|
|
484
536
|
return bindGroupResources(groupData, resources, newResourceIds);
|
|
485
537
|
|
|
486
538
|
case 5:
|
|
487
539
|
case "end":
|
|
488
|
-
return
|
|
540
|
+
return _context13.stop();
|
|
489
541
|
}
|
|
490
542
|
}
|
|
491
|
-
},
|
|
543
|
+
}, _callee13);
|
|
492
544
|
}));
|
|
493
545
|
return _addGroupResources.apply(this, arguments);
|
|
494
546
|
}
|
|
495
547
|
|
|
496
|
-
function bindViewResources(
|
|
548
|
+
function bindViewResources(_x8) {
|
|
497
549
|
return _bindViewResources.apply(this, arguments);
|
|
498
550
|
}
|
|
499
551
|
/**
|
|
@@ -505,25 +557,25 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
505
557
|
|
|
506
558
|
|
|
507
559
|
function _bindViewResources() {
|
|
508
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
560
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
|
|
509
561
|
var config, _yield$editDispatcher3, elements;
|
|
510
562
|
|
|
511
|
-
return _regeneratorRuntime.wrap(function
|
|
563
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
512
564
|
while (1) {
|
|
513
|
-
switch (
|
|
565
|
+
switch (_context14.prev = _context14.next) {
|
|
514
566
|
case 0:
|
|
515
567
|
console.log("关联视图的资源", data);
|
|
516
568
|
config = resourceConfig.getConfig();
|
|
517
569
|
config.resources = data;
|
|
518
|
-
|
|
570
|
+
_context14.next = 5;
|
|
519
571
|
return resourceConfig.updateConfig(config);
|
|
520
572
|
|
|
521
573
|
case 5:
|
|
522
|
-
|
|
574
|
+
_context14.next = 7;
|
|
523
575
|
return editDispatchers.fetchDataByConfig();
|
|
524
576
|
|
|
525
577
|
case 7:
|
|
526
|
-
_yield$editDispatcher3 =
|
|
578
|
+
_yield$editDispatcher3 = _context14.sent;
|
|
527
579
|
elements = _yield$editDispatcher3.elements;
|
|
528
580
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
|
529
581
|
|
|
@@ -533,37 +585,37 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
533
585
|
|
|
534
586
|
case 11:
|
|
535
587
|
case "end":
|
|
536
|
-
return
|
|
588
|
+
return _context14.stop();
|
|
537
589
|
}
|
|
538
590
|
}
|
|
539
|
-
},
|
|
591
|
+
}, _callee14);
|
|
540
592
|
}));
|
|
541
593
|
return _bindViewResources.apply(this, arguments);
|
|
542
594
|
}
|
|
543
595
|
|
|
544
|
-
function addLayerResources(
|
|
596
|
+
function addLayerResources(_x9, _x10) {
|
|
545
597
|
return _addLayerResources.apply(this, arguments);
|
|
546
598
|
}
|
|
547
599
|
|
|
548
600
|
function _addLayerResources() {
|
|
549
|
-
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
601
|
+
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(group, newResourceIds) {
|
|
550
602
|
var _yield$editDispatcher4, elements, data;
|
|
551
603
|
|
|
552
|
-
return _regeneratorRuntime.wrap(function
|
|
604
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
553
605
|
while (1) {
|
|
554
|
-
switch (
|
|
606
|
+
switch (_context15.prev = _context15.next) {
|
|
555
607
|
case 0:
|
|
556
608
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
|
557
609
|
|
|
558
|
-
|
|
610
|
+
_context15.next = 3;
|
|
559
611
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
|
560
612
|
|
|
561
613
|
case 3:
|
|
562
|
-
|
|
614
|
+
_context15.next = 5;
|
|
563
615
|
return editDispatchers.fetchDataByConfig();
|
|
564
616
|
|
|
565
617
|
case 5:
|
|
566
|
-
_yield$editDispatcher4 =
|
|
618
|
+
_yield$editDispatcher4 = _context15.sent;
|
|
567
619
|
elements = _yield$editDispatcher4.elements;
|
|
568
620
|
// 过滤出新增的资源和链路
|
|
569
621
|
data = {
|
|
@@ -578,7 +630,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
578
630
|
})
|
|
579
631
|
}; // 添加到分层
|
|
580
632
|
|
|
581
|
-
|
|
633
|
+
_context15.next = 10;
|
|
582
634
|
return topo.updateElements(data);
|
|
583
635
|
|
|
584
636
|
case 10:
|
|
@@ -591,35 +643,35 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
591
643
|
|
|
592
644
|
case 12:
|
|
593
645
|
case "end":
|
|
594
|
-
return
|
|
646
|
+
return _context15.stop();
|
|
595
647
|
}
|
|
596
648
|
}
|
|
597
|
-
},
|
|
649
|
+
}, _callee15);
|
|
598
650
|
}));
|
|
599
651
|
return _addLayerResources.apply(this, arguments);
|
|
600
652
|
}
|
|
601
653
|
|
|
602
|
-
function addResourceToFirstLayer(
|
|
654
|
+
function addResourceToFirstLayer(_x11) {
|
|
603
655
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
604
656
|
}
|
|
605
657
|
|
|
606
658
|
function _addResourceToFirstLayer() {
|
|
607
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
659
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(data) {
|
|
608
660
|
var group;
|
|
609
|
-
return _regeneratorRuntime.wrap(function
|
|
661
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
610
662
|
while (1) {
|
|
611
|
-
switch (
|
|
663
|
+
switch (_context16.prev = _context16.next) {
|
|
612
664
|
case 0:
|
|
613
665
|
group = resourceConfig.getGroups()[0];
|
|
614
|
-
|
|
666
|
+
_context16.next = 3;
|
|
615
667
|
return addLayerResources(group, data);
|
|
616
668
|
|
|
617
669
|
case 3:
|
|
618
670
|
case "end":
|
|
619
|
-
return
|
|
671
|
+
return _context16.stop();
|
|
620
672
|
}
|
|
621
673
|
}
|
|
622
|
-
},
|
|
674
|
+
}, _callee16);
|
|
623
675
|
}));
|
|
624
676
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
625
677
|
}
|
|
@@ -645,28 +697,28 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
645
697
|
}
|
|
646
698
|
|
|
647
699
|
var onSaveComboRes = /*#__PURE__*/function () {
|
|
648
|
-
var
|
|
649
|
-
return _regeneratorRuntime.wrap(function
|
|
700
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
701
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
650
702
|
while (1) {
|
|
651
|
-
switch (
|
|
703
|
+
switch (_context7.prev = _context7.next) {
|
|
652
704
|
case 0:
|
|
653
705
|
rlog.debug("关联资源-----onSaveComboRes", data);
|
|
654
706
|
topo.historyManager.beginTransaction();
|
|
655
707
|
|
|
656
708
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
|
657
|
-
|
|
709
|
+
_context7.next = 7;
|
|
658
710
|
break;
|
|
659
711
|
}
|
|
660
712
|
|
|
661
|
-
|
|
713
|
+
_context7.next = 5;
|
|
662
714
|
return addResourceToFirstLayer(data);
|
|
663
715
|
|
|
664
716
|
case 5:
|
|
665
|
-
|
|
717
|
+
_context7.next = 9;
|
|
666
718
|
break;
|
|
667
719
|
|
|
668
720
|
case 7:
|
|
669
|
-
|
|
721
|
+
_context7.next = 9;
|
|
670
722
|
return bindViewResources(data);
|
|
671
723
|
|
|
672
724
|
case 9:
|
|
@@ -674,43 +726,43 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
674
726
|
|
|
675
727
|
case 10:
|
|
676
728
|
case "end":
|
|
677
|
-
return
|
|
729
|
+
return _context7.stop();
|
|
678
730
|
}
|
|
679
731
|
}
|
|
680
|
-
},
|
|
732
|
+
}, _callee7);
|
|
681
733
|
}));
|
|
682
734
|
|
|
683
|
-
return function onSaveComboRes(
|
|
684
|
-
return
|
|
735
|
+
return function onSaveComboRes(_x12) {
|
|
736
|
+
return _ref6.apply(this, arguments);
|
|
685
737
|
};
|
|
686
738
|
}();
|
|
687
739
|
|
|
688
|
-
function checkSavePermission(
|
|
740
|
+
function checkSavePermission(_x13) {
|
|
689
741
|
return _checkSavePermission.apply(this, arguments);
|
|
690
742
|
}
|
|
691
743
|
|
|
692
744
|
function _checkSavePermission() {
|
|
693
|
-
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
745
|
+
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(id) {
|
|
694
746
|
var permission;
|
|
695
|
-
return _regeneratorRuntime.wrap(function
|
|
747
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
696
748
|
while (1) {
|
|
697
|
-
switch (
|
|
749
|
+
switch (_context17.prev = _context17.next) {
|
|
698
750
|
case 0:
|
|
699
|
-
|
|
751
|
+
_context17.next = 2;
|
|
700
752
|
return topoDispatchers.getTopoPermission({
|
|
701
753
|
id: id,
|
|
702
754
|
update: false
|
|
703
755
|
});
|
|
704
756
|
|
|
705
757
|
case 2:
|
|
706
|
-
permission =
|
|
758
|
+
permission = _context17.sent;
|
|
707
759
|
|
|
708
760
|
if (!topoPermissonUtil.isEditable(permission)) {
|
|
709
|
-
|
|
761
|
+
_context17.next = 5;
|
|
710
762
|
break;
|
|
711
763
|
}
|
|
712
764
|
|
|
713
|
-
return
|
|
765
|
+
return _context17.abrupt("return", true);
|
|
714
766
|
|
|
715
767
|
case 5:
|
|
716
768
|
_Dialog.alert({
|
|
@@ -722,42 +774,42 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
722
774
|
onOk: function onOk() {}
|
|
723
775
|
});
|
|
724
776
|
|
|
725
|
-
return
|
|
777
|
+
return _context17.abrupt("return", false);
|
|
726
778
|
|
|
727
779
|
case 7:
|
|
728
780
|
case "end":
|
|
729
|
-
return
|
|
781
|
+
return _context17.stop();
|
|
730
782
|
}
|
|
731
783
|
}
|
|
732
|
-
},
|
|
784
|
+
}, _callee17);
|
|
733
785
|
}));
|
|
734
786
|
return _checkSavePermission.apply(this, arguments);
|
|
735
787
|
}
|
|
736
788
|
|
|
737
789
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
738
|
-
var
|
|
790
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
|
|
739
791
|
var id, config, serialize, _config$layout, template, layout, saveConfig, valid, saveData;
|
|
740
792
|
|
|
741
|
-
return _regeneratorRuntime.wrap(function
|
|
793
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
742
794
|
while (1) {
|
|
743
|
-
switch (
|
|
795
|
+
switch (_context9.prev = _context9.next) {
|
|
744
796
|
case 0:
|
|
745
797
|
id = data.id, config = data.config, serialize = data.serialize;
|
|
746
798
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
|
747
799
|
|
|
748
800
|
if (!onSave) {
|
|
749
|
-
|
|
801
|
+
_context9.next = 6;
|
|
750
802
|
break;
|
|
751
803
|
}
|
|
752
804
|
|
|
753
805
|
// 自定义保存
|
|
754
806
|
saveConfig = /*#__PURE__*/function () {
|
|
755
|
-
var
|
|
756
|
-
return _regeneratorRuntime.wrap(function
|
|
807
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
808
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
757
809
|
while (1) {
|
|
758
|
-
switch (
|
|
810
|
+
switch (_context8.prev = _context8.next) {
|
|
759
811
|
case 0:
|
|
760
|
-
|
|
812
|
+
_context8.next = 2;
|
|
761
813
|
return editDispatchers.saveTopo({
|
|
762
814
|
id: id,
|
|
763
815
|
layout: layout,
|
|
@@ -766,14 +818,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
766
818
|
|
|
767
819
|
case 2:
|
|
768
820
|
case "end":
|
|
769
|
-
return
|
|
821
|
+
return _context8.stop();
|
|
770
822
|
}
|
|
771
823
|
}
|
|
772
|
-
},
|
|
824
|
+
}, _callee8);
|
|
773
825
|
}));
|
|
774
826
|
|
|
775
827
|
return function saveConfig() {
|
|
776
|
-
return
|
|
828
|
+
return _ref8.apply(this, arguments);
|
|
777
829
|
};
|
|
778
830
|
}();
|
|
779
831
|
|
|
@@ -781,7 +833,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
781
833
|
data: data,
|
|
782
834
|
saveConfig: saveConfig
|
|
783
835
|
});
|
|
784
|
-
return
|
|
836
|
+
return _context9.abrupt("return");
|
|
785
837
|
|
|
786
838
|
case 6:
|
|
787
839
|
// TODO 以下逻辑移到拓扑中心
|
|
@@ -789,21 +841,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
789
841
|
saving: true
|
|
790
842
|
}); // 检查权限
|
|
791
843
|
|
|
792
|
-
|
|
844
|
+
_context9.next = 9;
|
|
793
845
|
return checkSavePermission(id);
|
|
794
846
|
|
|
795
847
|
case 9:
|
|
796
|
-
valid =
|
|
848
|
+
valid = _context9.sent;
|
|
797
849
|
|
|
798
850
|
if (valid) {
|
|
799
|
-
|
|
851
|
+
_context9.next = 13;
|
|
800
852
|
break;
|
|
801
853
|
}
|
|
802
854
|
|
|
803
855
|
topoEditDispatchers.update({
|
|
804
856
|
saving: false
|
|
805
857
|
});
|
|
806
|
-
return
|
|
858
|
+
return _context9.abrupt("return");
|
|
807
859
|
|
|
808
860
|
case 13:
|
|
809
861
|
// 保存
|
|
@@ -813,7 +865,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
813
865
|
serialize: serialize
|
|
814
866
|
}, resourceConfig.getConfig());
|
|
815
867
|
rlog.info("保存", saveData);
|
|
816
|
-
|
|
868
|
+
_context9.next = 17;
|
|
817
869
|
return editDispatchers.saveTopo(saveData);
|
|
818
870
|
|
|
819
871
|
case 17:
|
|
@@ -825,14 +877,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
825
877
|
|
|
826
878
|
case 19:
|
|
827
879
|
case "end":
|
|
828
|
-
return
|
|
880
|
+
return _context9.stop();
|
|
829
881
|
}
|
|
830
882
|
}
|
|
831
|
-
},
|
|
883
|
+
}, _callee9);
|
|
832
884
|
}));
|
|
833
885
|
|
|
834
|
-
return function onSaveTopo(
|
|
835
|
-
return
|
|
886
|
+
return function onSaveTopo(_x14) {
|
|
887
|
+
return _ref7.apply(this, arguments);
|
|
836
888
|
};
|
|
837
889
|
}();
|
|
838
890
|
|
|
@@ -858,12 +910,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
858
910
|
|
|
859
911
|
|
|
860
912
|
var bindNodeResource = /*#__PURE__*/function () {
|
|
861
|
-
var
|
|
913
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(params) {
|
|
862
914
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
|
863
915
|
|
|
864
|
-
return _regeneratorRuntime.wrap(function
|
|
916
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
865
917
|
while (1) {
|
|
866
|
-
switch (
|
|
918
|
+
switch (_context11.prev = _context11.next) {
|
|
867
919
|
case 0:
|
|
868
920
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
|
869
921
|
return _extends({}, resources, {
|
|
@@ -874,11 +926,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
874
926
|
};
|
|
875
927
|
|
|
876
928
|
_doBind = function _doBind3() {
|
|
877
|
-
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
929
|
+
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
878
930
|
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
|
879
|
-
return _regeneratorRuntime.wrap(function
|
|
931
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
880
932
|
while (1) {
|
|
881
|
-
switch (
|
|
933
|
+
switch (_context10.prev = _context10.next) {
|
|
882
934
|
case 0:
|
|
883
935
|
dm = htTopo.getGraphView().dm(); // 创建
|
|
884
936
|
|
|
@@ -947,7 +999,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
947
999
|
// node.a("customName", null);
|
|
948
1000
|
// 删除关联在节点上的出口链路
|
|
949
1001
|
|
|
950
|
-
|
|
1002
|
+
_context10.next = 12;
|
|
951
1003
|
return deleteExLink(node);
|
|
952
1004
|
|
|
953
1005
|
case 12:
|
|
@@ -958,10 +1010,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
958
1010
|
|
|
959
1011
|
case 13:
|
|
960
1012
|
case "end":
|
|
961
|
-
return
|
|
1013
|
+
return _context10.stop();
|
|
962
1014
|
}
|
|
963
1015
|
}
|
|
964
|
-
},
|
|
1016
|
+
}, _callee10);
|
|
965
1017
|
}));
|
|
966
1018
|
return _doBind.apply(this, arguments);
|
|
967
1019
|
};
|
|
@@ -1001,22 +1053,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1001
1053
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
|
1002
1054
|
}
|
|
1003
1055
|
|
|
1004
|
-
|
|
1056
|
+
_context11.next = 13;
|
|
1005
1057
|
return resourceConfig.updateConfig(config);
|
|
1006
1058
|
|
|
1007
1059
|
case 13:
|
|
1008
|
-
|
|
1060
|
+
_context11.next = 15;
|
|
1009
1061
|
return editDispatchers.fetchDataByConfig();
|
|
1010
1062
|
|
|
1011
1063
|
case 15:
|
|
1012
|
-
_yield$editDispatcher =
|
|
1064
|
+
_yield$editDispatcher = _context11.sent;
|
|
1013
1065
|
elements = _yield$editDispatcher.elements;
|
|
1014
1066
|
newData = elements.find(function (item) {
|
|
1015
1067
|
return item.id === newResId;
|
|
1016
1068
|
});
|
|
1017
1069
|
|
|
1018
1070
|
if (newData) {
|
|
1019
|
-
|
|
1071
|
+
_context11.next = 23;
|
|
1020
1072
|
break;
|
|
1021
1073
|
}
|
|
1022
1074
|
|
|
@@ -1024,10 +1076,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1024
1076
|
|
|
1025
1077
|
rlog.warn("关联资源失败");
|
|
1026
1078
|
topo.historyManager.endTransaction();
|
|
1027
|
-
return
|
|
1079
|
+
return _context11.abrupt("return", false);
|
|
1028
1080
|
|
|
1029
1081
|
case 23:
|
|
1030
|
-
|
|
1082
|
+
_context11.next = 25;
|
|
1031
1083
|
return doBind();
|
|
1032
1084
|
|
|
1033
1085
|
case 25:
|
|
@@ -1035,14 +1087,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1035
1087
|
|
|
1036
1088
|
case 26:
|
|
1037
1089
|
case "end":
|
|
1038
|
-
return
|
|
1090
|
+
return _context11.stop();
|
|
1039
1091
|
}
|
|
1040
1092
|
}
|
|
1041
|
-
},
|
|
1093
|
+
}, _callee11);
|
|
1042
1094
|
}));
|
|
1043
1095
|
|
|
1044
|
-
return function bindNodeResource(
|
|
1045
|
-
return
|
|
1096
|
+
return function bindNodeResource(_x15) {
|
|
1097
|
+
return _ref9.apply(this, arguments);
|
|
1046
1098
|
};
|
|
1047
1099
|
}();
|
|
1048
1100
|
|