@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
@@ -8,6 +8,7 @@ exports.compatibleWith = void 0;
8
8
  exports.getLinksDetail = getLinksDetail;
9
9
  exports.isCrucialLink = isCrucialLink;
10
10
  exports.isExitLink = isExitLink;
11
+ exports.mergeExportLinkData = void 0;
11
12
  exports.mergeLinksData = mergeLinksData;
12
13
  exports.showLinkByConfig = exports.plurals = void 0;
13
14
 
@@ -41,44 +42,51 @@ var _CiCache = _interopRequireDefault(require("../cache/CiCache"));
41
42
 
42
43
  /**
43
44
  * 是否关键链路
44
- * @param {*} link
45
- * @returns
45
+ * @param {*} link
46
+ * @returns
46
47
  */
47
48
  function isCrucialLink(link) {
48
- return !!link.attributes['network_link.is_crucial'];
49
+ return !!link.attributes["network_link.is_crucial"];
49
50
  }
50
51
  /**
51
52
  * 是否出口链路
52
- * @param {*} link
53
- * @returns
53
+ * @param {*} link
54
+ * @returns
54
55
  */
55
56
 
56
57
 
57
58
  function isExitLink(link) {
58
- return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
59
+ return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
59
60
  }
60
61
 
61
62
  function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
62
- var linkCiMap = (0, _keyBy["default"])(links, 'id');
63
+ var linkCiMap = (0, _keyBy["default"])(links, "id");
63
64
  return links.map(function (link) {
64
65
  var _interfaceCiMap$attri, _interfaceCiMap$attri2;
65
66
 
66
67
  var linkCi = linkCiMap[link.id];
67
68
  var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
68
69
  var sourceNode = nodes.find(function (node) {
69
- return node.id === attributes['network_link.source_device_id'];
70
+ return node.id === attributes["network_link.source_device_id"];
70
71
  });
71
72
  var targetNode = nodes.find(function (node) {
72
- return node.id === attributes['network_link.destination_device_id'];
73
- }); // 翻译
73
+ return node.id === attributes["network_link.destination_device_id"];
74
+ });
75
+ var target = link.target; // 目的端为ip节点
76
+
77
+ if (attributes["destination_type"] === "ip") {
78
+ target = "ip:" + attributes["network_link.destination_ipv4"];
79
+ } // 翻译
80
+
74
81
 
75
82
  return (0, _extends2["default"])({}, link, {
83
+ target: target,
76
84
  attributes: (0, _extends2["default"])({}, attributes, {
77
85
  // 源/目的设备
78
- 'network_link.source_device_id_object': {
86
+ "network_link.source_device_id_object": {
79
87
  displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
80
88
  },
81
- 'network_link.destination_device_id_object': {
89
+ "network_link.destination_device_id_object": {
82
90
  displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
83
91
  },
84
92
  // 源/目的接口类型
@@ -86,10 +94,10 @@ function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
86
94
  destination_type_object: interfaceDoc[attributes.destination_type],
87
95
  // 源/目的接口
88
96
  source_id_object: {
89
- displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes['display_name']
97
+ displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
90
98
  },
91
99
  destination_id_object: {
92
- displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes['display_name']
100
+ displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
93
101
  }
94
102
  })
95
103
  });
@@ -129,7 +137,7 @@ function _getLinksDetail() {
129
137
  }), linkCis.map(function (item) {
130
138
  return item.attributes.destination_type;
131
139
  })))).filter(function (item) {
132
- return item !== 'ip';
140
+ return item !== "ip";
133
141
  });
134
142
  _context.next = 7;
135
143
  return _CiCache["default"].load(interfaceIds);
