@riil-frontend/component-topology 12.1.0-dev.1 → 12.1.0-dev.11

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 (68) 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/components/LinkTopo/LinkTopo.module.scss +1 -1
  29. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +8 -0
  30. package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
  31. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
  32. package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
  33. package/es/utils/clusterUtil.js +3 -3
  34. package/es/utils/htElementUtils.js +16 -84
  35. package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +2 -2
  36. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
  37. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -14
  38. package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +3 -28
  39. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
  40. package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -56
  41. package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +1 -1
  42. package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +38 -0
  43. package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +38 -0
  44. package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +83 -0
  45. package/lib/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
  46. package/lib/core/editor/hooks/useNewElementTheme.js +20 -16
  47. package/lib/core/editor/utils/edgeTypeStyleUtil.js +10 -8
  48. package/lib/core/hooks/usePolling.js +6 -5
  49. package/lib/core/hooks/useTopoEdit.js +177 -257
  50. package/lib/core/models/Alarm.js +14 -15
  51. package/lib/core/models/AttributeMetricDisplay.js +6 -6
  52. package/lib/core/models/HistoryManager.js +13 -17
  53. package/lib/core/models/TopoApp.js +22 -29
  54. package/lib/core/models/utils/linkUtils.js +19 -18
  55. package/lib/core/store/models/topoConfig.js +9 -16
  56. package/lib/core/utils/edgeUtil.js +8 -10
  57. package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
  58. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +52 -13
  59. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +1 -1
  60. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +8 -0
  61. package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
  62. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
  63. package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
  64. package/lib/utils/clusterUtil.js +2 -2
  65. package/lib/utils/htElementUtils.js +19 -93
  66. package/package.json +2 -2
  67. package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
  68. package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
@@ -4,19 +4,19 @@ import _Button from "@alifd/next/es/button";
4
4
  import _Dialog from "@alifd/next/es/dialog";
5
5
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import React, { useCallback, useEffect, useMemo, useState } from "react";
8
- import _ from "lodash";
9
- import rlog from "@riil-frontend/component-topology-utils/es/rlog";
7
+ import React, { useCallback, useState } from "react";
8
+ import Logger from 'loglevel';
10
9
  import { TopoEvent } from "@riil-frontend/component-topology-graph";
11
10
  import { TPL_BLANK, TPL_TREE } from "../../utils/template";
12
- import { getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode, getGroupChildren } from "../../utils/htElementUtils";
11
+ import { getGroupElementByTag, isEdge, containsElement, isGroup, isLayer, isNode, getGroupChildren } from "../../utils/htElementUtils";
13
12
  import useResourceConfig from "./useResourceConfig";
14
13
  import useGroupAddResource from "./useGroupAddResource";
15
14
  import { findGroupChildren } from "../../utils/topoData";
16
15
  import { isResourceElement } from "../../utils/htElementDataUtil";
17
16
  import { isClusterHtElement, isClusterMemberHtElement } from "../../utils/clusterUtil";
18
- import { isExitLink, mergeExportLinkData } from "../models/utils/linkUtils";
17
+ import { isExitLink } from "../models/utils/linkUtils";
19
18
  import { isUniqueIp, buildIpNode } from "../../networkTopo/utils/exitLinkUtil";
19
+ var rlog = Logger.getLogger('topo');
20
20
 
21
21
  var useTopoEdit = function useTopoEdit(params) {
22
22
  var topo = params.topo,
@@ -193,48 +193,7 @@ var useTopoEdit = function useTopoEdit(params) {
193
193
  return onOk;
194
194
  }()
195
195
  });
