@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.0-dev.2
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 +1 -1
- package/build/index.js +14 -14
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/core/components/TopoView/topoView.js +7 -4
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -15
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +2 -27
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -52
- package/es/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +71 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +3 -2
- package/es/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/es/core/editor/hooks/useNewElementTheme.js +20 -16
- package/es/core/editor/utils/edgeTypeStyleUtil.js +11 -32
- package/es/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/es/core/hooks/usePolling.js +2 -1
- package/es/core/hooks/useTopoEdit.js +206 -248
- package/es/core/models/AttributeMetricDisplay.js +4 -3
- package/es/core/models/HistoryManager.js +11 -9
- package/es/core/models/TopoApp.js +39 -45
- package/es/core/models/topoData.js +7 -14
- package/es/core/models/utils/linkUtils.js +36 -28
- package/es/core/store/models/topoConfig.js +14 -17
- package/es/core/utils/edgeUtil.js +7 -10
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/services/topo/basic.js +4 -2
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/networkTopo/utils/exitLinkUtil.js +23 -11
- package/es/networkTopo/utils/relateTopoDataUtil.js +38 -0
- package/es/style.js +1 -1
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +16 -84
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/core/components/TopoView/topoView.js +15 -19
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -14
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -56
- package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +83 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +7 -2
- package/lib/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/lib/core/editor/hooks/useNewElementTheme.js +20 -16
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +10 -33
- package/lib/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/lib/core/hooks/usePolling.js +6 -5
- package/lib/core/hooks/useTopoEdit.js +212 -272
- package/lib/core/models/AttributeMetricDisplay.js +6 -6
- package/lib/core/models/HistoryManager.js +13 -17
- package/lib/core/models/TopoApp.js +39 -43
- package/lib/core/models/topoData.js +7 -14
- package/lib/core/models/utils/linkUtils.js +36 -27
- package/lib/core/store/models/topoConfig.js +20 -31
- package/lib/core/utils/edgeUtil.js +8 -10
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/services/topo/basic.js +4 -2
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/networkTopo/utils/exitLinkUtil.js +23 -11
- package/lib/networkTopo/utils/relateTopoDataUtil.js +49 -0
- package/lib/style.js +1 -1
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +19 -93
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
|
@@ -19,9 +19,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
|
22
|
+
var _loglevel = _interopRequireDefault(require("loglevel"));
|
|
25
23
|
|
|
26
24
|
var _componentTopologyGraph = require("@riil-frontend/component-topology-graph");
|
|
27
25
|
|
|
@@ -47,6 +45,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
47
45
|
|
|
48
46
|
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
47
|
|
|
48
|
+
var rlog = _loglevel["default"].getLogger('topo');
|
|
49
|
+
|
|
50
50
|
var useTopoEdit = function useTopoEdit(params) {
|
|
51
51
|
var topo = params.topo,
|
|
52
52
|
topoId = params.topoId,
|
|
@@ -96,8 +96,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
var showGlobalAddResourceDrawer = function showGlobalAddResourceDrawer() {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
rlog.debug("showGlobalAddResourceDrawer", resourceConfig.getViewResources());
|
|
101
100
|
setComboResData(resourceConfig.getViewResources());
|
|
102
101
|
setShowComboResDrawer(true);
|
|
103
102
|
};
|
|
@@ -112,12 +111,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
112
111
|
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
|
113
112
|
|
|
114
113
|
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
|
115
|
-
|
|
116
|
-
_rlog["default"].info("onLayerAdd", {
|
|
114
|
+
rlog.info("onLayerAdd", {
|
|
117
115
|
config: config
|
|
118
116
|
}); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
|
|
119
117
|
|
|
120
|
-
|
|
121
118
|
if (!(!isLayerTopo && config.layers.length)) {
|
|
122
119
|
_context.next = 7;
|
|
123
120
|
break;
|
|
@@ -127,10 +124,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
127
124
|
return topoDispatchers.setTopoType(_template.TPL_TREE);
|
|
128
125
|
|
|
129
126
|
case 7:
|
|
130
|
-
// 更新配置
|
|
131
|
-
// resourceConfig.updateConfig(config);
|
|
132
|
-
// 更新配置对应的资源、链路
|
|
133
|
-
// editDispatchers.fetchDataByConfig();
|
|
134
127
|
topo.historyManager.endTransaction();
|
|
135
128
|
|
|
136
129
|
case 8:
|
|
@@ -155,12 +148,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
155
148
|
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
|
156
149
|
|
|
157
150
|
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
|
158
|
-
|
|
159
|
-
_rlog["default"].info("deleteLayer", {
|
|
151
|
+
rlog.info("deleteLayer", {
|
|
160
152
|
config: config
|
|
161
153
|
}); // 如果没有分层,将拓扑类型切换为空白模板
|
|
162
154
|
|
|
163
|
-
|
|
164
155
|
if (config.layers.length) {
|
|
165
156
|
_context2.next = 7;
|
|
166
157
|
break;
|
|
@@ -231,48 +222,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
231
222
|
return onOk;
|
|
232
223
|
}()
|
|
233
224
|
});
|
|
234
|
-
};
|
|
235
|
-
// return (
|
|
236
|
-
// <div>
|
|
237
|
-
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
|
238
|
-
// 仅删除区域
|
|
239
|
-
// </Button>
|
|
240
|
-
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
|
241
|
-
// 确定
|
|
242
|
-
// </Button>
|
|
243
|
-
// </div>
|
|
244
|
-
// );
|
|
245
|
-
// };
|
|
246
|
-
// const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
|
|
247
|
-
// function doDeleteOnlyGroup(data,group) {
|
|
248
|
-
// topo.historyManager.beginTransaction();
|
|
249
|
-
// console.log("仅删除区域", topo.view.topoClient, data);
|
|
250
|
-
// const children = getGroupChildren(group);
|
|
251
|
-
// children.map((child) => {
|
|
252
|
-
// child.setParent(null);
|
|
253
|
-
// // var viewRect = topo.getGraphView().getViewRect();
|
|
254
|
-
// // var nodeRect = child.getRect();
|
|
255
|
-
// // child.setPosition(
|
|
256
|
-
// // viewRect.x + nodeRect.width + 2,
|
|
257
|
-
// // viewRect.y + nodeRect.height + 4
|
|
258
|
-
// // ); // 解决集群从区域内移出时,连线位置未更新的问题
|
|
259
|
-
// setTimeout(function () {
|
|
260
|
-
// child.iv();
|
|
261
|
-
// topo.historyManager.endTransaction();
|
|
262
|
-
// }, 50);
|
|
263
|
-
// });
|
|
264
|
-
// topo.view.topoClient.deleteGroup(data);
|
|
265
|
-
// topo.historyManager.endTransaction();
|
|
266
|
-
// setGroupDeleteVisible(false);
|
|
267
|
-
// // console.log("仅删除区域", children, group);
|
|
268
|
-
// }
|
|
269
|
-
// function doDelete(data) {
|
|
270
|
-
// topo.historyManager.beginTransaction();
|
|
271
|
-
// // FIXME 。如果命中其他的动态条件,则立即显示
|
|
272
|
-
// topo.view.topoClient.deleteGroup(data);
|
|
273
|
-
// setGroupDeleteVisible(false);
|
|
274
|
-
// }
|
|
275
|
-
|
|
225
|
+
};
|
|
276
226
|
/**
|
|
277
227
|
* 删除容器。
|
|
278
228
|
*
|
|
@@ -303,21 +253,17 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
303
253
|
// content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
|
|
304
254
|
content: "是否仅删除区域或将区域包含的内容一同删除?",
|
|
305
255
|
footer: [/*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
256
|
+
key: "1",
|
|
306
257
|
type: "normal",
|
|
307
258
|
onClick: doDeleteOnlyGroup,
|
|
308
259
|
style: {
|
|
309
260
|
marginRight: "15px"
|
|
310
261
|
}
|
|
311
262
|
}, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
263
|
+
key: "2",
|
|
312
264
|
type: "normal",
|
|
313
265
|
onClick: doDelete
|
|
314
266
|
}, "\u5168\u90E8\u5220\u9664")],
|
|
315
|
-
// okProps: {
|
|
316
|
-
// children: "仅删除区域",
|
|
317
|
-
// type: "normal",
|
|
318
|
-
// className: "next-btn-normal",
|
|
319
|
-
// },
|
|
320
|
-
// cancelProps: { children: "全部删除" },
|
|
321
267
|
messageProps: {
|
|
322
268
|
type: "warning"
|
|
323
269
|
}
|
|
@@ -328,13 +274,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
328
274
|
console.log("仅删除区域", topo.view.topoClient, data);
|
|
329
275
|
var children = (0, _htElementUtils.getGroupChildren)(group);
|
|
330
276
|
children.map(function (child) {
|
|
331
|
-
child.setParent(null);
|
|
332
|
-
// var nodeRect = child.getRect();
|
|
333
|
-
// child.setPosition(
|
|
334
|
-
// viewRect.x + nodeRect.width + 2,
|
|
335
|
-
// viewRect.y + nodeRect.height + 4
|
|
336
|
-
// ); // 解决集群从区域内移出时,连线位置未更新的问题
|
|
337
|
-
|
|
277
|
+
child.setParent(null);
|
|
338
278
|
setTimeout(function () {
|
|
339
279
|
child.iv();
|
|
340
280
|
topo.historyManager.endTransaction();
|
|
@@ -353,10 +293,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
353
293
|
}
|
|
354
294
|
};
|
|
355
295
|
|
|
356
|
-
var deleteNode = function deleteNode(node) {
|
|
357
|
-
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, node);
|
|
358
|
-
};
|
|
359
|
-
|
|
360
296
|
var handleDeleteNode = function handleDeleteNode(element) {
|
|
361
297
|
var _topo$options$editor;
|
|
362
298
|
|
|
@@ -373,51 +309,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
373
309
|
if (typeof onNodeDelete === "function") {
|
|
374
310
|
onNodeDelete(data);
|
|
375
311
|
} else {
|
|
376
|
-
|
|
312
|
+
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, data);
|
|
377
313
|
}
|
|
378
314
|
}
|
|
379
315
|
}; // 删除关联在节点上的出口链路
|
|
380
316
|
|
|
381
317
|
|
|
382
|
-
var deleteExLink =
|
|
383
|
-
var
|
|
384
|
-
var _node$getEdges$toArra, _node$getEdges;
|
|
318
|
+
var deleteExLink = function deleteExLink(node) {
|
|
319
|
+
var _node$getEdges$toArra, _node$getEdges;
|
|
385
320
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
// console.log("删除关联在节点上的出口链路- node, config", node, config);
|
|
391
|
-
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 : [];
|
|
321
|
+
rlog.debug("删除关联在节点上的出口链路", {
|
|
322
|
+
node: node
|
|
323
|
+
});
|
|
324
|
+
var 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 : [];
|
|
392
325
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
326
|
+
if (edges.length > 0) {
|
|
327
|
+
edges.map(function (edge) {
|
|
328
|
+
if (edge.getTag()) {
|
|
329
|
+
var link = topo.dataModel.getDataById(edge.getTag());
|
|
397
330
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
case 2:
|
|
406
|
-
case "end":
|
|
407
|
-
return _context4.stop();
|
|
331
|
+
if (link && (0, _linkUtils.isExitLink)(link)) {
|
|
332
|
+
topo.getGraphView().dm().remove(edge);
|
|
333
|
+
}
|
|
408
334
|
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
return function deleteExLink(_x3) {
|
|
413
|
-
return _ref4.apply(this, arguments);
|
|
414
|
-
};
|
|
415
|
-
}();
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
416
338
|
|
|
417
339
|
var onDeleteElement = function onDeleteElement(data) {
|
|
418
340
|
var dtype = data.dtype;
|
|
419
|
-
|
|
420
|
-
_rlog["default"].info("onDeleteElement", data);
|
|
341
|
+
rlog.info("onDeleteElement", data);
|
|
421
342
|
|
|
422
343
|
if ((0, _htElementUtils.isLayer)(data)) {
|
|
423
344
|
handleDeleteLayer(data);
|
|
@@ -464,7 +385,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
464
385
|
function findUNExistedLinkElements(elements) {
|
|
465
386
|
var dm = topo.getDataModel();
|
|
466
387
|
var newLinkElements = elements.filter(function (element) {
|
|
467
|
-
return (element.type === "link" || element.type === "linkGroup") && !(0, _htElementUtils.
|
|
388
|
+
return (element.type === "link" || element.type === "linkGroup") && !(0, _htElementUtils.containsElement)(dm, element);
|
|
468
389
|
});
|
|
469
390
|
return newLinkElements;
|
|
470
391
|
}
|
|
@@ -477,43 +398,56 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
477
398
|
|
|
478
399
|
function findUNExistedElements(elements) {
|
|
479
400
|
var dm = topo.getDataModel();
|
|
480
|
-
var
|
|
481
|
-
return !(0, _htElementUtils.
|
|
401
|
+
var unExistedElements = elements.filter(function (element) {
|
|
402
|
+
return !(0, _htElementUtils.containsElement)(dm, element);
|
|
482
403
|
});
|
|
483
|
-
return
|
|
404
|
+
return unExistedElements;
|
|
484
405
|
}
|
|
485
406
|
/**
|
|
486
|
-
*
|
|
407
|
+
* 区域关联资源
|
|
408
|
+
* @param {{ id, tag }} group
|
|
409
|
+
* @param {*} resources
|
|
487
410
|
*/
|
|
488
411
|
|
|
489
412
|
|
|
490
|
-
function bindGroupResources(
|
|
413
|
+
function bindGroupResources(_x3, _x4) {
|
|
491
414
|
return _bindGroupResources.apply(this, arguments);
|
|
492
415
|
}
|
|
493
416
|
|
|
494
417
|
function _bindGroupResources() {
|
|
495
|
-
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
496
|
-
var
|
|
418
|
+
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(group, resources) {
|
|
419
|
+
var _yield$editDispatcher2, elements, dm, needDeleteHtDatas, nodeElements, newLinkElements, updateElements;
|
|
497
420
|
|
|
498
|
-
return _regenerator["default"].wrap(function
|
|
499
|
-
while (1) switch (
|
|
421
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
422
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
500
423
|
case 0:
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
424
|
+
rlog.debug("区域关联资源", {
|
|
425
|
+
group: group,
|
|
426
|
+
resources: resources
|
|
427
|
+
});
|
|
505
428
|
topo.historyManager.beginTransaction();
|
|
506
|
-
|
|
429
|
+
_context9.next = 4;
|
|
507
430
|
return resourceConfig.updateGroupResources(group, resources);
|
|
508
431
|
|
|
509
|
-
case
|
|
510
|
-
|
|
432
|
+
case 4:
|
|
433
|
+
_context9.next = 6;
|
|
511
434
|
return editDispatchers.fetchDataByConfig();
|
|
512
435
|
|
|
513
|
-
case
|
|
514
|
-
_yield$editDispatcher2 =
|
|
436
|
+
case 6:
|
|
437
|
+
_yield$editDispatcher2 = _context9.sent;
|
|
515
438
|
elements = _yield$editDispatcher2.elements;
|
|
516
|
-
//
|
|
439
|
+
rlog.debug("区域关联资源: 元素列表", elements); // 先删除多余的元素
|
|
440
|
+
|
|
441
|
+
dm = topo.getDataModel();
|
|
442
|
+
needDeleteHtDatas = (0, _htElementUtils.getElements)(dm).filter(function (htData) {
|
|
443
|
+
return htData.a('id') && !elements.find(function (ele) {
|
|
444
|
+
return ele.id === htData.a('id');
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
needDeleteHtDatas.forEach(function (htData) {
|
|
448
|
+
return dm.remove(htData);
|
|
449
|
+
}); // 区域里的所有子节点子区域、新增的链路
|
|
450
|
+
|
|
517
451
|
nodeElements = (0, _topoData.findGroupChildren)(elements, group);
|
|
518
452
|
newLinkElements = findUNExistedLinkElements(elements);
|
|
519
453
|
updateElements = [].concat(nodeElements, newLinkElements);
|
|
@@ -528,16 +462,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
528
462
|
|
|
529
463
|
topo.historyManager.endTransaction();
|
|
530
464
|
|
|
531
|
-
case
|
|
465
|
+
case 17:
|
|
532
466
|
case "end":
|
|
533
|
-
return
|
|
467
|
+
return _context9.stop();
|
|
534
468
|
}
|
|
535
|
-
},
|
|
469
|
+
}, _callee9);
|
|
536
470
|
}));
|
|
537
471
|
return _bindGroupResources.apply(this, arguments);
|
|
538
472
|
}
|
|
539
473
|
|
|
540
|
-
function addGroupResources(
|
|
474
|
+
function addGroupResources(_x5, _x6) {
|
|
541
475
|
return _addGroupResources.apply(this, arguments);
|
|
542
476
|
}
|
|
543
477
|
/**
|
|
@@ -546,10 +480,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
546
480
|
|
|
547
481
|
|
|
548
482
|
function _addGroupResources() {
|
|
549
|
-
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
483
|
+
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(group, newResourceIds) {
|
|
550
484
|
var groupConfig, resources, groupData;
|
|
551
|
-
return _regenerator["default"].wrap(function
|
|
552
|
-
while (1) switch (
|
|
485
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
486
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
553
487
|
case 0:
|
|
554
488
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
|
555
489
|
resources = {
|
|
@@ -559,19 +493,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
559
493
|
id: group.getTag(),
|
|
560
494
|
tag: group.a("tag")
|
|
561
495
|
};
|
|
562
|
-
|
|
496
|
+
_context10.next = 5;
|
|
563
497
|
return bindGroupResources(groupData, resources);
|
|
564
498
|
|
|
565
499
|
case 5:
|
|
566
500
|
case "end":
|
|
567
|
-
return
|
|
501
|
+
return _context10.stop();
|
|
568
502
|
}
|
|
569
|
-
},
|
|
503
|
+
}, _callee10);
|
|
570
504
|
}));
|
|
571
505
|
return _addGroupResources.apply(this, arguments);
|
|
572
506
|
}
|
|
573
507
|
|
|
574
|
-
function bindViewResources(
|
|
508
|
+
function bindViewResources(_x7) {
|
|
575
509
|
return _bindViewResources.apply(this, arguments);
|
|
576
510
|
}
|
|
577
511
|
/**
|
|
@@ -583,24 +517,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
583
517
|
|
|
584
518
|
|
|
585
519
|
function _bindViewResources() {
|
|
586
|
-
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
520
|
+
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(data) {
|
|
587
521
|
var config, result, _elements;
|
|
588
522
|
|
|
589
|
-
return _regenerator["default"].wrap(function
|
|
590
|
-
while (1) switch (
|
|
523
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
524
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
591
525
|
case 0:
|
|
592
526
|
// console.log("关联视图的资源", data);
|
|
593
527
|
config = resourceConfig.getConfig();
|
|
594
528
|
config.resources = data;
|
|
595
|
-
|
|
529
|
+
_context11.next = 4;
|
|
596
530
|
return resourceConfig.updateConfig(config);
|
|
597
531
|
|
|
598
532
|
case 4:
|
|
599
|
-
|
|
533
|
+
_context11.next = 6;
|
|
600
534
|
return editDispatchers.fetchDataByConfig();
|
|
601
535
|
|
|
602
536
|
case 6:
|
|
603
|
-
result =
|
|
537
|
+
result = _context11.sent;
|
|
604
538
|
console.log("fetchDataByConfig", result);
|
|
605
539
|
|
|
606
540
|
if (result) {
|
|
@@ -614,44 +548,42 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
614
548
|
|
|
615
549
|
case 9:
|
|
616
550
|
case "end":
|
|
617
|
-
return
|
|
551
|
+
return _context11.stop();
|
|
618
552
|
}
|
|
619
|
-
},
|
|
553
|
+
}, _callee11);
|
|
620
554
|
}));
|
|
621
555
|
return _bindViewResources.apply(this, arguments);
|
|
622
556
|
}
|
|
623
557
|
|
|
624
|
-
function addLayerResources(
|
|
558
|
+
function addLayerResources(_x8, _x9) {
|
|
625
559
|
return _addLayerResources.apply(this, arguments);
|
|
626
560
|
}
|
|
627
561
|
|
|
628
562
|
function _addLayerResources() {
|
|
629
|
-
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
563
|
+
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(group, newResourceIds) {
|
|
630
564
|
var _yield$editDispatcher3, elements, newElements;
|
|
631
565
|
|
|
632
|
-
return _regenerator["default"].wrap(function
|
|
633
|
-
while (1) switch (
|
|
566
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
567
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
634
568
|
case 0:
|
|
635
569
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
|
636
570
|
|
|
637
|
-
|
|
571
|
+
_context12.next = 3;
|
|
638
572
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
|
639
573
|
|
|
640
574
|
case 3:
|
|
641
|
-
|
|
575
|
+
_context12.next = 5;
|
|
642
576
|
return editDispatchers.fetchDataByConfig();
|
|
643
577
|
|
|
644
578
|
case 5:
|
|
645
|
-
_yield$editDispatcher3 =
|
|
579
|
+
_yield$editDispatcher3 = _context12.sent;
|
|
646
580
|
elements = _yield$editDispatcher3.elements;
|
|
647
581
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
|
648
582
|
newElements = findUNExistedElements(elements);
|
|
649
|
-
|
|
650
|
-
_rlog["default"].debug("添加分层资源", {
|
|
583
|
+
rlog.debug("添加分层资源", {
|
|
651
584
|
layer: group,
|
|
652
585
|
newElements: newElements
|
|
653
586
|
});
|
|
654
|
-
|
|
655
587
|
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
|
656
588
|
|
|
657
589
|
if (topo.linkDynamicStyleExecutor) {
|
|
@@ -667,32 +599,32 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
667
599
|
|
|
668
600
|
case 14:
|
|
669
601
|
case "end":
|
|
670
|
-
return
|
|
602
|
+
return _context12.stop();
|
|
671
603
|
}
|
|
672
|
-
},
|
|
604
|
+
}, _callee12);
|
|
673
605
|
}));
|
|
674
606
|
return _addLayerResources.apply(this, arguments);
|
|
675
607
|
}
|
|
676
608
|
|
|
677
|
-
function addResourceToFirstLayer(
|
|
609
|
+
function addResourceToFirstLayer(_x10) {
|
|
678
610
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
679
611
|
}
|
|
680
612
|
|
|
681
613
|
function _addResourceToFirstLayer() {
|
|
682
|
-
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
614
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(data) {
|
|
683
615
|
var group;
|
|
684
|
-
return _regenerator["default"].wrap(function
|
|
685
|
-
while (1) switch (
|
|
616
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
617
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
686
618
|
case 0:
|
|
687
619
|
group = resourceConfig.getGroups()[0];
|
|
688
|
-
|
|
620
|
+
_context13.next = 3;
|
|
689
621
|
return addLayerResources(group, data);
|
|
690
622
|
|
|
691
623
|
case 3:
|
|
692
624
|
case "end":
|
|
693
|
-
return
|
|
625
|
+
return _context13.stop();
|
|
694
626
|
}
|
|
695
|
-
},
|
|
627
|
+
}, _callee13);
|
|
696
628
|
}));
|
|
697
629
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
698
630
|
}
|
|
@@ -724,28 +656,27 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
724
656
|
|
|
725
657
|
|
|
726
658
|
var onSaveComboRes = /*#__PURE__*/function () {
|
|
727
|
-
var
|
|
728
|
-
return _regenerator["default"].wrap(function
|
|
729
|
-
while (1) switch (
|
|
659
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data) {
|
|
660
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
661
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
730
662
|
case 0:
|
|
731
|
-
|
|
732
|
-
|
|
663
|
+
rlog.debug("关联资源-----onSaveComboRes", data);
|
|
733
664
|
topo.historyManager.beginTransaction();
|
|
734
665
|
|
|
735
666
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
|
736
|
-
|
|
667
|
+
_context4.next = 7;
|
|
737
668
|
break;
|
|
738
669
|
}
|
|
739
670
|
|
|
740
|
-
|
|
671
|
+
_context4.next = 5;
|
|
741
672
|
return addResourceToFirstLayer(data);
|
|
742
673
|
|
|
743
674
|
case 5:
|
|
744
|
-
|
|
675
|
+
_context4.next = 9;
|
|
745
676
|
break;
|
|
746
677
|
|
|
747
678
|
case 7:
|
|
748
|
-
|
|
679
|
+
_context4.next = 9;
|
|
749
680
|
return bindViewResources(data);
|
|
750
681
|
|
|
751
682
|
case 9:
|
|
@@ -757,22 +688,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
757
688
|
|
|
758
689
|
case 12:
|
|
759
690
|
case "end":
|
|
760
|
-
return
|
|
691
|
+
return _context4.stop();
|
|
761
692
|
}
|
|
762
|
-
},
|
|
693
|
+
}, _callee4);
|
|
763
694
|
}));
|
|
764
695
|
|
|
765
|
-
return function onSaveComboRes(
|
|
766
|
-
return
|
|
696
|
+
return function onSaveComboRes(_x11) {
|
|
697
|
+
return _ref4.apply(this, arguments);
|
|
767
698
|
};
|
|
768
699
|
}();
|
|
769
700
|
|
|
770
701
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
771
|
-
var
|
|
702
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(data) {
|
|
772
703
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
|
773
704
|
|
|
774
|
-
return _regenerator["default"].wrap(function
|
|
775
|
-
while (1) switch (
|
|
705
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
706
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
776
707
|
case 0:
|
|
777
708
|
id = data.id, config = data.config, serialize = data.serialize;
|
|
778
709
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
|
@@ -780,11 +711,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
780
711
|
if (onSave) {
|
|
781
712
|
// 自定义保存
|
|
782
713
|
saveConfig = /*#__PURE__*/function () {
|
|
783
|
-
var
|
|
784
|
-
return _regenerator["default"].wrap(function
|
|
785
|
-
while (1) switch (
|
|
714
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
715
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
716
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
786
717
|
case 0:
|
|
787
|
-
|
|
718
|
+
_context5.next = 2;
|
|
788
719
|
return editDispatchers.saveTopo({
|
|
789
720
|
id: id,
|
|
790
721
|
layout: layout,
|
|
@@ -793,13 +724,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
793
724
|
|
|
794
725
|
case 2:
|
|
795
726
|
case "end":
|
|
796
|
-
return
|
|
727
|
+
return _context5.stop();
|
|
797
728
|
}
|
|
798
|
-
},
|
|
729
|
+
}, _callee5);
|
|
799
730
|
}));
|
|
800
731
|
|
|
801
732
|
return function saveConfig() {
|
|
802
|
-
return
|
|
733
|
+
return _ref6.apply(this, arguments);
|
|
803
734
|
};
|
|
804
735
|
}();
|
|
805
736
|
|
|
@@ -812,13 +743,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
812
743
|
|
|
813
744
|
case 3:
|
|
814
745
|
case "end":
|
|
815
|
-
return
|
|
746
|
+
return _context6.stop();
|
|
816
747
|
}
|
|
817
|
-
},
|
|
748
|
+
}, _callee6);
|
|
818
749
|
}));
|
|
819
750
|
|
|
820
|
-
return function onSaveTopo(
|
|
821
|
-
return
|
|
751
|
+
return function onSaveTopo(_x12) {
|
|
752
|
+
return _ref5.apply(this, arguments);
|
|
822
753
|
};
|
|
823
754
|
}();
|
|
824
755
|
|
|
@@ -827,9 +758,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
827
758
|
type: type,
|
|
828
759
|
data: data
|
|
829
760
|
};
|
|
830
|
-
|
|
831
|
-
_rlog["default"].debug("TopoCenter:onSaveBind", eventData);
|
|
832
|
-
|
|
761
|
+
rlog.debug("=> ht: saveBind", eventData);
|
|
833
762
|
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, eventData);
|
|
834
763
|
};
|
|
835
764
|
/**
|
|
@@ -846,11 +775,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
846
775
|
|
|
847
776
|
|
|
848
777
|
var bindNodeResource = /*#__PURE__*/function () {
|
|
849
|
-
var
|
|
778
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(params) {
|
|
850
779
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
|
851
780
|
|
|
852
|
-
return _regenerator["default"].wrap(function
|
|
853
|
-
while (1) switch (
|
|
781
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
782
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
854
783
|
case 0:
|
|
855
784
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
|
856
785
|
return (0, _extends2["default"])({}, resources, {
|
|
@@ -861,14 +790,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
861
790
|
};
|
|
862
791
|
|
|
863
792
|
_doBind = function _doBind3() {
|
|
864
|
-
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
865
|
-
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
|
866
|
-
return _regenerator["default"].wrap(function
|
|
867
|
-
while (1) switch (
|
|
793
|
+
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
794
|
+
var dm, needDeleteHtDatas, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
|
795
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
796
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
868
797
|
case 0:
|
|
869
798
|
dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
|
|
870
799
|
|
|
871
|
-
dm.remove(node); //
|
|
800
|
+
dm.remove(node); // 先删除多余的元素。解决 区域子节点关联ping,未更新显示链路及删除ip节点
|
|
801
|
+
|
|
802
|
+
needDeleteHtDatas = (0, _htElementUtils.getElements)(dm).filter(function (htData) {
|
|
803
|
+
return htData.a('id') && !elements.find(function (ele) {
|
|
804
|
+
return ele.id === htData.a('id');
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
needDeleteHtDatas.forEach(function (htData) {
|
|
808
|
+
return dm.remove(htData);
|
|
809
|
+
}); // 创建
|
|
872
810
|
|
|
873
811
|
newLinkElements = findUNExistedLinkElements(elements);
|
|
874
812
|
createElementsData = null;
|
|
@@ -917,8 +855,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
917
855
|
htTopo.createElements(createElementsData);
|
|
918
856
|
}
|
|
919
857
|
|
|
920
|
-
|
|
921
|
-
|
|
858
|
+
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置、父区域
|
|
922
859
|
|
|
923
860
|
newElement = dm.getDataByTag(newData.id);
|
|
924
861
|
|
|
@@ -926,21 +863,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
926
863
|
newElement.setSize(node.getSize());
|
|
927
864
|
newElement.setPosition(node.getPosition());
|
|
928
865
|
newElement.setImage(node.getImage());
|
|
866
|
+
newElement.setParent(parentGroupElement);
|
|
929
867
|
} // 选中
|
|
930
868
|
|
|
931
869
|
|
|
932
870
|
sm = htTopo.getGraphView().sm();
|
|
933
|
-
sm.setSelection([newElement]);
|
|
934
|
-
|
|
935
|
-
if (topo.linkDynamicStyleExecutor) {
|
|
936
|
-
topo.linkDynamicStyleExecutor.execute();
|
|
937
|
-
}
|
|
871
|
+
sm.setSelection([newElement]);
|
|
938
872
|
|
|
939
|
-
case
|
|
873
|
+
case 12:
|
|
940
874
|
case "end":
|
|
941
|
-
return
|
|
875
|
+
return _context7.stop();
|
|
942
876
|
}
|
|
943
|
-
},
|
|
877
|
+
}, _callee7);
|
|
944
878
|
}));
|
|
945
879
|
return _doBind.apply(this, arguments);
|
|
946
880
|
};
|
|
@@ -951,9 +885,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
951
885
|
|
|
952
886
|
topo.historyManager.beginTransaction();
|
|
953
887
|
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
|
954
|
-
|
|
955
|
-
_rlog["default"].debug("bindNodeResource", params);
|
|
956
|
-
|
|
888
|
+
rlog.debug("bindNodeResource", params);
|
|
957
889
|
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
|
958
890
|
|
|
959
891
|
parentGroupElement = node.getParent();
|
|
@@ -982,49 +914,55 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
982
914
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
|
983
915
|
}
|
|
984
916
|
|
|
985
|
-
|
|
917
|
+
_context8.next = 13;
|
|
986
918
|
return resourceConfig.updateConfig(config);
|
|
987
919
|
|
|
988
920
|
case 13:
|
|
989
|
-
|
|
921
|
+
_context8.next = 15;
|
|
990
922
|
return editDispatchers.fetchDataByConfig();
|
|
991
923
|
|
|
992
924
|
case 15:
|
|
993
|
-
_yield$editDispatcher =
|
|
925
|
+
_yield$editDispatcher = _context8.sent;
|
|
994
926
|
elements = _yield$editDispatcher.elements;
|
|
995
927
|
newData = elements.find(function (item) {
|
|
996
928
|
return item.id === newResId;
|
|
997
929
|
});
|
|
998
930
|
|
|
999
|
-
if (newData) {
|
|
1000
|
-
|
|
931
|
+
if (!newData) {
|
|
932
|
+
_context8.next = 25;
|
|
1001
933
|
break;
|
|
1002
934
|
}
|
|
1003
935
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
_message["default"].error("关联资源失败");
|
|
936
|
+
_context8.next = 21;
|
|
937
|
+
return doBind();
|
|
1007
938
|
|
|
1008
|
-
|
|
939
|
+
case 21:
|
|
940
|
+
topo.historyManager.endTransaction(); // 临时放这里,仅拓扑中心有
|
|
1009
941
|
|
|
1010
|
-
|
|
942
|
+
if (topo.linkDynamicStyleExecutor) {
|
|
943
|
+
topo.linkDynamicStyleExecutor.execute();
|
|
944
|
+
}
|
|
1011
945
|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
return doBind();
|
|
946
|
+
_context8.next = 29;
|
|
947
|
+
break;
|
|
1015
948
|
|
|
1016
949
|
case 25:
|
|
1017
950
|
topo.historyManager.endTransaction();
|
|
1018
951
|
|
|
1019
|
-
|
|
952
|
+
_message["default"].error("关联资源失败");
|
|
953
|
+
|
|
954
|
+
rlog.error("关联资源失败");
|
|
955
|
+
return _context8.abrupt("return", false);
|
|
956
|
+
|
|
957
|
+
case 29:
|
|
1020
958
|
case "end":
|
|
1021
|
-
return
|
|
959
|
+
return _context8.stop();
|
|
1022
960
|
}
|
|
1023
|
-
},
|
|
961
|
+
}, _callee8);
|
|
1024
962
|
}));
|
|
1025
963
|
|
|
1026
|
-
return function bindNodeResource(
|
|
1027
|
-
return
|
|
964
|
+
return function bindNodeResource(_x13) {
|
|
965
|
+
return _ref7.apply(this, arguments);
|
|
1028
966
|
};
|
|
1029
967
|
}();
|
|
1030
968
|
/**
|
|
@@ -1032,93 +970,96 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1032
970
|
*/
|
|
1033
971
|
|
|
1034
972
|
|
|
1035
|
-
function relateNodeIp(_x15, _x16) {
|
|
973
|
+
function relateNodeIp(_x14, _x15, _x16) {
|
|
1036
974
|
return _relateNodeIp.apply(this, arguments);
|
|
1037
975
|
}
|
|
1038
976
|
|
|
1039
977
|
function _relateNodeIp() {
|
|
1040
|
-
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
1041
|
-
var dm, isUnique, ipNodeData, configObj, configData,
|
|
978
|
+
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(txtValue, nodeElement, disableHistory) {
|
|
979
|
+
var dm, isUnique, ipNodeData, configObj, configData, elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
|
1042
980
|
|
|
1043
|
-
return _regenerator["default"].wrap(function
|
|
1044
|
-
while (1) switch (
|
|
981
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
982
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1045
983
|
case 0:
|
|
984
|
+
if (disableHistory === void 0) {
|
|
985
|
+
disableHistory = false;
|
|
986
|
+
}
|
|
987
|
+
|
|
1046
988
|
if (txtValue) {
|
|
1047
|
-
|
|
989
|
+
_context14.next = 3;
|
|
1048
990
|
break;
|
|
1049
991
|
}
|
|
1050
992
|
|
|
1051
|
-
return
|
|
993
|
+
return _context14.abrupt("return");
|
|
1052
994
|
|
|
1053
|
-
case
|
|
1054
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
|
1055
|
-
// return;
|
|
1056
|
-
// }
|
|
995
|
+
case 3:
|
|
1057
996
|
// 根据配置查询拓扑数据
|
|
1058
997
|
dm = topo.getDataModel(); // 执行唯一性验证
|
|
1059
998
|
|
|
1060
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
|
999
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
|
1061
1000
|
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1001
|
+
if (isUnique) {
|
|
1002
|
+
_context14.next = 7;
|
|
1064
1003
|
break;
|
|
1065
1004
|
}
|
|
1066
1005
|
|
|
1067
|
-
|
|
1068
|
-
_context15.next = 8;
|
|
1069
|
-
return deleteExLink(nodeElement);
|
|
1006
|
+
return _context14.abrupt("return");
|
|
1070
1007
|
|
|
1071
|
-
case
|
|
1008
|
+
case 7:
|
|
1009
|
+
disableHistory && topo.historyManager.setDisabled(true, '关联IP: 删除关联出口链路、节点绑定IP'); // 删除关联出口链路
|
|
1010
|
+
|
|
1011
|
+
deleteExLink(nodeElement); // 节点绑定IP
|
|
1012
|
+
|
|
1013
|
+
ipNodeData = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
|
1072
1014
|
nodeElement.a(ipNodeData);
|
|
1073
1015
|
nodeElement.setName(txtValue);
|
|
1074
|
-
nodeElement.setTag("ip:" + txtValue);
|
|
1016
|
+
nodeElement.setTag("ip:" + txtValue);
|
|
1017
|
+
disableHistory && topo.historyManager.setDisabled(false, '关联IP: 删除关联出口链路、节点绑定IP'); // 获取配置
|
|
1075
1018
|
|
|
1076
1019
|
configObj = topo.resourceConfig.getConfig();
|
|
1077
|
-
|
|
1020
|
+
_context14.next = 17;
|
|
1078
1021
|
return resourceConfig.updateConfig(configObj);
|
|
1079
1022
|
|
|
1080
|
-
case
|
|
1081
|
-
|
|
1023
|
+
case 17:
|
|
1024
|
+
_context14.next = 19;
|
|
1082
1025
|
return editDispatchers.fetchDataByConfig();
|
|
1083
1026
|
|
|
1084
|
-
case
|
|
1085
|
-
configData =
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
|
1089
|
-
|
|
1027
|
+
case 19:
|
|
1028
|
+
configData = _context14.sent;
|
|
1029
|
+
elements = configData.elements;
|
|
1030
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
|
1090
1031
|
newLink = newLinkElements.filter(function (item) {
|
|
1091
1032
|
return item.type === "link";
|
|
1092
1033
|
});
|
|
1093
1034
|
newLinkGroup = newLinkElements.filter(function (item) {
|
|
1094
1035
|
return item.type === "linkGroup";
|
|
1095
|
-
});
|
|
1096
|
-
// console.log("newData",newLinkElements, newLink);
|
|
1097
|
-
|
|
1036
|
+
});
|
|
1098
1037
|
createElementsData = {
|
|
1099
1038
|
groups: [],
|
|
1100
1039
|
nodes: [],
|
|
1101
1040
|
links: newLink,
|
|
1102
1041
|
linkGroups: newLinkGroup
|
|
1103
1042
|
};
|
|
1104
|
-
|
|
1043
|
+
rlog.debug("createElementsData", createElementsData);
|
|
1105
1044
|
|
|
1106
1045
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
|
1107
1046
|
_htTopo = topo.getHtTopo();
|
|
1047
|
+
disableHistory && topo.historyManager.setDisabled(true, '关联IP: 创建链路');
|
|
1108
1048
|
|
|
1109
|
-
_htTopo.createElements(createElementsData);
|
|
1049
|
+
_htTopo.createElements(createElementsData);
|
|
1110
1050
|
|
|
1051
|
+
disableHistory && topo.historyManager.setDisabled(false, '关联IP: 创建链路'); // 临时放这里,仅拓扑中心有
|
|
1111
1052
|
|
|
1112
1053
|
if (topo.linkDynamicStyleExecutor) {
|
|
1113
1054
|
topo.linkDynamicStyleExecutor.execute();
|
|
1114
1055
|
}
|
|
1115
1056
|
}
|
|
1116
1057
|
|
|
1117
|
-
case
|
|
1058
|
+
case 27:
|
|
1118
1059
|
case "end":
|
|
1119
|
-
return
|
|
1060
|
+
return _context14.stop();
|
|
1120
1061
|
}
|
|
1121
|
-
},
|
|
1062
|
+
}, _callee14);
|
|
1122
1063
|
}));
|
|
1123
1064
|
return _relateNodeIp.apply(this, arguments);
|
|
1124
1065
|
}
|
|
@@ -1139,8 +1080,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1139
1080
|
*/
|
|
1140
1081
|
|
|
1141
1082
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
|
1142
|
-
|
|
1143
|
-
|
|
1083
|
+
rlog.debug("设置视图鼠标模式", mode);
|
|
1144
1084
|
topo.getHtTopo().setViewMouseMode(mode);
|
|
1145
1085
|
topoEditDispatchers.update({
|
|
1146
1086
|
viewMouseMode: mode
|