@riil-frontend/component-topology 13.0.0-dev.8 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/build/index.js +29 -29
  2. package/es/components/ColorPanel/index.js +68 -58
  3. package/es/core/components/AlarmListPanel/components/AlarmListItem.js +10 -1
  4. package/es/core/components/AlarmListPanel/index.js +2 -1
  5. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +6 -5
  6. package/es/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +10 -4
  7. package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +21 -15
  8. package/es/core/hooks/useGraphAlarmDisplay.js +45 -18
  9. package/es/core/hooks/useLinkAlarmDisplay.js +163 -0
  10. package/es/core/hooks/useManageStatus.js +1 -0
  11. package/es/core/hooks/usePolling.js +78 -24
  12. package/es/core/hooks/useResourceConfig.js +1 -2
  13. package/es/core/hooks/useTopoEdit.js +2 -1
  14. package/es/core/models/TopoApp.js +1 -1
  15. package/es/core/models/topoData.js +3 -4
  16. package/es/core/models/utils/linkUtils.js +30 -24
  17. package/es/core/store/models/topoConfig.js +6 -7
  18. package/es/core/store/models/topoMod.js +3 -6
  19. package/es/core/utils/graphLinkUtil.js +1 -0
  20. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +2 -1
  21. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +3 -2
  22. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +4 -2
  23. package/es/networkTopo/services/topo/basic.js +18 -16
  24. package/es/networkTopo/utils/relateTopoDataUtil.js +43 -8
  25. package/es/utils/ResourceConfigUtil.js +1 -16
  26. package/lib/components/ColorPanel/index.js +71 -59
  27. package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +10 -1
  28. package/lib/core/components/AlarmListPanel/index.js +2 -1
  29. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +6 -5
  30. package/lib/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +10 -4
  31. package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +21 -15
  32. package/lib/core/hooks/useGraphAlarmDisplay.js +46 -18
  33. package/lib/core/hooks/useLinkAlarmDisplay.js +175 -0
  34. package/lib/core/hooks/useManageStatus.js +1 -0
  35. package/lib/core/hooks/usePolling.js +73 -19
  36. package/lib/core/hooks/useResourceConfig.js +1 -2
  37. package/lib/core/hooks/useTopoEdit.js +2 -1
  38. package/lib/core/models/TopoApp.js +1 -1
  39. package/lib/core/models/topoData.js +3 -4
  40. package/lib/core/models/utils/linkUtils.js +30 -24
  41. package/lib/core/store/models/topoConfig.js +6 -7
  42. package/lib/core/store/models/topoMod.js +3 -6
  43. package/lib/core/utils/graphLinkUtil.js +1 -0
  44. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +2 -1
  45. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +3 -2
  46. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +4 -2
  47. package/lib/networkTopo/services/topo/basic.js +18 -18
  48. package/lib/networkTopo/utils/relateTopoDataUtil.js +44 -8
  49. package/lib/utils/ResourceConfigUtil.js +1 -16
  50. package/package.json +2 -2
  51. package/es/networkTopo/utils/__tests__/relateTopoData.js +0 -110
  52. package/lib/networkTopo/utils/__tests__/relateTopoData.js +0 -115
@@ -1,15 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { useEffect } from 'react';
5
- import { useRequest } from 'ahooks';
6
- import _ from 'lodash';
7
- import Logger from 'loglevel';
8
- import { useCbbEventListener } from '@riil-frontend/component-riil-event-emitter';
4
+ import { useEffect } from "react";
5
+ import { useRequest } from "ahooks";
6
+ import _ from "lodash";
7
+ import Logger from "loglevel";
8
+ import { useCbbEventListener } from "@riil-frontend/component-riil-event-emitter";
9
9
  import DictCache from "../models/cache/DictCache";
10
10
  import useCiAttributeChange from "./useCiAttributeChange";
11
11
  import useHtDataPropertyChangeListener from "./ht/useHtDataPropertyChangeListener";
