@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
@@ -25,10 +25,10 @@ function useMetricPolling(_ref) {
25
25
  linkMetricCodes = _ref.linkMetricCodes;
26
26
  var linkId = linkCi.id;
27
27
  var arr = ['netDelayRatio', 'retansRatio'];
28
- var oldCodes = [];
29
- var newCodes = [];
28
+ var codes = [];
29
+ var retansRatioNetDelayRatioCodes = [];
30
30
  linkMetricCodes.map(function (item) {
31
- arr.indexOf(item) > -1 ? newCodes.push(item) : oldCodes.push(item);
31
+ arr.indexOf(item) > -1 ? retansRatioNetDelayRatioCodes.push(item) : codes.push(item);
32
32
  });
33
33
 
34
34
  var _useState = (0, _react.useState)({
@@ -42,35 +42,15 @@ function useMetricPolling(_ref) {
42
42
  data = _useState[0],
43
43
  setData = _useState[1];
44
44
 
45
- var queryLastestValues = (0, _ahooks.useRequest)(_services.queryLastestValue, {
45
+ var queryLastestValues = (0, _ahooks.useRequest)(_services.queryRetansRatioNetDelayRatio, {
46
46
  pollingInterval: 1000 * 15,
47
47
  pollingWhenHidden: false,
48
48
  debounceInterval: 200,
49
49
  manual: true,
50
50
  onSuccess: function onSuccess(result) {
51
- var datas = {
52
- linkOther: []
53
- };
54
-
55
- if (newCodes.includes('netDelayRatio')) {
56
- datas.linkOther.push({
57
- 'code': 'netDelayRatio',
58
- 'name': '下行RTT时延',
59
- 'ts': result.time,
60
- 'value': result.upNetDelayRatio + ' ms' + '|' + result.downNetDelayRatio + ' ms'
61
- });
62
- }
63
-
64
- if (newCodes.includes('retansRatio')) {
65
- datas.linkOther.push({
66
- 'code': 'retansRatio',
67
- 'name': '重传率',
68
- 'ts': result.time,
69
- 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
70
- });
71
- }
72
-
73
- setData((0, _extends2["default"])({}, data, datas));
51
+ setData((0, _extends2["default"])({}, data, {
52
+ linkOther: result
53
+ }));
74
54
  }
75
55
  }); // 轮询hooks
76
56
 
@@ -96,27 +76,38 @@ function useMetricPolling(_ref) {
96
76
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
97
77
  }
98
78
  });
99
- var linkMetricCodesStr = oldCodes.map(function (item) {
79
+ var linkMetricCodesStr = codes.map(function (item) {
100
80
  return item;
101
81
  }).sort().join(',');
102
82
  (0, _react.useEffect)(function () {
103
83
  if (linkId) {
104
84
  _rlog["default"].info('链路拓扑指标轮询 切换', {
105
85
  linkCi: linkCi,
106
- oldCodes: oldCodes
86
+ codes: codes
107
87
  });
108
88
 
109
- queryLinkMetricsRequest.run(linkCi, oldCodes);
110
-
111
- if (newCodes.length > 0) {
112
- queryLastestValues.run({
113
- 'id': linkCi.attributes.name
114
- });
115
- }
89
+ queryLinkMetricsRequest.run(linkCi, codes);
116
90
  }
117
91
 
118
92
  return function () {};
119
93
  }, [linkId, linkMetricCodesStr]);
94
+ var retansRatioNetDelayRatioCodesStr = retansRatioNetDelayRatioCodes.map(function (item) {
95
+ return item;
96
+ }).sort().join(',');
97
+ (0, _react.useEffect)(function () {
98
+ if (linkId) {
99
+ _rlog["default"].info('链路拓扑指标勾选rtt|重传率 轮询', {
100
+ linkCi: linkCi,
101
+ retansRatioNetDelayRatioCodes: retansRatioNetDelayRatioCodes
102
+ });
103
+
104
+ queryLastestValues.run({
105
+ 'id': linkCi.attributes.name
106
+ }, retansRatioNetDelayRatioCodes);
107
+ }
108
+
109
+ return function () {};
110
+ }, [linkId, retansRatioNetDelayRatioCodesStr]);
120
111
  (0, _react.useEffect)(function () {
121
112
  if (linkId) {
122
113
  _rlog["default"].info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
@@ -10,6 +10,7 @@ exports.queryLastestValue = queryLastestValue;
10
10
  exports.queryLatestMetrics = queryLatestMetrics;
11
11
  exports.queryLinkInterfacesLatestMetrics = queryLinkInterfacesLatestMetrics;
12
12
  exports.queryLinkLatestMetrics = queryLinkLatestMetrics;
13
+ exports.queryRetansRatioNetDelayRatio = queryRetansRatioNetDelayRatio;
13
14
 
14
15
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
16
 
@@ -276,7 +277,7 @@ function isOpenFlow(_x6) {
276
277
  return _isOpenFlow.apply(this, arguments);
277
278
  }
278
279
  /**
279
- * @name isOpenFlow 查指标值
280
+ * @name queryLastestValue 查指标值
280
281
  * @returns
281
282
  */
282
283
 
@@ -319,4 +320,60 @@ function _queryLastestValue() {
319
320
  }, _callee7);
320
321
  }));
321
322
  return _queryLastestValue.apply(this, arguments);
323
+ }
324
+
325
+ function queryRetansRatioNetDelayRatio(_x8, _x9) {
326
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
327
+ }
328
+
329
+ function _queryRetansRatioNetDelayRatio() {
330
+ _queryRetansRatioNetDelayRatio = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(params, retansRatioNetDelayRatioCodes) {
331
+ var result, linkOther;
332
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
333
+ while (1) {
334
+ switch (_context8.prev = _context8.next) {
335
+ case 0:
336
+ if (retansRatioNetDelayRatioCodes.length) {
337
+ _context8.next = 2;
338
+ break;
339
+ }
340
+
341
+ return _context8.abrupt("return", []);
342
+
343
+ case 2:
344
+ _context8.next = 4;
345
+ return queryLastestValue(params);
346
+
347
+ case 4:
348
+ result = _context8.sent;
349
+ linkOther = [];
350
+
351
+ if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
352
+ linkOther.push({
353
+ 'code': 'netDelayRatio',
354
+ 'name': 'RTT时延',
355
+ 'ts': result.time,
356
+ 'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
357
+ });
358
+ }
359
+
360
+ if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
361
+ linkOther.push({
362
+ 'code': 'retansRatio',
363
+ 'name': '重传率',
364
+ 'ts': result.time,
365
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
366
+ });
367
+ }
368
+
369
+ return _context8.abrupt("return", linkOther);
370
+
371
+ case 9:
372
+ case "end":
373
+ return _context8.stop();
374
+ }
375
+ }
376
+ }, _callee8);
377
+ }));
378
+ return _queryRetansRatioNetDelayRatio.apply(this, arguments);
322
379
  }
