@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,8 +1,8 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import keyBy from 'lodash/keyBy';
5
- import _ from 'lodash';
4
+ import keyBy from "lodash/keyBy";
5
+ import _ from "lodash";
6
6
  import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
7
7
 
8
8
  import { getEdges } from "../../../utils/htElementUtils";
@@ -18,24 +18,24 @@ import CiCache from "../cache/CiCache"; // const interfaceTypeMap = {
18
18
 
19
19
  /**
20
20
  * 是否关键链路
21
- * @param {*} link
22
- * @returns
21
+ * @param {*} link
22
+ * @returns
23
23
  */
24
24
 
25
25
  export function isCrucialLink(link) {
26
- return !!link.attributes['network_link.is_crucial'];
26
+ return !!link.attributes["network_link.is_crucial"];
27
27
  }
28
28
  /**
29
29
  * 是否出口链路
30
- * @param {*} link
31
- * @returns
30
+ * @param {*} link
31
+ * @returns
32
32
  */
33
33
 
34
34
  export function isExitLink(link) {
35
- return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
35
+ return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
36
36
  }
37
37
  export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
38
- var linkCiMap = keyBy(links, 'id');
38
+ var linkCiMap = keyBy(links, "id");
39
39
  return links.map(function (link) {
40
40
  var _interfaceCiMap$attri, _interfaceCiMap$attri2;
41
41
 
@@ -44,19 +44,26 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceD
44
44
  var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
45
45
 
46
46
  var sourceNode = nodes.find(function (node) {
47
- return node.id === attributes['network_link.source_device_id'];
47
+ return node.id === attributes["network_link.source_device_id"];
48
48
  });
49
49
  var targetNode = nodes.find(function (node) {
50
- return node.id === attributes['network_link.destination_device_id'];
51
- }); // 翻译
50
+ return node.id === attributes["network_link.destination_device_id"];
51
+ });
52
+ var target = link.target; // 目的端为ip节点
53
+
54
+ if (attributes["destination_type"] === "ip") {
55
+ target = "ip:" + attributes["network_link.destination_ipv4"];
56
+ } // 翻译
57
+
52
58
 
53
59
  return _extends({}, link, {
60
+ target: target,
54
61
  attributes: _extends({}, attributes, {
55
62
  // 源/目的设备
56
- 'network_link.source_device_id_object': {
63
+ "network_link.source_device_id_object": {
57
64
  displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
58
65
  },
59
- 'network_link.destination_device_id_object': {
66
+ "network_link.destination_device_id_object": {
60
67
  displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
61
68
  },
62
69
  // 源/目的接口类型
@@ -64,10 +71,10 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceD
64
71
  destination_type_object: interfaceDoc[attributes.destination_type],
65
72
  // 源/目的接口
66
73
  source_id_object: {
67
- displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes['display_name']
74
+ displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
68
75
  },
69
76
  destination_id_object: {
70
- displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes['display_name']
77
+ displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
71
78
  }
72
79
  })
73
80
  });
@@ -106,7 +113,7 @@ function _getLinksDetail() {
106
113
  }), linkCis.map(function (item) {
107
114
  return item.attributes.destination_type;
108
115
  })))).filter(function (item) {
109
- return item !== 'ip';
116
+ return item !== "ip";
110
117
  });
111
118
  _context.next = 7;
112
119
  return CiCache.load(interfaceIds);
