@riil-frontend/component-topology 2.10.0 → 2.12.1
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 +3 -3
- package/es/components/MultiResourceDrawer/index.js +18 -13
- package/es/core/components/TopoView/topoView.js +22 -12
- package/es/hooks/useRelateTopo.js +1 -0
- package/es/hooks/useRelateTopoConfig.js +0 -0
- package/es/hooks/useTopoEdit.js +189 -71
- package/es/models/topoCreateMod.js +5 -2
- package/es/topoCenter/components/TopoTreeSelect.js +5 -0
- package/es/topoCenter/viewer/createTopoViewer.js +0 -1
- package/lib/components/MultiResourceDrawer/index.js +18 -13
- package/lib/core/components/TopoView/topoView.js +22 -12
- package/lib/hooks/useRelateTopo.js +6 -0
- package/lib/hooks/useRelateTopoConfig.js +1 -0
- package/lib/hooks/useTopoEdit.js +189 -71
- package/lib/models/topoCreateMod.js +5 -2
- package/lib/topoCenter/components/TopoTreeSelect.js +14 -0
- package/lib/topoCenter/viewer/createTopoViewer.js +0 -2
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import ResourceSelectDrawer from "../ResourceSelectDrawer";
|
|
|
5
5
|
|
|
6
6
|
var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
7
7
|
var visible = props.visible,
|
|
8
|
-
|
|
8
|
+
isLayerTopo = props.isLayerTopo,
|
|
9
9
|
initialData = props.initialData,
|
|
10
10
|
totalSelection = props.totalSelection,
|
|
11
11
|
onSave = props.onSave,
|
|
@@ -18,20 +18,25 @@ var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
|
18
18
|
while (1) {
|
|
19
19
|
switch (_context.prev = _context.next) {
|
|
20
20
|
case 0:
|
|
21
|
-
result =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
result = selected;
|
|
22
|
+
|
|
23
|
+
if (!isLayerTopo) {
|
|
24
|
+
result = {
|
|
25
|
+
dynamic: {
|
|
26
|
+
selected: false,
|
|
27
|
+
condition: null,
|
|
28
|
+
data: null
|
|
29
|
+
},
|
|
30
|
+
"static": {
|
|
31
|
+
selected: true,
|
|
32
|
+
data: [].concat(initialData["static"].data, selected)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
onSave(result);
|
|
33
38
|
|
|
34
|
-
case
|
|
39
|
+
case 3:
|
|
35
40
|
case "end":
|
|
36
41
|
return _context.stop();
|
|
37
42
|
}
|
|
@@ -18,7 +18,7 @@ import styles from "./TopoView.module.scss";
|
|
|
18
18
|
import Settings from "../../editor/components/settings/Settings";
|
|
19
19
|
|
|
20
20
|
var TopoView = function TopoView(props) {
|
|
21
|
-
var _classnames, _topoApp$options$edit;
|
|
21
|
+
var _topoData$config, _classnames, _topoApp$options$edit;
|
|
22
22
|
|
|
23
23
|
var engine = props.engine,
|
|
24
24
|
topo = props.topo,
|
|
@@ -30,7 +30,10 @@ var TopoView = function TopoView(props) {
|
|
|
30
30
|
nodeDeleteable = props.nodeDeleteable,
|
|
31
31
|
onNodeDelete = props.onNodeDelete,
|
|
32
32
|
onLineDelete = props.onLineDelete,
|
|
33
|
-
|
|
33
|
+
onReady = props.onReady,
|
|
34
|
+
onDestroy = props.onDestroy,
|
|
35
|
+
onLoaded = props.onLoaded,
|
|
36
|
+
buildLoadOptions = props.buildLoadOptions;
|
|
34
37
|
var topoApp = engine || topo;
|
|
35
38
|
var store = topoApp.store;
|
|
36
39
|
|
|
@@ -53,7 +56,13 @@ var TopoView = function TopoView(props) {
|
|
|
53
56
|
viewState = topoState.viewState,
|
|
54
57
|
topoData = topoState.topoData,
|
|
55
58
|
urlParams = topoState.urlParams;
|
|
56
|
-
var isEditMode = viewState === 'edit';
|
|
59
|
+
var isEditMode = viewState === 'edit';
|
|
60
|
+
var topoShowType = topoData === null || topoData === void 0 ? void 0 : (_topoData$config = topoData.config) === null || _topoData$config === void 0 ? void 0 : _topoData$config.showType;
|
|
61
|
+
|
|
62
|
+
var _useState = useState(buildLoadOptions ? buildLoadOptions(topoData) : topoData),
|
|
63
|
+
tData = _useState[0],
|
|
64
|
+
setTData = _useState[1]; // rlog.debug('TopoView---income', topoId, viewState);
|
|
65
|
+
|
|
57
66
|
|
|
58
67
|
var resAndMetrics = bizState.resAndMetrics;
|
|
59
68
|
var topoEditApi = useTopoEdit({
|
|
@@ -63,7 +72,8 @@ var TopoView = function TopoView(props) {
|
|
|
63
72
|
onSave: onSave,
|
|
64
73
|
nodeDeleteable: nodeDeleteable,
|
|
65
74
|
onNodeDelete: onNodeDelete,
|
|
66
|
-
onLineDelete: onLineDelete
|
|
75
|
+
onLineDelete: onLineDelete,
|
|
76
|
+
topoShowType: topoShowType
|
|
67
77
|
});
|
|
68
78
|
var topoLoading = topoEditApi.topoLoading,
|
|
69
79
|
showSingleResDrawer = topoEditApi.showSingleResDrawer,
|
|
@@ -80,11 +90,6 @@ var TopoView = function TopoView(props) {
|
|
|
80
90
|
onDeleteElement = topoEditApi.onDeleteElement,
|
|
81
91
|
onSaveTopo = topoEditApi.onSaveTopo,
|
|
82
92
|
onTopoRelatedImage = topoEditApi.onTopoRelatedImage;
|
|
83
|
-
|
|
84
|
-
var _useState = useState(topoData),
|
|
85
|
-
tData = _useState[0],
|
|
86
|
-
setTData = _useState[1];
|
|
87
|
-
|
|
88
93
|
var containerLinkTopo = useContainerLinkTopo({
|
|
89
94
|
topoApp: topoApp
|
|
90
95
|
});
|
|
@@ -106,7 +111,7 @@ var TopoView = function TopoView(props) {
|
|
|
106
111
|
}, [topoId, viewState]);
|
|
107
112
|
useEffect(function () {
|
|
108
113
|
rlog.debug('TopoView.useEffect topoData', topoData);
|
|
109
|
-
setTData(topoData);
|
|
114
|
+
setTData(buildLoadOptions ? buildLoadOptions(topoData) : topoData);
|
|
110
115
|
|
|
111
116
|
if (topoData) {
|
|
112
117
|
// TODO 移到模型中
|
|
@@ -114,11 +119,15 @@ var TopoView = function TopoView(props) {
|
|
|
114
119
|
currentTopo: topoData.config
|
|
115
120
|
});
|
|
116
121
|
}
|
|
117
|
-
}, [topoData
|
|
122
|
+
}, [topoData]);
|
|
118
123
|
var onCreatedTopo = useCallback(function (topoClient) {
|
|
119
124
|
topoApp.view.onCreatedView(topoClient);
|
|
120
125
|
rlog.info('TopoView.onCreatedTopo');
|
|
121
126
|
initSelection();
|
|
127
|
+
|
|
128
|
+
if (onReady) {
|
|
129
|
+
onReady();
|
|
130
|
+
}
|
|
122
131
|
}, []);
|
|
123
132
|
var handleLoaded = useCallback(function () {
|
|
124
133
|
if (topoApp.alarms) {
|
|
@@ -218,7 +227,7 @@ var TopoView = function TopoView(props) {
|
|
|
218
227
|
enableRelateResource: ((_topoApp$options$edit = topoApp.options.editor) === null || _topoApp$options$edit === void 0 ? void 0 : _topoApp$options$edit.enableRelateResource) !== false,
|
|
219
228
|
onCreate: onCreatedTopo,
|
|
220
229
|
onLoaded: handleLoaded,
|
|
221
|
-
onDestroy:
|
|
230
|
+
onDestroy: onDestroy,
|
|
222
231
|
onEvent: onEvent,
|
|
223
232
|
style: {
|
|
224
233
|
width: '100%',
|
|
@@ -244,6 +253,7 @@ var TopoView = function TopoView(props) {
|
|
|
244
253
|
loading: topoLoading,
|
|
245
254
|
initialData: initialComboRes,
|
|
246
255
|
totalSelection: resSelections,
|
|
256
|
+
isLayerTopo: topoShowType === 'layers',
|
|
247
257
|
onSave: onSaveComboRes,
|
|
248
258
|
onClose: onCloseComboResDrawer
|
|
249
259
|
}), /*#__PURE__*/React.createElement(ViewerPlugin, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useRelateTopo(props) {}
|
|
File without changes
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -19,7 +19,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
19
19
|
isEditing = params.isEditing,
|
|
20
20
|
onSave = params.onSave,
|
|
21
21
|
onLineDelete = params.onLineDelete,
|
|
22
|
-
onNodeDelete = params.onNodeDelete
|
|
22
|
+
onNodeDelete = params.onNodeDelete,
|
|
23
|
+
topoShowType = params.topoShowType;
|
|
23
24
|
var store = topoApp.store;
|
|
24
25
|
var emitEvent = useCallback(function (eventType, eventData) {
|
|
25
26
|
topoApp.view.topoClient.emitEvent(eventType, eventData);
|
|
@@ -312,13 +313,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
312
313
|
|
|
313
314
|
var deleteGroup = function deleteGroup(data) {
|
|
314
315
|
var id = data.id,
|
|
315
|
-
tag = data.tag; //
|
|
316
|
+
tag = data.tag; // 新加的容器 tag 格式为 group_${id}
|
|
316
317
|
|
|
317
|
-
var
|
|
318
|
-
|
|
318
|
+
var group = topoApp.getDataModel().getDataById(tag) || topoApp.getDataModel().getDataByTag(id) || topoApp.getDataModel().getDatas().toArray().filter(function (item) {
|
|
319
|
+
return item.a('tag') === tag;
|
|
320
|
+
})[0];
|
|
319
321
|
|
|
320
322
|
if (!group) {
|
|
321
323
|
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (!group.getChildren().length) {
|
|
327
|
+
doDelete();
|
|
322
328
|
} // 有子节点时需要确认
|
|
323
329
|
|
|
324
330
|
|
|
@@ -334,23 +340,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
334
340
|
},
|
|
335
341
|
onOk: function () {
|
|
336
342
|
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
337
|
-
var index;
|
|
338
343
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
339
344
|
while (1) {
|
|
340
345
|
switch (_context2.prev = _context2.next) {
|
|
341
346
|
case 0:
|
|
342
|
-
|
|
343
|
-
return id ? group.id === id : group.tag === tag;
|
|
344
|
-
}); // Existing group
|
|
345
|
-
|
|
346
|
-
if (index > -1) {
|
|
347
|
-
editDispatchers.deleteGroup(index);
|
|
348
|
-
} // FIXME 。如果命中其他的动态条件,则立即显示
|
|
349
|
-
|
|
347
|
+
doDelete();
|
|
350
348
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
case 3:
|
|
349
|
+
case 1:
|
|
354
350
|
case "end":
|
|
355
351
|
return _context2.stop();
|
|
356
352
|
}
|
|
@@ -366,6 +362,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
366
362
|
}()
|
|
367
363
|
});
|
|
368
364
|
}
|
|
365
|
+
|
|
366
|
+
function doDelete() {
|
|
367
|
+
var index = groups.findIndex(function (group) {
|
|
368
|
+
return id ? group.id === id : group.tag === tag;
|
|
369
|
+
}); // Existing group
|
|
370
|
+
|
|
371
|
+
if (index > -1) {
|
|
372
|
+
editDispatchers.deleteGroup(index);
|
|
373
|
+
} // FIXME 。如果命中其他的动态条件,则立即显示
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
topoApp.view.topoClient.deleteGroup(data);
|
|
377
|
+
}
|
|
369
378
|
};
|
|
370
379
|
/**
|
|
371
380
|
* 删除容器内的单个资源
|
|
@@ -430,22 +439,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
430
439
|
|
|
431
440
|
return index;
|
|
432
441
|
}
|
|
433
|
-
/**
|
|
434
|
-
* 关联容器的资源
|
|
435
|
-
*/
|
|
436
442
|
|
|
443
|
+
function findGroup(groups, group) {
|
|
444
|
+
var id = group.id,
|
|
445
|
+
tag = group.tag;
|
|
437
446
|
|
|
438
|
-
|
|
439
|
-
|
|
447
|
+
if (id) {
|
|
448
|
+
// Existing group
|
|
449
|
+
return groups.filter(function (group) {
|
|
450
|
+
return group.id === id;
|
|
451
|
+
})[0];
|
|
452
|
+
} else if (tag) {
|
|
453
|
+
return groups.filter(function (group) {
|
|
454
|
+
return group.tag === tag;
|
|
455
|
+
})[0];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function bindGroupResourcesConfig(_x, _x2) {
|
|
462
|
+
return _bindGroupResourcesConfig.apply(this, arguments);
|
|
440
463
|
}
|
|
441
464
|
/**
|
|
442
|
-
*
|
|
465
|
+
* 关联容器的资源
|
|
443
466
|
*/
|
|
444
467
|
|
|
445
468
|
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
var id, tag, name, index, newGroup
|
|
469
|
+
function _bindGroupResourcesConfig() {
|
|
470
|
+
_bindGroupResourcesConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(group, data) {
|
|
471
|
+
var id, tag, name, index, newGroup;
|
|
449
472
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
450
473
|
while (1) {
|
|
451
474
|
switch (_context5.prev = _context5.next) {
|
|
@@ -456,13 +479,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
456
479
|
tag: tag
|
|
457
480
|
});
|
|
458
481
|
|
|
459
|
-
if (index > -1) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
482
|
+
if (!(index > -1)) {
|
|
483
|
+
_context5.next = 7;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
_context5.next = 5;
|
|
488
|
+
return editDispatchers.updateGroupResourcesByIndex({
|
|
489
|
+
index: index,
|
|
490
|
+
resources: data
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
case 5:
|
|
494
|
+
_context5.next = 8;
|
|
495
|
+
break;
|
|
496
|
+
|
|
497
|
+
case 7:
|
|
498
|
+
if (tag) {
|
|
466
499
|
// New group
|
|
467
500
|
newGroup = _extends({}, DEFAULT_GROUP, {
|
|
468
501
|
resources: data,
|
|
@@ -472,11 +505,43 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
472
505
|
editDispatchers.addGroup(newGroup);
|
|
473
506
|
}
|
|
474
507
|
|
|
475
|
-
|
|
508
|
+
case 8:
|
|
509
|
+
case "end":
|
|
510
|
+
return _context5.stop();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}, _callee5);
|
|
514
|
+
}));
|
|
515
|
+
return _bindGroupResourcesConfig.apply(this, arguments);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function bindGroupResources(_x3, _x4) {
|
|
519
|
+
return _bindGroupResources.apply(this, arguments);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* 关联视图的资源
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
function _bindGroupResources() {
|
|
527
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(group, data) {
|
|
528
|
+
var id, tag, _yield$editDispatcher, elements, groupElement;
|
|
529
|
+
|
|
530
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
531
|
+
while (1) {
|
|
532
|
+
switch (_context6.prev = _context6.next) {
|
|
533
|
+
case 0:
|
|
534
|
+
id = group.id, tag = group.tag;
|
|
535
|
+
_context6.next = 3;
|
|
536
|
+
return bindGroupResourcesConfig(group, data);
|
|
537
|
+
|
|
538
|
+
case 3:
|
|
539
|
+
_context6.next = 5;
|
|
476
540
|
return editDispatchers.refreshDataByConfig();
|
|
477
541
|
|
|
478
542
|
case 5:
|
|
479
|
-
|
|
543
|
+
_yield$editDispatcher = _context6.sent;
|
|
544
|
+
elements = _yield$editDispatcher.topoDataTrans;
|
|
480
545
|
rlog.debug('useUpdateEffect--id, tag', id, tag);
|
|
481
546
|
|
|
482
547
|
if (id) {
|
|
@@ -491,55 +556,108 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
491
556
|
|
|
492
557
|
setFocusedGroup(null);
|
|
493
558
|
|
|
494
|
-
case
|
|
559
|
+
case 11:
|
|
495
560
|
case "end":
|
|
496
|
-
return
|
|
561
|
+
return _context6.stop();
|
|
497
562
|
}
|
|
498
563
|
}
|
|
499
|
-
},
|
|
564
|
+
}, _callee6);
|
|
500
565
|
}));
|
|
501
566
|
return _bindGroupResources.apply(this, arguments);
|
|
502
567
|
}
|
|
503
568
|
|
|
504
|
-
function bindViewResources(
|
|
569
|
+
function bindViewResources(_x5) {
|
|
505
570
|
return _bindViewResources.apply(this, arguments);
|
|
506
571
|
}
|
|
507
572
|
|
|
508
573
|
function _bindViewResources() {
|
|
509
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
510
|
-
var elements;
|
|
511
|
-
|
|
574
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
575
|
+
var _yield$editDispatcher2, elements;
|
|
576
|
+
|
|
577
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
512
578
|
while (1) {
|
|
513
|
-
switch (
|
|
579
|
+
switch (_context7.prev = _context7.next) {
|
|
514
580
|
case 0:
|
|
515
|
-
|
|
581
|
+
_context7.next = 2;
|
|
516
582
|
return editDispatchers.updateViewResources(data);
|
|
517
583
|
|
|
518
584
|
case 2:
|
|
519
|
-
|
|
585
|
+
_context7.next = 4;
|
|
520
586
|
return editDispatchers.refreshDataByConfig();
|
|
521
587
|
|
|
522
588
|
case 4:
|
|
523
|
-
|
|
589
|
+
_yield$editDispatcher2 = _context7.sent;
|
|
590
|
+
elements = _yield$editDispatcher2.topoDataTrans;
|
|
524
591
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
|
|
525
592
|
|
|
526
|
-
case
|
|
593
|
+
case 7:
|
|
527
594
|
case "end":
|
|
528
|
-
return
|
|
595
|
+
return _context7.stop();
|
|
529
596
|
}
|
|
530
597
|
}
|
|
531
|
-
},
|
|
598
|
+
}, _callee7);
|
|
532
599
|
}));
|
|
533
600
|
return _bindViewResources.apply(this, arguments);
|
|
534
601
|
}
|
|
535
602
|
|
|
603
|
+
function addResourceToFirstLayer(_x6) {
|
|
604
|
+
return _addResourceToFirstLayer.apply(this, arguments);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function _addResourceToFirstLayer() {
|
|
608
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
|
|
609
|
+
var group, config, _yield$editDispatcher3, topoData;
|
|
610
|
+
|
|
611
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
612
|
+
while (1) {
|
|
613
|
+
switch (_context8.prev = _context8.next) {
|
|
614
|
+
case 0:
|
|
615
|
+
group = groups[0];
|
|
616
|
+
config = {
|
|
617
|
+
dynamic: {
|
|
618
|
+
selected: false,
|
|
619
|
+
condition: null,
|
|
620
|
+
data: null
|
|
621
|
+
},
|
|
622
|
+
"static": {
|
|
623
|
+
selected: true,
|
|
624
|
+
data: [].concat(group.resources["static"].data, data)
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
_context8.next = 4;
|
|
628
|
+
return bindGroupResourcesConfig(group, config);
|
|
629
|
+
|
|
630
|
+
case 4:
|
|
631
|
+
_context8.next = 6;
|
|
632
|
+
return editDispatchers.refreshDataByConfig();
|
|
633
|
+
|
|
634
|
+
case 6:
|
|
635
|
+
_yield$editDispatcher3 = _context8.sent;
|
|
636
|
+
topoData = _yield$editDispatcher3.topoData;
|
|
637
|
+
topoApp.updateElements(topoData);
|
|
638
|
+
|
|
639
|
+
case 9:
|
|
640
|
+
case "end":
|
|
641
|
+
return _context8.stop();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}, _callee8);
|
|
645
|
+
}));
|
|
646
|
+
return _addResourceToFirstLayer.apply(this, arguments);
|
|
647
|
+
}
|
|
648
|
+
|
|
536
649
|
var onSaveComboRes = function onSaveComboRes(data) {
|
|
537
650
|
rlog.debug('关联资源-----onSaveComboRes', data, focusedGroup);
|
|
538
651
|
|
|
539
|
-
if (
|
|
540
|
-
|
|
652
|
+
if (topoShowType !== 'layers') {
|
|
653
|
+
if (focusedGroup) {
|
|
654
|
+
bindGroupResources(focusedGroup, data);
|
|
655
|
+
} else {
|
|
656
|
+
bindViewResources(data);
|
|
657
|
+
}
|
|
541
658
|
} else {
|
|
542
|
-
|
|
659
|
+
// 分层拓扑,添加到第一层
|
|
660
|
+
addResourceToFirstLayer(data);
|
|
543
661
|
}
|
|
544
662
|
};
|
|
545
663
|
|
|
@@ -579,32 +697,32 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
579
697
|
}
|
|
580
698
|
};
|
|
581
699
|
|
|
582
|
-
function checkSavePermission(
|
|
700
|
+
function checkSavePermission(_x7) {
|
|
583
701
|
return _checkSavePermission.apply(this, arguments);
|
|
584
702
|
}
|
|
585
703
|
|
|
586
704
|
function _checkSavePermission() {
|
|
587
|
-
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
705
|
+
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id) {
|
|
588
706
|
var permission;
|
|
589
|
-
return _regeneratorRuntime.wrap(function
|
|
707
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
590
708
|
while (1) {
|
|
591
|
-
switch (
|
|
709
|
+
switch (_context9.prev = _context9.next) {
|
|
592
710
|
case 0:
|
|
593
|
-
|
|
711
|
+
_context9.next = 2;
|
|
594
712
|
return topoDispatchers.getTopoPermission({
|
|
595
713
|
id: id,
|
|
596
714
|
update: false
|
|
597
715
|
});
|
|
598
716
|
|
|
599
717
|
case 2:
|
|
600
|
-
permission =
|
|
718
|
+
permission = _context9.sent;
|
|
601
719
|
|
|
602
720
|
if (!topoPermissonUtil.isEditable(permission)) {
|
|
603
|
-
|
|
721
|
+
_context9.next = 5;
|
|
604
722
|
break;
|
|
605
723
|
}
|
|
606
724
|
|
|
607
|
-
return
|
|
725
|
+
return _context9.abrupt("return", true);
|
|
608
726
|
|
|
609
727
|
case 5:
|
|
610
728
|
_Dialog.alert({
|
|
@@ -616,14 +734,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
616
734
|
onOk: function onOk() {}
|
|
617
735
|
});
|
|
618
736
|
|
|
619
|
-
return
|
|
737
|
+
return _context9.abrupt("return", false);
|
|
620
738
|
|
|
621
739
|
case 7:
|
|
622
740
|
case "end":
|
|
623
|
-
return
|
|
741
|
+
return _context9.stop();
|
|
624
742
|
}
|
|
625
743
|
}
|
|
626
|
-
},
|
|
744
|
+
}, _callee9);
|
|
627
745
|
}));
|
|
628
746
|
return _checkSavePermission.apply(this, arguments);
|
|
629
747
|
}
|
|
@@ -740,7 +858,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
740
858
|
}, _callee4);
|
|
741
859
|
}));
|
|
742
860
|
|
|
743
|
-
return function onSaveTopo(
|
|
861
|
+
return function onSaveTopo(_x8) {
|
|
744
862
|
return _ref5.apply(this, arguments);
|
|
745
863
|
};
|
|
746
864
|
}();
|
|
@@ -807,22 +925,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
807
925
|
* @return {Promise<void>}
|
|
808
926
|
*/
|
|
809
927
|
|
|
810
|
-
function refreshDataByConfig(
|
|
928
|
+
function refreshDataByConfig(_x9) {
|
|
811
929
|
return _refreshDataByConfig.apply(this, arguments);
|
|
812
930
|
}
|
|
813
931
|
|
|
814
932
|
function _refreshDataByConfig() {
|
|
815
|
-
_refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
933
|
+
_refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(config) {
|
|
816
934
|
var resources, groups, dRes, sRes, query;
|
|
817
|
-
return _regeneratorRuntime.wrap(function
|
|
935
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
818
936
|
while (1) {
|
|
819
|
-
switch (
|
|
937
|
+
switch (_context10.prev = _context10.next) {
|
|
820
938
|
case 0:
|
|
821
939
|
resources = config.resources, groups = config.groups;
|
|
822
940
|
dRes = resources.dynamic, sRes = resources["static"];
|
|
823
941
|
|
|
824
942
|
if (!(dRes.selected && dRes.condition || sRes.selected && isAvailableArray(sRes.data) || isAvailableArray(groups))) {
|
|
825
|
-
|
|
943
|
+
_context10.next = 7;
|
|
826
944
|
break;
|
|
827
945
|
}
|
|
828
946
|
|
|
@@ -833,15 +951,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
833
951
|
};
|
|
834
952
|
rlog.debug('useEffect', editState, isEditing, topoId, resources, groups); // editDispatchers.update({ resources, groups });
|
|
835
953
|
|
|
836
|
-
|
|
954
|
+
_context10.next = 7;
|
|
837
955
|
return editDispatchers.getTopoByConditions(query);
|
|
838
956
|
|
|
839
957
|
case 7:
|
|
840
958
|
case "end":
|
|
841
|
-
return
|
|
959
|
+
return _context10.stop();
|
|
842
960
|
}
|
|
843
961
|
}
|
|
844
|
-
},
|
|
962
|
+
}, _callee10);
|
|
845
963
|
}));
|
|
846
964
|
return _refreshDataByConfig.apply(this, arguments);
|
|
847
965
|
}
|
|
@@ -371,7 +371,7 @@ export default function (topoApp) {
|
|
|
371
371
|
|
|
372
372
|
case 5:
|
|
373
373
|
data = _context2.sent;
|
|
374
|
-
return _context2.abrupt("return", data);
|
|
374
|
+
return _context2.abrupt("return", data.topoDataTrans);
|
|
375
375
|
|
|
376
376
|
case 7:
|
|
377
377
|
case "end":
|
|
@@ -478,7 +478,10 @@ export default function (topoApp) {
|
|
|
478
478
|
// });
|
|
479
479
|
// 返回查询后的数据,便于外部获取到数据后像HT通知更新
|
|
480
480
|
|
|
481
|
-
return _context4.abrupt("return",
|
|
481
|
+
return _context4.abrupt("return", {
|
|
482
|
+
topoData: topoData,
|
|
483
|
+
topoDataTrans: topoDataTrans
|
|
484
|
+
});
|
|
482
485
|
|
|
483
486
|
case 19:
|
|
484
487
|
case "end":
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import createMenuCommands from "../../contextmenu/createMenuCommands";
|
|
3
2
|
import TopoCenter from "../models/TopoCenter";
|
|
4
3
|
export function createTopoViewer(options) {
|
|
5
4
|
var topoApp = new TopoCenter(_extends({}, options));
|
|
@@ -17,7 +17,7 @@ var _ResourceSelectDrawer = _interopRequireDefault(require("../ResourceSelectDra
|
|
|
17
17
|
|
|
18
18
|
var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
19
19
|
var visible = props.visible,
|
|
20
|
-
|
|
20
|
+
isLayerTopo = props.isLayerTopo,
|
|
21
21
|
initialData = props.initialData,
|
|
22
22
|
totalSelection = props.totalSelection,
|
|
23
23
|
onSave = props.onSave,
|
|
@@ -30,20 +30,25 @@ var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
|
30
30
|
while (1) {
|
|
31
31
|
switch (_context.prev = _context.next) {
|
|
32
32
|
case 0:
|
|
33
|
-
result =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
result = selected;
|
|
34
|
+
|
|
35
|
+
if (!isLayerTopo) {
|
|
36
|
+
result = {
|
|
37
|
+
dynamic: {
|
|
38
|
+
selected: false,
|
|
39
|
+
condition: null,
|
|
40
|
+
data: null
|
|
41
|
+
},
|
|
42
|
+
"static": {
|
|
43
|
+
selected: true,
|
|
44
|
+
data: [].concat(initialData["static"].data, selected)
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
onSave(result);
|
|
45
50
|
|
|
46
|
-
case
|
|
51
|
+
case 3:
|
|
47
52
|
case "end":
|
|
48
53
|
return _context.stop();
|
|
49
54
|
}
|