@@ -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%;
@@ -92,6 +92,7 @@ function _addLinkData() {
92
92
 
93
93
  case 4:
94
94
  networkLinks = _context.sent;
95
+ console.log("如果是网络链路,补充详情信息", networkLinks);
95
96
  otherLinks = links.filter(function (link) {
96
97
  return link.ciType !== 'network_link';
97
98
  });
@@ -100,7 +101,7 @@ function _addLinkData() {
100
101
  linkGroups: []
101
102
  }));
102
103
 
103
- case 7:
104
+ case 8:
104
105
  case "end":
105
106
  return _context.stop();
106
107
  }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports["default"] = void 0;
7
+
8
+ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
9
+
10
+ var _htElementUtils = require("../../utils/htElementUtils");
11
+
12
+ var _attributeFormatter = _interopRequireDefault(require("../../core/models/attributeFormatter"));
13
+
14
+ /**
15
+ * 连线组标注、悬浮框数据构建
16
+ */
17
+ // 参与计算的链路指标
18
+ var metrics = [// 总流速
19
+ {
20
+ code: "interface_totalbps",
21
+ calcType: "sum"
22
+ }, // 带宽利用率
23
+ {
24
+ code: "bandwidth_utilization",
25
+ calcType: "avg"
26
+ }, // 发送带宽利用率
27
+ {
28
+ code: "out_bandwidth_utilization",
29
+ calcType: "avg",
30
+ showWhenSameSource: true
31
+ }, // 接收带宽利用率
32
+ {
33
+ code: "in_bandwidth_utilization",
34
+ calcType: "avg",
35
+ showWhenSameSource: true
36
+ }, {
37
+ code: "out_rate",
38
+ calcType: "sum",
39
+ showWhenSameSource: true
40
+ }, {
41
+ code: "in_rate",
42
+ calcType: "sum",
43
+ showWhenSameSource: true
44
+ }];
45
+ var calcFnMap = {
46
+ sum: function sum(values) {
47
+ return values.reduce(function (total, val) {
48
+ return total + parseInt(val || 0, 10);
49
+ }, 0);
50
+ },
51
+ avg: function avg(values) {
52
+ return values.reduce(function (total, val) {
53
+ return total + parseFloat(val || 0, 10);
54
+ }, 0) / values.length;
55
+ }
56
+ };
57
+
58
+ var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
59
+ function IpNodeTagsTipsBuilder(amDisplay) {
60
+ this.amDisplay = void 0;
61
+ this.topo = void 0;
62
+ this.amDisplay = amDisplay;
63
+ this.topo = amDisplay.topo;
64
+ }
65
+
66
+ var _proto = IpNodeTagsTipsBuilder.prototype;
67
+
68
+ _proto.getExtElementTagsAndTips = function getExtElementTagsAndTips() {
69
+ return this.getIpNodeTagsAndTips();
70
+ };
71
+
72
+ _proto.getIpNodeTagsAndTips = function getIpNodeTagsAndTips() {
73
+ // const ciConfigs = this.amDisplay.getResourceTagTipConfig();
74
+ var tts = [];
75
+ var data = this.amDisplay.getData();
76
+ var ipNodes = data.filter(function (item) {
77
+ return item.bindType === "ip";
78
+ });
79
+ var topo = this.topo;
80
+ var dm = this.topo.getDataModel();
81
+ var config = topo.attributeMetricDisplay.getConfig();
82
+ console.log("getIpNodeTagsAndTips", config, ipNodes);
83
+
84
+ if (config.nodeTag && !config.nodeTag.isCustom) {
85
+ var tagDatas = config.nodeTag.data;
86
+ var hasIpv4 = tagDatas.filter(function (item) {
87
+ return item.code === "ipv4_address";
88
+ }).length > 0;
89
+ ipNodes.map(function (node) {
90
+ if (hasIpv4) {
91
+ tts.push({
92
+ type: node,
93
+ id: node.id,
94
+ tags: [{
95
+ type: "attribute",
96
+ code: "ipv4_address",
97
+ // 属性code
98
+ name: "IPv4地址",
99
+ // 属性名称
100
+ value: node.bindIp,
101
+ // 属性值
102
+ originValue: node.bindIp
103
+ }],
104
+ tips: []
105
+ });
106
+ } else {
107
+ tts.push({
108
+ type: node,
109
+ id: node.id,
110
+ tags: [],
111
+ tips: []
112
+ });
113
+ }
114
+ });
115
+ }
116
+
117
+ return tts;
118
+ };
119
+
120
+ return IpNodeTagsTipsBuilder;
121
+ }();
122
+
123
+ exports["default"] = IpNodeTagsTipsBuilder;
@@ -16,15 +16,15 @@ var _linkUtil = require("../utils/linkUtil");
16
16
  // network_link.actual_bandwidth