12
- var rlog = Logger.getLogger('topo');
12
+ var rlog = Logger.getLogger("topo");
13
13
  /**
14
14
  * 轮询获取指标hooks
15
15
  * @param {*} props
@@ -21,15 +21,15 @@ var usePolling = function usePolling(props) {
21
21
  useCiAttributeChange({
22
22
  topo: topo
23
23
  });
24
- var bizState = store.useModelState('topoBizMod');
24
+ var bizState = store.useModelState("topoBizMod");
25
25
  var resAndMetrics = bizState.resAndMetrics,
26
26
  pollingSwitch = bizState.pollingSwitch;
27
- var displayConfig = topo.store.useModelState('displayConfig');
28
- var resourceOverviewState = topo.store.useModelState('topoBaseInfoOverview');
27
+ var displayConfig = topo.store.useModelState("displayConfig");
28
+ var resourceOverviewState = topo.store.useModelState("topoBaseInfoOverview");
29
29
  var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList;
30
30
  /**
31
31
  * 查询拓扑图资源的属性指标
32
- *
32
+ *
33
33
  * @returns {array}
34
34
  */
35
35
 
@@ -37,7 +37,7 @@ var usePolling = function usePolling(props) {
37
37
  return _fetchData.apply(this, arguments);
38
38
  }
39
39
  /**
40
- *
40
+ *
41
41
  * @returns {{id, attributes: object[], metrics: object[]}[]} 属性和指标
42
42
  */
43
43
 
