@riil-frontend/component-topology 9.0.0-a.8 → 9.0.1

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 (115) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +15 -15
  4. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  5. package/es/core/components/TopoView/GraphViewPanel.js +17 -4
  6. package/es/core/components/TopoView/TopoView.module.scss +17 -3
  7. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  8. package/es/core/editor/components/EditorPlugin.js +4 -1
  9. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  10. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  11. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  12. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  13. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  14. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  15. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +20 -5
  16. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  17. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  18. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  19. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  20. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  21. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  22. package/es/core/editor/components/settings/core/getPropertyViewType.js +3 -0
  23. package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
  24. package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
  25. package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -2
  26. package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
  27. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
  28. package/es/core/editor/config/themes.js +53 -2
  29. package/es/core/editor/utils/edgeTypeStyleUtil.js +38 -0
  30. package/es/core/hooks/useCanvasTheme.js +12 -4
  31. package/es/core/hooks/useResourceConfig.js +2 -1
  32. package/es/core/hooks/useTopoEdit.js +120 -19
  33. package/es/core/hooks/useTopoFullscreen.js +32 -0
  34. package/es/core/models/AttributeMetricDisplay.js +89 -74
  35. package/es/core/models/TopoApp.js +1 -1
  36. package/es/core/models/attributeFormatter/index.js +16 -16
  37. package/es/core/models/topoData.js +16 -9
  38. package/es/core/models/utils/linkUtils.js +52 -27
  39. package/es/core/store/models/topoConfig.js +51 -20
  40. package/es/core/test/Test.js +52 -0
  41. package/es/core/utils/graphLinkUtil.js +11 -6
  42. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +16 -2
  43. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +8 -78
  44. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  45. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -37
  46. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
  47. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
  48. package/es/networkTopo/getTopoData.js +2 -1
  49. package/es/networkTopo/models/IpNodeTagsTipsBuilder.js +113 -0
  50. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
  51. package/es/networkTopo/models/TopoCenter.js +4 -3
  52. package/es/networkTopo/services/link.js +1 -1
  53. package/es/networkTopo/services/topo/basic.js +27 -26
  54. package/es/networkTopo/services/topo/networkLink.js +45 -3
  55. package/es/networkTopo/utils/exitLinkUtil.js +257 -0
  56. package/es/style.js +1 -0
  57. package/es/utils/ResourceConfigUtil.js +5 -4
  58. package/es/utils/htElementDataUtil.js +1 -7
  59. package/es/utils/htElementUtils.js +21 -21
  60. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  61. package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
  62. package/lib/core/components/TopoView/TopoView.module.scss +17 -3
  63. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  64. package/lib/core/editor/components/EditorPlugin.js +7 -1
  65. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  66. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  67. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  68. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  69. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  70. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  71. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +19 -3
  72. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  73. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  74. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  75. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  76. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  77. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  78. package/lib/core/editor/components/settings/core/getPropertyViewType.js +3 -0
  79. package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
  80. package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
  81. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -1
  82. package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
  83. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
  84. package/lib/core/editor/config/themes.js +53 -2
  85. package/lib/core/editor/utils/edgeTypeStyleUtil.js +39 -0
  86. package/lib/core/hooks/useCanvasTheme.js +12 -4
  87. package/lib/core/hooks/useResourceConfig.js +2 -1
  88. package/lib/core/hooks/useTopoEdit.js +121 -18
  89. package/lib/core/hooks/useTopoFullscreen.js +42 -0
  90. package/lib/core/models/AttributeMetricDisplay.js +85 -74
  91. package/lib/core/models/TopoApp.js +1 -1
  92. package/lib/core/models/attributeFormatter/index.js +14 -14
  93. package/lib/core/models/topoData.js +16 -9
  94. package/lib/core/models/utils/linkUtils.js +53 -26
  95. package/lib/core/store/models/topoConfig.js +56 -19
  96. package/lib/core/test/Test.js +52 -0
  97. package/lib/core/utils/graphLinkUtil.js +10 -5
  98. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +15 -1
  99. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +7 -78
  100. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  101. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -36
  102. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
  103. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
  104. package/lib/networkTopo/getTopoData.js +2 -1
  105. package/lib/networkTopo/models/IpNodeTagsTipsBuilder.js +123 -0
  106. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
  107. package/lib/networkTopo/models/TopoCenter.js +4 -3
  108. package/lib/networkTopo/services/topo/basic.js +28 -28
  109. package/lib/networkTopo/services/topo/networkLink.js +45 -3
  110. package/lib/networkTopo/utils/exitLinkUtil.js +269 -0
  111. package/lib/style.js +1 -0
  112. package/lib/utils/ResourceConfigUtil.js +4 -4
  113. package/lib/utils/htElementDataUtil.js +0 -10
  114. package/lib/utils/htElementUtils.js +21 -21
  115. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { useRequest } from 'ahooks';