196
- }; // const deleteGroupFooterBtn = () => {
197
- // return (
198
- // <div>
199
- // <Button type="primary" onClick={doDeleteOnlyGroup()}>
200
- // 仅删除区域
201
- // </Button>
202
- // <Button type="primary" onClick={doDeleteOnlyGroup()}>
203
- // 确定
204
- // </Button>
205
- // </div>
206
- // );
207
- // };
208
- // const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
209
- // function doDeleteOnlyGroup(data,group) {
210
- // topo.historyManager.beginTransaction();
211
- // console.log("仅删除区域", topo.view.topoClient, data);
212
- // const children = getGroupChildren(group);
213
- // children.map((child) => {
214
- // child.setParent(null);
215
- // // var viewRect = topo.getGraphView().getViewRect();
216
- // // var nodeRect = child.getRect();
217
- // // child.setPosition(
218
- // // viewRect.x + nodeRect.width + 2,
219
- // // viewRect.y + nodeRect.height + 4
220
- // // ); // 解决集群从区域内移出时,连线位置未更新的问题
221
- // setTimeout(function () {
222
- // child.iv();
223
- // topo.historyManager.endTransaction();
224
- // }, 50);
225
- // });
226
- // topo.view.topoClient.deleteGroup(data);
227
- // topo.historyManager.endTransaction();
228
- // setGroupDeleteVisible(false);
229
- // // console.log("仅删除区域", children, group);
230
- // }
231
- // function doDelete(data) {
232
- // topo.historyManager.beginTransaction();
233
- // // FIXME 。如果命中其他的动态条件,则立即显示
234
- // topo.view.topoClient.deleteGroup(data);
235
- // setGroupDeleteVisible(false);
236
- // }
237
-
196
+ };
238
197
  /**
239
198
  * 删除容器。
240
199
  *
@@ -265,21 +224,17 @@ var useTopoEdit = function useTopoEdit(params) {
265
224
  // content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
266
225
  content: "是否仅删除区域或将区域包含的内容一同删除?",
267
226
  footer: [/*#__PURE__*/React.createElement(_Button, {
227
+ key: "1",
268
228
  type: "normal",
269
229
  onClick: doDeleteOnlyGroup,
270
230
  style: {
271
231
  marginRight: "15px"
272
232
  }
273
233
  }, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/React.createElement(_Button, {
234
+ key: "2",
274
235
  type: "normal",
275
236
  onClick: doDelete
276
237
  }, "\u5168\u90E8\u5220\u9664")],
277
- // okProps: {
278
- // children: "仅删除区域",
279
- // type: "normal",
280
- // className: "next-btn-normal",
281
- // },
282
- // cancelProps: { children: "全部删除" },
283
238
  messageProps: {
284
239
  type: "warning"
285
240
  }
@@ -290,13 +245,7 @@ var useTopoEdit = function useTopoEdit(params) {
290
245
  console.log("仅删除区域", topo.view.topoClient, data);
291
246
  var children = getGroupChildren(group);
292
247
  children.map(function (child) {
293
- child.setParent(null); // var viewRect = topo.getGraphView().getViewRect();
294
- // var nodeRect = child.getRect();
295
- // child.setPosition(
296
- // viewRect.x + nodeRect.width + 2,
297
- // viewRect.y + nodeRect.height + 4
298
- // ); // 解决集群从区域内移出时,连线位置未更新的问题
299
-
248
+ child.setParent(null);
300
249
  setTimeout(function () {
301
250
  child.iv();
302
251
  topo.historyManager.endTransaction();
@@ -315,10 +264,6 @@ var useTopoEdit = function useTopoEdit(params) {
315
264
  }
316
265
  };
317
266
 
318
- var deleteNode = function deleteNode(node) {
319
- emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, node);
320
- };
321
-
322
267
  var handleDeleteNode = function handleDeleteNode(element) {
323
268
  var _topo$options$editor;
324
269
 
@@ -335,46 +280,32 @@ var useTopoEdit = function useTopoEdit(params) {
335
280
  if (typeof onNodeDelete === "function") {
336
281
  onNodeDelete(data);
337
282
  } else {
338
- deleteNode(data);
283
+ emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, node);
339
284
  }
340
285
  }
341
286
  }; // 删除关联在节点上的出口链路
342
287
 
343
288
 
344
- var deleteExLink = /*#__PURE__*/function () {
345
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
346
- var _node$getEdges$toArra, _node$getEdges;
289
+ var deleteExLink = function deleteExLink(node) {
290
+ var _node$getEdges$toArra, _node$getEdges;
347
291
 
348
- var edges;
349
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
350
- while (1) switch (_context4.prev = _context4.next) {
351
- case 0:
352
- // console.log("删除关联在节点上的出口链路- node, config", node, config);
353
- 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 : [];
292
+ rlog.debug("删除关联在节点上的出口链路", {
293
+ node: node
294
+ });
295
+ 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 : [];
354
296
 
355
- if (edges.length > 0) {
356
- edges.map(function (edge) {
357
- if (edge.getTag()) {
358
- var link = topo.dataModel.getDataById(edge.getTag());
297
+ if (edges.length > 0) {
298
+ edges.map(function (edge) {
299
+ if (edge.getTag()) {
300
+ var link = topo.dataModel.getDataById(edge.getTag());
359
301
 
360
- if (link && isExitLink(link)) {
361
- topo.getGraphView().dm().remove(edge);
362
- }
363
- }
364
- });
365
- }
366
-
367
- case 2:
368
- case "end":
369
- return _context4.stop();
302
+ if (link && isExitLink(link)) {
303
+ topo.getGraphView().dm().remove(edge);
304
+ }
370
305
  }
371
- }, _callee4);
372
- }));
373
-
374
- return function deleteExLink(_x3) {
375
- return _ref4.apply(this, arguments);
376
- };
377
- }();
306
+ });
307
+ }
308
+ };
378
309
 