@@ -53,7 +53,7 @@ var usePolling = function usePolling(props) {
53
53
  var ipv6 = data.attributeMap.ipv6_address;
54
54
 
55
55
  if (!ipv6 && data.attributeMap.ipv6_address_list) {
56
- ipv6 = (data.attributeMap.ipv6_address_list || '').split(',')[0];
56
+ ipv6 = (data.attributeMap.ipv6_address_list || "").split(",")[0];
57
57
  }
58
58
 
59
59
  return _extends({}, data, {
@@ -85,9 +85,62 @@ var usePolling = function usePolling(props) {
85
85
  // 合并属性、指标
86
86
  var _topo$dataModel$getDa = topo.dataModel.getData(),
87
87
  nodes = _topo$dataModel$getDa.nodes,
88
- links = _topo$dataModel$getDa.links;
89
-
90
- return [].concat(nodes, links).filter(function (item) {
88
+ links = _topo$dataModel$getDa.links; // console.log('fetchData-mergeData',ciMetricsResult, nodes, links)
89
+ // 判断通断状态
90
+
91
+
92
+ var breakLinks = links.filter(function (item) {
93
+ return item.ciType === "network_link";
94
+ }).map(function (link) {
95
+ console.log("fetchData-mergeData", link);
96
+ var breakFlag = false;
97
+ ciMetricsResult.forEach(function (item) {
98
+ if (item.id === link.id) {
99
+ if (item.metrics.hasOwnProperty("run_status")) {
100
+ if (item.metrics.run_status !== "1") {
101
+ breakFlag = true;
102
+ }
103
+ }
104
+
105
+ if (link.attributes["network_link.is_crucial"] && item.metrics.hasOwnProperty("remote_ping_status")) {
106
+ if (item.metrics.remote_ping_status !== "1") {
107
+ breakFlag = true;
108
+ }
109
+ }
110
+ }
111
+ });
112
+ var element = topo.getDataModel().getDataByTag(link.id);
113
+
114
+ if (!element) {
115
+ return;
116
+ }
117
+
118
+ if (breakFlag) {
119
+ console.log("link.setNodeStyleIcon-breakFlag", element);
120
+ topo.getHtTopo().setNodeStyleIcon(element, {
121
+ styleIcon: "linkbreak",
122
+ position: 17,
123
+ icon: "resource.link.linkbreak"
124
+ });
125
+ topo.dataModel.updateData([_extends({}, link, {
126
+ breakState: true
127
+ })]);
128
+ element === null || element === void 0 ? void 0 : element.s("edge.color", "#C9CED2");
129
+ return link.id; //element.a('linkbreak',true);
130
+ } else {
131
+ // 恢复状态
132
+ element.removeStyleIcon("linkbreak");
133
+ topo.dataModel.updateData([_extends({}, link, {
134
+ breakState: false
135
+ })]);
136
+ element === null || element === void 0 ? void 0 : element.a('linkbreak', false);
137
+ return undefined; // topo.getHtTopo().setNodeStyleIcon(element, { styleIcon: 'linkbreak',position: 17, icon: 'resource.link.linkbreak' });
138
+ }
139
+ });
140
+ console.log('link-break', breakLinks, links);
141
+ return [].concat(nodes, links.filter(function (link) {
142
+ return !breakLinks.includes(link.id);
143
+ })).filter(function (item) {
91
144
  return !!item.ciType;
92
145
  }).map(function (ciData) {
93
146
  var resultData = _extends({}, ciData, {
@@ -107,7 +160,7 @@ var usePolling = function usePolling(props) {
107
160
  });
108
161
  };
109
162
 
110
- _topo$store$getModelS = topo.store.getModelState('topoBizMod').resAndMetrics, resIdsList = _topo$store$getModelS.resIdsList, nodeIdsList = _topo$store$getModelS.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
163
+ _topo$store$getModelS = topo.store.getModelState("topoBizMod").resAndMetrics, resIdsList = _topo$store$getModelS.resIdsList, nodeIdsList = _topo$store$getModelS.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
111
164
  // 无资源,不查询
112
165
 
113
166
  if (resIdsList.length) {
@@ -122,7 +175,8 @@ var usePolling = function usePolling(props) {
122
175
  codes = topo.attributeMetricDisplay.getResourceMetricCodes();
123
176
  param = {
124
177
  ciId: nodeIdsList,
125
- codes: codes,
178
+ codes: [].concat(codes, ["run_status", "remote_ping_status"]),
179
+ // 判断链路通断状态
126
180
  // 过滤掉不需要查询的
127
181
  relationId: topo.attributeMetricDisplay.getEdges().map(function (edge) {
128
182
  return {
@@ -212,7 +266,7 @@ var usePolling = function usePolling(props) {
212
266
 
213
267
  useEffect(function () {
214
268
  if (topo.options.enableDefaultMetricLoader) {
215
- rlog.debug('usePolling.useEffect: 开始轮询', {
269
+ rlog.debug("usePolling.useEffect: 开始轮询", {
216
270
  pollingSwitch: pollingSwitch,
217
271
  resIdsList: resIdsList,
218
272
  resourceOverviewState: resourceOverviewState,
@@ -223,16 +277,16 @@ var usePolling = function usePolling(props) {
223
277
 
224
278
  return function () {
225
279
  if (loading) {
226
- rlog.debug('usePolling.useEffect: 结束轮询', resAndMetrics);
280
+ rlog.debug("usePolling.useEffect: 结束轮询", resAndMetrics);
227
281
  stopPoll();
228
282
  }
229
283
  };
230
284
  }, [pollingSwitch, resIdsList, displayConfig, resourceOverviewState.id, resourceOverviewState.metricCodes]); // 属性变更监听更新
231
285
 
232
- useCbbEventListener('topo', {
233
- name: 'topo',
286
+ useCbbEventListener("topo", {
287
+ name: "topo",
234
288
  onMessage: function onMessage(message) {
235
- if (message.type === 'attribute') {
289
+ if (message.type === "attribute") {
236
290
  var data = message.data;
237
291
  }
238
292
  }
@@ -243,8 +297,8 @@ var usePolling = function usePolling(props) {
243
297
  onChange: function onChange(e) {
244
298
  var property = e.property,
245
299
  data = e.data;
246
- var isGroupExpandedChanged = data instanceof ht.Group && property === 'expanded';
247
- var isEdgeExpandedChanged = data instanceof ht.Edge && property === 'edge.expanded';
300
+ var isGroupExpandedChanged = data instanceof ht.Group && property === "expanded";
301
+ var isEdgeExpandedChanged = data instanceof ht.Edge && property === "edge.expanded";
248
302
 
249
303
  if (isGroupExpandedChanged || isEdgeExpandedChanged) {
250
304
  topo.attributeMetricDisplay.updateTagsTips();
@@ -41,8 +41,7 @@ export default function (props) {
41
41
  var config = getConfigFromHt();
42
42
  return {
43
43
  resources: config.resources,
44
- groups: config.groups,
45
- relateTopoIdList: config.relateTopoIdList
44
+ groups: config.groups
46
45
  };
47
46
  };
48
47
 
@@ -1142,7 +1142,8 @@ var useTopoEdit = function useTopoEdit(params) {
1142
1142
  */
1143
1143
  onSaveTopo: onSaveTopo,
1144
1144
  getResourceConfigFromHt: resourceConfig.getConfigFromHt,
1145
- onLayerAdded: onLayerAdded
1145
+ onLayerAdded: onLayerAdded,
1146
+ findUNExistedLinkElements: findUNExistedLinkElements
1146
1147
  };
1147
1148
  };
1148
1149
 
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "13.0.0-dev.8" === 'string' ? "13.0.0-dev.8" : null;
27
+ var version = typeof "13.0.1" === 'string' ? "13.0.1" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -41,11 +41,11 @@ export function saveTopo(_x) {
41
41
 
42
42
  function _saveTopo() {
43
43
  _saveTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
44
- var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources;
44
+ var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, viewGroupId, groupInfo, viewResources;
45
45
  return _regeneratorRuntime.wrap(function _callee$(_context) {
46
46
  while (1) switch (_context.prev = _context.next) {
47
47
  case 0:
48
- topoService = data.topoService, topoId = data.id, template = data.template, layout = data.layout, backgroundId = data.backgroundId, globalConfig = data.globalConfig, serialize = data.serialize, resources = data.resources, groups = data.groups, relateTopoIdList = data.relateTopoIdList, viewGroupId = data.viewGroupId;
48
+ topoService = data.topoService, topoId = data.id, template = data.template, layout = data.layout, backgroundId = data.backgroundId, globalConfig = data.globalConfig, serialize = data.serialize, resources = data.resources, groups = data.groups, viewGroupId = data.viewGroupId;
49
49
  rlog.debug("saveTopo", data); // 保存布局
50
50
 
51
51
  if (!(template && layout)) {
@@ -97,8 +97,7 @@ function _saveTopo() {
97
97
  rlog.debug("saveTopo-groupInfo", groupInfo);
98
98
  _context.next = 15;
99
99
  return topoService.bindResourceToTopo(topoId, {
100
- groups: groupInfo,
101
- relateTopoIdList: relateTopoIdList
100
+ groups: groupInfo
102
101
  });
103
102
 
104
103
  case 15:
@@ -46,40 +46,35 @@ export function isAggLink(link) {
46
46
 
47
47
  return (link === null || link === void 0 ? void 0 : (_link$attributes2 = link.attributes) === null || _link$attributes2 === void 0 ? void 0 : _link$attributes2.destination_type) === "network.agg_interface" && (link === null || link === void 0 ? void 0 : (_link$attributes3 = link.attributes) === null || _link$attributes3 === void 0 ? void 0 : _link$attributes3.source_type) === "network.agg_interface";
48
48
  }
49
- export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
49
+ export function mergeLinksData(links, linkCis, nodes, ciMap, interfaceDoc) {
50
50
  var linkCiMap = keyBy(links, "id");
51
51
  return links.map(function (link) {
52
- var _interfaceCiMap$attri, _interfaceCiMap$attri2;
52
+ var _ciMap$attributes$net, _ciMap$attributes$net2, _ciMap$attributes$sou, _ciMap$attributes$des;
53
53
 
54
54
  var linkCi = linkCiMap[link.id];
55
55
 
56
- var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
56
+ var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes); // 翻译
57
57
 
58
- var sourceNode = nodes.find(function (node) {
59
- return node.id === attributes["network_link.source_device_id"];
60
- });
61
- var targetNode = nodes.find(function (node) {
62
- return node.id === attributes["network_link.destination_device_id"];
63
- }); // 翻译
64
58
 
65
59
  return _extends({}, link, {
60
+ breakState: false,
66
61
  attributes: _extends({}, attributes, {
67
62
  // 源/目的设备
68
63
  "network_link.source_device_id_object": {
69
- displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
64
+ displayName: (_ciMap$attributes$net = ciMap[attributes["network_link.source_device_id"]]) === null || _ciMap$attributes$net === void 0 ? void 0 : _ciMap$attributes$net.attributes["display_name"]
70
65
  },
71
66
  "network_link.destination_device_id_object": {
72
- displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
67
+ displayName: (_ciMap$attributes$net2 = ciMap[attributes["network_link.destination_device_id"]]) === null || _ciMap$attributes$net2 === void 0 ? void 0 : _ciMap$attributes$net2.attributes["display_name"]
73
68
  },
74
69
  // 源/目的接口类型
75
70
  source_type_object: interfaceDoc[attributes.source_type],
76
71
  destination_type_object: interfaceDoc[attributes.destination_type],
77
72
  // 源/目的接口
78
73
  source_id_object: {
79
- displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
74
+ displayName: (_ciMap$attributes$sou = ciMap[attributes.source_id]) === null || _ciMap$attributes$sou === void 0 ? void 0 : _ciMap$attributes$sou.attributes["display_name"]
80
75
  },
81
76
  destination_id_object: {
82
- displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
77
+ displayName: (_ciMap$attributes$des = ciMap[attributes.destination_id]) === null || _ciMap$attributes$des === void 0 ? void 0 : _ciMap$attributes$des.attributes["display_name"]
83
78
  }
84
79
  })
85
80
  });
@@ -91,7 +86,7 @@ export function getLinksDetail(_x, _x2) {
91
86
 
92
87
  function _getLinksDetail() {
93
88
  _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
94
- var linkCis, interfaceIds, interfaceTypes, interfaceCiMap, interfaceDoc;
89
+ var linkCis, ciMap, ciIds, interfaceTypes, loadCiMap, interfaceDoc;
95
90
  return _regeneratorRuntime.wrap(function _callee$(_context) {
96
91
  while (1) switch (_context.prev = _context.next) {
97
92
  case 0:
@@ -104,11 +99,20 @@ function _getLinksDetail() {
104
99
 
105
100
  case 2:
106
101
  linkCis = links;
107
- interfaceIds = [].concat(linkCis.map(function (item) {
102
+ ciMap = keyBy(nodes, "id");
103
+ ciIds = _.uniq([].concat(linkCis.map(function (item) {
104
+ return item.attributes['network_link.destination_device_id'];
105
+ }), linkCis.map(function (item) {
106
+ return item.attributes['network_link.source_device_id'];
107
+ }), linkCis.map(function (item) {
108
108
  return item.attributes.source_id;
109
109
  }), linkCis.map(function (item) {
110
110
  return item.attributes.destination_id;
111
- }));
111
+ }))).filter(function (item) {
112
+ return !!item;
113
+ }).filter(function (item) {
114
+ return !ciMap[item];
115
+ });
112
116
  interfaceTypes = _.compact(_.uniq([].concat(linkCis.map(function (item) {
113
117
  return item.attributes.source_type;
114
118
  }), linkCis.map(function (item) {
@@ -116,19 +120,21 @@ function _getLinksDetail() {
116
120
  })))).filter(function (item) {
117
121
  return item !== "ip";
118
122
  });
119
- _context.next = 7;
120
- return CiCache.load(interfaceIds);
123
+ _context.next = 8;
124
+ return CiCache.load(ciIds);
121
125
 
122
- case 7:
123
- interfaceCiMap = _context.sent;
124
- _context.next = 10;
126
+ case 8:
127
+ loadCiMap = _context.sent;
128
+ _context.next = 11;
125
129
  return CiTypeCache.load(interfaceTypes);
126
130
 
127
- case 10:
131
+ case 11:
128
132
  interfaceDoc = _context.sent;
129
- return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc));
133
+ Object.assign(ciMap, loadCiMap); // console.log('getLinksDetail-mergeLinksData', { relations, interfaceIds, interfaceCis, })
134
+
135
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, ciMap, interfaceDoc));
130
136
 
131
- case 12:
137
+ case 14:
132
138
  case "end":
133
139
  return _context.stop();
134
140
  }
@@ -243,18 +243,17 @@ export default function (topoApp) {
243
243
  var _this2 = this;
244
244
 
245
245
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
246
- var editState, resources, _editState$groups, groups, relateTopoIdList, query, data;
246
+ var editState, resources, _editState$groups, groups, query, data;
247
247
 
248
248
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
249
249
  while (1) switch (_context2.prev = _context2.next) {
250
250
  case 0:
251
251
  editState = rootState.topoConfig;
252
- resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, relateTopoIdList = editState.relateTopoIdList;
252
+ resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups;
253
253
  query = {
254
254
  id: rootState.topoMod.topoId,
255
255
  resources: resources,
256
- groups: groups,
257
- relateTopoIdList: relateTopoIdList
256
+ groups: groups
258
257
  };
259
258
  _context2.next = 5;
260
259
  return _this2.getTopoByConditions(query);
@@ -297,13 +296,13 @@ export default function (topoApp) {
297
296
  var _this4 = this;
298
297
 
299
298
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
300
- var topoId, resources, groups, relateTopoIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
299
+ var topoId, resources, groups, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
301
300
 
302
301
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
303
302
  while (1) switch (_context4.prev = _context4.next) {
304
303
  case 0:
305
304
  rlog.debug("getTopoByConditions--------", params);
306
- topoId = params.id, resources = params.resources, groups = params.groups, relateTopoIdList = params.relateTopoIdList;
305
+ topoId = params.id, resources = params.resources, groups = params.groups;
307
306
  viewConditions = resToConditions(resources);
308
307
  groupInfo = isAvailableArray(groups) && groups.map(function (group) {
309
308
  return _extends({}, group, {
@@ -313,7 +312,7 @@ export default function (topoApp) {
313
312
  });
314
313
  rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
315
314
  _context4.next = 7;
316
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, relateTopoIdList);
315
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo);
317
316
 
318
317
  case 7:
319
318
  data = _context4.sent;
@@ -395,7 +395,8 @@ export default function (topoApp) {
395
395
  globalConfig: extraConfig,
396
396
  type: (_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.showType,
397
397
  topoData: topoData,
398
- resAndMetrics: resAndMetrics
398
+ resAndMetrics: resAndMetrics,
399
+ loading: false
399
400
  });
400
401
 
401
402
  case 47:
@@ -425,11 +426,7 @@ export default function (topoApp) {
425
426
  rlog.info('topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ', endTime.diff(startTime, 'seconds', true));
426
427
  topoApp.options.onLoad();
427
428
 
428
- _this3.update({
429
- loading: false
430
- });
431
-
432
- case 62:
429
+ case 61:
433
430
  case "end":
434
431
  return _context4.stop();
435
432
  }
@@ -11,6 +11,7 @@ export function fixLink(topo) {
11
11
  edges.forEach(function (edge) {
12
12
  var source = edge.getSource();
13
13
  var target = edge.getTarget();
14
+ console.log('fixLink', edge, source, target);
14
15
  var linkData = linkDatas.find(function (data) {
15
16
  return data.id === edge.getTag();
16
17
  }); // TODO 判断两端互相切换
@@ -883,7 +883,8 @@ export default function ResourceOverview(props) {
883
883
  return item.code;
884
884
  }),
885
885
  getOverviewConfig: resourceOverviewProps.getOverviewConfig,
886
- saveOverviewConfig: resourceOverviewProps.saveOverviewConfig
886
+ saveOverviewConfig: resourceOverviewProps.saveOverviewConfig,
887
+ jumpto: topo.viewProps.jumpto
887
888
  }) : /*#__PURE__*/React.createElement(BlockBox, {
888
889
  headerTitle: "\u5173\u952E\u6307\u6807",
889
890
  headerExtra: /*#__PURE__*/React.createElement(Configurator, {
@@ -7,7 +7,8 @@ import styles from "./LinkTopo.module.scss";
7
7
  export default function LinkTopo(props) {
8
8
  var data = props.data,
9
9
  linkMetricCodes = props.linkMetricCodes,
10
- openFlow = props.openFlow;
10
+ openFlow = props.openFlow,
11
+ jumpto = props.jumpto;
11
12
  var metricData = useMetricPolling({
12
13
  linkCi: data,
13
14
  linkMetricCodes: linkMetricCodes
@@ -33,7 +34,7 @@ export default function LinkTopo(props) {
33
34
  data: data // 链路ci数据
34
35
  ,
35
36
  isNarrow: true,
36
- jumpto: getHistory().push
37
+ jumpto: jumpto || getHistory().push
37
38
  }, metricData, {
38
39
  openFlow: openFlow
39
40
  })));
@@ -13,7 +13,8 @@ export default function LinkTopoCard(props) {
13
13
  defaultCols = props.defaultCols,
14
14
  metricCol = props.metricCol,
15
15
  metricColChange = props.metricColChange,
16
- metricCodes = props.metricCodes; // eslint-disable-next-line camelcase
16
+ metricCodes = props.metricCodes,
17
+ jumpto = props.jumpto; // eslint-disable-next-line camelcase
17
18
 
18
19
  var supportTemplates = (data === null || data === void 0 ? void 0 : (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.support_templates) || ''; // 该资源监控模板
19
20
 
@@ -104,6 +105,7 @@ export default function LinkTopoCard(props) {
104
105
  linkMetricCodes: openFlow && openFlow.name == '查看流量构成' ? metricCodes : metricCodes.filter(function (i) {
105
106
  return i != 'netDelayRatio' && i != 'retansRatio';
106
107
  }),
107
- openFlow: openFlow
108
+ openFlow: openFlow,
109
+ jumpto: jumpto
108
110
  }));
109
111
  }
@@ -1,7 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _extends from "@babel/runtime/helpers/extends";
4
- var _excluded = ["groups", "resources"];
5
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
4
  import { request } from '@riil-frontend/component-topology-utils';
7
5
  import { rlog } from '@riil-frontend/component-topology-utils';
@@ -9,7 +7,7 @@ import blackList from "./blacklist";
9
7
  import { TOPO_API_ROOT } from "./constants";
10
8
  import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
11
9
  import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
12
- import * as processBothTopoDataUtil from "../../utils/relateTopoDataUtil";
10
+ import * as relateTopoDataUtil from "../../utils/relateTopoDataUtil";
13
11
  var API_ROOT = TOPO_API_ROOT;
14
12
  /**
15
13
  * 拓扑图(看做一个容器)的“父容器”ID
@@ -99,7 +97,8 @@ function prepareGroupParams(modifiedGroups) {
99
97
  };
100
98
  }).filter(Boolean);
101
99
  return {
102
- groups: groups
100
+ groups: groups,
101
+ relateTopoIdList: relateTopoDataUtil.getRelateTopoIdListFromConfig(modifiedGroups)
103
102
  };
104
103
  }
105
104
 
@@ -399,7 +398,7 @@ export default _extends({
399
398
  }),
400
399
  serialize: result.serialize ? JSON.parse(result.serialize) : undefined
401
400
  });
402
- result = processBothTopoDataUtil.processBothTopoData(result);
401
+ result = relateTopoDataUtil.processBothTopoData(result);
403
402
  result = processExitLink(result);
404
403
  return _context12.abrupt("return", result);
405
404
 
@@ -418,11 +417,11 @@ export default _extends({
418
417
  * @param {Array} groups
419
418
  * @returns
420
419
  */
421
- getTopoDataByResource: function getTopoDataByResource(id, resources, groups, relateTopoIdList) {
420
+ getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
422
421
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
423
422
  var _result$nodes2, _result$links2;
424
423
 
425
- var data, obj, result;
424
+ var data, params, result;
426
425
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
427
426
  while (1) switch (_context13.prev = _context13.next) {
428
427
  case 0:
@@ -436,11 +435,9 @@ export default _extends({
436
435
  });
437
436
  }
438
437
 
439
- obj = prepareGroupParams(data);
438
+ params = prepareGroupParams(data);
440
439
  _context13.next = 5;
441
- return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj, {
442
- relateTopoIdList: relateTopoIdList
443
- }));
440
+ return request.post(API_ROOT + "/structure/byCondition/" + id, params);
444
441
 
445
442
  case 5:
446
443
  result = _context13.sent;
@@ -452,9 +449,14 @@ export default _extends({
452
449
  });
453
450
  })
454
451
  });
455
- return _context13.abrupt("return", processByConditionResult(result, obj.groups));
452
+ result = relateTopoDataUtil.processByConditionTopoData({
453
+ data: result,
454
+ config: data
455
+ });
456
+ result = processByConditionResult(result, params.groups);
457
+ return _context13.abrupt("return", result);
456
458
 
457
- case 8:
459
+ case 10:
458
460
  case "end":
459
461
  return _context13.stop();
460
462
  }
@@ -471,11 +473,11 @@ export default _extends({
471
473
  */
472
474
  bindResourceToTopo: function bindResourceToTopo(id, config) {
473
475
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
474
- var groups, resources, otherConfig, newGroups, obj;
476
+ var groups, resources, newGroups, obj;
475
477
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
476
478
  while (1) switch (_context14.prev = _context14.next) {
477
479
  case 0:
478
- groups = config.groups, resources = config.resources, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
480
+ groups = config.groups, resources = config.resources;
479
481
  newGroups = Array.isArray(groups) ? groups : [];
480
482
 
481
483
  if (resources) {
@@ -489,7 +491,7 @@ export default _extends({
489
491
 
490
492
  obj = prepareGroupParams(newGroups);
491
493
  _context14.next = 6;
492
- return request.post(API_ROOT + "/resource/" + id, _extends({}, otherConfig, obj));
494
+ return request.post(API_ROOT + "/resource/" + id, obj);
493
495
 
494
496
  case 6:
495
497
  return _context14.abrupt("return", _context14.sent);