4
- import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics, queryLastestValue } from "../services";
4
+ import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics, queryRetansRatioNetDelayRatio } from "../services";
5
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog'; // 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
6
6
 
7
7
  export default function useMetricPolling(_ref) {
@@ -9,10 +9,10 @@ export default function useMetricPolling(_ref) {
9
9
  linkMetricCodes = _ref.linkMetricCodes;
10
10
  var linkId = linkCi.id;
11
11
  var arr = ['netDelayRatio', 'retansRatio'];
12
- var oldCodes = [];
13
- var newCodes = [];
12
+ var codes = [];
13
+ var retansRatioNetDelayRatioCodes = [];
14
14
  linkMetricCodes.map(function (item) {
15
- arr.indexOf(item) > -1 ? newCodes.push(item) : oldCodes.push(item);
15
+ arr.indexOf(item) > -1 ? retansRatioNetDelayRatioCodes.push(item) : codes.push(item);
16
16
  });
17
17
 
18
18
  var _useState = useState({
@@ -26,35 +26,15 @@ export default function useMetricPolling(_ref) {
26
26
  data = _useState[0],
27
27
  setData = _useState[1];
28
28
 
29
- var queryLastestValues = useRequest(queryLastestValue, {
29
+ var queryLastestValues = useRequest(queryRetansRatioNetDelayRatio, {
30
30
  pollingInterval: 1000 * 15,
31
31
  pollingWhenHidden: false,
32
32
  debounceInterval: 200,
33
33
  manual: true,
34
34
  onSuccess: function onSuccess(result) {
35
- var datas = {
36
- linkOther: []
37
- };
38
-
39
- if (newCodes.includes('netDelayRatio')) {
40
- datas.linkOther.push({
41
- 'code': 'netDelayRatio',
42
- 'name': '下行RTT时延',
43
- 'ts': result.time,
44
- 'value': result.upNetDelayRatio + ' ms' + '|' + result.downNetDelayRatio + ' ms'
45
- });
46
- }
47
-
48
- if (newCodes.includes('retansRatio')) {
49
- datas.linkOther.push({
50
- 'code': 'retansRatio',
51
- 'name': '重传率',
52
- 'ts': result.time,
53
- 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
54
- });
55
- }
56
-
57
- setData(_extends({}, data, datas));
35
+ setData(_extends({}, data, {
36
+ linkOther: result
37
+ }));
58
38
  }
59
39
  }); // 轮询hooks
60
40
 
@@ -78,26 +58,36 @@ export default function useMetricPolling(_ref) {
78
58
  rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
79
59
  }
80
60
  });
81
- var linkMetricCodesStr = oldCodes.map(function (item) {
61
+ var linkMetricCodesStr = codes.map(function (item) {
82
62
  return item;
83
63
  }).sort().join(',');
84
64
  useEffect(function () {
85
65
  if (linkId) {
86
66
  rlog.info('链路拓扑指标轮询 切换', {
87
67
  linkCi: linkCi,
88
- oldCodes: oldCodes
68
+ codes: codes
89
69
  });
90
- queryLinkMetricsRequest.run(linkCi, oldCodes);
91
-
92
- if (newCodes.length > 0) {
93
- queryLastestValues.run({
94
- 'id': linkCi.attributes.name
95
- });
96
- }
70
+ queryLinkMetricsRequest.run(linkCi, codes);
97
71
  }
98
72
 
99
73
  return function () {};
100
74
  }, [linkId, linkMetricCodesStr]);
75
+ var retansRatioNetDelayRatioCodesStr = retansRatioNetDelayRatioCodes.map(function (item) {
76
+ return item;
77
+ }).sort().join(',');
78
+ useEffect(function () {
79
+ if (linkId) {
80
+ rlog.info('链路拓扑指标勾选rtt|重传率 轮询', {
81
+ linkCi: linkCi,
82
+ retansRatioNetDelayRatioCodes: retansRatioNetDelayRatioCodes
83
+ });
84
+ queryLastestValues.run({
85
+ 'id': linkCi.attributes.name
86
+ }, retansRatioNetDelayRatioCodes);
87
+ }
88
+
89
+ return function () {};
90
+ }, [linkId, retansRatioNetDelayRatioCodesStr]);
101
91
  useEffect(function () {
102
92
  if (linkId) {
103
93
  rlog.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
@@ -245,7 +245,7 @@ export function isOpenFlow(_x6) {
245
245
  return _isOpenFlow.apply(this, arguments);
246
246
  }
247
247
  /**
248
- * @name isOpenFlow 查指标值
248
+ * @name queryLastestValue 查指标值
249
249
  * @returns
250
250
  */
251
251
 
@@ -287,4 +287,60 @@ function _queryLastestValue() {
287
287
  }, _callee7);
288
288
  }));
289
289
  return _queryLastestValue.apply(this, arguments);
290
+ }
291
+
292
+ export function queryRetansRatioNetDelayRatio(_x8, _x9) {
293
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
294
+ }
295
+
296
+ function _queryRetansRatioNetDelayRatio() {
297
+ _queryRetansRatioNetDelayRatio = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, retansRatioNetDelayRatioCodes) {
298
+ var result, linkOther;
299
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
300
+ while (1) {
301
+ switch (_context8.prev = _context8.next) {
302
+ case 0:
303
+ if (retansRatioNetDelayRatioCodes.length) {
304
+ _context8.next = 2;
305
+ break;
306
+ }
307
+
308
+ return _context8.abrupt("return", []);
309
+
310
+ case 2:
311
+ _context8.next = 4;
312
+ return queryLastestValue(params);
313
+
314
+ case 4:
315
+ result = _context8.sent;
316
+ linkOther = [];
317
+
318
+ if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
319
+ linkOther.push({
320
+ 'code': 'netDelayRatio',
321
+ 'name': 'RTT时延',
322
+ 'ts': result.time,
323
+ 'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
324
+ });
325
+ }
326
+
327
+ if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
328
+ linkOther.push({
329
+ 'code': 'retansRatio',
330
+ 'name': '重传率',
331
+ 'ts': result.time,
332
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
333
+ });
334
+ }
335
+
336
+ return _context8.abrupt("return", linkOther);
337
+
338
+ case 9:
339
+ case "end":
340
+ return _context8.stop();
341
+ }
342
+ }
343
+ }, _callee8);
344
+ }));
345
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
290
346
  }