17
17
  function calcEdgeWidth(actualBandwidth) {
18
18
  if (!actualBandwidth) {
19
- return 2;
19
+ return 3;
20
20
  } else if (actualBandwidth <= 100) {
21
- return 2;
22
- } else if (actualBandwidth <= 1000) {
23
21
  return 3;
24
- } else if (actualBandwidth <= 10000) {
22
+ } else if (actualBandwidth <= 1000) {
25
23
  return 4;
26
- } else if (actualBandwidth > 10000) {
24
+ } else if (actualBandwidth <= 10000) {
27
25
  return 5;
26
+ } else if (actualBandwidth > 10000) {
27
+ return 6;
28
28
  }
29
29
  }
30
30
 
@@ -180,11 +180,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
180
180
  var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
181
181
 
182
182
  if (!autoChangeEdgeWidth) {
183
- return 2;
183
+ return 3;
184
184
  }
185
185
 
186
186
  if (!links.length) {
187
- return 2;
187
+ return 3;
188
188
  }
189
189
 
190
190
  var total = 0;
@@ -203,7 +203,7 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
203
203
  var autoChangeEdgeWidth = displayConfig.autoChangeEdgeWidth !== false;
204
204
 
205
205
  if (!autoChangeEdgeWidth) {
206
- return 2;
206
+ return 3;
207
207
  }
208
208
 
