@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.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 (92) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +29 -29
  4. package/es/components/ColorPanel/index.js +68 -58
  5. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
  6. package/es/core/components/TopoView/topoView.js +7 -4
  7. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
  8. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -15
  9. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -91
  10. package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +2 -27
  11. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
  12. package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -52
  13. package/es/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +120 -0
  14. package/es/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +29 -0
  15. package/es/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +29 -0
  16. package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +77 -0
  17. package/es/core/editor/components/settings/core/updateElementProperty.js +3 -2
  18. package/es/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
  19. package/es/core/editor/hooks/useKeyboardShortcut.js +4 -0
  20. package/es/core/editor/hooks/useNewElementTheme.js +20 -16
  21. package/es/core/editor/utils/edgeTypeStyleUtil.js +11 -32
  22. package/es/core/hooks/useGraphAlarmDisplay.js +4 -0
  23. package/es/core/hooks/usePolling.js +2 -1
  24. package/es/core/hooks/useResourceConfig.js +1 -2
  25. package/es/core/hooks/useTopoEdit.js +210 -248
  26. package/es/core/models/AttributeMetricDisplay.js +4 -3
  27. package/es/core/models/HistoryManager.js +11 -9
  28. package/es/core/models/TopoApp.js +39 -45
  29. package/es/core/models/topoData.js +9 -17
  30. package/es/core/models/utils/linkUtils.js +65 -52
  31. package/es/core/store/models/topoConfig.js +7 -11
  32. package/es/core/utils/edgeUtil.js +7 -10
  33. package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
  34. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +4 -2
  35. package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
  36. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
  37. package/es/networkTopo/services/topo/basic.js +27 -17
  38. package/es/networkTopo/utils/__tests__/relateTopoData.js +205 -0
  39. package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
  40. package/es/networkTopo/utils/exitLinkUtil.js +25 -13
  41. package/es/networkTopo/utils/relateTopoDataUtil.js +149 -0
  42. package/es/style.js +1 -1
  43. package/es/utils/ResourceConfigUtil.js +1 -16
  44. package/es/utils/clusterUtil.js +3 -3
  45. package/es/utils/htElementUtils.js +19 -85
  46. package/lib/components/ColorPanel/index.js +71 -59
  47. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
  48. package/lib/core/components/TopoView/topoView.js +15 -19
  49. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
  50. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -14
  51. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +11 -95
  52. package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +3 -28
  53. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
  54. package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -56
  55. package/lib/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +136 -0
  56. package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +38 -0
  57. package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +38 -0
  58. package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +89 -0
  59. package/lib/core/editor/components/settings/core/updateElementProperty.js +7 -2
  60. package/lib/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
  61. package/lib/core/editor/hooks/useKeyboardShortcut.js +4 -0
  62. package/lib/core/editor/hooks/useNewElementTheme.js +20 -16
  63. package/lib/core/editor/utils/edgeTypeStyleUtil.js +10 -33
  64. package/lib/core/hooks/useGraphAlarmDisplay.js +4 -0
  65. package/lib/core/hooks/usePolling.js +6 -5
  66. package/lib/core/hooks/useResourceConfig.js +1 -2
  67. package/lib/core/hooks/useTopoEdit.js +216 -272
  68. package/lib/core/models/AttributeMetricDisplay.js +6 -6
  69. package/lib/core/models/HistoryManager.js +13 -17
  70. package/lib/core/models/TopoApp.js +39 -43
  71. package/lib/core/models/topoData.js +9 -17
  72. package/lib/core/models/utils/linkUtils.js +65 -51
  73. package/lib/core/store/models/topoConfig.js +13 -25
  74. package/lib/core/utils/edgeUtil.js +8 -10
  75. package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
  76. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +6 -2
  77. package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
  78. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
  79. package/lib/networkTopo/services/topo/basic.js +32 -18
  80. package/lib/networkTopo/utils/__tests__/relateTopoData.js +210 -0
  81. package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
  82. package/lib/networkTopo/utils/exitLinkUtil.js +25 -13
  83. package/lib/networkTopo/utils/relateTopoDataUtil.js +164 -0
  84. package/lib/style.js +1 -1
  85. package/lib/utils/ResourceConfigUtil.js +1 -16
  86. package/lib/utils/clusterUtil.js +2 -2
  87. package/lib/utils/htElementUtils.js +22 -94
  88. package/package.json +2 -2
  89. package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
  90. package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
  91. /package/es/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
  92. /package/lib/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