@@ -8,6 +8,12 @@
8
8
  margin-top: 16px;
9
9
  margin-right: -25px;
10
10
  overflow: hidden;
11
+ .isCrucialLink{
12
+ line-height: 24px;
13
+
14
+ display: flex;
15
+ float: left;
16
+ }
11
17
  .item {
12
18
  width: 220px;
13
19
  max-width: 100%;
@@ -77,6 +77,7 @@ function _addLinkData() {
77
77
 
78
78
  case 4:
79
79
  networkLinks = _context.sent;
80
+ console.log("如果是网络链路,补充详情信息", networkLinks);
80
81
  otherLinks = links.filter(function (link) {
81
82
  return link.ciType !== 'network_link';
82
83
  });
@@ -85,7 +86,7 @@ function _addLinkData() {
85
86
  linkGroups: []
86
87
  }));
87
88
 
88
- case 7:
89
+ case 8:
89
90
  case "end":
90
91
  return _context.stop();
91
92
  }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * 连线组标注、悬浮框数据构建
3
+ */
4
+ import rlog from "@riil-frontend/component-topology-utils/es/rlog";
5
+ import { getEdgeGroups } from "../../utils/htElementUtils";
6
+ import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与计算的链路指标
7
+
8
+ var metrics = [// 总流速
9
+ {
10
+ code: "interface_totalbps",
11
+ calcType: "sum"
12
+ }, // 带宽利用率
13
+ {
14
+ code: "bandwidth_utilization",
15
+ calcType: "avg"
16
+ }, // 发送带宽利用率
17
+ {
18
+ code: "out_bandwidth_utilization",
19
+ calcType: "avg",
20
+ showWhenSameSource: true
21
+ }, // 接收带宽利用率
22
+ {
23
+ code: "in_bandwidth_utilization",
24
+ calcType: "avg",
25
+ showWhenSameSource: true
26
+ }, {
27
+ code: "out_rate",
28
+ calcType: "sum",
29
+ showWhenSameSource: true
30
+ }, {
31
+ code: "in_rate",
32
+ calcType: "sum",
33
+ showWhenSameSource: true
34
+ }];
35
+ var calcFnMap = {
36
+ sum: function sum(values) {
37
+ return values.reduce(function (total, val) {
38
+ return total + parseInt(val || 0, 10);
39
+ }, 0);
40
+ },
41
+ avg: function avg(values) {
42
+ return values.reduce(function (total, val) {
43
+ return total + parseFloat(val || 0, 10);
44
+ }, 0) / values.length;
45
+ }
46
+ };
47
+
48
+ var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
49
+ function IpNodeTagsTipsBuilder(amDisplay) {
50
+ this.amDisplay = void 0;
51
+ this.topo = void 0;
52
+ this.amDisplay = amDisplay;
53
+ this.topo = amDisplay.topo;
54
+ }
55
+
56
+ var _proto = IpNodeTagsTipsBuilder.prototype;
57
+
58
+ _proto.getExtElementTagsAndTips = function getExtElementTagsAndTips() {
59
+ return this.getIpNodeTagsAndTips();
60
+ };
61
+
62
+ _proto.getIpNodeTagsAndTips = function getIpNodeTagsAndTips() {
63
+ // const ciConfigs = this.amDisplay.getResourceTagTipConfig();
64
+ var tts = [];
65
+ var data = this.amDisplay.getData();
66
+ var ipNodes = data.filter(function (item) {
67
+ return item.bindType === "ip";
68
+ });
69
+ var topo = this.topo;
70
+ var dm = this.topo.getDataModel();
71
+ var config = topo.attributeMetricDisplay.getConfig();
72
+ console.log("getIpNodeTagsAndTips", config, ipNodes);
73
+
74
+ if (config.nodeTag && !config.nodeTag.isCustom) {
75
+ var tagDatas = config.nodeTag.data;
76
+ var hasIpv4 = tagDatas.filter(function (item) {
77
+ return item.code === "ipv4_address";
78
+ }).length > 0;
79
+ ipNodes.map(function (node) {
80
+ if (hasIpv4) {
81
+ tts.push({
82
+ type: node,
83
+ id: node.id,
84
+ tags: [{
85
+ type: "attribute",
86
+ code: "ipv4_address",
87
+ // 属性code
88
+ name: "IPv4地址",
89
+ // 属性名称
90
+ value: node.bindIp,
91
+ // 属性值
92
+ originValue: node.bindIp
93
+ }],
94
+ tips: []
95
+ });
96
+ } else {
97
+ tts.push({
98
+ type: node,
99
+ id: node.id,
100
+ tags: [],
101
+ tips: []
102
+ });
103
+ }
104
+ });
105
+ }
106
+
107
+ return tts;
108
+ };
109
+
110
+ return IpNodeTagsTipsBuilder;
111
+ }();
112
+
113
+ export { IpNodeTagsTipsBuilder as default };
@@ -5,15 +5,15 @@ import { getLinksBetweenNodes } from "../utils/linkUtil"; // network_link.actual
5
5
 