209
209
  return this.calcEdgeWidth(link.attributes['network_link.actual_bandwidth']);
@@ -27,7 +27,8 @@ var _store = _interopRequireDefault(require("../store"));
27
27
 
28
28
  var _ResourceInfoDisplay = require("../../constants/ResourceInfoDisplay");
29
29
 
30
- // import LinkTagsTipsBuilder from './LinkTagsTipsBuilder';
30
+ var _IpNodeTagsTipsBuilder = _interopRequireDefault(require("./IpNodeTagsTipsBuilder"));
31
+
31
32
  var TopoCenter = /*#__PURE__*/function (_TopoApp) {
32
33
  (0, _inheritsLoose2["default"])(TopoCenter, _TopoApp);
33
34
 
@@ -46,8 +47,8 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
46
47
  },
47
48
  getDefaultLinkTipConfig: function getDefaultLinkTipConfig() {
48
49
  return _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG;
49
- } // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
50
-
50
+ },
51
+ ExtElementTagTipBuilder: _IpNodeTagsTipsBuilder["default"]
51
52
  }
52
53
  })) || this;
53
54
  _this.resourceConfig = null;
@@ -25,7 +25,9 @@ var _cmdb = require("../cmdb");
25
25
 
26
26
  var _model = require("../model");
27
27
 
28
- var _excluded = ["groups", "resources"];
28
+ var _exitLinkUtil = require("../../utils/exitLinkUtil");
29
+
30
+ var _excluded = ["groups", "resources", "exportLinkIdList"];
29
31
  var API_ROOT = _constants.TOPO_API_ROOT;
30
32
  /**
31
33
  * 拓扑图(看做一个容器)的“父容器”ID
@@ -72,10 +74,16 @@ function prepareResourceParams(conditions, query) {
72
74
  dynamicCondition.sort = query.sortBy + " " + query.sortOrder;
73
75
  }
74
76
 
75
- var fixedConditionIdList = staticRes || undefined;
76
77
  return {
77
78
  dynamicCondition: dynamicCondition,
78
- fixedConditionIdList: fixedConditionIdList
79
+ fixedConditionIdList: (staticRes || []).filter(function (ciId) {
80
+ return !ciId.startsWith('ip:');
81
+ }),
82
+ linkIps: (staticRes || []).filter(function (ciId) {
83
+ return ciId.startsWith('ip:');
84
+ }).map(function (ciId) {
85
+ return ciId.replace('ip:', '');
86
+ })
79
87
  };
80
88
  }
81
89
 
@@ -420,40 +428,33 @@ var _default = (0, _extends2["default"])({
420
428
  */
421
429
  getTopoData: function getTopoData(id) {
422
430
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
423
- var _result$links, result;
431
+ var _result$nodes, _result$links;
424
432
 
433
+ var result;
425
434
  return _regenerator["default"].wrap(function _callee12$(_context12) {
426
435
  while (1) {
427
436
  switch (_context12.prev = _context12.next) {
428
437
  case 0:
429
- _context12.prev = 0;
430
- _context12.next = 3;
438
+ _context12.next = 2;
431
439
  return _componentTopologyUtils.request.get(API_ROOT + "/structure/both/" + id);
432
440
 
433
- case 3:
441
+ case 2:
434
442
  result = _context12.sent;
435
- return _context12.abrupt("return", (0, _extends2["default"])({}, result, {
443
+ return _context12.abrupt("return", (0, _exitLinkUtil.processExitLink)((0, _extends2["default"])({}, result, {
444
+ nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
436
445
  links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
437
446
  return (0, _extends2["default"])({}, item, {
438
447
  ciType: 'network_link'
439
448
  });
440
449
  })
441
- }));
442
-
443
- case 7:
444
- _context12.prev = 7;
445
- _context12.t0 = _context12["catch"](0);
446
-
447
- _rlog["default"].debug('getTopoData-error', _context12.t0);
450
+ })));
448
451
 
449
- return _context12.abrupt("return", null);
450
-
451
- case 11:
452
+ case 4:
452
453
  case "end":
453
454
  return _context12.stop();
454
455
  }
455
456
  }
456
- }, _callee12, null, [[0, 7]]);
457
+ }, _callee12);
457
458
  }))();
458
459
  },
459
460
 