379
310
  var onDeleteElement = function onDeleteElement(data) {
380
311
  var dtype = data.dtype;
@@ -425,7 +356,7 @@ var useTopoEdit = function useTopoEdit(params) {
425
356
  function findUNExistedLinkElements(elements) {
426
357
  var dm = topo.getDataModel();
427
358
  var newLinkElements = elements.filter(function (element) {
428
- return (element.type === "link" || element.type === "linkGroup") && !isExistedElement(topo.getHtTopo(), dm, element);
359
+ return (element.type === "link" || element.type === "linkGroup") && !containsElement(dm, element);
429
360
  });
430
361
  return newLinkElements;
431
362
  }
@@ -439,7 +370,7 @@ var useTopoEdit = function useTopoEdit(params) {
439
370
  function findUNExistedElements(elements) {
440
371
  var dm = topo.getDataModel();
441
372
  var newLinkElements = elements.filter(function (element) {
442
- return !isExistedElement(topo.getHtTopo(), dm, element);
373
+ return !containsElement(dm, element);
443
374
  });
444
375
  return newLinkElements;
445
376
  }
@@ -448,29 +379,29 @@ var useTopoEdit = function useTopoEdit(params) {
448
379
  */
449
380
 
450
381
 
451
- function bindGroupResources(_x4, _x5) {
382
+ function bindGroupResources(_x3, _x4) {
452
383
  return _bindGroupResources.apply(this, arguments);
453
384
  }
454
385
 
455
386
  function _bindGroupResources() {
456
- _bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(group, resources) {
387
+ _bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(group, resources) {
457
388
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
458
389
 
459
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
460
- while (1) switch (_context10.prev = _context10.next) {
390
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
391
+ while (1) switch (_context9.prev = _context9.next) {
461
392
  case 0:
462
393
  id = group.id, tag = group.tag;
463
394
  rlog.debug("bindGroupResources--id, tag", id, tag);
464
395
  topo.historyManager.beginTransaction();
465
- _context10.next = 5;
396
+ _context9.next = 5;
466
397
  return resourceConfig.updateGroupResources(group, resources);
467
398
 
468
399
  case 5:
469
- _context10.next = 7;
400
+ _context9.next = 7;
470
401
  return editDispatchers.fetchDataByConfig();
471
402
 
472
403
  case 7:
473
- _yield$editDispatcher2 = _context10.sent;
404
+ _yield$editDispatcher2 = _context9.sent;
474
405
  elements = _yield$editDispatcher2.elements;
475
406
  // 区域里的子区域及子区域的节点、新增的链路
476
407
  nodeElements = findGroupChildren(elements, group);
@@ -489,14 +420,14 @@ var useTopoEdit = function useTopoEdit(params) {
489
420
 
490
421
  case 14:
491
422
  case "end":
492
- return _context10.stop();
423
+ return _context9.stop();
493
424
  }
494
- }, _callee10);
425
+ }, _callee9);
495
426
  }));
496
427
  return _bindGroupResources.apply(this, arguments);
497
428
  }
498
429
 
499
- function addGroupResources(_x6, _x7) {
430
+ function addGroupResources(_x5, _x6) {
500
431
  return _addGroupResources.apply(this, arguments);
501
432
  }
502
433
  /**
@@ -505,10 +436,10 @@ var useTopoEdit = function useTopoEdit(params) {
505
436
 
506
437
 
507
438
  function _addGroupResources() {
508
- _addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, newResourceIds) {
439
+ _addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(group, newResourceIds) {
509
440
  var groupConfig, resources, groupData;
510
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
511
- while (1) switch (_context11.prev = _context11.next) {
441
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
442
+ while (1) switch (_context10.prev = _context10.next) {
512
443
  case 0:
513
444
  groupConfig = resourceConfig.getGroupConfigByElement(group);
514
445
  resources = {
@@ -518,19 +449,19 @@ var useTopoEdit = function useTopoEdit(params) {
518
449
  id: group.getTag(),
519
450
  tag: group.a("tag")
520
451
  };
521
- _context11.next = 5;
452
+ _context10.next = 5;
522
453
  return bindGroupResources(groupData, resources);
523
454
 
524
455
  case 5:
525
456
  case "end":
526
- return _context11.stop();
457
+ return _context10.stop();
527
458
  }
528
- }, _callee11);
459
+ }, _callee10);
529
460
  }));
530
461
  return _addGroupResources.apply(this, arguments);
531
462
  }
532
463
 
533
- function bindViewResources(_x8) {
464
+ function bindViewResources(_x7) {
534
465
  return _bindViewResources.apply(this, arguments);
535
466
  }
536
467
  /**
@@ -542,24 +473,24 @@ var useTopoEdit = function useTopoEdit(params) {
542
473
 
543
474
 
544
475
  function _bindViewResources() {
545
- _bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
476
+ _bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(data) {
546
477
  var config, result, _elements;
547
478
 
548
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
549
- while (1) switch (_context12.prev = _context12.next) {
479
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
480
+ while (1) switch (_context11.prev = _context11.next) {
550
481
  case 0:
551
482
  // console.log("关联视图的资源", data);
552
483
  config = resourceConfig.getConfig();
553
484
  config.resources = data;
554
- _context12.next = 4;
485
+ _context11.next = 4;
555
486
  return resourceConfig.updateConfig(config);
556
487
 
557
488
  case 4:
558
- _context12.next = 6;
489
+ _context11.next = 6;
559
490
  return editDispatchers.fetchDataByConfig();
560
491
 
561
492
  case 6:
562
- result = _context12.sent;
493
+ result = _context11.sent;
563
494
  console.log("fetchDataByConfig", result);
564
495
 
565
496
  if (result) {
@@ -573,35 +504,35 @@ var useTopoEdit = function useTopoEdit(params) {
573
504
 
574
505
  case 9:
575
506
  case "end":
576
- return _context12.stop();
507
+ return _context11.stop();
577
508
  }
578
- }, _callee12);
509
+ }, _callee11);
579
510
  }));
580
511
  return _bindViewResources.apply(this, arguments);
581
512
  }
582
513
 
583
- function addLayerResources(_x9, _x10) {
514
+ function addLayerResources(_x8, _x9) {
584
515
  return _addLayerResources.apply(this, arguments);
585
516
  }
586
517
 
587
518
  function _addLayerResources() {
588
- _addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
519
+ _addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(group, newResourceIds) {
589
520
  var _yield$editDispatcher3, elements, newElements;
590
521
 
591
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
592
- while (1) switch (_context13.prev = _context13.next) {
522
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
523
+ while (1) switch (_context12.prev = _context12.next) {
593
524
  case 0:
594
525
  topo.historyManager.beginTransaction(); // 构造新的配置
595
526
 
596
- _context13.next = 3;
527
+ _context12.next = 3;
597
528
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
598
529
 
599
530
  case 3:
600
- _context13.next = 5;
531
+ _context12.next = 5;
601
532
  return editDispatchers.fetchDataByConfig();
602
533
 
603
534
  case 5:
604
- _yield$editDispatcher3 = _context13.sent;
535
+ _yield$editDispatcher3 = _context12.sent;
605
536
  elements = _yield$editDispatcher3.elements;
606
537
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
607
538
  newElements = findUNExistedElements(elements);
@@ -624,32 +555,32 @@ var useTopoEdit = function useTopoEdit(params) {
624
555
 
625
556
  case 14:
626
557
  case "end":
627
- return _context13.stop();
558
+ return _context12.stop();
628
559
  }
629
- }, _callee13);
560
+ }, _callee12);
630
561
  }));
631
562
  return _addLayerResources.apply(this, arguments);
632
563
  }
633
564
 
634
- function addResourceToFirstLayer(_x11) {
565
+ function addResourceToFirstLayer(_x10) {
635
566
  return _addResourceToFirstLayer.apply(this, arguments);
636
567
  }
637
568
 
638
569
  function _addResourceToFirstLayer() {
639
- _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
570
+ _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(data) {
640
571
  var group;
641
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
642
- while (1) switch (_context14.prev = _context14.next) {
572
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
573
+ while (1) switch (_context13.prev = _context13.next) {
643
574
  case 0:
644
575
  group = resourceConfig.getGroups()[0];
645
- _context14.next = 3;
576
+ _context13.next = 3;
646
577
  return addLayerResources(group, data);
647
578
 
648
579
  case 3:
649
580
  case "end":
650
- return _context14.stop();
581
+ return _context13.stop();
651
582
  }
652
- }, _callee14);
583
+ }, _callee13);
653
584
  }));
654
585
  return _addResourceToFirstLayer.apply(this, arguments);
655
586
  }
@@ -681,27 +612,27 @@ var useTopoEdit = function useTopoEdit(params) {
681
612
 
682
613
 
683
614
  var onSaveComboRes = /*#__PURE__*/function () {
684
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
685
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
686
- while (1) switch (_context5.prev = _context5.next) {
615
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
616
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
617
+ while (1) switch (_context4.prev = _context4.next) {
687
618
  case 0:
688
619
  rlog.debug("关联资源-----onSaveComboRes", data);
689
620
  topo.historyManager.beginTransaction();
690
621
 
691
622
  if (!(getAddResourceType() === "addToFirstLayer")) {
692
- _context5.next = 7;
623
+ _context4.next = 7;
693
624
  break;
694
625
  }
695
626
 
696
- _context5.next = 5;
627
+ _context4.next = 5;
697
628
  return addResourceToFirstLayer(data);
698
629
 
699
630
  case 5:
700
- _context5.next = 9;
631
+ _context4.next = 9;
701
632
  break;
702
633
 
703
634
  case 7:
704
- _context5.next = 9;
635
+ _context4.next = 9;
705
636
  return bindViewResources(data);
706
637
 
707
638
  case 9:
@@ -713,22 +644,22 @@ var useTopoEdit = function useTopoEdit(params) {
713
644
 
714
645
  case 12:
715
646
  case "end":
716
- return _context5.stop();
647
+ return _context4.stop();
717
648
  }
718
- }, _callee5);
649
+ }, _callee4);
719
650
  }));
