@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.0-dev.10
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.css +1 -1
- package/build/index.js +29 -29
- package/es/components/ColorPanel/index.js +68 -58
- 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/FontColorButton.js +10 -91
- 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/FontColorDropdown.js +120 -0
- 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 +77 -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/useKeyboardShortcut.js +4 -0
- 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/useResourceConfig.js +1 -2
- package/es/core/hooks/useTopoEdit.js +210 -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 +9 -17
- package/es/core/models/utils/linkUtils.js +65 -52
- package/es/core/store/models/topoConfig.js +7 -11
- package/es/core/utils/edgeUtil.js +7 -10
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +4 -2
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/services/topo/basic.js +27 -17
- package/es/networkTopo/utils/__tests__/relateTopoData.js +205 -0
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/networkTopo/utils/exitLinkUtil.js +25 -13
- package/es/networkTopo/utils/relateTopoDataUtil.js +149 -0
- package/es/style.js +1 -1
- package/es/utils/ResourceConfigUtil.js +1 -16
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +19 -85
- package/lib/components/ColorPanel/index.js +71 -59
- 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/FontColorButton.js +11 -95
- 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/FontColorDropdown.js +136 -0
- 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 +89 -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/useKeyboardShortcut.js +4 -0
- 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/useResourceConfig.js +1 -2
- package/lib/core/hooks/useTopoEdit.js +216 -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 +9 -17
- package/lib/core/models/utils/linkUtils.js +65 -51
- package/lib/core/store/models/topoConfig.js +13 -25
- package/lib/core/utils/edgeUtil.js +8 -10
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +6 -2
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/services/topo/basic.js +32 -18
- package/lib/networkTopo/utils/__tests__/relateTopoData.js +210 -0
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/networkTopo/utils/exitLinkUtil.js +25 -13
- package/lib/networkTopo/utils/relateTopoDataUtil.js +164 -0
- package/lib/style.js +1 -1
- package/lib/utils/ResourceConfigUtil.js +1 -16
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +22 -94
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
- /package/es/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
- /package/lib/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
@@ -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,38 @@ 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 : [];
|
392
|
-
|
393
|
-
if (edges.length > 0) {
|
394
|
-
edges.map(function (edge) {
|
395
|
-
if (edge.getTag()) {
|
396
|
-
var link = topo.dataModel.getDataById(edge.getTag());
|
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 : [];
|
397
325
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
});
|
403
|
-
}
|
326
|
+
if (edges.length > 0) {
|
327
|
+
edges.map(function (edge) {
|
328
|
+
if (edge.getTag()) {
|
329
|
+
var link = topo.dataModel.getDataById(edge.getTag());
|
404
330
|
|
405
|
-
|
406
|
-
|
407
|
-
|
331
|
+
if (link && (0, _linkUtils.isExitLink)(link)) {
|
332
|
+
topo.getGraphView().dm().remove(edge);
|
333
|
+
}
|
408
334
|
}
|
409
|
-
}
|
410
|
-
}
|
335
|
+
});
|
336
|
+
}
|
337
|
+
};
|
411
338
|
|
412
|
-
|
413
|
-
return _ref4.apply(this, arguments);
|
414
|
-
};
|
415
|
-
}();
|
339
|
+
var batchDeleteSelectedElement = function batchDeleteSelectedElement() {};
|
416
340
|
|
417
341
|
var onDeleteElement = function onDeleteElement(data) {
|
418
342
|
var dtype = data.dtype;
|
419
|
-
|
420
|
-
_rlog["default"].info("onDeleteElement", data);
|
343
|
+
rlog.info("onDeleteElement", data);
|
421
344
|
|
422
345
|
if ((0, _htElementUtils.isLayer)(data)) {
|
423
346
|
handleDeleteLayer(data);
|
@@ -464,7 +387,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
464
387
|
function findUNExistedLinkElements(elements) {
|
465
388
|
var dm = topo.getDataModel();
|
466
389
|
var newLinkElements = elements.filter(function (element) {
|
467
|
-
return (element.type === "link" || element.type === "linkGroup") && !(0, _htElementUtils.
|
390
|
+
return (element.type === "link" || element.type === "linkGroup") && !(0, _htElementUtils.containsElement)(dm, element);
|
468
391
|
});
|
469
392
|
return newLinkElements;
|
470
393
|
}
|
@@ -477,43 +400,56 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
477
400
|
|
478
401
|
function findUNExistedElements(elements) {
|
479
402
|
var dm = topo.getDataModel();
|
480
|
-
var
|
481
|
-
return !(0, _htElementUtils.
|
403
|
+
var unExistedElements = elements.filter(function (element) {
|
404
|
+
return !(0, _htElementUtils.containsElement)(dm, element);
|
482
405
|
});
|
483
|
-
return
|
406
|
+
return unExistedElements;
|
484
407
|
}
|
485
408
|
/**
|
486
|
-
*
|
409
|
+
* 区域关联资源
|
410
|
+
* @param {{ id, tag }} group
|
411
|
+
* @param {*} resources
|
487
412
|
*/
|
488
413
|
|
489
414
|
|
490
|
-
function bindGroupResources(
|
415
|
+
function bindGroupResources(_x3, _x4) {
|
491
416
|
return _bindGroupResources.apply(this, arguments);
|
492
417
|
}
|
493
418
|
|
494
419
|
function _bindGroupResources() {
|
495
|
-
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
496
|
-
var
|
420
|
+
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(group, resources) {
|
421
|
+
var _yield$editDispatcher2, elements, dm, needDeleteHtDatas, nodeElements, newLinkElements, updateElements;
|
497
422
|
|
498
|
-
return _regenerator["default"].wrap(function
|
499
|
-
while (1) switch (
|
423
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
424
|
+
while (1) switch (_context9.prev = _context9.next) {
|
500
425
|
case 0:
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
426
|
+
rlog.debug("区域关联资源", {
|
427
|
+
group: group,
|
428
|
+
resources: resources
|
429
|
+
});
|
505
430
|
topo.historyManager.beginTransaction();
|
506
|
-
|
431
|
+
_context9.next = 4;
|
507
432
|
return resourceConfig.updateGroupResources(group, resources);
|
508
433
|
|
509
|
-
case
|
510
|
-
|
434
|
+
case 4:
|
435
|
+
_context9.next = 6;
|
511
436
|
return editDispatchers.fetchDataByConfig();
|
512
437
|
|
513
|
-
case
|
514
|
-
_yield$editDispatcher2 =
|
438
|
+
case 6:
|
439
|
+
_yield$editDispatcher2 = _context9.sent;
|
515
440
|
elements = _yield$editDispatcher2.elements;
|
516
|
-
//
|
441
|
+
rlog.debug("区域关联资源: 元素列表", elements); // 先删除多余的元素
|
442
|
+
|
443
|
+
dm = topo.getDataModel();
|
444
|
+
needDeleteHtDatas = (0, _htElementUtils.getElements)(dm).filter(function (htData) {
|
445
|
+
return htData.a('id') && !elements.find(function (ele) {
|
446
|
+
return ele.id === htData.a('id');
|
447
|
+
});
|
448
|
+
});
|
449
|
+
needDeleteHtDatas.forEach(function (htData) {
|
450
|
+
return dm.remove(htData);
|
451
|
+
}); // 区域里的所有子节点子区域、新增的链路
|
452
|
+
|
517
453
|
nodeElements = (0, _topoData.findGroupChildren)(elements, group);
|
518
454
|
newLinkElements = findUNExistedLinkElements(elements);
|
519
455
|
updateElements = [].concat(nodeElements, newLinkElements);
|
@@ -528,16 +464,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
528
464
|
|
529
465
|
topo.historyManager.endTransaction();
|
530
466
|
|
531
|
-
case
|
467
|
+
case 17:
|
532
468
|
case "end":
|
533
|
-
return
|
469
|
+
return _context9.stop();
|
534
470
|
}
|
535
|
-
},
|
471
|
+
}, _callee9);
|
536
472
|
}));
|
537
473
|
return _bindGroupResources.apply(this, arguments);
|
538
474
|
}
|
539
475
|
|
540
|
-
function addGroupResources(
|
476
|
+
function addGroupResources(_x5, _x6) {
|
541
477
|
return _addGroupResources.apply(this, arguments);
|
542
478
|
}
|
543
479
|
/**
|
@@ -546,10 +482,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
546
482
|
|
547
483
|
|
548
484
|
function _addGroupResources() {
|
549
|
-
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
485
|
+
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(group, newResourceIds) {
|
550
486
|
var groupConfig, resources, groupData;
|
551
|
-
return _regenerator["default"].wrap(function
|
552
|
-
while (1) switch (
|
487
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
488
|
+
while (1) switch (_context10.prev = _context10.next) {
|
553
489
|
case 0:
|
554
490
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
555
491
|
resources = {
|
@@ -559,19 +495,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
559
495
|
id: group.getTag(),
|
560
496
|
tag: group.a("tag")
|
561
497
|
};
|
562
|
-
|
498
|
+
_context10.next = 5;
|
563
499
|
return bindGroupResources(groupData, resources);
|
564
500
|
|
565
501
|
case 5:
|
566
502
|
case "end":
|
567
|
-
return
|
503
|
+
return _context10.stop();
|
568
504
|
}
|
569
|
-
},
|
505
|
+
}, _callee10);
|
570
506
|
}));
|
571
507
|
return _addGroupResources.apply(this, arguments);
|
572
508
|
}
|
573
509
|
|
574
|
-
function bindViewResources(
|
510
|
+
function bindViewResources(_x7) {
|
575
511
|
return _bindViewResources.apply(this, arguments);
|
576
512
|
}
|
577
513
|
/**
|
@@ -583,24 +519,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
583
519
|
|
584
520
|
|
585
521
|
function _bindViewResources() {
|
586
|
-
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
522
|
+
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(data) {
|
587
523
|
var config, result, _elements;
|
588
524
|
|
589
|
-
return _regenerator["default"].wrap(function
|
590
|
-
while (1) switch (
|
525
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
526
|
+
while (1) switch (_context11.prev = _context11.next) {
|
591
527
|
case 0:
|
592
528
|
// console.log("关联视图的资源", data);
|
593
529
|
config = resourceConfig.getConfig();
|
594
530
|
config.resources = data;
|
595
|
-
|
531
|
+
_context11.next = 4;
|
596
532
|
return resourceConfig.updateConfig(config);
|
597
533
|
|
598
534
|
case 4:
|
599
|
-
|
535
|
+
_context11.next = 6;
|
600
536
|
return editDispatchers.fetchDataByConfig();
|
601
537
|
|
602
538
|
case 6:
|
603
|
-
result =
|
539
|
+
result = _context11.sent;
|
604
540
|
console.log("fetchDataByConfig", result);
|
605
541
|
|
606
542
|
if (result) {
|
@@ -614,44 +550,42 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
614
550
|
|
615
551
|
case 9:
|
616
552
|
case "end":
|
617
|
-
return
|
553
|
+
return _context11.stop();
|
618
554
|
}
|
619
|
-
},
|
555
|
+
}, _callee11);
|
620
556
|
}));
|
621
557
|
return _bindViewResources.apply(this, arguments);
|
622
558
|
}
|
623
559
|
|
624
|
-
function addLayerResources(
|
560
|
+
function addLayerResources(_x8, _x9) {
|
625
561
|
return _addLayerResources.apply(this, arguments);
|
626
562
|
}
|
627
563
|
|
628
564
|
function _addLayerResources() {
|
629
|
-
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
565
|
+
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(group, newResourceIds) {
|
630
566
|
var _yield$editDispatcher3, elements, newElements;
|
631
567
|
|
632
|
-
return _regenerator["default"].wrap(function
|
633
|
-
while (1) switch (
|
568
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
569
|
+
while (1) switch (_context12.prev = _context12.next) {
|
634
570
|
case 0:
|
635
571
|
topo.historyManager.beginTransaction(); // 构造新的配置
|
636
572
|
|
637
|
-
|
573
|
+
_context12.next = 3;
|
638
574
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
639
575
|
|
640
576
|
case 3:
|
641
|
-
|
577
|
+
_context12.next = 5;
|
642
578
|
return editDispatchers.fetchDataByConfig();
|
643
579
|
|
644
580
|
case 5:
|
645
|
-
_yield$editDispatcher3 =
|
581
|
+
_yield$editDispatcher3 = _context12.sent;
|
646
582
|
elements = _yield$editDispatcher3.elements;
|
647
583
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
648
584
|
newElements = findUNExistedElements(elements);
|
649
|
-
|
650
|
-
_rlog["default"].debug("添加分层资源", {
|
585
|
+
rlog.debug("添加分层资源", {
|
651
586
|
layer: group,
|
652
587
|
newElements: newElements
|
653
588
|
});
|
654
|
-
|
655
589
|
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
656
590
|
|
657
591
|
if (topo.linkDynamicStyleExecutor) {
|
@@ -667,32 +601,32 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
667
601
|
|
668
602
|
case 14:
|
669
603
|
case "end":
|
670
|
-
return
|
604
|
+
return _context12.stop();
|
671
605
|
}
|
672
|
-
},
|
606
|
+
}, _callee12);
|
673
607
|
}));
|
674
608
|
return _addLayerResources.apply(this, arguments);
|
675
609
|
}
|
676
610
|
|
677
|
-
function addResourceToFirstLayer(
|
611
|
+
function addResourceToFirstLayer(_x10) {
|
678
612
|
return _addResourceToFirstLayer.apply(this, arguments);
|
679
613
|
}
|
680
614
|
|
681
615
|
function _addResourceToFirstLayer() {
|
682
|
-
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
616
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(data) {
|
683
617
|
var group;
|
684
|
-
return _regenerator["default"].wrap(function
|
685
|
-
while (1) switch (
|
618
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
619
|
+
while (1) switch (_context13.prev = _context13.next) {
|
686
620
|
case 0:
|
687
621
|
group = resourceConfig.getGroups()[0];
|
688
|
-
|
622
|
+
_context13.next = 3;
|
689
623
|
return addLayerResources(group, data);
|
690
624
|
|
691
625
|
case 3:
|
692
626
|
case "end":
|
693
|
-
return
|
627
|
+
return _context13.stop();
|
694
628
|
}
|
695
|
-
},
|
629
|
+
}, _callee13);
|
696
630
|
}));
|
697
631
|
return _addResourceToFirstLayer.apply(this, arguments);
|
698
632
|
}
|
@@ -724,28 +658,27 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
724
658
|
|
725
659
|
|
726
660
|
var onSaveComboRes = /*#__PURE__*/function () {
|
727
|
-
var
|
728
|
-
return _regenerator["default"].wrap(function
|
729
|
-
while (1) switch (
|
661
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data) {
|
662
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
663
|
+
while (1) switch (_context4.prev = _context4.next) {
|
730
664
|
case 0:
|
731
|
-
|
732
|
-
|
665
|
+
rlog.debug("关联资源-----onSaveComboRes", data);
|
733
666
|
topo.historyManager.beginTransaction();
|
734
667
|
|
735
668
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
736
|
-
|
669
|
+
_context4.next = 7;
|
737
670
|
break;
|
738
671
|
}
|
739
672
|
|
740
|
-
|
673
|
+
_context4.next = 5;
|
741
674
|
return addResourceToFirstLayer(data);
|
742
675
|
|
743
676
|
case 5:
|
744
|
-
|
677
|
+
_context4.next = 9;
|
745
678
|
break;
|
746
679
|
|
747
680
|
case 7:
|
748
|
-
|
681
|
+
_context4.next = 9;
|
749
682
|
return bindViewResources(data);
|
750
683
|
|
751
684
|
case 9:
|
@@ -757,22 +690,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
757
690
|
|
758
691
|
case 12:
|
759
692
|
case "end":
|
760
|
-
return
|
693
|
+
return _context4.stop();
|
761
694
|
}
|
762
|
-
},
|
695
|
+
}, _callee4);
|
763
696
|
}));
|
764
697
|
|
765
|
-
return function onSaveComboRes(
|
766
|
-
return
|
698
|
+
return function onSaveComboRes(_x11) {
|
699
|
+
return _ref4.apply(this, arguments);
|
767
700
|
};
|
768
701
|
}();
|
769
702
|
|
770
703
|
var onSaveTopo = /*#__PURE__*/function () {
|
771
|
-
var
|
704
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(data) {
|
772
705
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
773
706
|
|
774
|
-
return _regenerator["default"].wrap(function
|
775
|
-
while (1) switch (
|
707
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
708
|
+
while (1) switch (_context6.prev = _context6.next) {
|
776
709
|
case 0:
|
777
710
|
id = data.id, config = data.config, serialize = data.serialize;
|
778
711
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
@@ -780,11 +713,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
780
713
|
if (onSave) {
|
781
714
|
// 自定义保存
|
782
715
|
saveConfig = /*#__PURE__*/function () {
|
783
|
-
var
|
784
|
-
return _regenerator["default"].wrap(function
|
785
|
-
while (1) switch (
|
716
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
717
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
718
|
+
while (1) switch (_context5.prev = _context5.next) {
|
786
719
|
case 0:
|
787
|
-
|
720
|
+
_context5.next = 2;
|
788
721
|
return editDispatchers.saveTopo({
|
789
722
|
id: id,
|
790
723
|
layout: layout,
|
@@ -793,13 +726,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
793
726
|
|
794
727
|
case 2:
|
795
728
|
case "end":
|
796
|
-
return
|
729
|
+
return _context5.stop();
|
797
730
|
}
|
798
|
-
},
|
731
|
+
}, _callee5);
|
799
732
|
}));
|
800
733
|
|
801
734
|
return function saveConfig() {
|
802
|
-
return
|
735
|
+
return _ref6.apply(this, arguments);
|
803
736
|
};
|
804
737
|
}();
|
805
738
|
|
@@ -812,13 +745,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
812
745
|
|
813
746
|
case 3:
|
814
747
|
case "end":
|
815
|
-
return
|
748
|
+
return _context6.stop();
|
816
749
|
}
|
817
|
-
},
|
750
|
+
}, _callee6);
|
818
751
|
}));
|
819
752
|
|
820
|
-
return function onSaveTopo(
|
821
|
-
return
|
753
|
+
return function onSaveTopo(_x12) {
|
754
|
+
return _ref5.apply(this, arguments);
|
822
755
|
};
|
823
756
|
}();
|
824
757
|
|
@@ -827,9 +760,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
827
760
|
type: type,
|
828
761
|
data: data
|
829
762
|
};
|
830
|
-
|
831
|
-
_rlog["default"].debug("TopoCenter:onSaveBind", eventData);
|
832
|
-
|
763
|
+
rlog.debug("=> ht: saveBind", eventData);
|
833
764
|
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, eventData);
|
834
765
|
};
|
835
766
|
/**
|
@@ -846,11 +777,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
846
777
|
|
847
778
|
|
848
779
|
var bindNodeResource = /*#__PURE__*/function () {
|
849
|
-
var
|
780
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(params) {
|
850
781
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
851
782
|
|
852
|
-
return _regenerator["default"].wrap(function
|
853
|
-
while (1) switch (
|
783
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
784
|
+
while (1) switch (_context8.prev = _context8.next) {
|
854
785
|
case 0:
|
855
786
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
856
787
|
return (0, _extends2["default"])({}, resources, {
|
@@ -861,14 +792,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
861
792
|
};
|
862
793
|
|
863
794
|
_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 (
|
795
|
+
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
796
|
+
var dm, needDeleteHtDatas, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
797
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
798
|
+
while (1) switch (_context7.prev = _context7.next) {
|
868
799
|
case 0:
|
869
800
|
dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
|
870
801
|
|
871
|
-
dm.remove(node); //
|
802
|
+
dm.remove(node); // 先删除多余的元素。解决 区域子节点关联ping,未更新显示链路及删除ip节点
|
803
|
+
|
804
|
+
needDeleteHtDatas = (0, _htElementUtils.getElements)(dm).filter(function (htData) {
|
805
|
+
return htData.a('id') && !elements.find(function (ele) {
|
806
|
+
return ele.id === htData.a('id');
|
807
|
+
});
|
808
|
+
});
|
809
|
+
needDeleteHtDatas.forEach(function (htData) {
|
810
|
+
return dm.remove(htData);
|
811
|
+
}); // 创建
|
872
812
|
|
873
813
|
newLinkElements = findUNExistedLinkElements(elements);
|
874
814
|
createElementsData = null;
|
@@ -917,8 +857,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
917
857
|
htTopo.createElements(createElementsData);
|
918
858
|
}
|
919
859
|
|
920
|
-
|
921
|
-
|
860
|
+
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置、父区域
|
922
861
|
|
923
862
|
newElement = dm.getDataByTag(newData.id);
|
924
863
|
|
@@ -926,21 +865,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
926
865
|
newElement.setSize(node.getSize());
|
927
866
|
newElement.setPosition(node.getPosition());
|
928
867
|
newElement.setImage(node.getImage());
|
868
|
+
newElement.setParent(parentGroupElement);
|
929
869
|
} // 选中
|
930
870
|
|
931
871
|
|
932
872
|
sm = htTopo.getGraphView().sm();
|
933
|
-
sm.setSelection([newElement]);
|
934
|
-
|
935
|
-
if (topo.linkDynamicStyleExecutor) {
|
936
|
-
topo.linkDynamicStyleExecutor.execute();
|
937
|
-
}
|
873
|
+
sm.setSelection([newElement]);
|
938
874
|
|
939
|
-
case
|
875
|
+
case 12:
|
940
876
|
case "end":
|
941
|
-
return
|
877
|
+
return _context7.stop();
|
942
878
|
}
|
943
|
-
},
|
879
|
+
}, _callee7);
|
944
880
|
}));
|
945
881
|
return _doBind.apply(this, arguments);
|
946
882
|
};
|
@@ -951,9 +887,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
951
887
|
|
952
888
|
topo.historyManager.beginTransaction();
|
953
889
|
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
954
|
-
|
955
|
-
_rlog["default"].debug("bindNodeResource", params);
|
956
|
-
|
890
|
+
rlog.debug("bindNodeResource", params);
|
957
891
|
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
958
892
|
|
959
893
|
parentGroupElement = node.getParent();
|
@@ -982,49 +916,55 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
982
916
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
983
917
|
}
|
984
918
|
|
985
|
-
|
919
|
+
_context8.next = 13;
|
986
920
|
return resourceConfig.updateConfig(config);
|
987
921
|
|
988
922
|
case 13:
|
989
|
-
|
923
|
+
_context8.next = 15;
|
990
924
|
return editDispatchers.fetchDataByConfig();
|
991
925
|
|
992
926
|
case 15:
|
993
|
-
_yield$editDispatcher =
|
927
|
+
_yield$editDispatcher = _context8.sent;
|
994
928
|
elements = _yield$editDispatcher.elements;
|
995
929
|
newData = elements.find(function (item) {
|
996
930
|
return item.id === newResId;
|
997
931
|
});
|
998
932
|
|
999
|
-
if (newData) {
|
1000
|
-
|
933
|
+
if (!newData) {
|
934
|
+
_context8.next = 25;
|
1001
935
|
break;
|
1002
936
|
}
|
1003
937
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
_message["default"].error("关联资源失败");
|
938
|
+
_context8.next = 21;
|
939
|
+
return doBind();
|
1007
940
|
|
1008
|
-
|
941
|
+
case 21:
|
942
|
+
topo.historyManager.endTransaction(); // 临时放这里,仅拓扑中心有
|
1009
943
|
|
1010
|
-
|
944
|
+
if (topo.linkDynamicStyleExecutor) {
|
945
|
+
topo.linkDynamicStyleExecutor.execute();
|
946
|
+
}
|
1011
947
|
|
1012
|
-
|
1013
|
-
|
1014
|
-
return doBind();
|
948
|
+
_context8.next = 29;
|
949
|
+
break;
|
1015
950
|
|
1016
951
|
case 25:
|
1017
952
|
topo.historyManager.endTransaction();
|
1018
953
|
|
1019
|
-
|
954
|
+
_message["default"].error("关联资源失败");
|
955
|
+
|
956
|
+
rlog.error("关联资源失败");
|
957
|
+
return _context8.abrupt("return", false);
|
958
|
+
|
959
|
+
case 29:
|
1020
960
|
case "end":
|
1021
|
-
return
|
961
|
+
return _context8.stop();
|
1022
962
|
}
|
1023
|
-
},
|
963
|
+
}, _callee8);
|
1024
964
|
}));
|
1025
965
|
|
1026
|
-
return function bindNodeResource(
|
1027
|
-
return
|
966
|
+
return function bindNodeResource(_x13) {
|
967
|
+
return _ref7.apply(this, arguments);
|
1028
968
|
};
|
1029
969
|
}();
|
1030
970
|
/**
|
@@ -1032,93 +972,96 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1032
972
|
*/
|
1033
973
|
|
1034
974
|
|
1035
|
-
function relateNodeIp(_x15, _x16) {
|
975
|
+
function relateNodeIp(_x14, _x15, _x16) {
|
1036
976
|
return _relateNodeIp.apply(this, arguments);
|
1037
977
|
}
|
1038
978
|
|
1039
979
|
function _relateNodeIp() {
|
1040
|
-
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
1041
|
-
var dm, isUnique, ipNodeData, configObj, configData,
|
980
|
+
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(txtValue, nodeElement, disableHistory) {
|
981
|
+
var dm, isUnique, ipNodeData, configObj, configData, elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1042
982
|
|
1043
|
-
return _regenerator["default"].wrap(function
|
1044
|
-
while (1) switch (
|
983
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
984
|
+
while (1) switch (_context14.prev = _context14.next) {
|
1045
985
|
case 0:
|
986
|
+
if (disableHistory === void 0) {
|
987
|
+
disableHistory = false;
|
988
|
+
}
|
989
|
+
|
1046
990
|
if (txtValue) {
|
1047
|
-
|
991
|
+
_context14.next = 3;
|
1048
992
|
break;
|
1049
993
|
}
|
1050
994
|
|
1051
|
-
return
|
995
|
+
return _context14.abrupt("return");
|
1052
996
|
|
1053
|
-
case
|
1054
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
1055
|
-
// return;
|
1056
|
-
// }
|
997
|
+
case 3:
|
1057
998
|
// 根据配置查询拓扑数据
|
1058
999
|
dm = topo.getDataModel(); // 执行唯一性验证
|
1059
1000
|
|
1060
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
1001
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
1061
1002
|
|
1062
|
-
if (
|
1063
|
-
|
1003
|
+
if (isUnique) {
|
1004
|
+
_context14.next = 7;
|
1064
1005
|
break;
|
1065
1006
|
}
|
1066
1007
|
|
1067
|
-
|
1068
|
-
_context15.next = 8;
|
1069
|
-
return deleteExLink(nodeElement);
|
1008
|
+
return _context14.abrupt("return");
|
1070
1009
|
|
1071
|
-
case
|
1010
|
+
case 7:
|
1011
|
+
disableHistory && topo.historyManager.setDisabled(true, '关联IP: 删除关联出口链路、节点绑定IP'); // 删除关联出口链路
|
1012
|
+
|
1013
|
+
deleteExLink(nodeElement); // 节点绑定IP
|
1014
|
+
|
1015
|
+
ipNodeData = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1072
1016
|
nodeElement.a(ipNodeData);
|
1073
1017
|
nodeElement.setName(txtValue);
|
1074
|
-
nodeElement.setTag("ip:" + txtValue);
|
1018
|
+
nodeElement.setTag("ip:" + txtValue);
|
1019
|
+
disableHistory && topo.historyManager.setDisabled(false, '关联IP: 删除关联出口链路、节点绑定IP'); // 获取配置
|
1075
1020
|
|
1076
1021
|
configObj = topo.resourceConfig.getConfig();
|
1077
|
-
|
1022
|
+
_context14.next = 17;
|
1078
1023
|
return resourceConfig.updateConfig(configObj);
|
1079
1024
|
|
1080
|
-
case
|
1081
|
-
|
1025
|
+
case 17:
|
1026
|
+
_context14.next = 19;
|
1082
1027
|
return editDispatchers.fetchDataByConfig();
|
1083
1028
|
|
1084
|
-
case
|
1085
|
-
configData =
|
1086
|
-
|
1087
|
-
|
1088
|
-
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1089
|
-
|
1029
|
+
case 19:
|
1030
|
+
configData = _context14.sent;
|
1031
|
+
elements = configData.elements;
|
1032
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
1090
1033
|
newLink = newLinkElements.filter(function (item) {
|
1091
1034
|
return item.type === "link";
|
1092
1035
|
});
|
1093
1036
|
newLinkGroup = newLinkElements.filter(function (item) {
|
1094
1037
|
return item.type === "linkGroup";
|
1095
|
-
});
|
1096
|
-
// console.log("newData",newLinkElements, newLink);
|
1097
|
-
|
1038
|
+
});
|
1098
1039
|
createElementsData = {
|
1099
1040
|
groups: [],
|
1100
1041
|
nodes: [],
|
1101
1042
|
links: newLink,
|
1102
1043
|
linkGroups: newLinkGroup
|
1103
1044
|
};
|
1104
|
-
|
1045
|
+
rlog.debug("createElementsData", createElementsData);
|
1105
1046
|
|
1106
1047
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1107
1048
|
_htTopo = topo.getHtTopo();
|
1049
|
+
disableHistory && topo.historyManager.setDisabled(true, '关联IP: 创建链路');
|
1108
1050
|
|
1109
|
-
_htTopo.createElements(createElementsData);
|
1051
|
+
_htTopo.createElements(createElementsData);
|
1110
1052
|
|
1053
|
+
disableHistory && topo.historyManager.setDisabled(false, '关联IP: 创建链路'); // 临时放这里,仅拓扑中心有
|
1111
1054
|
|
1112
1055
|
if (topo.linkDynamicStyleExecutor) {
|
1113
1056
|
topo.linkDynamicStyleExecutor.execute();
|
1114
1057
|
}
|
1115
1058
|
}
|
1116
1059
|
|
1117
|
-
case
|
1060
|
+
case 27:
|
1118
1061
|
case "end":
|
1119
|
-
return
|
1062
|
+
return _context14.stop();
|
1120
1063
|
}
|
1121
|
-
},
|
1064
|
+
}, _callee14);
|
1122
1065
|
}));
|
1123
1066
|
return _relateNodeIp.apply(this, arguments);
|
1124
1067
|
}
|
@@ -1139,8 +1082,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1139
1082
|
*/
|
1140
1083
|
|
1141
1084
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
1142
|
-
|
1143
|
-
|
1085
|
+
rlog.debug("设置视图鼠标模式", mode);
|
1144
1086
|
topo.getHtTopo().setViewMouseMode(mode);
|
1145
1087
|
topoEditDispatchers.update({
|
1146
1088
|
viewMouseMode: mode
|
@@ -1212,6 +1154,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1212
1154
|
onCloseComboResDrawer: function onCloseComboResDrawer() {
|
1213
1155
|
return setShowComboResDrawer(false);
|
1214
1156
|
},
|
1157
|
+
batchDeleteSelectedElement: batchDeleteSelectedElement,
|
1215
1158
|
|
1216
1159
|
/**
|
1217
1160
|
* 拓扑图元素(节点、连线、容器)删除回调
|
@@ -1228,7 +1171,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1228
1171
|
*/
|
1229
1172
|
onSaveTopo: onSaveTopo,
|
1230
1173
|
getResourceConfigFromHt: resourceConfig.getConfigFromHt,
|
1231
|
-
onLayerAdded: onLayerAdded
|
1174
|
+
onLayerAdded: onLayerAdded,
|
1175
|
+
findUNExistedLinkElements: findUNExistedLinkElements
|
1232
1176
|
};
|
1233
1177
|
};
|
1234
1178
|
|