@@ -464,9 +465,9 @@ var _default = (0, _extends2["default"])({
464
465
  * @param {Array} groups
465
466
  * @returns
466
467
  */
467
- getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
468
+ getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
468
469
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
469
- var _result$links2;
470
+ var _result$nodes2, _result$links2;
470
471
 
471
472
  var data, obj, result;
472
473
  return _regenerator["default"].wrap(function _callee13$(_context13) {
@@ -485,19 +486,18 @@ var _default = (0, _extends2["default"])({
485
486
 
486
487
  obj = prepareGroupParams(data);
487
488
  _context13.next = 5;
488
- return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id, (0, _extends2["default"])({}, obj, {
489
- exportLinkIdList: exportLinkIdList
490
- }));
489
+ return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id, (0, _extends2["default"])({}, obj));
491
490
 
492
491
  case 5:
493
492
  result = _context13.sent;
494
- return _context13.abrupt("return", (0, _extends2["default"])({}, result, {
493
+ return _context13.abrupt("return", (0, _exitLinkUtil.processByConditionResult)((0, _extends2["default"])({}, result, {
494
+ nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
495
495
  links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
496
496
  return (0, _extends2["default"])({}, item, {
497
497
  ciType: 'network_link'
498
498
  });
499
499
  })
500
- }));
500
+ }), obj.groups));
501
501
 
502
502
  case 7:
503
503
  case "end":
@@ -517,12 +517,12 @@ var _default = (0, _extends2["default"])({
517
517
  */
518
518
  bindResourceToTopo: function bindResourceToTopo(id, config) {
519
519
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
520
- var groups, resources, otherConfig, newGroups, obj;
520
+ var groups, resources, exportLinkIdList, otherConfig, newGroups, obj;
521
521
  return _regenerator["default"].wrap(function _callee14$(_context14) {
522
522
  while (1) {
523
523
  switch (_context14.prev = _context14.next) {
524
524
  case 0:
525
- groups = config.groups, resources = config.resources, otherConfig = (0, _objectWithoutPropertiesLoose2["default"])(config, _excluded);
525
+ groups = config.groups, resources = config.resources, exportLinkIdList = config.exportLinkIdList, otherConfig = (0, _objectWithoutPropertiesLoose2["default"])(config, _excluded);
526
526
  newGroups = isAvailableArray(groups) ? groups : [];
527
527
 
528
528
  if (resources) {
@@ -17,9 +17,9 @@ var API_ROOT = _constants.TOPO_API_ROOT;
17
17
  var _default = {
18
18
  /**
19
19
  * 批量查询ci类型是否可创建链路
20
- *
21
- * @param {*} typeCodes
22
- * @returns
20
+ *
21
+ * @param {*} typeCodes
22
+ * @returns
23
23
  */
24
24
  getCiTypesConnectable: function getCiTypesConnectable(typeCodes) {
25
25
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
@@ -40,6 +40,48 @@ var _default = {
40
40
  }
41
41
  }, _callee);
42
42
  }))();
43
+ },
44
+
45
+ /**
46
+ * 通过ip查询关联链路
47
+ *
48
+ * @param {array} ciIds
49
+ */
50
+ queryLinksByIp: function queryLinksByIp(ids, ip) {
51
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
52
+ var stag, condition, parm, result;
53
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
54
+ while (1) {
55
+ switch (_context2.prev = _context2.next) {
56
+ case 0:
57
+ stag = "'" + ids.join("','") + "'";
58
+ condition = "type('network_link') && network_link.destination_ipv4 = '" + ip + "' && network_link.source_device_id in [" + stag + "]";
59
+ parm = {
60
+ condition: condition,
61
+ sort: "name asc",
62
+ currentPage: 1,
63
+ pageSize: 999
64
+ };
65
+ _context2.prev = 3;
66
+ _context2.next = 6;
67
+ return _componentTopologyUtils.request.post("/mdc/v1/api/cmdb/commonQueryCiData", parm);
68
+
69
+ case 6:
70
+ result = _context2.sent;
71
+ return _context2.abrupt("return", result);
72
+
73
+ case 10:
74
+ _context2.prev = 10;
75
+ _context2.t0 = _context2["catch"](3);
76
+ rlog.error("通过ip查询关联链路", _context2.t0);
77
+
78
+ case 13:
79
+ case "end":
80
+ return _context2.stop();
81
+ }
82
+ }
83
+ }, _callee2, null, [[3, 10]]);
84
+ }))();
43
85
  }
44
86
  };
45
87
  exports["default"] = _default;