6
6
  function calcEdgeWidth(actualBandwidth) {
7
7
  if (!actualBandwidth) {
8
- return 2;
8
+ return 3;
9
9
  } else if (actualBandwidth <= 100) {
10
- return 2;
11
- } else if (actualBandwidth <= 1000) {
12
10
  return 3;
13
- } else if (actualBandwidth <= 10000) {
11
+ } else if (actualBandwidth <= 1000) {
14
12
  return 4;
15
- } else if (actualBandwidth > 10000) {
13
+ } else if (actualBandwidth <= 10000) {
16
14
  return 5;
15
+ } else if (actualBandwidth > 10000) {
16
+ return 6;
17
17
  }
18
18
  }
19
19
 
@@ -169,11 +169,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
169
169
  var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
170
170
 
171
171
  if (!autoChangeEdgeWidth) {
172
- return 2;
172
+ return 3;
173
173
  }
174
174
 
175
175
  if (!links.length) {
176
- return 2;
176
+ return 3;
177
177
  }
178
178
 
179
179
  var total = 0;
@@ -192,7 +192,7 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
192
192
  var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
193
193
 
194
194
  if (!autoChangeEdgeWidth) {
195
- return 2;
195
+ return 3;
196
196
  }
197
197
 
198
198
  return this.calcEdgeWidth(link.attributes['network_link.actual_bandwidth']);
