@riil-frontend/component-topology 11.0.35 → 11.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.js +37 -29
- package/es/components/MultiResourceDrawer/index.js +8 -6
- package/es/components/ResourceList/ResourceSelect.js +8 -7
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
- package/es/components/SingleResourceDrawer/SelectDrawer.js +8 -6
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
- package/es/core/editor/components/BackgroundView/index.js +73 -54
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -5
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
- package/es/core/hooks/usePolling.js +21 -13
- package/es/core/hooks/useResourceConfig.js +37 -21
- package/es/core/hooks/useTopoEdit.js +215 -147
- package/es/core/models/Alarm.js +104 -38
- package/es/core/models/AttributeMetricDisplay.js +36 -14
- package/es/core/models/TopoApp.js +197 -75
- package/es/core/models/TopoGraphView.js +20 -10
- package/es/core/models/cache/CiCache.js +12 -6
- package/es/core/models/cache/CiTypeCache.js +20 -10
- package/es/core/models/cache/DictCache.js +10 -6
- package/es/core/models/graph/Background.js +9 -6
- package/es/core/models/plugins/resourceWebControllUrl.js +21 -8
- package/es/core/models/tagstips/ElementTagTipConfig.js +20 -10
- package/es/core/models/topoData.js +7 -5
- package/es/core/models/utils/linkUtils.js +8 -5
- package/es/core/services/cmdb/metric.js +7 -5
- package/es/core/services/cmdb.js +7 -5
- package/es/core/services/index.js +23 -9
- package/es/core/services/topo/tagtip.js +7 -5
- package/es/core/store/models/customIcon.js +11 -6
- package/es/core/utils/imageUtil.js +7 -5
- package/es/core/utils/saveSerialize.js +7 -5
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -18
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +47 -34
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +74 -34
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +29 -24
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -26
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +15 -7
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
- package/es/networkTopo/components/Link/hook.js +21 -14
- package/es/networkTopo/components/Link/index.js +32 -18
- package/es/networkTopo/components/Link/setting.js +8 -6
- package/es/networkTopo/getTopoData.js +23 -10
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
- package/es/networkTopo/models/TopoCenter.js +24 -10
- package/es/networkTopo/services/cmdb.js +333 -233
- package/es/networkTopo/services/mdc.js +24 -15
- package/es/networkTopo/services/metric.js +16 -11
- package/es/networkTopo/services/model.js +412 -283
- package/es/networkTopo/utils/exportData.js +7 -5
- package/lib/components/MultiResourceDrawer/index.js +8 -6
- package/lib/components/ResourceList/ResourceSelect.js +8 -6
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
- package/lib/core/editor/components/BackgroundView/index.js +74 -55
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -4
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
- package/lib/core/hooks/usePolling.js +21 -13
- package/lib/core/hooks/useResourceConfig.js +37 -21
- package/lib/core/hooks/useTopoEdit.js +215 -147
- package/lib/core/models/Alarm.js +104 -38
- package/lib/core/models/AttributeMetricDisplay.js +36 -14
- package/lib/core/models/TopoApp.js +197 -75
- package/lib/core/models/TopoGraphView.js +20 -10
- package/lib/core/models/cache/CiCache.js +12 -6
- package/lib/core/models/cache/CiTypeCache.js +20 -10
- package/lib/core/models/cache/DictCache.js +10 -6
- package/lib/core/models/graph/Background.js +9 -6
- package/lib/core/models/plugins/resourceWebControllUrl.js +21 -8
- package/lib/core/models/tagstips/ElementTagTipConfig.js +20 -10
- package/lib/core/models/topoData.js +7 -4
- package/lib/core/models/utils/linkUtils.js +8 -4
- package/lib/core/services/cmdb/metric.js +7 -4
- package/lib/core/services/cmdb.js +7 -4
- package/lib/core/services/index.js +21 -8
- package/lib/core/services/topo/tagtip.js +7 -4
- package/lib/core/store/models/customIcon.js +11 -6
- package/lib/core/utils/imageUtil.js +7 -4
- package/lib/core/utils/saveSerialize.js +7 -4
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -19
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +49 -36
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +73 -35
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +29 -24
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -25
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +14 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
- package/lib/networkTopo/components/Link/hook.js +23 -15
- package/lib/networkTopo/components/Link/index.js +32 -18
- package/lib/networkTopo/components/Link/setting.js +8 -6
- package/lib/networkTopo/getTopoData.js +23 -10
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
- package/lib/networkTopo/models/TopoCenter.js +24 -10
- package/lib/networkTopo/services/cmdb.js +336 -235
- package/lib/networkTopo/services/mdc.js +24 -14
- package/lib/networkTopo/services/metric.js +16 -10
- package/lib/networkTopo/services/model.js +414 -284
- package/lib/networkTopo/utils/exportData.js +7 -4
- package/lib/utils/htElementDataUtil.js +4 -2
- package/package.json +3 -3
@@ -48,8 +48,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
48
48
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
49
49
|
|
50
50
|
var useTopoEdit = function useTopoEdit(params) {
|
51
|
-
var _ref2, _ref3, _ref4, _bindGroupResources, _addGroupResources, _bindViewResources, _addLayerResources, _addResourceToFirstLayer, _ref5, _ref6, _ref8, _relateNodeIp;
|
52
|
-
|
53
51
|
var topo = params.topo,
|
54
52
|
topoId = params.topoId,
|
55
53
|
isEditing = params.isEditing,
|
@@ -104,8 +102,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
104
102
|
setShowComboResDrawer(true);
|
105
103
|
};
|
106
104
|
|
107
|
-
var onLayerAdded = function
|
108
|
-
|
105
|
+
var onLayerAdded = /*#__PURE__*/function () {
|
106
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
|
109
107
|
var target, direction, config;
|
110
108
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
111
109
|
while (1) switch (_context.prev = _context.next) {
|
@@ -140,11 +138,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
140
138
|
return _context.stop();
|
141
139
|
}
|
142
140
|
}, _callee);
|
143
|
-
}))
|
144
|
-
};
|
141
|
+
}));
|
145
142
|
|
146
|
-
|
147
|
-
|
143
|
+
return function onLayerAdded(_x) {
|
144
|
+
return _ref2.apply(this, arguments);
|
145
|
+
};
|
146
|
+
}();
|
147
|
+
|
148
|
+
var deleteLayer = /*#__PURE__*/function () {
|
149
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(layerElement) {
|
148
150
|
var config;
|
149
151
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
150
152
|
while (1) switch (_context2.prev = _context2.next) {
|
@@ -183,12 +185,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
183
185
|
return _context2.stop();
|
184
186
|
}
|
185
187
|
}, _callee2);
|
186
|
-
}))
|
187
|
-
};
|
188
|
+
}));
|
188
189
|
|
189
|
-
|
190
|
-
|
190
|
+
return function deleteLayer(_x2) {
|
191
|
+
return _ref3.apply(this, arguments);
|
192
|
+
};
|
193
|
+
}();
|
191
194
|
|
195
|
+
var handleDeleteLayer = function handleDeleteLayer(layerElement) {
|
192
196
|
var hasChildren = !!layerElement.getChildren().toArray().length;
|
193
197
|
|
194
198
|
if (!hasChildren) {
|
@@ -206,8 +210,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
206
210
|
messageProps: {
|
207
211
|
type: "warning"
|
208
212
|
},
|
209
|
-
onOk: function
|
210
|
-
|
213
|
+
onOk: function () {
|
214
|
+
var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
211
215
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
212
216
|
while (1) switch (_context3.prev = _context3.next) {
|
213
217
|
case 0:
|
@@ -218,8 +222,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
218
222
|
return _context3.stop();
|
219
223
|
}
|
220
224
|
}, _callee3);
|
221
|
-
}))
|
222
|
-
|
225
|
+
}));
|
226
|
+
|
227
|
+
function onOk() {
|
228
|
+
return _onOk.apply(this, arguments);
|
229
|
+
}
|
230
|
+
|
231
|
+
return onOk;
|
232
|
+
}()
|
223
233
|
});
|
224
234
|
}; // const deleteGroupFooterBtn = () => {
|
225
235
|
// return (
|
@@ -369,8 +379,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
369
379
|
}; // 删除关联在节点上的出口链路
|
370
380
|
|
371
381
|
|
372
|
-
var deleteExLink = function
|
373
|
-
|
382
|
+
var deleteExLink = /*#__PURE__*/function () {
|
383
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(node) {
|
374
384
|
var _node$getEdges$toArra, _node$getEdges;
|
375
385
|
|
376
386
|
var config, edges, exportLinkIdList;
|
@@ -404,8 +414,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
404
414
|
return _context4.stop();
|
405
415
|
}
|
406
416
|
}, _callee4);
|
407
|
-
}))
|
408
|
-
|
417
|
+
}));
|
418
|
+
|
419
|
+
return function deleteExLink(_x3) {
|
420
|
+
return _ref4.apply(this, arguments);
|
421
|
+
};
|
422
|
+
}();
|
409
423
|
|
410
424
|
var onDeleteElement = function onDeleteElement(data) {
|
411
425
|
var dtype = data.dtype;
|
@@ -481,27 +495,31 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
481
495
|
|
482
496
|
|
483
497
|
function bindGroupResources(_x4, _x5) {
|
484
|
-
return
|
485
|
-
|
498
|
+
return _bindGroupResources.apply(this, arguments);
|
499
|
+
}
|
486
500
|
|
487
|
-
|
488
|
-
|
501
|
+
function _bindGroupResources() {
|
502
|
+
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(group, resources) {
|
503
|
+
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
504
|
+
|
505
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
506
|
+
while (1) switch (_context10.prev = _context10.next) {
|
489
507
|
case 0:
|
490
508
|
id = group.id, tag = group.tag;
|
491
509
|
|
492
510
|
_rlog["default"].debug("bindGroupResources--id, tag", id, tag);
|
493
511
|
|
494
512
|
topo.historyManager.beginTransaction();
|
495
|
-
|
513
|
+
_context10.next = 5;
|
496
514
|
return resourceConfig.updateGroupResources(group, resources);
|
497
515
|
|
498
516
|
case 5:
|
499
|
-
|
517
|
+
_context10.next = 7;
|
500
518
|
return editDispatchers.fetchDataByConfig();
|
501
519
|
|
502
520
|
case 7:
|
503
|
-
_yield$
|
504
|
-
elements = _yield$
|
521
|
+
_yield$editDispatcher2 = _context10.sent;
|
522
|
+
elements = _yield$editDispatcher2.elements;
|
505
523
|
// 区域里的子区域及子区域的节点、新增的链路
|
506
524
|
nodeElements = (0, _topoData.findGroupChildren)(elements, group);
|
507
525
|
newLinkElements = findUNExistedLinkElements(elements);
|
@@ -519,17 +537,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
519
537
|
|
520
538
|
case 14:
|
521
539
|
case "end":
|
522
|
-
return
|
540
|
+
return _context10.stop();
|
523
541
|
}
|
524
|
-
},
|
525
|
-
}))
|
542
|
+
}, _callee10);
|
543
|
+
}));
|
544
|
+
return _bindGroupResources.apply(this, arguments);
|
526
545
|
}
|
527
546
|
|
528
547
|
function addGroupResources(_x6, _x7) {
|
529
|
-
return
|
548
|
+
return _addGroupResources.apply(this, arguments);
|
549
|
+
}
|
550
|
+
/**
|
551
|
+
* 关联视图的资源
|
552
|
+
*/
|
553
|
+
|
554
|
+
|
555
|
+
function _addGroupResources() {
|
556
|
+
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
|
530
557
|
var groupConfig, resources, groupData;
|
531
|
-
return _regenerator["default"].wrap(function
|
532
|
-
while (1) switch (
|
558
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
559
|
+
while (1) switch (_context11.prev = _context11.next) {
|
533
560
|
case 0:
|
534
561
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
535
562
|
resources = {
|
@@ -539,80 +566,90 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
539
566
|
id: group.getTag(),
|
540
567
|
tag: group.a("tag")
|
541
568
|
};
|
542
|
-
|
569
|
+
_context11.next = 5;
|
543
570
|
return bindGroupResources(groupData, resources);
|
544
571
|
|
545
572
|
case 5:
|
546
573
|
case "end":
|
547
|
-
return
|
574
|
+
return _context11.stop();
|
548
575
|
}
|
549
|
-
},
|
550
|
-
}))
|
576
|
+
}, _callee11);
|
577
|
+
}));
|
578
|
+
return _addGroupResources.apply(this, arguments);
|
579
|
+
}
|
580
|
+
|
581
|
+
function bindViewResources(_x8) {
|
582
|
+
return _bindViewResources.apply(this, arguments);
|
551
583
|
}
|
552
584
|
/**
|
553
|
-
*
|
585
|
+
* 分层添加资源
|
586
|
+
* @param group
|
587
|
+
* @param newResourceIds 新增的资源id列表
|
588
|
+
* @return {Promise<void>}
|
554
589
|
*/
|
555
590
|
|
556
591
|
|
557
|
-
function
|
558
|
-
|
559
|
-
var config,
|
592
|
+
function _bindViewResources() {
|
593
|
+
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
|
594
|
+
var config, result, _elements;
|
560
595
|
|
561
|
-
return _regenerator["default"].wrap(function
|
562
|
-
while (1) switch (
|
596
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
597
|
+
while (1) switch (_context12.prev = _context12.next) {
|
563
598
|
case 0:
|
564
599
|
// console.log("关联视图的资源", data);
|
565
600
|
config = resourceConfig.getConfig();
|
566
601
|
config.resources = data;
|
567
|
-
|
602
|
+
_context12.next = 4;
|
568
603
|
return resourceConfig.updateConfig(config);
|
569
604
|
|
570
605
|
case 4:
|
571
|
-
|
606
|
+
_context12.next = 6;
|
572
607
|
return editDispatchers.fetchDataByConfig();
|
573
608
|
|
574
609
|
case 6:
|
575
|
-
|
576
|
-
|
577
|
-
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
610
|
+
result = _context12.sent;
|
611
|
+
console.log("fetchDataByConfig", result);
|
578
612
|
|
579
|
-
if (
|
580
|
-
|
613
|
+
if (result) {
|
614
|
+
_elements = result.elements;
|
615
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
616
|
+
|
617
|
+
if (topo.linkDynamicStyleExecutor) {
|
618
|
+
topo.linkDynamicStyleExecutor.execute();
|
619
|
+
}
|
581
620
|
}
|
582
621
|
|
583
|
-
case
|
622
|
+
case 9:
|
584
623
|
case "end":
|
585
|
-
return
|
624
|
+
return _context12.stop();
|
586
625
|
}
|
587
|
-
},
|
588
|
-
}))
|
626
|
+
}, _callee12);
|
627
|
+
}));
|
628
|
+
return _bindViewResources.apply(this, arguments);
|
589
629
|
}
|
590
|
-
/**
|
591
|
-
* 分层添加资源
|
592
|
-
* @param group
|
593
|
-
* @param newResourceIds 新增的资源id列表
|
594
|
-
* @return {Promise<void>}
|
595
|
-
*/
|
596
|
-
|
597
630
|
|
598
631
|
function addLayerResources(_x9, _x10) {
|
599
|
-
return
|
632
|
+
return _addLayerResources.apply(this, arguments);
|
633
|
+
}
|
634
|
+
|
635
|
+
function _addLayerResources() {
|
636
|
+
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
|
600
637
|
var _yield$editDispatcher3, elements, newElements;
|
601
638
|
|
602
|
-
return _regenerator["default"].wrap(function
|
603
|
-
while (1) switch (
|
639
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
640
|
+
while (1) switch (_context13.prev = _context13.next) {
|
604
641
|
case 0:
|
605
642
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
606
643
|
|
607
|
-
|
644
|
+
_context13.next = 3;
|
608
645
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
609
646
|
|
610
647
|
case 3:
|
611
|
-
|
648
|
+
_context13.next = 5;
|
612
649
|
return editDispatchers.fetchDataByConfig();
|
613
650
|
|
614
651
|
case 5:
|
615
|
-
_yield$editDispatcher3 =
|
652
|
+
_yield$editDispatcher3 = _context13.sent;
|
616
653
|
elements = _yield$editDispatcher3.elements;
|
617
654
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
618
655
|
newElements = findUNExistedElements(elements);
|
@@ -637,28 +674,34 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
637
674
|
|
638
675
|
case 14:
|
639
676
|
case "end":
|
640
|
-
return
|
677
|
+
return _context13.stop();
|
641
678
|
}
|
642
|
-
},
|
643
|
-
}))
|
679
|
+
}, _callee13);
|
680
|
+
}));
|
681
|
+
return _addLayerResources.apply(this, arguments);
|
644
682
|
}
|
645
683
|
|
646
684
|
function addResourceToFirstLayer(_x11) {
|
647
|
-
return
|
685
|
+
return _addResourceToFirstLayer.apply(this, arguments);
|
686
|
+
}
|
687
|
+
|
688
|
+
function _addResourceToFirstLayer() {
|
689
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
|
648
690
|
var group;
|
649
|
-
return _regenerator["default"].wrap(function
|
650
|
-
while (1) switch (
|
691
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
692
|
+
while (1) switch (_context14.prev = _context14.next) {
|
651
693
|
case 0:
|
652
694
|
group = resourceConfig.getGroups()[0];
|
653
|
-
|
695
|
+
_context14.next = 3;
|
654
696
|
return addLayerResources(group, data);
|
655
697
|
|
656
698
|
case 3:
|
657
699
|
case "end":
|
658
|
-
return
|
700
|
+
return _context14.stop();
|
659
701
|
}
|
660
|
-
},
|
661
|
-
}))
|
702
|
+
}, _callee14);
|
703
|
+
}));
|
704
|
+
return _addResourceToFirstLayer.apply(this, arguments);
|
662
705
|
}
|
663
706
|
|
664
707
|
function getAddResourceType() {
|
@@ -687,29 +730,29 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
687
730
|
*/
|
688
731
|
|
689
732
|
|
690
|
-
var onSaveComboRes = function
|
691
|
-
|
692
|
-
return _regenerator["default"].wrap(function
|
693
|
-
while (1) switch (
|
733
|
+
var onSaveComboRes = /*#__PURE__*/function () {
|
734
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
735
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
736
|
+
while (1) switch (_context5.prev = _context5.next) {
|
694
737
|
case 0:
|
695
738
|
_rlog["default"].debug("关联资源-----onSaveComboRes", data);
|
696
739
|
|
697
740
|
topo.historyManager.beginTransaction();
|
698
741
|
|
699
742
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
700
|
-
|
743
|
+
_context5.next = 7;
|
701
744
|
break;
|
702
745
|
}
|
703
746
|
|
704
|
-
|
747
|
+
_context5.next = 5;
|
705
748
|
return addResourceToFirstLayer(data);
|
706
749
|
|
707
750
|
case 5:
|
708
|
-
|
751
|
+
_context5.next = 9;
|
709
752
|
break;
|
710
753
|
|
711
754
|
case 7:
|
712
|
-
|
755
|
+
_context5.next = 9;
|
713
756
|
return bindViewResources(data);
|
714
757
|
|
715
758
|
case 9:
|
@@ -721,30 +764,34 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
721
764
|
|
722
765
|
case 12:
|
723
766
|
case "end":
|
724
|
-
return
|
767
|
+
return _context5.stop();
|
725
768
|
}
|
726
|
-
},
|
727
|
-
}))
|
728
|
-
|
769
|
+
}, _callee5);
|
770
|
+
}));
|
771
|
+
|
772
|
+
return function onSaveComboRes(_x12) {
|
773
|
+
return _ref5.apply(this, arguments);
|
774
|
+
};
|
775
|
+
}();
|
729
776
|
|
730
|
-
var onSaveTopo = function
|
731
|
-
|
732
|
-
var id, config, serialize, _config$layout, template, layout,
|
777
|
+
var onSaveTopo = /*#__PURE__*/function () {
|
778
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(data) {
|
779
|
+
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
733
780
|
|
734
|
-
return _regenerator["default"].wrap(function
|
735
|
-
while (1) switch (
|
781
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
782
|
+
while (1) switch (_context7.prev = _context7.next) {
|
736
783
|
case 0:
|
737
784
|
id = data.id, config = data.config, serialize = data.serialize;
|
738
785
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
739
786
|
|
740
787
|
if (onSave) {
|
741
788
|
// 自定义保存
|
742
|
-
saveConfig = function
|
743
|
-
|
744
|
-
return _regenerator["default"].wrap(function
|
745
|
-
while (1) switch (
|
789
|
+
saveConfig = /*#__PURE__*/function () {
|
790
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
791
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
792
|
+
while (1) switch (_context6.prev = _context6.next) {
|
746
793
|
case 0:
|
747
|
-
|
794
|
+
_context6.next = 2;
|
748
795
|
return editDispatchers.saveTopo({
|
749
796
|
id: id,
|
750
797
|
layout: layout,
|
@@ -753,11 +800,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
753
800
|
|
754
801
|
case 2:
|
755
802
|
case "end":
|
756
|
-
return
|
803
|
+
return _context6.stop();
|
757
804
|
}
|
758
|
-
},
|
759
|
-
}))
|
760
|
-
|
805
|
+
}, _callee6);
|
806
|
+
}));
|
807
|
+
|
808
|
+
return function saveConfig() {
|
809
|
+
return _ref7.apply(this, arguments);
|
810
|
+
};
|
811
|
+
}();
|
761
812
|
|
762
813
|
onSave({
|
763
814
|
topo: topo,
|
@@ -768,11 +819,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
768
819
|
|
769
820
|
case 3:
|
770
821
|
case "end":
|
771
|
-
return
|
822
|
+
return _context7.stop();
|
772
823
|
}
|
773
|
-
},
|
774
|
-
}))
|
775
|
-
|
824
|
+
}, _callee7);
|
825
|
+
}));
|
826
|
+
|
827
|
+
return function onSaveTopo(_x13) {
|
828
|
+
return _ref6.apply(this, arguments);
|
829
|
+
};
|
830
|
+
}();
|
776
831
|
|
777
832
|
var saveBind = function saveBind(type, data) {
|
778
833
|
var eventData = {
|
@@ -797,14 +852,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
797
852
|
*/
|
798
853
|
|
799
854
|
|
800
|
-
var bindNodeResource = function
|
801
|
-
|
802
|
-
var _doBind;
|
855
|
+
var bindNodeResource = /*#__PURE__*/function () {
|
856
|
+
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(params) {
|
857
|
+
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
803
858
|
|
804
|
-
|
805
|
-
|
806
|
-
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
807
|
-
while (1) switch (_context14.prev = _context14.next) {
|
859
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
860
|
+
while (1) switch (_context9.prev = _context9.next) {
|
808
861
|
case 0:
|
809
862
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
810
863
|
return (0, _extends2["default"])({}, resources, {
|
@@ -814,11 +867,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
814
867
|
});
|
815
868
|
};
|
816
869
|
|
817
|
-
|
818
|
-
|
870
|
+
_doBind = function _doBind3() {
|
871
|
+
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
819
872
|
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
820
|
-
return _regenerator["default"].wrap(function
|
821
|
-
while (1) switch (
|
873
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
874
|
+
while (1) switch (_context8.prev = _context8.next) {
|
822
875
|
case 0:
|
823
876
|
dm = htTopo.getGraphView().dm(); // 创建
|
824
877
|
|
@@ -888,7 +941,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
888
941
|
// node.a("customName", null);
|
889
942
|
// 删除关联在节点上的出口链路
|
890
943
|
|
891
|
-
|
944
|
+
_context8.next = 12;
|
892
945
|
return deleteExLink(node);
|
893
946
|
|
894
947
|
case 12:
|
@@ -899,10 +952,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
899
952
|
|
900
953
|
case 13:
|
901
954
|
case "end":
|
902
|
-
return
|
955
|
+
return _context8.stop();
|
903
956
|
}
|
904
|
-
},
|
905
|
-
}))
|
957
|
+
}, _callee8);
|
958
|
+
}));
|
959
|
+
return _doBind.apply(this, arguments);
|
960
|
+
};
|
961
|
+
|
962
|
+
doBind = function _doBind2() {
|
963
|
+
return _doBind.apply(this, arguments);
|
906
964
|
};
|
907
965
|
|
908
966
|
topo.historyManager.beginTransaction();
|
@@ -938,22 +996,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
938
996
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
939
997
|
}
|
940
998
|
|
941
|
-
|
999
|
+
_context9.next = 13;
|
942
1000
|
return resourceConfig.updateConfig(config);
|
943
1001
|
|
944
|
-
case
|
945
|
-
|
1002
|
+
case 13:
|
1003
|
+
_context9.next = 15;
|
946
1004
|
return editDispatchers.fetchDataByConfig();
|
947
1005
|
|
948
|
-
case
|
949
|
-
_yield$
|
950
|
-
elements = _yield$
|
1006
|
+
case 15:
|
1007
|
+
_yield$editDispatcher = _context9.sent;
|
1008
|
+
elements = _yield$editDispatcher.elements;
|
951
1009
|
newData = elements.find(function (item) {
|
952
1010
|
return item.id === newResId;
|
953
1011
|
});
|
954
1012
|
|
955
1013
|
if (newData) {
|
956
|
-
|
1014
|
+
_context9.next = 23;
|
957
1015
|
break;
|
958
1016
|
}
|
959
1017
|
|
@@ -962,30 +1020,38 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
962
1020
|
_rlog["default"].warn("关联资源失败");
|
963
1021
|
|
964
1022
|
topo.historyManager.endTransaction();
|
965
|
-
return
|
1023
|
+
return _context9.abrupt("return", false);
|
966
1024
|
|
967
|
-
case
|
968
|
-
|
1025
|
+
case 23:
|
1026
|
+
_context9.next = 25;
|
969
1027
|
return doBind();
|
970
1028
|
|
971
|
-
case
|
1029
|
+
case 25:
|
972
1030
|
topo.historyManager.endTransaction();
|
973
1031
|
|
974
|
-
case
|
1032
|
+
case 26:
|
975
1033
|
case "end":
|
976
|
-
return
|
1034
|
+
return _context9.stop();
|
977
1035
|
}
|
978
|
-
},
|
979
|
-
}))
|
980
|
-
|
1036
|
+
}, _callee9);
|
1037
|
+
}));
|
1038
|
+
|
1039
|
+
return function bindNodeResource(_x14) {
|
1040
|
+
return _ref8.apply(this, arguments);
|
1041
|
+
};
|
1042
|
+
}();
|
981
1043
|
/**
|
982
1044
|
* 关联IP的图片节点
|
983
1045
|
*/
|
984
1046
|
|
985
1047
|
|
986
1048
|
function relateNodeIp(_x15, _x16) {
|
987
|
-
return
|
988
|
-
|
1049
|
+
return _relateNodeIp.apply(this, arguments);
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
function _relateNodeIp() {
|
1053
|
+
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
1054
|
+
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
989
1055
|
|
990
1056
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
991
1057
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1007,7 +1073,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1007
1073
|
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1008
1074
|
|
1009
1075
|
if (!isUnique) {
|
1010
|
-
_context15.next =
|
1076
|
+
_context15.next = 24;
|
1011
1077
|
break;
|
1012
1078
|
}
|
1013
1079
|
|
@@ -1031,8 +1097,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1031
1097
|
case 16:
|
1032
1098
|
configData = _context15.sent;
|
1033
1099
|
// console.log("configData",configObj, configData);
|
1034
|
-
|
1035
|
-
newLinkElements = findUNExistedLinkElements(
|
1100
|
+
_elements2 = configData.elements;
|
1101
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1036
1102
|
|
1037
1103
|
newLink = newLinkElements.filter(function (item) {
|
1038
1104
|
return item.type === "link";
|
@@ -1047,7 +1113,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1113
|
nodes: [],
|
1048
1114
|
links: newLink,
|
1049
1115
|
linkGroups: newLinkGroup
|
1050
|
-
};
|
1116
|
+
};
|
1117
|
+
console.log("createElementsData", createElementsData);
|
1051
1118
|
|
1052
1119
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1053
1120
|
_htTopo = topo.getHtTopo();
|
@@ -1055,12 +1122,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1055
1122
|
_htTopo.createElements(createElementsData);
|
1056
1123
|
}
|
1057
1124
|
|
1058
|
-
case
|
1125
|
+
case 24:
|
1059
1126
|
case "end":
|
1060
1127
|
return _context15.stop();
|
1061
1128
|
}
|
1062
1129
|
}, _callee15);
|
1063
|
-
}))
|
1130
|
+
}));
|
1131
|
+
return _relateNodeIp.apply(this, arguments);
|
1064
1132
|
}
|
1065
1133
|
|
1066
1134
|
var onEvent = function onEvent(e) {
|