@@ -147,10 +154,10 @@ export var compatibleWith = function compatibleWith(value) {
147
154
 
148
155
  export var plurals = {
149
156
  0: [],
150
- 1: ['phy'],
151
- 2: ['phy'],
152
- 3: ['agg'],
153
- 4: ['phy', 'agg']
157
+ 1: ["phy"],
158
+ 2: ["phy"],
159
+ 3: ["agg"],
160
+ 4: ["phy", "agg"]
154
161
  };
155
162
  export var showLinkByConfig = function showLinkByConfig(props) {
156
163
  var _plurals$compatibleWi;
@@ -165,27 +172,45 @@ export var showLinkByConfig = function showLinkByConfig(props) {
165
172
  var dm = gv.getDataModel();
166
173
  var edges = getEdges(dm); // console.log("edges", edges);
167
174
 
168
- var showPhy = types.indexOf('phy') >= 0;
169
- var showAgg = types.indexOf('agg') >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
175
+ var showPhy = types.indexOf("phy") >= 0;
176
+ var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
170
177
 
171
178
  if (Array.isArray(edges) && edges.length > 0) {
172
179
  edges.map(function (edge) {
173
180
  if (showType === 1 || showType === true) {
174
181
  // 单链路全部显示
175
182
  // console.log("单链路全部显示", edge);
176
- edge.s('2d.visible', true);
183
+ edge.s("2d.visible", true);
177
184
  } else {
178
185
  var _d$attributes, _d$attributes2;
179
186
 
180
187
  var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
181
188
 
182
- 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') {
183
- edge.s('2d.visible', showAgg);
189
+ 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") {
190
+ edge.s("2d.visible", showAgg);
184
191
  } else {
185
192
  // console.log("edge", edge, d, showAgg);
186
- edge.s('2d.visible', showPhy);
193
+ edge.s("2d.visible", showPhy);
187
194
  }
188
195
  }
189
196
  });
190
197
  }
198
+ };
199
+ export var mergeExportLinkData = function mergeExportLinkData(props) {
200
+ var source = props.source,
201
+ target = props.target,
202
+ link = props.link;
203
+ var attrObj = link.attributes;
204
+
205
+ var linkData = _extends({}, link, {
206
+ name: attrObj.name,
207
+ source: attrObj["network_link.source_device_id"],
208
+ target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
209
+ operation: attrObj.operation,
210
+ interfaceSource: attrObj["source_id"],
211
+ interfaceTarget: attrObj["destination_id"],
212
+ ciType: link.typeCode
213
+ });
214
+
215
+ return linkData;
191
216
  };
@@ -13,6 +13,7 @@ import { removeFromArray } from "../../../utils/format";
13
13
  import { DEFAULT_GROUP } from "../../../utils/template";
14
14
  import { combTopoData, getCiTypes } from "../../../utils/topoData";
15
15
  import { saveTopo as _saveTopo, resToConditions, getLayoutId } from "../../../core/models/topoData";
16
+ import networkLinkServer from "../../../networkTopo/services/topo/networkLink";
16
17
  import { addLinkData, buildData as buildTopoData } from "../../../networkTopo/getTopoData";
17
18
 
18
19
  var newGroupWithUUID = function newGroupWithUUID(group) {
@@ -244,24 +245,26 @@ export default function (topoApp) {
244
245
  var _this2 = this;
245
246
 
246
247
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
247
- var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
248
+ var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, _editState$ipNodes, ipNodes, query, data;
248
249
 
249
250
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
250
251
  while (1) {
251
252
  switch (_context2.prev = _context2.next) {
252
253
  case 0:
253
254
  editState = rootState.topoConfig;
254
- 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;
255
+ 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;
256
+ console.log("editState", editState);
255
257
  query = {
256
258
  id: rootState.topoMod.topoId,
257
259
  resources: resources,
258
260
  groups: groups,
259
- exportLinkIdList: exportLinkIdList
261
+ exportLinkIdList: exportLinkIdList,
262
+ ipNodes: ipNodes
260
263
  };
261
- _context2.next = 5;
264
+ _context2.next = 6;
262
265
  return _this2.getTopoByConditions(query);
263
266
 
264
- case 5:
267
+ case 6:
265
268
  data = _context2.sent;
266
269
  rlog.debug("按配置查询拓扑数据", {
267
270
  config: {
@@ -272,7 +275,7 @@ export default function (topoApp) {
272
275
  });
273
276
  return _context2.abrupt("return", data);
274
277
 
275
- case 8:
278
+ case 9:
276
279
  case "end":
277
280
  return _context2.stop();
278
281
  }
@@ -308,36 +311,37 @@ export default function (topoApp) {
308
311
  var _this4 = this;
309
312
 
310
313
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
311
- var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
314
+ var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
312
315
 
313
316
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
314
317
  while (1) {
315
318
  switch (_context4.prev = _context4.next) {
316
319
  case 0:
317
- // rlog.debug("getTopoByConditions--------", params);
318
- topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
320
+ rlog.debug("getTopoByConditions--------", params);
321
+ topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
319
322
  viewConditions = resToConditions(resources);
320
323
  groupInfo = isAvailableArray(groups) && groups.map(function (group) {
321
324
  return _extends({}, group, {
322
325
  layout: getLayoutId(group.layout),
323
326
  resources: resToConditions(group.resources)
324
327
  });
325
- }); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
326
-
327
- _context4.next = 5;
328
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
328
+ });
329
+ rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
330
+ _context4.next = 7;
331
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
329
332
 
330
- case 5:
333
+ case 7:
331
334
  data = _context4.sent;
332
- _context4.next = 8;
335
+ rlog.debug("getTopoByConditions--------data", data);
336
+ _context4.next = 11;
333
337
  return buildTopoData(data);
334
338
 
335
- case 8:
339
+ case 11:
336
340
  data = _context4.sent;
337
- _context4.next = 11;
341
+ _context4.next = 14;
338
342
  return Promise.all([addLinkData(data), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
339
343
 
340
- case 11:
344
+ case 14:
341
345
  _yield$Promise$all = _context4.sent;
342
346
  dataWithLinkDetail = _yield$Promise$all[0];
343
347
  _combTopoData = combTopoData({
@@ -364,7 +368,7 @@ export default function (topoApp) {
364
368
  topoDataTrans: topoDataTrans
365
369
  });
366
370
 
367
- case 19:
371
+ case 22:
368
372
  case "end":
369
373
  return _context4.stop();
370
374
  }
@@ -393,7 +397,7 @@ export default function (topoApp) {
393
397
  }].concat(displayConfig.saveHistories || [])
394
398
  }))
395
399
  };
396
- rlog.debug('saveGlobalConfig', config);
400
+ rlog.debug("saveGlobalConfig", config);
397
401
  _context5.next = 5;
398
402
  return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
399
403
 
@@ -461,6 +465,33 @@ export default function (topoApp) {
461
465
  switchToViewMode: function switchToViewMode() {
462
466
  this.reset();
463
467
  dispatch.topoMod.switchToViewMode();
468
+ },
469
+ queryAllLinkByIp: function queryAllLinkByIp(data) {
470
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
471
+ var _result$data;
472
+
473
+ var ids, ip, result;
474
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
475
+ while (1) {
476
+ switch (_context8.prev = _context8.next) {
477
+ case 0:
478
+ ids = data.ids, ip = data.ip;
479
+ console.log("queryAllLinkByIp", ids, ip);
480
+ _context8.next = 4;
481
+ return networkLinkServer.queryLinksByIp(ids, ip);
482
+
483
+ case 4:
484
+ result = _context8.sent;
485
+ console.log("queryAllLinkByIp-result", result);
486
+ return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
487
+
488
+ case 7:
489
+ case "end":
490
+ return _context8.stop();
491
+ }
492
+ }
493
+ }, _callee8);
494
+ }))();
464
495
  }