@@ -1,5 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import DefaultDetailContent from "../../ResourceDetail/DefaultDetailContent";
3
+ import { isEdgeGroupAgent } from "../../../../../../utils/htElementUtils";
3
4
 
4
5
  function useElementDetailManager(props) {
5
6
  var topo = props.topo,
@@ -62,9 +63,8 @@ function useElementDetailManager(props) {
62
63
  }
63
64
 
64
65
  function openByHtElement(htElement) {
65
- var isEdgeGroupAgent = htElement instanceof ht.Edge && htElement.isEdgeGroupAgent() && !htElement.s('edge.expanded');
66
66
  open({
67
- id: isEdgeGroupAgent || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
67
+ id: isEdgeGroupAgent(htElement) || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
68
68
  htElement: htElement
69
69
  });
70
70
  }
@@ -10,11 +10,11 @@ import Link from "../../../../../../../components/Link";
10
10
  import service from "../../../../../../services/overview";
11
11
  import styles from "./index.module.scss";
12
12
  import { getHistory } from '@riil-frontend/component-topology-utils';
13
+ import loglevel from 'loglevel';
13
14
 
14
15
  function formatUrl(url) {
15
16
  var _window, _window$location;
16
17
 
17
- console.log(url);
18
18
  var prefix = '/default/pagecenter';
19
19
 
20
20
  if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) === 0 && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) === 0) {
@@ -28,12 +28,14 @@ function EventsCard(props) {
28
28
  var alarmRiskList = props.alarmRiskList,
29
29
  closeDetailDrawer = props.closeDetailDrawer,
30
30
  onHandleAlarm = props.onHandleAlarm;
31
+ var log = loglevel.getLogger('topo');
31
32
 
32
33
  var jumpTo = function jumpTo(url) {
33
34
  closeDetailDrawer();
34
35
 
35
36
  if (topo.viewProps.jumpto) {
36
- topo.viewProps.jumpto(formatUrl(url));
37
+ log.debug('formatUrl(url)', url);
38
+ topo.viewProps.jumpto(url);
37
39
  } else {
38
40
  getHistory().push(formatUrl(url));
39
41
  }
@@ -1,4 +1,4 @@
1
- import { getEdgeGroups } from "../../utils/htElementUtils";
1
+ import { getEdgeGroupAgents, getEdgeGroups } from "../../utils/htElementUtils";
2
2
  import { getEdgeGroupLinkIdConfig } from "../utils/edgeGroupTagUtil";
3
3
 
4
4
  var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
@@ -16,11 +16,11 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
16
16
 
17
17
  var topo = this.topo;
18
18
  var dm = this.topo.getDataModel();
19
- var edgeGroupsTagsTips = getEdgeGroups(dm).map(function (edgeGroup) {
20
- var edge = edgeGroup.getEdges().getArray()[0]; // 获取配置的链路
21
-
22
- var linkId = getEdgeGroupLinkIdConfig(edge, topo);
23
- var edgeGroupId = [edge.getSourceAgent().getId(), edge.getTargetAgent().getId()];
19
+ var edgeGroupAgents = getEdgeGroupAgents(dm);
20
+ var edgeGroupsTagsTips = edgeGroupAgents.map(function (edgeGroupAgent) {
21
+ // 获取配置的链路
22
+ var linkId = getEdgeGroupLinkIdConfig(edgeGroupAgent, topo);
23
+ var edgeGroupId = [edgeGroupAgent.getSource().getId(), edgeGroupAgent.getTarget().getId()];
24
24
  var data = {
25
25
  tags: [],
26
26
  tips: []
@@ -31,7 +31,7 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
31
31
  }
32
32
 
33
33
  return {
34
- htId: edge.getId(),
34
+ htId: edgeGroupAgent.getId(),
35
35
  edgeGroupId: edgeGroupId,
36
36
  tags: data.tags,
37
37
  tips: data.tips,
@@ -1,7 +1,5 @@
1
- import { rlog } from '@riil-frontend/component-topology-utils';
2
1
  import { isClusterHtElement } from "../../utils/clusterUtil";
3
- import { getEdgeGroupByNodeTags, getEdges, isNode } from "../../utils/htElementUtils";
4
- import { getLinksBetweenNodes } from "../utils/linkUtil"; // network_link.actual_bandwidth
2
+ import { isNode } from "../../utils/htElementUtils"; // network_link.actual_bandwidth
5
3
 
6
4
  function calcEdgeWidth(actualBandwidth) {
7
5
  if (!actualBandwidth) {
@@ -52,16 +50,17 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
52
50
  var _proto = LinkDynamicStyleExecutor.prototype;
53
51
 
54
52
  _proto.execute = function execute() {
55
- var _this = this;
53
+ var _topo$historyManager,
54
+ _this = this,
55
+ _topo$historyManager2;
56
56
 
57
57
  var topo = this.topo;
58
58
 
59
59
  var _topo$dataModel$getDa = topo.dataModel.getData(),
60
- links = _topo$dataModel$getDa.links,
61
- linkGroups = _topo$dataModel$getDa.linkGroups;
60
+ links = _topo$dataModel$getDa.links;
62
61
 
63
62
  var dataModel = this.topo.getDataModel();
64
- topo.historyManager && topo.historyManager.setDisabled(true, '链路动态样式'); // 1、如果连线可见,设置线宽
63
+ (_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '链路动态粗细'); // 1、如果连线可见,设置线宽
65
64
 
66
65
  links.forEach(function (link) {
67
66
  var edge = dataModel.getDataByTag(link.id);
@@ -69,63 +68,8 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
69
68
  if (edge) {
70
69
  edge.s('edge.width', _this.calcLinkEdgeWidth(link));
71
70
  }
72
- }); // 2、如果连线组关联链路并可见,设置线宽
73
-
74
- linkGroups.forEach(function (link) {
75
- // 聚合链路是连线/连线组,并可以查询到
76
- var edge = topo.getDataModel().getDataByTag(link.id);
77
-
78
- if (edge) {
79
- edge.s('edge.width', _this.calcLinkEdgeWidth(link));
80
- return;
81
- } // 聚合链路是连线组(编辑模式还未关联业务信息)
82
-
83
-
84
- var edgeGroup = getEdgeGroupByNodeTags(dataModel, link.source, link.target);
85
-
86
- if (edgeGroup) {
87
- var edgeGroupAgent = edgeGroup.getEdgeGroupAgent(); // 判断是显示的连线组元素
88
-
89
- if (edgeGroupAgent) {
90
- edgeGroup.getEdgeGroupAgent().s('edge.width', _this.calcLinkEdgeWidth(link));
91
- }
92
- } else {
93
- rlog.warn('动态链路样式执行:未找到聚合链路的ht元素', link);
94
- }
95
- }); // 3、如果连线组未关联链路并可见,设置线宽。
96
-
97
- var edges = getEdges(dataModel);
98
- edges.forEach(function (edge) {
99
- try {
100
- // 获取两端代理节点
101
- var sourceAgent = edge.getSourceAgent();
102
- var targetAgent = edge.getTargetAgent();
103
- var sourceId = sourceAgent.getTag();
104
- var targetId = targetAgent.getTag(); // 查询是否有聚合链路
105
-
106
- var aggLink = linkGroups.find(function (link) {
107
- return link.source === sourceId && link.target === targetId || link.target === sourceId && link.source === targetId;
108
- }); // 如果连线组未关联链路并可见
109
-
110
- if (!aggLink && edge.isEdgeGroupAgent()) {
111
- // 查询两端代理节点(包含子节点)间的子链路列表
112
- var sourceCiIds = getChildrenNodeCiIds([sourceAgent]);
113
- var targetCiIds = getChildrenNodeCiIds([targetAgent]);
114
- var aggLinks = getLinksBetweenNodes(linkGroups, sourceCiIds, targetCiIds);
115
- var phyLinks = getLinksBetweenNodes(links, sourceCiIds, targetCiIds);
116
- var linkBetweenNodes = aggLinks.length ? aggLinks : phyLinks; // 如果有子链路,计算线宽并设置
117
-
118
- if (linkBetweenNodes.length) {
119
- var edgeWidth = _this.calcEdgeGroupEdgeWidth(linkBetweenNodes);
120
-
121
- edge.s('edge.width', edgeWidth);
122
- }
123
- }
124
- } catch (error) {
125
- rlog.error('连线组未关联链路并可见,设置线宽:异常', edge, error);
126
- }
127
71
  });
128
- topo.historyManager && topo.historyManager.setDisabled(false, '链路动态样式');
72
+ (_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '链路动态粗细');
129
73
  }
130
74
  /**
131
75
  * 处理单个连线组切换。有链路时设置
@@ -1,7 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _extends from "@babel/runtime/helpers/extends";
4
- var _excluded = ["groups", "resources"];
5
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
4
  import { request } from '@riil-frontend/component-topology-utils';
7
5
  import { rlog } from '@riil-frontend/component-topology-utils';
@@ -9,6 +7,7 @@ import blackList from "./blacklist";
9
7
  import { TOPO_API_ROOT } from "./constants";
10
8
  import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
11
9
  import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
10
+ import * as relateTopoDataUtil from "../../utils/relateTopoDataUtil";
12
11
  var API_ROOT = TOPO_API_ROOT;
13
12
  /**
14
13
  * 拓扑图(看做一个容器)的“父容器”ID
@@ -49,7 +48,7 @@ function prepareResourceParams(conditions, query) {
49
48
  return {
50
49
  dynamicCondition: dynamicCondition,
51
50
  fixedConditionIdList: (staticRes || []).filter(function (ciId) {
52
- return !ciId.startsWith('ip:');
51
+ return !ciId.includes(':');
53
52
  }),
54
53
  linkIps: (staticRes || []).filter(function (ciId) {
55
54
  return ciId.startsWith('ip:');
@@ -98,7 +97,8 @@ function prepareGroupParams(modifiedGroups) {
98
97
  };
99
98
  }).filter(Boolean);
100
99
  return {
101
- groups: groups
100
+ groups: groups,
101
+ relateTopoIdList: relateTopoDataUtil.getRelateTopoIdListFromConfig(modifiedGroups)
102
102
  };
103
103
  }
104
104
 
@@ -389,16 +389,20 @@ export default _extends({
389
389
 
390
390
  case 2:
391
391
  result = _context12.sent;
392
- return _context12.abrupt("return", processExitLink(_extends({}, result, {
392
+ result = _extends({}, result, {
393
393
  nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
394
394
  links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
395
395
  return _extends({}, item, {
396
396
  ciType: 'network_link'
397
397
  });
398
- })
399
- })));
398
+ }),
399
+ serialize: result.serialize ? JSON.parse(result.serialize) : undefined
400
+ });
401
+ result = relateTopoDataUtil.processBothTopoData(result);
402
+ result = processExitLink(result);
403
+ return _context12.abrupt("return", result);
400
404
 
401
- case 4:
405
+ case 7:
402
406
  case "end":
403
407
  return _context12.stop();
404
408
  }
@@ -417,7 +421,7 @@ export default _extends({
417
421
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
418
422
  var _result$nodes2, _result$links2;
419
423
 
420
- var data, obj, result;
424
+ var data, params, result;
421
425
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
422
426
  while (1) switch (_context13.prev = _context13.next) {
423
427
  case 0:
@@ -431,22 +435,28 @@ export default _extends({
431
435
  });
432
436
  }
433
437
 
434
- obj = prepareGroupParams(data);
438
+ params = prepareGroupParams(data);
435
439
  _context13.next = 5;
436
- return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj));
440
+ return request.post(API_ROOT + "/structure/byCondition/" + id, params);
437
441
 
438
442
  case 5:
439
443
  result = _context13.sent;
440
- return _context13.abrupt("return", processByConditionResult(_extends({}, result, {
444
+ result = _extends({}, result, {
441
445
  nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
442
446
  links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
443
447
  return _extends({}, item, {
444
448
  ciType: 'network_link'
445
449
  });
446
450
  })
447
- }), obj.groups));
451
+ });
452
+ result = relateTopoDataUtil.processByConditionTopoData({
453
+ data: result,
454
+ config: data
455
+ });
456
+ result = processByConditionResult(result, params.groups);
457
+ return _context13.abrupt("return", result);
448
458
 
449
- case 7:
459
+ case 10:
450
460
  case "end":
451
461
  return _context13.stop();
452
462
  }
@@ -463,11 +473,11 @@ export default _extends({
463
473
  */
464
474
  bindResourceToTopo: function bindResourceToTopo(id, config) {
465
475
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
466
- var groups, resources, otherConfig, newGroups, obj;
476
+ var groups, resources, newGroups, obj;
467
477
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
468
478
  while (1) switch (_context14.prev = _context14.next) {
469
479
  case 0:
470
- groups = config.groups, resources = config.resources, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
480
+ groups = config.groups, resources = config.resources;
471
481
  newGroups = Array.isArray(groups) ? groups : [];
472
482
 
473
483
  if (resources) {
@@ -481,7 +491,7 @@ export default _extends({
481
491
 
482
492
  obj = prepareGroupParams(newGroups);
483
493
  _context14.next = 6;
484
- return request.post(API_ROOT + "/resource/" + id, _extends({}, otherConfig, obj));
494
+ return request.post(API_ROOT + "/resource/" + id, obj);
485
495
 
486
496
  case 6:
487
497
  return _context14.abrupt("return", _context14.sent);
@@ -0,0 +1,205 @@
1
+ // 二、子拓扑链路
2
+ // - 资源-子拓扑资源
3
+ // - 资源-子拓扑IP、Ping资源
4
+ // - 子拓扑资源-IP、Ping资源
5
+ // - 子拓扑资源-子拓扑资源
6
+ // - 子拓扑资源-子拓扑IP、Ping资源
7
+ export var topoLinks = [// 资源-子拓扑资源
8
+ {
9
+ ciType: 'network_link',
10
+ "id": "00000000010decab",
11
+ "name": '资源、Ping资源-子拓扑资源',
12
+ "source": "00000000010de861",
13
+ 'targetType': 'topo',
14
+ "target": "6",
15
+ "operation": "delete",
16
+ "interfaceSource": "00000000010de8da",
17
+ "interfaceTarget": "00000000010de973",
18
+ "attributes": {
19
+ "network_link.to_if_connect": "r926054146526674944",
20
+ "network_link.source_device_ipv4": "172.17.166.18",
21
+ "network_link.destination_ipv4": "172.17.166.20",
22
+ "network_link.work_mode": "single",
23
+ "support_templates": "m.ethernet_link",
24
+ "destination_id": "00000000010de973",
25
+ "rated_bandwidth": 1000,
26
+ "network_link.actual_bandwidth": 1000,
27
+ "source_type": "network.interface",
28
+ "network_link.connect_type": "phy",
29
+ "display_name": "资源-子拓扑资源",
30
+ "asset_status": "2",
31
+ "destination_type": "network.interface",
32
+ "network_link.network_category": "CAN",
33
+ "network_link.source_ipv4": "172.17.166.18",
34
+ "name": "资源-子拓扑资源",
35
+ "distance_outlet": 2147483647,
36
+ "network_link.is_crucial": false,
37
+ "source_id": "00000000010de8da",
38
+ "network_link.source_device_id": "00000000010de861",
39
+ "network_link.destination_device_id": "00000000010de864",
40
+ "network_link.destination_device_ipv4": "172.17.166.20"
41
+ },
42
+ "sourceCode": null,
43
+ "level": null,
44
+ "customType": null,
45
+ "manageStatus": 3
46
+ }, // 资源-子拓扑IP、Ping资源
47
+ {
48
+ ciType: 'network_link',
49
+ "id": "00000000019990f1",
50
+ "name": "资源-子拓扑IP",
51
+ "source": "00000000010de861",
52
+ 'targetType': 'topo',
53
+ "target": "6",
54
+ "operation": "delete",
55
+ "interfaceSource": "00000000010de8b3",
56
+ "interfaceTarget": "",
57
+ "attributes": {
58
+ "network_link.source_device_ipv4": "172.17.166.18",
59
+ "network_link.destination_ipv4": "1.1.1.1",
60
+ "network_link.work_mode": "AandS",
61
+ "support_templates": "m.ethernet_link",
62
+ "rated_bandwidth": 100,
63
+ "network_link.actual_bandwidth": 100,
64
+ "source_type": "network.interface",
65
+ "network_link.connect_type": "phy",
66
+ "display_name": "资源-子拓扑IP",
67
+ "asset_status": "2",
68
+ "network_link_type": "2",
69
+ "destination_type": "ip",
70
+ "network_link.role": "master",
71
+ "network_link.network_category": "CAN",
72
+ "dcs": "331268969",
73
+ "network_link.source_ipv4": "172.17.166.18",
74
+ "name": "资源-子拓扑IP",
75
+ "distance_outlet": 2147483647,
76
+ "network_link.is_crucial": false,
77
+ "source_id": "00000000010de8b3",
78
+ "network_link.source_device_id": "00000000010de861",
79
+ "network_link.destination_device_ipv4": "1.1.1.1"
80
+ },
81
+ "sourceCode": null,
82
+ "level": null,
83
+ "customType": null,
84
+ "manageStatus": 3
85
+ }, // 子拓扑资源-IP、Ping资源
86
+ {
87
+ ciType: 'network_link',
88
+ "id": "0000000001999538",
89
+ "name": "IP-子拓扑资源",
90
+ 'sourceType': 'topo',
91
+ "source": "6",
92
+ "target": "",
93
+ "operation": "delete",
94
+ "interfaceSource": "00000000010de95e",
95
+ "interfaceTarget": "",
96
+ "attributes": {
97
+ "network_link.source_device_ipv4": "172.17.166.20",
98
+ "network_link.destination_ipv4": "1.5.5.5",
99
+ "network_link.work_mode": "AandS",
100
+ "support_templates": "m.ethernet_link",
101
+ "rated_bandwidth": 1000,
102
+ "network_link.actual_bandwidth": 1000,
103
+ "source_type": "network.interface",
104
+ "network_link.connect_type": "phy",
105
+ "display_name": "IP-子拓扑资源",
106
+ "asset_status": "2",
107
+ "network_link_type": "2",
108
+ "destination_type": "ip",
109
+ "network_link.role": "master",
110
+ "network_link.network_category": "CAN",
111
+ "dcs": "331268969",
112
+ "network_link.source_ipv4": "172.17.166.20",
113
+ "name": "172.17.166.20(Gi 0/1) - 1.5.5.5",
114
+ "distance_outlet": 2147483647,
115
+ "network_link.is_crucial": false,
116
+ "source_id": "00000000010de95e",
117
+ "network_link.source_device_id": "00000000010de864",
118
+ "network_link.destination_device_ipv4": "1.5.5.5"
119
+ },
120
+ "sourceCode": null,
121
+ "level": null,
122
+ "customType": null,
123
+ "manageStatus": 3
124
+ }, // 子拓扑资源-子拓扑资源
125
+ {
126
+ ciType: 'network_link',
127
+ "id": "0000000001899476",
128
+ "name": '子拓扑资源-子拓扑资源',
129
+ 'sourceType': 'topo',
130
+ "source": "3",
131
+ 'targetType': 'topo',
132
+ "target": "6",
133
+ "operation": "delete",
134
+ "interfaceSource": "00000000010de90e",
135
+ "interfaceTarget": "00000000010de973",
136
+ "attributes": {
137
+ "network_link.to_if_connect": "r933757920628178944",
138
+ "network_link.source_device_ipv4": "172.17.166.19",
139
+ "network_link.destination_ipv4": "172.17.166.20",
140
+ "network_link.work_mode": "single",
141
+ "support_templates": "m.ethernet_link",
142
+ "destination_id": "00000000010de973",
143
+ "rated_bandwidth": 1000,
144
+ "network_link.actual_bandwidth": 1000,
145
+ "source_type": "network.interface",
146
+ "network_link.connect_type": "phy",
147
+ "display_name": "子拓扑资源-子拓扑资源",
148
+ "asset_status": "2",
149
+ "network_link_type": "2",
150
+ "destination_type": "network.interface",
151
+ "network_link.network_category": "CAN",
152
+ "network_link.source_ipv4": "172.17.166.19",
153
+ "name": "172.17.166.19(Gi 0/50) - 172.17.166.20(Gi 0/22)",
154
+ "distance_outlet": 2147483647,
155
+ "network_link.is_crucial": false,
156
+ "source_id": "00000000010de90e",
157
+ "network_link.source_device_id": "00000000010de862",
158
+ "network_link.destination_device_id": "00000000010de864",
159
+ "network_link.destination_device_ipv4": "172.17.166.20"
160
+ },
161
+ "sourceCode": null,
162
+ "level": null,
163
+ "customType": null,
164
+ "manageStatus": 3
165
+ }, // 子拓扑资源-子拓扑IP、Ping资源
166
+ {
167
+ ciType: 'network_link',
168
+ "id": "0000000001999c86",
169
+ "name": "子拓扑资源-子拓扑IP",
170
+ 'sourceType': 'topo',
171
+ "source": "3",
172
+ 'targetType': 'topo',
173
+ "target": "6",
174
+ "operation": "delete",
175
+ "interfaceSource": "00000000010de95e",
176
+ "interfaceTarget": "",
177
+ "attributes": {
178
+ "network_link.source_device_ipv4": "172.17.166.20",
179
+ "network_link.destination_ipv4": "2.2.2.2",
180
+ "network_link.work_mode": "AandS",
181
+ "support_templates": "m.ethernet_link",
182
+ "rated_bandwidth": 1000,
183
+ "network_link.actual_bandwidth": 1000,
184
+ "source_type": "network.interface",
185
+ "network_link.connect_type": "phy",
186
+ "display_name": "子拓扑资源-子拓扑IP",
187
+ "asset_status": "2",
188
+ "network_link_type": "2",
189
+ "destination_type": "ip",
190
+ "network_link.role": "master",
191
+ "network_link.network_category": "CAN",
192
+ "dcs": "331268969",
193
+ "network_link.source_ipv4": "172.17.166.20",
194
+ "name": "172.17.166.20(Gi 0/1) - 2.2.2.2",
195
+ "distance_outlet": 2147483647,
196
+ "network_link.is_crucial": false,
197
+ "source_id": "00000000010de95e",
198
+ "network_link.source_device_id": "00000000010de864",
199
+ "network_link.destination_device_ipv4": "2.2.2.2"
200
+ },
201
+ "sourceCode": null,
202
+ "level": null,
203
+ "customType": null,
204
+ "manageStatus": 3
205
+ }];
@@ -55,8 +55,8 @@ export function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
55
55
  });
56
56
  }
57
57
  export function getEdgeGroupConfigId(edgeGroup) {
58
- var sourceNode = edgeGroup.getSourceAgent();
59
- var targetNode = edgeGroup.getTargetAgent();
58
+ var sourceNode = edgeGroup.getSource();
59
+ var targetNode = edgeGroup.getTarget();
60
60
  var sourceId = sourceNode.a('uuid');
61
61
  var targetId = targetNode.a('uuid');
62
62
  return [sourceId, targetId].sort().join(',');
@@ -36,11 +36,11 @@ export function buildIpNode(ip) {
36
36
  }
37
37
 
38
38
  function getHtSerialize(serialize) {
39
- if (serialize) {
39
+ if (serialize && typeof serialize === 'string') {
40
40
  return JSON.parse(serialize);
41
41
  }
42
42
 
43
- return null;
43
+ return serialize;
44
44
  }
45
45
 
46
46
  function isExitLink(link) {
@@ -239,9 +239,10 @@ function updateLinkTarget(links, nodes) {
239
239
 
240
240
 
241
241
  export function processByConditionResult(topoData, groupConfigs) {
242
- var nodes = topoData.nodes,
242
+ var groups = topoData.groups,
243
+ nodes = topoData.nodes,
243
244
  links = topoData.links;
244
- var ipNodes = getIpNodes(groupConfigs, nodes); // 出口链路目的端设置为IP节点或者ping资源节点id
245
+ var ipNodes = getIpNodes(groupConfigs, topoData); // 出口链路目的端设置为IP节点或者ping资源节点id
245
246
 
246
247
  var newLinks = updateLinkTarget(links, nodes);
247
248
  return _extends({}, topoData, {
@@ -249,15 +250,26 @@ export function processByConditionResult(topoData, groupConfigs) {
249
250
  links: newLinks
250
251
  });
251
252
 
252
- function getIpNodes(groupConfigs, nodes) {
253
- var ips = groupConfigs.map(function (g) {
254
- return g.condition.linkIps;
255
- }).reduce(function (result, groupIps) {
256
- return [].concat(result, groupIps);
257
- }, []) // 过滤ping资源对应的ip节点
258
- .filter(function (ip) {
259
- return !findPingNode(nodes, ip);
253
+ function getIpNodes(groupConfigs, _ref) {
254
+ var groups = _ref.groups,
255
+ nodes = _ref.nodes;
256
+ var ipNodes = [];
257
+ groupConfigs.forEach(function (g) {
258
+ g.condition.linkIps // 过滤ping资源对应的ip节点
259
+ .filter(function (ip) {
260
+ return !findPingNode(nodes, ip);
261
+ }).map(function (ip) {
262
+ var topoGroup = g.topoGroup;
263
+ var group = groups.find(function (item) {
264
+ return item.id === topoGroup.id || item.tag === topoGroup.tag;
265
+ });
266
+ ipNodes.push(_extends({}, buildIpNode(ip), {
267
+ // 解决区域里有ip添加资源ip消失的问题
268
+ 'groupId': group === null || group === void 0 ? void 0 : group.id,
269
+ 'groupTag': group === null || group === void 0 ? void 0 : group.tag
270
+ }));
271
+ });
260
272
  });
261
- return ips.map(buildIpNode);
273
+ return ipNodes;
262
274
  }
263
275
  }