720
651
 
721
- return function onSaveComboRes(_x12) {
722
- return _ref5.apply(this, arguments);
652
+ return function onSaveComboRes(_x11) {
653
+ return _ref4.apply(this, arguments);
723
654
  };
724
655
  }();
725
656
 
726
657
  var onSaveTopo = /*#__PURE__*/function () {
727
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
658
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
728
659
  var id, config, serialize, _config$layout, template, layout, saveConfig;
729
660
 
730
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
731
- while (1) switch (_context7.prev = _context7.next) {
661
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
662
+ while (1) switch (_context6.prev = _context6.next) {
732
663
  case 0:
733
664
  id = data.id, config = data.config, serialize = data.serialize;
734
665
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
@@ -736,11 +667,11 @@ var useTopoEdit = function useTopoEdit(params) {
736
667
  if (onSave) {
737
668
  // 自定义保存
738
669
  saveConfig = /*#__PURE__*/function () {
739
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
740
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
741
- while (1) switch (_context6.prev = _context6.next) {
670
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
671
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
672
+ while (1) switch (_context5.prev = _context5.next) {
742
673
  case 0:
743
- _context6.next = 2;
674
+ _context5.next = 2;
744
675
  return editDispatchers.saveTopo({
745
676
  id: id,
746
677
  layout: layout,
@@ -749,13 +680,13 @@ var useTopoEdit = function useTopoEdit(params) {
749
680
 
750
681
  case 2:
751
682
  case "end":
752
- return _context6.stop();
683
+ return _context5.stop();
753
684
  }
754
- }, _callee6);
685
+ }, _callee5);
755
686
  }));
756
687
 
757
688
  return function saveConfig() {
758
- return _ref7.apply(this, arguments);
689
+ return _ref6.apply(this, arguments);
759
690
  };
760
691
  }();
761
692
 
@@ -768,13 +699,13 @@ var useTopoEdit = function useTopoEdit(params) {
768
699
 
769
700
  case 3:
770
701
  case "end":
771
- return _context7.stop();
702
+ return _context6.stop();
772
703
  }
773
- }, _callee7);
704
+ }, _callee6);
774
705
  }));