@@ -173,10 +181,10 @@ var compatibleWith = function compatibleWith(value) {
173
181
  exports.compatibleWith = compatibleWith;
174
182
  var plurals = {
175
183
  0: [],
176
- 1: ['phy'],
177
- 2: ['phy'],
178
- 3: ['agg'],
179
- 4: ['phy', 'agg']
184
+ 1: ["phy"],
185
+ 2: ["phy"],
186
+ 3: ["agg"],
187
+ 4: ["phy", "agg"]
180
188
  };
181
189
  exports.plurals = plurals;
182
190
 
@@ -193,29 +201,48 @@ var showLinkByConfig = function showLinkByConfig(props) {
193
201
  var dm = gv.getDataModel();
194
202
  var edges = (0, _htElementUtils.getEdges)(dm); // console.log("edges", edges);
195
203
 
196
- var showPhy = types.indexOf('phy') >= 0;
197
- var showAgg = types.indexOf('agg') >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
204
+ var showPhy = types.indexOf("phy") >= 0;
205
+ var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
198
206
 
199
207
  if (Array.isArray(edges) && edges.length > 0) {
200
208
  edges.map(function (edge) {
201
209
  if (showType === 1 || showType === true) {
202
210
  // 单链路全部显示
203
211
  // console.log("单链路全部显示", edge);
204
- edge.s('2d.visible', true);
212
+ edge.s("2d.visible", true);
205
213
  } else {
206
214
  var _d$attributes, _d$attributes2;
207
215
 
208
216
  var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
209
217
 
210
- if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === 'network.agg_interface' && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === 'network.agg_interface') {
211
- edge.s('2d.visible', showAgg);
218
+ if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === "network.agg_interface" && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === "network.agg_interface") {
219
+ edge.s("2d.visible", showAgg);
212
220
  } else {
213
221
  // console.log("edge", edge, d, showAgg);
214
- edge.s('2d.visible', showPhy);
222
+ edge.s("2d.visible", showPhy);
215
223
  }
216
224
  }
217
225
  });
218
226
  }
219
227
  };
220
228
 
221
- exports.showLinkByConfig = showLinkByConfig;
229
+ exports.showLinkByConfig = showLinkByConfig;
230
+
231
+ var mergeExportLinkData = function mergeExportLinkData(props) {
232
+ var source = props.source,
233
+ target = props.target,
234
+ link = props.link;
235
+ var attrObj = link.attributes;
236
+ var linkData = (0, _extends2["default"])({}, link, {
237
+ name: attrObj.name,
238
+ source: attrObj["network_link.source_device_id"],
239
+ target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
240
+ operation: attrObj.operation,
241
+ interfaceSource: attrObj["source_id"],
242
+ interfaceTarget: attrObj["destination_id"],
243
+ ciType: link.typeCode
244
+ });
245
+ return linkData;
246
+ };
247
+
248
+ exports.mergeExportLinkData = mergeExportLinkData;
@@ -27,6 +27,8 @@ var _topoData = require("../../../utils/topoData");
27
27
 
28
28
  var _topoData2 = require("../../../core/models/topoData");
29
29
 
30
+ var _networkLink = _interopRequireDefault(require("../../../networkTopo/services/topo/networkLink"));
31
+
30
32
  var _getTopoData = require("../../../networkTopo/getTopoData");
31
33
 
