@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
|
@@ -110,47 +110,99 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
110
110
|
setShowComboResDrawer(true);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
var onLayerAdded = function
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
153
|
+
return function onLayerAdded(_x) {
|
|
154
|
+
return _ref3.apply(this, arguments);
|
|
155
|
+
};
|
|
156
|
+
}();
|
|
138
157
|
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
170
|
+
_rlog["default"].info("deleteLayer", {
|
|
171
|
+
config: config
|
|
172
|
+
}); // 如果没有分层,将拓扑类型切换为空白模板
|
|
147
173
|
|
|
148
174
|
|
|
149
|
-
|
|
175
|
+
if (config.layers.length) {
|
|
176
|
+
_context3.next = 7;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
150
179
|
|
|
151
|
-
|
|
152
|
-
|
|
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
|
|
175
|
-
return _regenerator["default"].wrap(function
|
|
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 (
|
|
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
|
|
235
|
+
return _context4.stop();
|
|
184
236
|
}
|
|
185
237
|
}
|
|
186
|
-
},
|
|
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
|
|
233
|
-
return _regenerator["default"].wrap(function
|
|
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 (
|
|
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
|
|
293
|
+
return _context5.stop();
|
|
242
294
|
}
|
|
243
295
|
}
|
|
244
|
-
},
|
|
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
|
|
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
|
|
397
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
346
398
|
while (1) {
|
|
347
|
-
switch (
|
|
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
|
-
|
|
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
|
-
|
|
420
|
+
_context6.next = 8;
|
|
369
421
|
return resourceConfig.updateConfig(config);
|
|
370
422
|
|
|
371
423
|
case 8:
|
|
372
424
|
case "end":
|
|
373
|
-
return
|
|
425
|
+
return _context6.stop();
|
|
374
426
|
}
|
|
375
427
|
}
|
|
376
|
-
},
|
|
428
|
+
}, _callee6);
|
|
377
429
|
}));
|
|
378
430
|
|
|
379
|
-
return function deleteExLink(
|
|
380
|
-
return
|
|
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(
|
|
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
|
|
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
|
|
503
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
452
504
|
while (1) {
|
|
453
|
-
switch (
|
|
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
|
-
|
|
511
|
+
_context12.next = 4;
|
|
460
512
|
return resourceConfig.updateGroupResources(group, resources);
|
|
461
513
|
|
|
462
514
|
case 4:
|
|
463
|
-
|
|
515
|
+
_context12.next = 6;
|
|
464
516
|
return editDispatchers.fetchDataByConfig();
|
|
465
517
|
|
|
466
518
|
case 6:
|
|
467
|
-
_yield$editDispatcher2 =
|
|
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
|
|
536
|
+
return _context12.stop();
|
|
485
537
|
}
|
|
486
538
|
}
|
|
487
|
-
},
|
|
539
|
+
}, _callee12);
|
|
488
540
|
}));
|
|
489
541
|
return _bindGroupResources.apply(this, arguments);
|
|
490
542
|
}
|
|
491
543
|
|
|
492
|
-
function addGroupResources(
|
|
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
|
|
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
|
|
555
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
504
556
|
while (1) {
|
|
505
|
-
switch (
|
|
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
|
-
|
|
567
|
+
_context13.next = 5;
|
|
516
568
|
return bindGroupResources(groupData, resources, newResourceIds);
|
|
517
569
|
|
|
518
570
|
case 5:
|
|
519
571
|
case "end":
|
|
520
|
-
return
|
|
572
|
+
return _context13.stop();
|
|
521
573
|
}
|
|
522
574
|
}
|
|
523
|
-
},
|
|
575
|
+
}, _callee13);
|
|
524
576
|
}));
|
|
525
577
|
return _addGroupResources.apply(this, arguments);
|
|
526
578
|
}
|
|
527
579
|
|
|
528
|
-
function bindViewResources(
|
|
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
|
|
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
|
|
595
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
544
596
|
while (1) {
|
|
545
|
-
switch (
|
|
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
|
-
|
|
602
|
+
_context14.next = 5;
|
|
551
603
|
return resourceConfig.updateConfig(config);
|
|
552
604
|
|
|
553
605
|
case 5:
|
|
554
|
-
|
|
606
|
+
_context14.next = 7;
|
|
555
607
|
return editDispatchers.fetchDataByConfig();
|
|
556
608
|
|
|
557
609
|
case 7:
|
|
558
|
-
_yield$editDispatcher3 =
|
|
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
|
|
620
|
+
return _context14.stop();
|
|
569
621
|
}
|
|
570
622
|
}
|
|
571
|
-
},
|
|
623
|
+
}, _callee14);
|
|
572
624
|
}));
|
|
573
625
|
return _bindViewResources.apply(this, arguments);
|
|
574
626
|
}
|
|
575
627
|
|
|
576
|
-
function addLayerResources(
|
|
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
|
|
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
|
|
636
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
585
637
|
while (1) {
|
|
586
|
-
switch (
|
|
638
|
+
switch (_context15.prev = _context15.next) {
|
|
587
639
|
case 0:
|
|
588
640
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
|
589
641
|
|
|
590
|
-
|
|
642
|
+
_context15.next = 3;
|
|
591
643
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
|
592
644
|
|
|
593
645
|
case 3:
|
|
594
|
-
|
|
646
|
+
_context15.next = 5;
|
|
595
647
|
return editDispatchers.fetchDataByConfig();
|
|
596
648
|
|
|
597
649
|
case 5:
|
|
598
|
-
_yield$editDispatcher4 =
|
|
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
|
-
|
|
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
|
|
678
|
+
return _context15.stop();
|
|
627
679
|
}
|
|
628
680
|
}
|
|
629
|
-
},
|
|
681
|
+
}, _callee15);
|
|
630
682
|
}));
|
|
631
683
|
return _addLayerResources.apply(this, arguments);
|
|
632
684
|
}
|
|
633
685
|
|
|
634
|
-
function addResourceToFirstLayer(
|
|
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
|
|
691
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(data) {
|
|
640
692
|
var group;
|
|
641
|
-
return _regenerator["default"].wrap(function
|
|
693
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
642
694
|
while (1) {
|
|
643
|
-
switch (
|
|
695
|
+
switch (_context16.prev = _context16.next) {
|
|
644
696
|
case 0:
|
|
645
697
|
group = resourceConfig.getGroups()[0];
|
|
646
|
-
|
|
698
|
+
_context16.next = 3;
|
|
647
699
|
return addLayerResources(group, data);
|
|
648
700
|
|
|
649
701
|
case 3:
|
|
650
702
|
case "end":
|
|
651
|
-
return
|
|
703
|
+
return _context16.stop();
|
|
652
704
|
}
|
|
653
705
|
}
|
|
654
|
-
},
|
|
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
|
|
681
|
-
return _regenerator["default"].wrap(function
|
|
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 (
|
|
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
|
-
|
|
742
|
+
_context7.next = 7;
|
|
691
743
|
break;
|
|
692
744
|
}
|
|
693
745
|
|
|
694
|
-
|
|
746
|
+
_context7.next = 5;
|
|
695
747
|
return addResourceToFirstLayer(data);
|
|
696
748
|
|
|
697
749
|
case 5:
|
|
698
|
-
|
|
750
|
+
_context7.next = 9;
|
|
699
751
|
break;
|
|
700
752
|
|
|
701
753
|
case 7:
|
|
702
|
-
|
|
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
|
|
762
|
+
return _context7.stop();
|
|
711
763
|
}
|
|
712
764
|
}
|
|
713
|
-
},
|
|
765
|
+
}, _callee7);
|
|
714
766
|
}));
|
|
715
767
|
|
|
716
|
-
return function onSaveComboRes(
|
|
717
|
-
return
|
|
768
|
+
return function onSaveComboRes(_x12) {
|
|
769
|
+
return _ref6.apply(this, arguments);
|
|
718
770
|
};
|
|
719
771
|
}();
|
|
720
772
|
|
|
721
|
-
function checkSavePermission(
|
|
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
|
|
778
|
+
_checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(id) {
|
|
727
779
|
var permission;
|
|
728
|
-
return _regenerator["default"].wrap(function
|
|
780
|
+
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
|
729
781
|
while (1) {
|
|
730
|
-
switch (
|
|
782
|
+
switch (_context17.prev = _context17.next) {
|
|
731
783
|
case 0:
|
|
732
|
-
|
|
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 =
|
|
791
|
+
permission = _context17.sent;
|
|
740
792
|
|
|
741
793
|
if (!_topoPermissionUtil["default"].isEditable(permission)) {
|
|
742
|
-
|
|
794
|
+
_context17.next = 5;
|
|
743
795
|
break;
|
|
744
796
|
}
|
|
745
797
|
|
|
746
|
-
return
|
|
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
|
|
810
|
+
return _context17.abrupt("return", false);
|
|
759
811
|
|
|
760
812
|
case 7:
|
|
761
813
|
case "end":
|
|
762
|
-
return
|
|
814
|
+
return _context17.stop();
|
|
763
815
|
}
|
|
764
816
|
}
|
|
765
|
-
},
|
|
817
|
+
}, _callee17);
|
|
766
818
|
}));
|
|
767
819
|
return _checkSavePermission.apply(this, arguments);
|
|
768
820
|
}
|
|
769
821
|
|
|
770
822
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
771
|
-
var
|
|
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
|
|
826
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
775
827
|
while (1) {
|
|
776
|
-
switch (
|
|
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
|
-
|
|
834
|
+
_context9.next = 6;
|
|
783
835
|
break;
|
|
784
836
|
}
|
|
785
837
|
|
|
786
838
|
// 自定义保存
|
|
787
839
|
saveConfig = /*#__PURE__*/function () {
|
|
788
|
-
var
|
|
789
|
-
return _regenerator["default"].wrap(function
|
|
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 (
|
|
843
|
+
switch (_context8.prev = _context8.next) {
|
|
792
844
|
case 0:
|
|
793
|
-
|
|
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
|
|
854
|
+
return _context8.stop();
|
|
803
855
|
}
|
|
804
856
|
}
|
|
805
|
-
},
|
|
857
|
+
}, _callee8);
|
|
806
858
|
}));
|
|
807
859
|
|
|
808
860
|
return function saveConfig() {
|
|
809
|
-
return
|
|
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
|
|
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
|
-
|
|
877
|
+
_context9.next = 9;
|
|
826
878
|
return checkSavePermission(id);
|
|
827
879
|
|
|
828
880
|
case 9:
|
|
829
|
-
valid =
|
|
881
|
+
valid = _context9.sent;
|
|
830
882
|
|
|
831
883
|
if (valid) {
|
|
832
|
-
|
|
884
|
+
_context9.next = 13;
|
|
833
885
|
break;
|
|
834
886
|
}
|
|
835
887
|
|
|
836
888
|
topoEditDispatchers.update({
|
|
837
889
|
saving: false
|
|
838
890
|
});
|
|
839
|
-
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
|
-
|
|
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
|
|
915
|
+
return _context9.stop();
|
|
864
916
|
}
|
|
865
917
|
}
|
|
866
|
-
},
|
|
918
|
+
}, _callee9);
|
|
867
919
|
}));
|
|
868
920
|
|
|
869
|
-
return function onSaveTopo(
|
|
870
|
-
return
|
|
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
|
|
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
|
|
953
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
902
954
|
while (1) {
|
|
903
|
-
switch (
|
|
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
|
|
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
|
|
968
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
917
969
|
while (1) {
|
|
918
|
-
switch (
|
|
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
|
-
|
|
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
|
|
1051
|
+
return _context10.stop();
|
|
1000
1052
|
}
|
|
1001
1053
|
}
|
|
1002
|
-
},
|
|
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
|
-
|
|
1096
|
+
_context11.next = 13;
|
|
1045
1097
|
return resourceConfig.updateConfig(config);
|
|
1046
1098
|
|
|
1047
1099
|
case 13:
|
|
1048
|
-
|
|
1100
|
+
_context11.next = 15;
|
|
1049
1101
|
return editDispatchers.fetchDataByConfig();
|
|
1050
1102
|
|
|
1051
1103
|
case 15:
|
|
1052
|
-
_yield$editDispatcher =
|
|
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
|
-
|
|
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
|
|
1120
|
+
return _context11.abrupt("return", false);
|
|
1069
1121
|
|
|
1070
1122
|
case 23:
|
|
1071
|
-
|
|
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
|
|
1131
|
+
return _context11.stop();
|
|
1080
1132
|
}
|
|
1081
1133
|
}
|
|
1082
|
-
},
|
|
1134
|
+
}, _callee11);
|
|
1083
1135
|
}));
|
|
1084
1136
|
|
|
1085
|
-
return function bindNodeResource(
|
|
1086
|
-
return
|
|
1137
|
+
return function bindNodeResource(_x15) {
|
|
1138
|
+
return _ref9.apply(this, arguments);
|
|
1087
1139
|
};
|
|
1088
1140
|
}();
|
|
1089
1141
|
|