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