32
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -264,24 +266,26 @@ function _default(topoApp) {
264
266
  var _this2 = this;
265
267
 
266
268
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
267
- var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
269
+ var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, _editState$ipNodes, ipNodes, query, data;
268
270
 
269
271
  return _regenerator["default"].wrap(function _callee2$(_context2) {
270
272
  while (1) {
271
273
  switch (_context2.prev = _context2.next) {
272
274
  case 0:
273
275
  editState = rootState.topoConfig;
274
- resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink;
276
+ resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink, _editState$ipNodes = editState.ipNodes, ipNodes = _editState$ipNodes === void 0 ? [] : _editState$ipNodes;
277
+ console.log("editState", editState);
275
278
  query = {
276
279
  id: rootState.topoMod.topoId,
277
280
  resources: resources,
278
281
  groups: groups,
279
- exportLinkIdList: exportLinkIdList
282
+ exportLinkIdList: exportLinkIdList,
283
+ ipNodes: ipNodes
280
284
  };
281
- _context2.next = 5;
285
+ _context2.next = 6;
282
286
  return _this2.getTopoByConditions(query);
283
287
 
284
- case 5:
288
+ case 6:
285
289
  data = _context2.sent;
286
290
 
287
291
  _rlog["default"].debug("按配置查询拓扑数据", {
@@ -294,7 +298,7 @@ function _default(topoApp) {
294
298
 
295
299
  return _context2.abrupt("return", data);
296
300
 
297
- case 8:
301
+ case 9:
298
302
  case "end":
299
303
  return _context2.stop();
300
304
  }
@@ -330,36 +334,42 @@ function _default(topoApp) {
330
334
  var _this4 = this;
331
335
 
332
336
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
333
- var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
337
+ var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
334
338
 
335
339
  return _regenerator["default"].wrap(function _callee4$(_context4) {
336
340
  while (1) {
337
341
  switch (_context4.prev = _context4.next) {
338
342
  case 0:
339
- // rlog.debug("getTopoByConditions--------", params);
340
- topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
343
+ _rlog["default"].debug("getTopoByConditions--------", params);
344
+
345
+ topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
341
346
  viewConditions = (0, _topoData2.resToConditions)(resources);
342
347
  groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
343
348
  return (0, _extends2["default"])({}, group, {
344
349
  layout: (0, _topoData2.getLayoutId)(group.layout),
345
350
  resources: (0, _topoData2.resToConditions)(group.resources)
346
351
  });
347
- }); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
352
+ });
348
353
 
349
- _context4.next = 5;
350
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
354
+ _rlog["default"].debug("getTopoByConditions--------", viewConditions, groupInfo);
351
355
 
352
- case 5:
356
+ _context4.next = 7;
357
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
358
+
359
+ case 7:
353
360
  data = _context4.sent;
354
- _context4.next = 8;
361
+
362
+ _rlog["default"].debug("getTopoByConditions--------data", data);
363
+
364
+ _context4.next = 11;
355
365
  return (0, _getTopoData.buildData)(data);
356
366
 
357
- case 8:
367
+ case 11:
358
368
  data = _context4.sent;
359
- _context4.next = 11;
369
+ _context4.next = 14;
360
370
  return Promise.all([(0, _getTopoData.addLinkData)(data), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(data)), dispatch.customIcon.loadCustomIcons()]);
361
371
 
362
- case 11:
372
+ case 14:
363
373
  _yield$Promise$all = _context4.sent;
364
374
  dataWithLinkDetail = _yield$Promise$all[0];
365
375
  _combTopoData = (0, _topoData.combTopoData)({
@@ -386,7 +396,7 @@ function _default(topoApp) {
386
396
  topoDataTrans: topoDataTrans
387
397
  });
388
398
 
389
- case 19:
399
+ case 22:
390
400
  case "end":
391
401
  return _context4.stop();
392
402
  }
@@ -416,7 +426,7 @@ function _default(topoApp) {
416
426
  }))
417
427
  };
418
428
 
419
- _rlog["default"].debug('saveGlobalConfig', config);
429
+ _rlog["default"].debug("saveGlobalConfig", config);
420
430
 
421
431
  _context5.next = 5;
422
432
  return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
@@ -485,6 +495,33 @@ function _default(topoApp) {
485
495
  switchToViewMode: function switchToViewMode() {
486
496
  this.reset();
487
497
  dispatch.topoMod.switchToViewMode();
498
+ },
499
+ queryAllLinkByIp: function queryAllLinkByIp(data) {
500
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
501
+ var _result$data;
502
+
503
+ var ids, ip, result;
504
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
505
+ while (1) {
506
+ switch (_context8.prev = _context8.next) {
507
+ case 0:
508
+ ids = data.ids, ip = data.ip;
509
+ console.log("queryAllLinkByIp", ids, ip);
510
+ _context8.next = 4;
511
+ return _networkLink["default"].queryLinksByIp(ids, ip);
512
+
513
+ case 4:
514
+ result = _context8.sent;
515
+ console.log("queryAllLinkByIp-result", result);
516
+ return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
517
+
518
+ case 7:
519
+ case "end":
520
+ return _context8.stop();
521
+ }
522
+ }
523
+ }, _callee8);
524
+ }))();
488
525
  }