775
706
 
776
- return function onSaveTopo(_x13) {
777
- return _ref6.apply(this, arguments);
707
+ return function onSaveTopo(_x12) {
708
+ return _ref5.apply(this, arguments);
778
709
  };
779
710
  }();
780
711
 
@@ -800,11 +731,11 @@ var useTopoEdit = function useTopoEdit(params) {
800
731
 
801
732
 
802
733
  var bindNodeResource = /*#__PURE__*/function () {
803
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(params) {
734
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params) {
804
735
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
805
736
 
806
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
807
- while (1) switch (_context9.prev = _context9.next) {
737
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
738
+ while (1) switch (_context8.prev = _context8.next) {
808
739
  case 0:
809
740
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
810
741
  return _extends({}, resources, {
@@ -815,10 +746,10 @@ var useTopoEdit = function useTopoEdit(params) {
815
746
  };
816
747
 
817
748
  _doBind = function _doBind3() {
818
- _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
749
+ _doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
819
750
  var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
820
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
821
- while (1) switch (_context8.prev = _context8.next) {
751
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
752
+ while (1) switch (_context7.prev = _context7.next) {
822
753
  case 0:
823
754
  dm = htTopo.getGraphView().dm(); // 移除旧节点。先删除后创建,解决ip节点替换ping资源后链路丢失问题
824
755
 
@@ -871,7 +802,7 @@ var useTopoEdit = function useTopoEdit(params) {
871
802
  htTopo.createElements(createElementsData);
872
803
  }
873
804
 
874
- rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
805
+ rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置、父区域
875
806
 
876
807
  newElement = dm.getDataByTag(newData.id);
877
808
 
@@ -879,21 +810,18 @@ var useTopoEdit = function useTopoEdit(params) {
879
810
  newElement.setSize(node.getSize());
880
811
  newElement.setPosition(node.getPosition());
881
812
  newElement.setImage(node.getImage());
813
+ newElement.setParent(parentGroupElement);
882
814
  } // 选中
883
815
 
884
816
 
885
817
  sm = htTopo.getGraphView().sm();
886
- sm.setSelection([newElement]); // 临时放这里,仅拓扑中心有
818
+ sm.setSelection([newElement]);
887
819
 
888
- if (topo.linkDynamicStyleExecutor) {
889
- topo.linkDynamicStyleExecutor.execute();
890
- }
891
-
892
- case 11:
820
+ case 10:
893
821
  case "end":
894
- return _context8.stop();
822
+ return _context7.stop();
895
823
  }
896
- }, _callee8);
824
+ }, _callee7);
897
825
  }));
898
826
  return _doBind.apply(this, arguments);
899
827
  };
@@ -933,48 +861,55 @@ var useTopoEdit = function useTopoEdit(params) {
933
861
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
934
862
  }
935
863
 
936
- _context9.next = 13;
864
+ _context8.next = 13;
937
865
  return resourceConfig.updateConfig(config);
938
866
 
939
867
  case 13:
940
- _context9.next = 15;
868
+ _context8.next = 15;
941
869
  return editDispatchers.fetchDataByConfig();
942
870
 
943
871
  case 15:
944
- _yield$editDispatcher = _context9.sent;
872
+ _yield$editDispatcher = _context8.sent;
945
873
  elements = _yield$editDispatcher.elements;
946
874
  newData = elements.find(function (item) {
947
875
  return item.id === newResId;
948
876
  });
949
877
 
950
- if (newData) {
951
- _context9.next = 23;
878
+ if (!newData) {
879
+ _context8.next = 25;
952
880
  break;
953
881
  }
954
882
 
955
- topo.historyManager.endTransaction();
883
+ _context8.next = 21;
884
+ return doBind();
956
885
 
957
- _Message.error("关联资源失败");
886
+ case 21:
887
+ topo.historyManager.endTransaction(); // 临时放这里,仅拓扑中心有
958
888
 
959
- rlog.error("关联资源失败");
960
- return _context9.abrupt("return", false);
889
+ if (topo.linkDynamicStyleExecutor) {
890
+ topo.linkDynamicStyleExecutor.execute();
891
+ }
961
892
 
962
- case 23:
963
- _context9.next = 25;
964
- return doBind();
893
+ _context8.next = 29;
894
+ break;
965
895
 
966
896
  case 25:
967
897
  topo.historyManager.endTransaction();
968
898
 
969
- case 26:
899
+ _Message.error("关联资源失败");
900
+
901
+ rlog.error("关联资源失败");
902
+ return _context8.abrupt("return", false);
903
+
904
+ case 29:
970
905
  case "end":
971
- return _context9.stop();
906
+ return _context8.stop();
972
907
  }
973
- }, _callee9);
908
+ }, _callee8);
974
909
  }));