465
496
  };
466
497
  }
@@ -22,6 +22,58 @@ var Test = /*#__PURE__*/function () {
22
22
  _proto.onReady = function onReady() {// TODO 待移除测试代码
23
23
  // this.iconManage.openUpload()
24
24
  // this.topo.store.getModelDispatchers('linkDynamicStyleConfig').open({type: 'networkLink'});
25
+ }
26
+ /**
27
+ * 关联IP示例代码
28
+ */
29
+ ;
30
+
31
+ _proto.createExportLink = function createExportLink() {
32
+ var htTopo = this.topo.getHtTopo();
33
+ var dm = htTopo.getGraphView().dm(); // 设置节点关联IP
34
+
35
+ var nodeElement = htTopo.getGraphView().sm().fd();
36
+ var ip = {
37
+ 'id': 'ip:1.1.1.1',
38
+ 'name': '1.1.1.1',
39
+ customName: null,
40
+ // 'groupId': null,
41
+ // 'groupTag': null,
42
+ 'ipAddress': '1.1.1.1',
43
+ // 'attributes': [],
44
+ // 'metrics': [],
45
+ 'type': 'node' // 'dtype': 'device'
46
+
47
+ };
48
+ nodeElement.a(ip);
49
+ nodeElement.setTag('ip:1.1.1.1');
50
+ var link = {
51
+ 'id': '0000000019b462d1',
52
+ 'name': '172.17.160.116(Gi2/2/0/1) - 172.27.130.13(Gi 0/9)',
53
+ 'source': '00000000029f9411',
54
+ 'target': 'ip:1.1.1.1',
55
+ 'operation': 'delete',
56
+ 'interfaceSource': '0000000018080aee',
57
+ 'interfaceTarget': '000000000341b015',
58
+ 'ciType': 'network_link',
59
+ 'attributes': [],
60
+ 'manageStatus': 0,
61
+ 'permission': {
62
+ 'readable': true,
63
+ 'writeable': true,
64
+ 'deleteable': true
65
+ },
66
+ 'metrics': [],
67
+ 'type': 'link',
68
+ 'dtype': 'link'
69
+ };
70
+ var createElementsData = {
71
+ groups: [],
72
+ nodes: [],
73
+ links: [link],
74
+ linkGroups: []
75
+ };
76
+ htTopo.createElements(createElementsData);
25
77
  };
26
78
 
27
79
  return Test;
@@ -1,4 +1,4 @@
1
- import { getEdges } from "../../utils/htElementUtils";
1
+ import { getElements, isEdge } from "../../utils/htElementUtils";
2
2
  /**
3
3
  * 连线两端节点变更时更新显示。如果两端互相切换,切换两端样式
4
4
  * @param {*} topo
@@ -7,7 +7,7 @@ import { getEdges } from "../../utils/htElementUtils";
7
7
  export function fixLink(topo) {
8
8
  var linkDatas = topo.dataModel.getEdges();
9
9
  var dm = topo.getHtTopo().getGraphView().dm();
10
- var edges = getEdges(dm);
10
+ var edges = getElements(dm).filter(isEdge);
11
11
  edges.forEach(function (edge) {
12
12
  var source = edge.getSource();
13
13
  var target = edge.getTarget();
@@ -16,15 +16,20 @@ export function fixLink(topo) {
16
16
  }); // TODO 判断两端互相切换
17
17
  // const isChange =
18
18
 
19
- if (linkData && source.getTag() !== linkData.source) {
19
+ if (linkData && (source === null || source === void 0 ? void 0 : source.getTag()) !== linkData.source) {
20
20
  var node = dm.getDataByTag(linkData.source);
21
- edge.setSource(node);
21
+
22
+ if (node) {
23
+ edge.setSource(node);
24
+ }
22
25
  }
23
26
 
24
- if (linkData && linkData.target && target.getTag() !== linkData.target) {
27
+ if (linkData && linkData.target && (target === null || target === void 0 ? void 0 : target.getTag()) !== linkData.target) {
25
28
  var _node = dm.getDataByTag(linkData.target);
26
29
 
27
- edge.setTarget(_node);
30
+ if (_node) {
31
+ edge.setTarget(_node);
32
+ }
28
33
  } // TODO 两端互相切换,交换两端样式
29
34
 
30
35
  });
@@ -1,7 +1,9 @@
1
+ import _Switch from "@alifd/next/es/switch";
1
2
  import React from "react"; // import { Link } from "react-router-dom";
2
3
 
3
- import styles from "./index.module.scss"; // url 处理,UICBB 的地址需截取前缀
4
+ import styles from "./index.module.scss";
4
5
 
6
+ // url 处理,UICBB 的地址需截取前缀
5
7
  function formatUrl(url) {
6
8
  var _window, _window$location;
7
9
 
@@ -55,6 +57,12 @@ export default function BaseInfo(props) {
55
57
  data = props.data,
56
58
  baseInfo = props.baseInfo,
57
59
  renderContent = props.renderContent;
60
+
61
+ var onChange = function onChange(checked) {
62
+ topo.topoCrucialLinkFn([data.id], !checked);
63
+ };
64
+
65
+ var defaultChecked = topo.dataModel.getDataById(data.id).attributes['network_link.is_crucial'] || false;
58
66
  var content = renderContent ? renderContent({
59
67
  type: type,
60
68
  data: data,
@@ -70,5 +78,11 @@ export default function BaseInfo(props) {
70
78
 
71
79
  return /*#__PURE__*/React.createElement("div", {
72
80
  className: styles["base-info"]
73
- }, content);
81
+ }, content, type == 'link' && /*#__PURE__*/React.createElement("div", {
82
+ className: styles.isCrucialLink
83
+ }, "\u662F\u5426\u5173\u952E\uFF1A", /*#__PURE__*/React.createElement(_Switch, {
84
+ defaultChecked: defaultChecked,
85
+ onChange: onChange,
86
+ size: "small"
87
+ })));
74
88
  }