489
526
  };
490
527
  }
@@ -27,6 +27,58 @@ var Test = /*#__PURE__*/function () {
27
27
  _proto.onReady = function onReady() {// TODO 待移除测试代码
28
28
  // this.iconManage.openUpload()
29
29
  // this.topo.store.getModelDispatchers('linkDynamicStyleConfig').open({type: 'networkLink'});
30
+ }
31
+ /**
32
+ * 关联IP示例代码
33
+ */
34
+ ;
35
+
36
+ _proto.createExportLink = function createExportLink() {
37
+ var htTopo = this.topo.getHtTopo();
38
+ var dm = htTopo.getGraphView().dm(); // 设置节点关联IP
39
+
40
+ var nodeElement = htTopo.getGraphView().sm().fd();
41
+ var ip = {
42
+ 'id': 'ip:1.1.1.1',
43
+ 'name': '1.1.1.1',
44
+ customName: null,
45
+ // 'groupId': null,
46
+ // 'groupTag': null,
47
+ 'ipAddress': '1.1.1.1',
48
+ // 'attributes': [],
49
+ // 'metrics': [],
50
+ 'type': 'node' // 'dtype': 'device'
51
+
52
+ };
53
+ nodeElement.a(ip);
54
+ nodeElement.setTag('ip:1.1.1.1');
55
+ var link = {
56
+ 'id': '0000000019b462d1',
57
+ 'name': '172.17.160.116(Gi2/2/0/1) - 172.27.130.13(Gi 0/9)',
58
+ 'source': '00000000029f9411',
59
+ 'target': 'ip:1.1.1.1',
60
+ 'operation': 'delete',
61
+ 'interfaceSource': '0000000018080aee',
62
+ 'interfaceTarget': '000000000341b015',
63
+ 'ciType': 'network_link',
64
+ 'attributes': [],
65
+ 'manageStatus': 0,
66
+ 'permission': {
67
+ 'readable': true,
68
+ 'writeable': true,
69
+ 'deleteable': true
70
+ },
71
+ 'metrics': [],
72
+ 'type': 'link',
73
+ 'dtype': 'link'
74
+ };
75
+ var createElementsData = {
76
+ groups: [],
77
+ nodes: [],
78
+ links: [link],
79
+ linkGroups: []
80
+ };
81
+ htTopo.createElements(createElementsData);
30
82
  };
31
83
 
32
84
  return Test;
@@ -12,7 +12,7 @@ var _htElementUtils = require("../../utils/htElementUtils");
12
12
  function fixLink(topo) {
13
13
  var linkDatas = topo.dataModel.getEdges();
14
14
  var dm = topo.getHtTopo().getGraphView().dm();
15
- var edges = (0, _htElementUtils.getEdges)(dm);
15
+ var edges = (0, _htElementUtils.getElements)(dm).filter(_htElementUtils.isEdge);
16
16
  edges.forEach(function (edge) {
17
17
  var source = edge.getSource();
18
18
  var target = edge.getTarget();
@@ -21,15 +21,20 @@ function fixLink(topo) {
21
21
  }); // TODO 判断两端互相切换
22
22
  // const isChange =
23
23
 
24
- if (linkData && source.getTag() !== linkData.source) {
24
+ if (linkData && (source === null || source === void 0 ? void 0 : source.getTag()) !== linkData.source) {
25
25
  var node = dm.getDataByTag(linkData.source);
26
- edge.setSource(node);
26
+
27
+ if (node) {
28
+ edge.setSource(node);
29
+ }
27
30
  }
28
31
 
29
- if (linkData && linkData.target && target.getTag() !== linkData.target) {
32
+ if (linkData && linkData.target && (target === null || target === void 0 ? void 0 : target.getTag()) !== linkData.target) {
30
33
  var _node = dm.getDataByTag(linkData.target);
31
34
 
32
- edge.setTarget(_node);
35
+ if (_node) {
36
+ edge.setTarget(_node);
37
+ }
33
38
  } // TODO 两端互相切换,交换两端样式
34
39
 
35
40
  });
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports["default"] = BaseInfo;
7
7
 
8
+ var _switch = _interopRequireDefault(require("@alifd/next/lib/switch"));
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
9
11
 
10
12
  var _indexModule = _interopRequireDefault(require("./index.module.scss"));
@@ -64,6 +66,12 @@ function BaseInfo(props) {
64
66
  data = props.data,
65
67
  baseInfo = props.baseInfo,
66
68
  renderContent = props.renderContent;
69
+
70
+ var onChange = function onChange(checked) {
71
+ topo.topoCrucialLinkFn([data.id], !checked);
72
+ };
73
+
74
+ var defaultChecked = topo.dataModel.getDataById(data.id).attributes['network_link.is_crucial'] || false;
67
75
  var content = renderContent ? renderContent({
68
76
  type: type,
69
77
  data: data,
@@ -79,5 +87,11 @@ function BaseInfo(props) {
79
87
 
80
88
  return /*#__PURE__*/_react["default"].createElement("div", {
81
89
  className: _indexModule["default"]["base-info"]
82
- }, content);
90
+ }, content, type == 'link' && /*#__PURE__*/_react["default"].createElement("div", {
91
+ className: _indexModule["default"].isCrucialLink
92
+ }, "\u662F\u5426\u5173\u952E\uFF1A", /*#__PURE__*/_react["default"].createElement(_switch["default"], {
93
+ defaultChecked: defaultChecked,
94
+ onChange: onChange,
95
+ size: "small"
96
+ })));
83
97
  }
@@ -53,8 +53,6 @@ var _LinkTopoCard = _interopRequireDefault(require("./components/LinkTopo/LinkTo
53
53
 
54
54
  var _EventsCard = _interopRequireDefault(require("./EventsCard"));
55
55
 
56
- var _services2 = require("./components/LinkTopo/services");
57
-
58
56
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
59
57
 
60
58
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -726,7 +724,7 @@ function ResourceOverview(props) {
726
724
  _metricColChange = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(col) {
727
725
  var _col2, _col3;
728
726
 
729
- var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
727
+ var codes, endTime, params, _ref5, times, metricList, metricLists;
730
728
 
731
729
  return _regenerator["default"].wrap(function _callee8$(_context8) {
732
730
  while (1) {
@@ -774,16 +772,7 @@ function ResourceOverview(props) {
774
772
 
775
773
  case 11:
776
774
  metricList = _context8.sent;
777
- _context8.next = 14;
778
- return queryMetricList({
779
- 'name': data.attributes.display_name
780
- }, {
781
- 'id': data.attributes.name
782
- });
783
-
784
- case 14:
785
- newMetricList = _context8.sent;
786
- metricLists = metricList.concat(getNewMetricList(newMetricList));
775
+ metricLists = metricList.concat(getNewMetricList());
787
776
 
788
777
  _rlog.rlog.debug('metricColChange', metricLists, monitorMetricModels);
789
778
 
@@ -811,7 +800,7 @@ function ResourceOverview(props) {
811
800
  }, 60000);
812
801
  }
813
802
 
814
- case 20:
803
+ case 17:
815
804
  case "end":
816
805
  return _context8.stop();
817
806
  }
@@ -821,73 +810,12 @@ function ResourceOverview(props) {
821
810
  return _metricColChange.apply(this, arguments);
822
811
  }
823
812
 
824
- function queryMetricList(_x9, _x10) {
825
- return _queryMetricList.apply(this, arguments);
826
- }
827
-
828
- function _queryMetricList() {
829
- _queryMetricList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data, param) {
830
- var checkMenus, isOpen, list;
831
- return _regenerator["default"].wrap(function _callee9$(_context9) {
832
- while (1) {
833
- switch (_context9.prev = _context9.next) {
834
- case 0:
835
- if (!(ciType !== 'network_link')) {
836
- _context9.next = 2;
837
- break;
838
- }
839
-
840
- return _context9.abrupt("return", []);
841
-
842
- case 2:
843
- _context9.next = 4;
844
- return (0, _services2.checkMenu)();
845
-
846
- case 4:
847
- checkMenus = _context9.sent;
848
-
849
- if (!(checkMenus[0].passed == 'PASS')) {
850
- _context9.next = 14;
851
- break;
852
- }
853
-
854
- _context9.next = 8;
855
- return (0, _services2.isOpenFlow)(data);
856
-
857
- case 8:
858
- isOpen = _context9.sent;
859
-
860
- if (!isOpen) {
861
- _context9.next = 14;
862
- break;
863
- }
864
-
865
- _context9.next = 12;
866
- return (0, _services2.queryLastestValue)(param);
867
-
868
- case 12:
869
- list = _context9.sent;
870
- return _context9.abrupt("return", list);
871
-
872
- case 14:
873
- return _context9.abrupt("return", []);
874
-
875
- case 15:
876
- case "end":
877
- return _context9.stop();
878
- }
879
- }
880
- }, _callee9);
881
- }));
882
- return _queryMetricList.apply(this, arguments);
883
- }
884
-
885
- var getNewMetricList = function getNewMetricList(data) {
813
+ var getNewMetricList = function getNewMetricList() {
886
814
  return [{
887
815
  errorMsg: null,
888
816
  mainCiId: "netDelayRatio",
889
817
  metricCode: "netDelayRatio",
890
- metricValue: data.upNetDelayRatio + ' ms' + '|' + data.downNetDelayRatio + ' ms',
818
+ metricValue: '0',
891
819
  subCiId: '',
892
820
  subCiType: null,
893
821
  mainCiType: null
@@ -895,7 +823,7 @@ function ResourceOverview(props) {
895
823
  errorMsg: null,
896
824
  mainCiId: "retansRatio",
897
825
  metricCode: "retansRatio",
898
- metricValue: data.upRetransRatio + ' %' + '|' + data.downRetansRatio + ' %',
826
+ metricValue: '0',
899
827
  subCiId: '',
900
828
  subCiType: null,
901
829
  mainCiType: null
@@ -959,6 +887,7 @@ function ResourceOverview(props) {
959
887
  ciTypeMeta: ciTypeMeta,
960
888
  baseInfo: baseInfo,
961
889
  isAppTopo: isAppTopo,
890
+ topo: topo,
962
891
  headerExtra: function headerExtra(p) {
963
892
  var _resourceOverviewProp3;
964
893
 
@@ -25,6 +25,20 @@ function LinkTopo(props) {
25
25
  linkCi: data,
26
26
  linkMetricCodes: linkMetricCodes
27
27
  });
28
+ var linkMetrics = [].concat(metricData.linkMetrics, metricData.linkOther);
29
+ var linkMetricsList = [];
30
+
31
+ if (linkMetrics.length > 0) {
32
+ linkMetricCodes.forEach(function (e) {
33
+ var linkMetricsData = linkMetrics.filter(function (i) {
34
+ return e == i.code;
35
+ });
36
+ if (linkMetricsData.length > 0) linkMetricsList.push(linkMetricsData[0]);
37
+ });
38
+ metricData.linkMetrics = linkMetricsList;
39
+ metricData.linkOther = [];
40
+ }
41
+
28
42
  return /*#__PURE__*/_react["default"].createElement("div", {
29
43
  className: _LinkTopoModule["default"].container
30
44
  }, /*#__PURE__*/_react["default"].createElement(_componentCrucialLinkTopo["default"], (0, _extends2["default"])({