975
910
 
976
- return function bindNodeResource(_x14) {
977
- return _ref8.apply(this, arguments);
911
+ return function bindNodeResource(_x13) {
912
+ return _ref7.apply(this, arguments);
978
913
  };
979
914
  }();
980
915
  /**
@@ -982,93 +917,96 @@ var useTopoEdit = function useTopoEdit(params) {
982
917
  */
983
918
 
984
919
 
985
- function relateNodeIp(_x15, _x16) {
920
+ function relateNodeIp(_x14, _x15, _x16) {
986
921
  return _relateNodeIp.apply(this, arguments);
987
922
  }
988
923
 
989
924
  function _relateNodeIp() {
990
- _relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
991
- var dm, isUnique, ipNodeData, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
925
+ _relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(txtValue, nodeElement, disableHistory) {
926
+ var dm, isUnique, ipNodeData, configObj, configData, elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
992
927
 
993
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
994
- while (1) switch (_context15.prev = _context15.next) {
928
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
929
+ while (1) switch (_context14.prev = _context14.next) {
995
930
  case 0:
931
+ if (disableHistory === void 0) {
932
+ disableHistory = false;
933
+ }
934
+
996
935
  if (txtValue) {
997
- _context15.next = 2;
936
+ _context14.next = 3;
998
937
  break;
999
938
  }
1000
939
 
1001
- return _context15.abrupt("return");
940
+ return _context14.abrupt("return");
1002
941
 
1003
- case 2:
1004
- // if (txtValue === nodeElement.a('bindIp')) {
1005
- // return;
1006
- // }
942
+ case 3:
1007
943
  // 根据配置查询拓扑数据
1008
944
  dm = topo.getDataModel(); // 执行唯一性验证
1009
945
 
1010
- isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
946
+ isUnique = isUniqueIp(dm, txtValue, nodeElement);
1011
947
 
1012
- if (!isUnique) {
1013
- _context15.next = 24;
948
+ if (isUnique) {
949
+ _context14.next = 7;
1014
950
  break;
1015
951
  }
1016
952
 
1017
- ipNodeData = buildIpNode(txtValue);
1018
- _context15.next = 8;
1019
- return deleteExLink(nodeElement);
953
+ return _context14.abrupt("return");
1020
954
 
1021
- case 8:
955
+ case 7:
956
+ disableHistory && topo.historyManager.setDisabled(true, '关联IP: 删除关联出口链路、节点绑定IP'); // 删除关联出口链路
957
+
958
+ deleteExLink(nodeElement); // 节点绑定IP
959
+
960
+ ipNodeData = buildIpNode(txtValue);
1022
961
  nodeElement.a(ipNodeData);
1023
962
  nodeElement.setName(txtValue);
1024
- nodeElement.setTag("ip:" + txtValue); // 获取配置
963
+ nodeElement.setTag("ip:" + txtValue);
964
+ disableHistory && topo.historyManager.setDisabled(false, '关联IP: 删除关联出口链路、节点绑定IP'); // 获取配置
1025
965
 
1026
966
  configObj = topo.resourceConfig.getConfig();
1027
- _context15.next = 14;
967
+ _context14.next = 17;
1028
968
  return resourceConfig.updateConfig(configObj);
1029
969
 
1030
- case 14:
1031
- _context15.next = 16;
970
+ case 17:
971
+ _context14.next = 19;
1032
972
  return editDispatchers.fetchDataByConfig();
1033
973
 
1034
- case 16:
1035
- configData = _context15.sent;
1036
- // console.log("configData",configObj, configData);
1037
- _elements2 = configData.elements;
1038
- newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
1039
-
974
+ case 19:
975
+ configData = _context14.sent;
976
+ elements = configData.elements;
977
+ newLinkElements = findUNExistedLinkElements(elements);
1040
978
  newLink = newLinkElements.filter(function (item) {
1041
979
  return item.type === "link";
1042
980
  });
1043
981
  newLinkGroup = newLinkElements.filter(function (item) {
1044
982
  return item.type === "linkGroup";
1045
- }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1046
- // console.log("newData",newLinkElements, newLink);
1047
-
983
+ });
1048
984
  createElementsData = {
1049
985
  groups: [],
1050
986
  nodes: [],
1051
987
  links: newLink,
1052
988
  linkGroups: newLinkGroup
1053
989
  };
1054
- console.log("createElementsData", createElementsData);
990
+ rlog.debug("createElementsData", createElementsData);
1055
991
 
1056
992
  if ([].concat(newLink, newLinkGroup).length > 0) {
1057
993
  _htTopo = topo.getHtTopo();
994
+ disableHistory && topo.historyManager.setDisabled(true, '关联IP: 创建链路');
1058
995
 
1059
- _htTopo.createElements(createElementsData); // 临时放这里,仅拓扑中心有
996
+ _htTopo.createElements(createElementsData);
1060
997
 
998
+ disableHistory && topo.historyManager.setDisabled(false, '关联IP: 创建链路'); // 临时放这里,仅拓扑中心有
1061
999
 
1062
1000
  if (topo.linkDynamicStyleExecutor) {
1063
1001
  topo.linkDynamicStyleExecutor.execute();
1064
1002
  }
1065
1003
  }
1066
1004
 
1067
- case 24:
1005
+ case 27:
1068
1006
  case "end":
1069
- return _context15.stop();
1007
+ return _context14.stop();
1070
1008
  }
1071
- }, _callee15);
1009
+ }, _callee14);
1072
1010
  }));
1073
1011
  return _relateNodeIp.apply(this, arguments);
1074
1012
  }