@@ -29,8 +29,7 @@ import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
29
29
  import Configurator from "./components/Configurator";
30
30
  import { formatMetric } from "../../../../../../models/attributeFormatter";
31
31
  import LinkTopoCard from "./components/LinkTopo/LinkTopoCard";
32
- import EventsCard from "./EventsCard";
33
- import { checkMenu, isOpenFlow, queryLastestValue } from "./components/LinkTopo/services"; // url 处理,UICBB 的地址需截取前缀
32
+ import EventsCard from "./EventsCard"; // url 处理,UICBB 的地址需截取前缀
34
33
 
35
34
  function formatUrl(url) {
36
35
  var _window, _window$location;
@@ -692,7 +691,7 @@ export default function ResourceOverview(props) {
692
691
  _metricColChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(col) {
693
692
  var _col2, _col3;
694
693
 
695
- var codes, endTime, params, _ref5, times, metricList, newMetricList, metricLists;
694
+ var codes, endTime, params, _ref5, times, metricList, metricLists;
696
695
 
697
696
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
698
697
  while (1) {
@@ -740,16 +739,7 @@ export default function ResourceOverview(props) {
740
739
 
741
740
  case 11:
742
741
  metricList = _context8.sent;
743
- _context8.next = 14;
744
- return queryMetricList({
745
- 'name': data.attributes.display_name
746
- }, {
747
- 'id': data.attributes.name
748
- });
749
-
750
- case 14:
751
- newMetricList = _context8.sent;
752
- metricLists = metricList.concat(getNewMetricList(newMetricList));
742
+ metricLists = metricList.concat(getNewMetricList());
753
743
  rlog.debug('metricColChange', metricLists, monitorMetricModels);
754
744
  setMetric(col.map(function (item, key) {
755
745
  return {
@@ -775,7 +765,7 @@ export default function ResourceOverview(props) {
775
765
  }, 60000);
776
766
  }
777
767
 
778
- case 20:
768
+ case 17:
779
769
  case "end":
780
770
  return _context8.stop();
781
771
  }
@@ -785,73 +775,12 @@ export default function ResourceOverview(props) {
785
775
  return _metricColChange.apply(this, arguments);
786
776
  }
787
777
 
788
- function queryMetricList(_x9, _x10) {
789
- return _queryMetricList.apply(this, arguments);
790
- }
791
-
792
- function _queryMetricList() {
793
- _queryMetricList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, param) {
794
- var checkMenus, isOpen, list;
795
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
796
- while (1) {
797
- switch (_context9.prev = _context9.next) {
798
- case 0:
799
- if (!(ciType !== 'network_link')) {
800
- _context9.next = 2;
801
- break;
802
- }
803
-
804
- return _context9.abrupt("return", []);
805
-
806
- case 2:
807
- _context9.next = 4;
808
- return checkMenu();
809
-
810
- case 4:
811
- checkMenus = _context9.sent;
812
-
813
- if (!(checkMenus[0].passed == 'PASS')) {
814
- _context9.next = 14;
815
- break;
816
- }
817
-
818
- _context9.next = 8;
819
- return isOpenFlow(data);
820
-
821
- case 8:
822
- isOpen = _context9.sent;
823
-
824
- if (!isOpen) {
825
- _context9.next = 14;
826
- break;
827
- }
828
-
829
- _context9.next = 12;
830
- return queryLastestValue(param);
831
-
832
- case 12:
833
- list = _context9.sent;
834
- return _context9.abrupt("return", list);
835
-
836
- case 14:
837
- return _context9.abrupt("return", []);
838
-
839
- case 15:
840
- case "end":
841
- return _context9.stop();
842
- }
843
- }
844
- }, _callee9);
845
- }));
846
- return _queryMetricList.apply(this, arguments);
847
- }
848
-
849
- var getNewMetricList = function getNewMetricList(data) {
778
+ var getNewMetricList = function getNewMetricList() {
850
779
  return [{
851
780
  errorMsg: null,
852
781
  mainCiId: "netDelayRatio",
853
782
  metricCode: "netDelayRatio",
854
- metricValue: data.upNetDelayRatio + ' ms' + '|' + data.downNetDelayRatio + ' ms',
783
+ metricValue: '0',
855
784
  subCiId: '',
856
785
  subCiType: null,
857
786
  mainCiType: null
@@ -859,7 +788,7 @@ export default function ResourceOverview(props) {
859
788
  errorMsg: null,
860
789
  mainCiId: "retansRatio",
861
790
  metricCode: "retansRatio",
862
- metricValue: data.upRetransRatio + ' %' + '|' + data.downRetansRatio + ' %',
791
+ metricValue: '0',
863
792
  subCiId: '',
864
793
  subCiType: null,
865
794
  mainCiType: null
@@ -922,6 +851,7 @@ export default function ResourceOverview(props) {
922
851
  ciTypeMeta: ciTypeMeta,
923
852
  baseInfo: baseInfo,
924
853
  isAppTopo: isAppTopo,
854
+ topo: topo,
925
855
  headerExtra: function headerExtra(p) {
926
856
  var _resourceOverviewProp3;
927
857
 
@@ -12,6 +12,20 @@ export default function LinkTopo(props) {
12
12
  linkCi: data,
13
13
  linkMetricCodes: linkMetricCodes
14
14
  });
15
+ var linkMetrics = [].concat(metricData.linkMetrics, metricData.linkOther);
16
+ var linkMetricsList = [];
17
+
18
+ if (linkMetrics.length > 0) {
19
+ linkMetricCodes.forEach(function (e) {
20
+ var linkMetricsData = linkMetrics.filter(function (i) {
21
+ return e == i.code;
22
+ });
23
+ if (linkMetricsData.length > 0) linkMetricsList.push(linkMetricsData[0]);
24
+ });
25
+ metricData.linkMetrics = linkMetricsList;
26
+ metricData.linkOther = [];
27
+ }
28
+
15
29
  return /*#__PURE__*/React.createElement("div", {
16
30
  className: styles.container
17
31
  }, /*#__PURE__*/React.createElement(CrucialLinkTopo, _extends({