@@ -8,7 +8,8 @@ import TopoApp from "../../core/models/TopoApp";
8
8
  import createMenuCommands from "../../contextmenu/createMenuCommands";
9
9
  import getTopoData from "../getTopoData";
10
10
  import customStoreModels from "../store";
11
- import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay"; // import LinkTagsTipsBuilder from './LinkTagsTipsBuilder';
11
+ import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
12
+ import IpNodeTagsTipsBuilder from "./IpNodeTagsTipsBuilder";
12
13
 
13
14
  var TopoCenter = /*#__PURE__*/function (_TopoApp) {
14
15
  _inheritsLoose(TopoCenter, _TopoApp);
@@ -28,8 +29,8 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
28
29
  },
29
30
  getDefaultLinkTipConfig: function getDefaultLinkTipConfig() {
30
31
  return DEFAULT_TIP_COMMON_CONFIG;
31
- } // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
32
-
32
+ },
33
+ ExtElementTagTipBuilder: IpNodeTagsTipsBuilder
33
34
  }
34
35
  })) || this;
35
36
  _this.resourceConfig = null;
@@ -1,6 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { request } from '@riil-frontend/component-topology-utils';
3
+ import { request } from "@riil-frontend/component-topology-utils";
4
4
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
5
5
  export default {
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
- var _excluded = ["groups", "resources"];
4
+ var _excluded = ["groups", "resources", "exportLinkIdList"];
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { request } from '@riil-frontend/component-topology-utils';
7
7
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
@@ -9,6 +9,7 @@ import blackList from "./blacklist";
9
9
  import { TOPO_API_ROOT } from "./constants";
10
10
  import { commonQuery } from "../cmdb";
11
11
  import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
12
+ import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
12
13
  var API_ROOT = TOPO_API_ROOT;
13
14
  /**
14
15
  * 拓扑图(看做一个容器)的“父容器”ID
@@ -53,10 +54,16 @@ function prepareResourceParams(conditions, query) {
53
54
  dynamicCondition.sort = query.sortBy + " " + query.sortOrder;
54
55
  }
55
56
 
56
- var fixedConditionIdList = staticRes || undefined;
57
57
  return {
58
58
  dynamicCondition: dynamicCondition,
59
- fixedConditionIdList: fixedConditionIdList
59
+ fixedConditionIdList: (staticRes || []).filter(function (ciId) {
60
+ return !ciId.startsWith('ip:');
61
+ }),
62
+ linkIps: (staticRes || []).filter(function (ciId) {
63
+ return ciId.startsWith('ip:');
64
+ }).map(function (ciId) {
65
+ return ciId.replace('ip:', '');
66
+ })
60
67
  };
61
68
  }
62
69
 
@@ -401,38 +408,33 @@ export default _extends({
401
408
  */
402
409
  getTopoData: function getTopoData(id) {
403
410
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
404
- var _result$links, result;
411
+ var _result$nodes, _result$links;
405
412
 
413
+ var result;
406
414
  return _regeneratorRuntime.wrap(function _callee12$(_context12) {
407
415
  while (1) {
408
416
  switch (_context12.prev = _context12.next) {
409
417
  case 0:
410
- _context12.prev = 0;
411
- _context12.next = 3;
418
+ _context12.next = 2;
412
419
  return request.get(API_ROOT + "/structure/both/" + id);
413
420
 
414
- case 3:
421
+ case 2:
415
422
  result = _context12.sent;
416
- return _context12.abrupt("return", _extends({}, result, {
423
+ return _context12.abrupt("return", processExitLink(_extends({}, result, {
424
+ nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
417
425
  links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
418
426
  return _extends({}, item, {
419
427
  ciType: 'network_link'
420
428
  });
421
429
  })
422
- }));
430
+ })));
423
431
 
424
- case 7:
425
- _context12.prev = 7;
426
- _context12.t0 = _context12["catch"](0);
427
- rlog.debug('getTopoData-error', _context12.t0);
428
- return _context12.abrupt("return", null);
429
-
430
- case 11:
432
+ case 4:
431
433
  case "end":
432
434
  return _context12.stop();
433
435
  }
434
436
  }
435
- }, _callee12, null, [[0, 7]]);
437
+ }, _callee12);
436
438
  }))();
437
439
  },
438
440
 
@@ -443,9 +445,9 @@ export default _extends({
443
445
  * @param {Array} groups
444
446
  * @returns
445
447
  */
446
- getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
448
+ getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
447
449
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
448
- var _result$links2;
450
+ var _result$nodes2, _result$links2;
449
451
 
450
452
  var data, obj, result;
451
453
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
@@ -464,19 +466,18 @@ export default _extends({
464
466
 
465
467
  obj = prepareGroupParams(data);
466
468
  _context13.next = 5;
467
- return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj, {
468
- exportLinkIdList: exportLinkIdList
469
- }));
469
+ return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj));
470
470
 
471
471
  case 5:
472
472
  result = _context13.sent;
473
- return _context13.abrupt("return", _extends({}, result, {
473
+ return _context13.abrupt("return", processByConditionResult(_extends({}, result, {
474
+ nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
474
475
  links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
475
476
  return _extends({}, item, {
476
477
  ciType: 'network_link'
477
478
  });
478
479
  })
479
- }));
480
+ }), obj.groups));
480
481
 
481
482
  case 7:
482
483
  case "end":
@@ -496,12 +497,12 @@ export default _extends({
496
497
  */
497
498
  bindResourceToTopo: function bindResourceToTopo(id, config) {
498
499
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
499
- var groups, resources, otherConfig, newGroups, obj;
500
+ var groups, resources, exportLinkIdList, otherConfig, newGroups, obj;
500
501
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
501
502
  while (1) {
502
503
  switch (_context14.prev = _context14.next) {
503
504
  case 0:
504
- groups = config.groups, resources = config.resources, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
505
+ groups = config.groups, resources = config.resources, exportLinkIdList = config.exportLinkIdList, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
505
506
  newGroups = isAvailableArray(groups) ? groups : [];
506
507
 
507
508
  if (resources) {
@@ -6,9 +6,9 @@ var API_ROOT = TOPO_API_ROOT;
6
6
  export default {
7
7
  /**
8
8
  * 批量查询ci类型是否可创建链路
9
- *
10
- * @param {*} typeCodes
11
- * @returns
9
+ *
10
+ * @param {*} typeCodes
11
+ * @returns
12
12
  */
13
13
  getCiTypesConnectable: function getCiTypesConnectable(typeCodes) {
14
14
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -29,5 +29,47 @@ export default {
29
29
  }
30
30
  }, _callee);
31
31
  }))();
32
+ },
33
+
34
+ /**
35
+ * 通过ip查询关联链路
36
+ *
37
+ * @param {array} ciIds
38
+ */
39
+ queryLinksByIp: function queryLinksByIp(ids, ip) {
40
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
41
+ var stag, condition, parm, result;
42
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
43
+ while (1) {
44
+ switch (_context2.prev = _context2.next) {
45
+ case 0:
46
+ stag = "'" + ids.join("','") + "'";
47
+ condition = "type('network_link') && network_link.destination_ipv4 = '" + ip + "' && network_link.source_device_id in [" + stag + "]";
48
+ parm = {
49
+ condition: condition,
50
+ sort: "name asc",
51
+ currentPage: 1,
52
+ pageSize: 999
53
+ };
54
+ _context2.prev = 3;
55
+ _context2.next = 6;
56
+ return request.post("/mdc/v1/api/cmdb/commonQueryCiData", parm);
57
+
58
+ case 6:
59
+ result = _context2.sent;
60
+ return _context2.abrupt("return", result);
61
+
62
+ case 10:
63
+ _context2.prev = 10;
64
+ _context2.t0 = _context2["catch"](3);
65
+ rlog.error("通过ip查询关联链路", _context2.t0);
66
+
67
+ case 13:
68
+ case "end":
69
+ return _context2.stop();
70
+ }
71
+ }
72
+ }, _callee2, null, [[3, 10]]);
73
+ }))();
32
74
  }
33
75
  };