@riil-frontend/component-topology 7.0.9 → 8.0.0-a.10

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 (73) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +13 -13
  3. package/es/components/BatchAttrMetric/setting.js +0 -2
  4. package/es/core/common/icons/basicIcons.js +57 -0
  5. package/es/core/common/icons/icon.js +4 -6
  6. package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
  7. package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
  8. package/es/core/components/TopoView/GraphViewPanel.js +1 -2
  9. package/es/core/components/TopoView/topoView.js +3 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
  11. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
  12. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  13. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  14. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  15. package/es/core/hooks/useTopoEdit.js +35 -127
  16. package/es/core/models/AttributeMetricDisplay.js +4 -4
  17. package/es/core/models/TopoApp.js +2 -2
  18. package/es/core/models/tagstips/ElementTagTipConfig.js +18 -10
  19. package/es/core/models/topoData.js +9 -1
  20. package/es/core/models/utils/linkUtils.js +53 -91
  21. package/es/core/services/topo/basic.js +34 -0
  22. package/es/core/services/topo/constants.js +1 -0
  23. package/es/core/services/topo/index.js +4 -0
  24. package/es/core/store/models/topoBizMod.js +1 -11
  25. package/es/core/store/models/topoConfig.js +6 -7
  26. package/es/core/store/models/topoMod.js +74 -50
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  28. package/es/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  29. package/es/networkTopo/getTopoData.js +72 -64
  30. package/es/networkTopo/models/TopoCenter.js +14 -94
  31. package/es/networkTopo/services/topo/basic.js +30 -10
  32. package/es/networkTopo/store/linkManager.js +0 -1
  33. package/es/networkTopo/store/topoCenter.js +0 -1
  34. package/es/networkTopo/store/topoLinkMod.js +0 -1
  35. package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
  36. package/es/utils/topoData.js +4 -169
  37. package/lib/components/BatchAttrMetric/setting.js +0 -4
  38. package/lib/core/common/icons/basicIcons.js +62 -0
  39. package/lib/core/common/icons/icon.js +5 -7
  40. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
  41. package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
  42. package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
  43. package/lib/core/components/TopoView/topoView.js +4 -1
  44. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +43 -24
  45. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
  46. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  47. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  48. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  49. package/lib/core/hooks/useTopoEdit.js +35 -129
  50. package/lib/core/models/AttributeMetricDisplay.js +4 -4
  51. package/lib/core/models/TopoApp.js +3 -3
  52. package/lib/core/models/tagstips/ElementTagTipConfig.js +19 -11
  53. package/lib/core/models/topoData.js +9 -1
  54. package/lib/core/models/utils/linkUtils.js +52 -93
  55. package/lib/core/services/topo/basic.js +46 -0
  56. package/lib/core/services/topo/constants.js +6 -0
  57. package/lib/core/services/topo/index.js +16 -0
  58. package/lib/core/store/models/topoBizMod.js +1 -11
  59. package/lib/core/store/models/topoConfig.js +5 -6
  60. package/lib/core/store/models/topoMod.js +71 -48
  61. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  62. package/lib/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  63. package/lib/networkTopo/getTopoData.js +73 -65
  64. package/lib/networkTopo/models/TopoCenter.js +14 -94
  65. package/lib/networkTopo/services/topo/basic.js +30 -10
  66. package/lib/networkTopo/store/linkManager.js +0 -2
  67. package/lib/networkTopo/store/topoCenter.js +0 -2
  68. package/lib/networkTopo/store/topoLinkMod.js +0 -2
  69. package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
  70. package/lib/utils/topoData.js +6 -172
  71. package/package.json +2 -2
  72. /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
  73. /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -356,7 +356,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
356
356
  /*#__PURE__*/
357
357
  function () {
358
358
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
359
- var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
359
+ var topo, _topo$store$getModelS, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
360
360
 
361
361
  return _regeneratorRuntime.wrap(function _callee$(_context) {
362
362
  while (1) {
@@ -383,7 +383,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
383
383
  };
384
384
 
385
385
  topo = this.topo;
386
- _topo$store$getState$ = topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _topo$store$getState$.resIdsList, nodeIdsList = _topo$store$getState$.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
386
+ _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);
387
387
  // 无资源,不查询
388
388
 
389
389
  if (resIdsList.length) {
@@ -636,8 +636,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
636
636
 
637
637
  var elementTagsAndTips = this.buildTagsTips() // 开锁状态下禁用悬停展示悬浮框
638
638
  .map(function (item) {
639
- var _topo$store$getModelS = topo.store.getModelState('lock'),
640
- lock = _topo$store$getModelS.lock;
639
+ var _topo$store$getModelS2 = topo.store.getModelState('lock'),
640
+ lock = _topo$store$getModelS2.lock;
641
641
 
642
642
  return lock ? item : _extends({}, item, {
643
643
  tips: []
@@ -1,10 +1,10 @@
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 topoService from '@riil-frontend/component-topology-common/es/services/topo';
5
4
  import { setRequest } from '@riil-frontend/component-topology-utils';
6
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
6
  import { cloneDeep } from 'lodash';
7
+ import topoService from "../services/topo";
8
8
  import CiTypeCache from "./cache/CiTypeCache";
9
9
  import Alarm from "./Alarm";
10
10
  import TopoGraphView from "./TopoGraphView";
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
23
23
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
25
25
 
26
- var version = typeof "7.0.9" === 'string' ? "7.0.9" : null;
26
+ var version = typeof "8.0.0-a.10" === 'string' ? "8.0.0-a.10" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -2,14 +2,14 @@ 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
4
  import { getLinkMtCodes, getMonitorTemplateCodesFromTopoData, getMtCodeCiTypeMap, getNodeMtCodes } from "./utils";
5
- import { getMetricsByMonitorTemplateCodes } from "../../services/topo";
5
+ import { getMetricsByMonitorTemplateCodes } from "../../services/topo/tagtip";
6
6
  import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
7
7
 
8
8
  var ElementTagTipConfig = /*#__PURE__*/function () {
9
9
  function ElementTagTipConfig(topo) {
10
10
  this.topoData = void 0;
11
11
  this.mtCodes = void 0;
12
- this.mtMetricsMap = void 0;
12
+ this.mtMetricsMap = {};
13
13
  this.mtCiTypeMap = void 0;
14
14
  this.topo = topo;
15
15
  }
@@ -25,28 +25,36 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
25
25
  this.topoData = topoData;
26
26
  this.mtCodes = getMonitorTemplateCodesFromTopoData(topoData);
27
27
  _context.prev = 2;
28
- _context.next = 5;
28
+
29
+ if (!this.mtCodes.length) {
30
+ _context.next = 7;
31
+ break;
32
+ }
33
+
34
+ _context.next = 6;
29
35
  return getMetricsByMonitorTemplateCodes(this.mtCodes);
30
36
 
31
- case 5:
37
+ case 6:
32
38
  this.mtMetricsMap = _context.sent;
33
- _context.next = 11;
39
+
40
+ case 7:
41
+ _context.next = 12;
34
42
  break;
35
43
 
36
- case 8:
37
- _context.prev = 8;
44
+ case 9:
45
+ _context.prev = 9;
38
46
  _context.t0 = _context["catch"](2);
39
47
  rlog.error('查询监控模板指标失败', _context.t0);
40
48
 
41
- case 11:
49
+ case 12:
42
50
  this.mtCiTypeMap = getMtCodeCiTypeMap(topoData);
43
51
 
44
- case 12:
52
+ case 13:
45
53
  case "end":
46
54
  return _context.stop();
47
55
  }
48
56
  }
49
- }, _callee, this, [[2, 8]]);
57
+ }, _callee, this, [[2, 9]]);
50
58
  }));
51
59
 
52
60
  function init(_x) {
@@ -4,8 +4,16 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { TOPO_PARENT_ID } from "@riil-frontend/component-topology-common/es/services/topo";
5
5
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
6
  export function getLayoutId(layout) {
7
- if (!layout || typeof layout === "string") {
7
+ if (!layout) {
8
8
  return layout;
9
+ } // 拖拽添加分层后点击保存ht传参不正确,临时适配
10
+
11
+
12
+ if (typeof layout === "string") {
13
+ return {
14
+ v: 'towardeast',
15
+ h: 'towardsouth'
16
+ }[layout] || layout;
9
17
  }
10
18
 
11
19
  var id = layout.id,
@@ -1,12 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import topoService from "@riil-frontend/component-topology-common/es/services/topo";
5
- import keyBy from "lodash/keyBy";
6
- import _ from "lodash";
4
+ import keyBy from 'lodash/keyBy';
5
+ import _ from 'lodash';
7
6
  import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
8
7
 
9
- import { getEdges } from "../../../utils/htElementUtils"; // const interfaceTypeMap = {
8
+ import { getEdges } from "../../../utils/htElementUtils";
9
+ import CiTypeCache from "../cache/CiTypeCache"; // const interfaceTypeMap = {
10
10
  // "network.interface": {
11
11
  // displayName: "网络接口",
12
12
  // },
@@ -33,42 +33,8 @@ export function isCrucialLink(link) {
33
33
  export function isExitLink(link) {
34
34
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
35
35
  }
36
- export var getInterfaceObject = /*#__PURE__*/function () {
37
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
38
- var query, promises, result, ifDoc;
39
- return _regeneratorRuntime.wrap(function _callee$(_context) {
40
- while (1) {
41
- switch (_context.prev = _context.next) {
42
- case 0:
43
- query = _.compact(_.uniq(codes));
44
- promises = query.map(queryModelAsset);
45
- _context.next = 4;
46
- return Promise.all(promises);
47
-
48
- case 4:
49
- result = _context.sent;
50
- ifDoc = {};
51
- result.map(function (ifItem) {
52
- ifDoc[ifItem.code] = {
53
- displayName: ifItem.displayName
54
- };
55
- });
56
- return _context.abrupt("return", ifDoc);
57
-
58
- case 8:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }
63
- }, _callee);
64
- }));
65
-
66
- return function getInterfaceObject(_x) {
67
- return _ref.apply(this, arguments);
68
- };
69
- }();
70
36
  export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
71
- var linkCiMap = keyBy(linkCis, "id");
37
+ var linkCiMap = keyBy(links, 'id');
72
38
  return links.map(function (link) {
73
39
  var _interfaceCis$find, _interfaceCis$find2;
74
40
 
@@ -77,22 +43,19 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
77
43
  var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
78
44
 
79
45
  var sourceNode = nodes.find(function (node) {
80
- return node.id === attributes["network_link.source_device_id"];
46
+ return node.id === attributes['network_link.source_device_id'];
81
47
  });
82
48
  var targetNode = nodes.find(function (node) {
83
- return node.id === attributes["network_link.destination_device_id"];
49
+ return node.id === attributes['network_link.destination_device_id'];
84
50
  }); // 翻译
85
51
 
86
52
  return _extends({}, link, {
87
- id: linkCi.id,
88
- ciType: linkCi === null || linkCi === void 0 ? void 0 : linkCi.typeCode,
89
- name: linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes.name,
90
53
  attributes: _extends({}, attributes, {
91
54
  // 源/目的设备
92
- "network_link.source_device_id_object": {
55
+ 'network_link.source_device_id_object': {
93
56
  displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
94
57
  },
95
- "network_link.destination_device_id_object": {
58
+ 'network_link.destination_device_id_object': {
96
59
  displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
97
60
  },
98
61
  // 源/目的接口类型
@@ -102,71 +65,70 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
102
65
  source_id_object: {
103
66
  displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
104
67
  return node.id === attributes.source_id;
105
- })) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes["display_name"]
68
+ })) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes['display_name']
106
69
  },
107
70
  destination_id_object: {
108
71
  displayName: (_interfaceCis$find2 = interfaceCis.find(function (node) {
109
72
  return node.id === attributes.destination_id;
110
- })) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes["display_name"]
73
+ })) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes['display_name']
111
74
  }
112
75
  })
113
76
  });
114
77
  });
115
78
  }
116
- export function getLinksDetail(_x2, _x3) {
79
+ export function getLinksDetail(_x, _x2) {
117
80
  return _getLinksDetail.apply(this, arguments);
118
81
  }
119
82
 
120
83
  function _getLinksDetail() {
121
- _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(links, nodes) {
84
+ _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
122
85
  var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
123
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
124
87
  while (1) {
125
- switch (_context2.prev = _context2.next) {
88
+ switch (_context.prev = _context.next) {
126
89
  case 0:
127
90
  if (!(!links || !links.length)) {
128
- _context2.next = 2;
91
+ _context.next = 2;
129
92
  break;
130
93
  }
131
94
 
132
- return _context2.abrupt("return", []);
95
+ return _context.abrupt("return", []);
133
96
 
134
97
  case 2:
135
- _context2.next = 4;
136
- return topoService.relation.batchQueryRelation(links.map(function (link) {
137
- return link.id;
98
+ // const linkCis = await topoService.relation.batchQueryRelation(
99
+ // links.map((link) => link.id)
100
+ // );
101
+ linkCis = links;
102
+ interfaceIds = [].concat(linkCis.map(function (item) {
103
+ return item.attributes.source_id;
104
+ }), linkCis.map(function (item) {
105
+ return item.attributes.destination_id;
138
106
  }));
139
-
140
- case 4:
141
- linkCis = _context2.sent;
142
- interfaceIds = [];
143
- interfaceTypes = [];
144
- linkCis.map(function (item) {
145
- interfaceIds.push(item.attributes.source_id);
146
- interfaceIds.push(item.attributes.destination_id);
147
- interfaceTypes.push(item.attributes.source_type);
148
- interfaceTypes.push(item.attributes.destination_type);
107
+ interfaceTypes = _.compact(_.uniq([].concat(linkCis.map(function (item) {
108
+ return item.attributes.source_type;
109
+ }), linkCis.map(function (item) {
110
+ return item.attributes.destination_type;
111
+ })))).filter(function (item) {
112
+ return item !== 'ip';
149
113
  });
150
- _context2.next = 10;
114
+ _context.next = 7;
151
115
  return queryCisByIds(interfaceIds);
152
116
 
153
- case 10:
154
- interfaceCis = _context2.sent;
155
- _context2.next = 13;
156
- return getInterfaceObject(interfaceTypes.filter(function (item) {
157
- return item !== 'ip';
158
- }));
117
+ case 7:
118
+ interfaceCis = _context.sent;
119
+ _context.next = 10;
120
+ return CiTypeCache.getCiTypeMap(interfaceTypes);
159
121
 
160
- case 13:
161
- interfaceDoc = _context2.sent;
162
- return _context2.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
122
+ case 10:
123
+ interfaceDoc = _context.sent;
124
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
163
125
 
164
- case 15:
126
+ case 12:
165
127
  case "end":
166
- return _context2.stop();
128
+ return _context.stop();
167
129
  }
168
130
  }
169
- }, _callee2);
131
+ }, _callee);
170
132
  }));
171
133
  return _getLinksDetail.apply(this, arguments);
172
134
  }
@@ -188,10 +150,10 @@ export var compatibleWith = function compatibleWith(value) {
188
150
 
189
151
  export var plurals = {
190
152
  0: [],
191
- 1: ["phy"],
192
- 2: ["phy"],
193
- 3: ["agg"],
194
- 4: ["phy", "agg"]
153
+ 1: ['phy'],
154
+ 2: ['phy'],
155
+ 3: ['agg'],
156
+ 4: ['phy', 'agg']
195
157
  };
196
158
  export var showLinkByConfig = function showLinkByConfig(props) {
197
159
  var _plurals$compatibleWi;
@@ -206,25 +168,25 @@ export var showLinkByConfig = function showLinkByConfig(props) {
206
168
  var dm = gv.getDataModel();
207
169
  var edges = getEdges(dm); // console.log("edges", edges);
208
170
 
209
- var showPhy = types.indexOf("phy") >= 0;
210
- var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
171
+ var showPhy = types.indexOf('phy') >= 0;
172
+ var showAgg = types.indexOf('agg') >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
211
173
 
212
174
  if (Array.isArray(edges) && edges.length > 0) {
213
175
  edges.map(function (edge) {
214
176
  if (showType === 1 || showType === true) {
215
177
  // 单链路全部显示
216
178
  // console.log("单链路全部显示", edge);
217
- edge.s("2d.visible", true);
179
+ edge.s('2d.visible', true);
218
180
  } else {
219
181
  var _d$attributes, _d$attributes2;
220
182
 
221
183
  var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
222
184
 
223
- 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") {
224
- edge.s("2d.visible", showAgg);
185
+ 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') {
186
+ edge.s('2d.visible', showAgg);
225
187
  } else {
226
188
  // console.log("edge", edge, d, showAgg);
227
- edge.s("2d.visible", showPhy);
189
+ edge.s('2d.visible', showPhy);
228
190
  }
229
191
  }
230
192
  });
@@ -0,0 +1,34 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { request } from '@riil-frontend/component-topology-utils';
4
+ import { TOPO_API_ROOT } from "./constants";
5
+ export default {
6
+ /**
7
+ * 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
8
+ * @param {Number} id Topo ID
9
+ * @param {String} data ht拓扑序列化数据
10
+ * @returns
11
+ */
12
+ saveSerializeData: function saveSerializeData(id, data) {
13
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
14
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
15
+ while (1) {
16
+ switch (_context.prev = _context.next) {
17
+ case 0:
18
+ _context.next = 2;
19
+ return request.post(TOPO_API_ROOT + "/structure/" + id, {
20
+ data: data
21
+ });
22
+
23
+ case 2:
24
+ return _context.abrupt("return", _context.sent);
25
+
26
+ case 3:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }
31
+ }, _callee);
32
+ }))();
33
+ }
34
+ };
@@ -0,0 +1 @@
1
+ export var TOPO_API_ROOT = '/topo/v1/api';
@@ -0,0 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import topoService from '@riil-frontend/component-topology-common/es/services/topo';
3
+ import basic from "./basic";
4
+ export default _extends({}, topoService, basic);
@@ -11,7 +11,6 @@ export default function (engine) {
11
11
  metricDoc: {},
12
12
  attrDoc: {},
13
13
  allCiSet: {},
14
- ciSetDoc: {},
15
14
  pollingSwitch: false,
16
15
 
17
16
  /**
@@ -32,7 +31,6 @@ export default function (engine) {
32
31
  var _this = this;
33
32
 
34
33
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
35
- var ciDoc, newCiDoc;
36
34
  return _regeneratorRuntime.wrap(function _callee$(_context) {
37
35
  while (1) {
38
36
  switch (_context.prev = _context.next) {
@@ -41,17 +39,9 @@ export default function (engine) {
41
39
  resAndMetrics: conditions
42
40
  });
43
41
 
44
- ciDoc = conditions.ciDoc;
45
- newCiDoc = _extends({}, ciDoc); // rlog.debug('topoBizMod.combBatchCiInfo getBatchCiInfo', conditions);
46
-
47
- _this.update({
48
- ciSetDoc: newCiDoc,
49
- pollingSwitch: true
50
- });
51
-
52
42
  return _context.abrupt("return", {});
53
43
 
54
- case 5:
44
+ case 2:
55
45
  case "end":
56
46
  return _context.stop();
57
47
  }
@@ -13,7 +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 { buildData as buildTopoData } from "../../../networkTopo/getTopoData";
16
+ import { addLinkData, buildData as buildTopoData } from "../../../networkTopo/getTopoData";
17
17
 
18
18
  var newGroupWithUUID = function newGroupWithUUID(group) {
19
19
  if (group === void 0) {
@@ -308,7 +308,7 @@ export default function (topoApp) {
308
308
  var _this4 = this;
309
309
 
310
310
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
311
- var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, ciTypeMap, _combTopoData, topoData, resAndMetrics, topoDataTrans;
311
+ var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
312
312
 
313
313
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
314
314
  while (1) {
@@ -335,20 +335,19 @@ export default function (topoApp) {
335
335
  case 8:
336
336
  data = _context4.sent;
337
337
  _context4.next = 11;
338
- return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
338
+ return Promise.all([addLinkData(data), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
339
339
 
340
340
  case 11:
341
341
  _yield$Promise$all = _context4.sent;
342
- ciTypeMap = _yield$Promise$all[0];
342
+ dataWithLinkDetail = _yield$Promise$all[0];
343
343
  _combTopoData = combTopoData({
344
344
  engine: topoApp,
345
345
  data: data,
346
346
  linkTo: null,
347
- globalConfig: state.topoMod.globalConfig,
348
- ciTypeMap: ciTypeMap
347
+ globalConfig: state.topoMod.globalConfig
349
348
  }), topoData = _combTopoData.topoData, resAndMetrics = _combTopoData.resAndMetrics;
350
349
  dispatch.topoMod.update({
351
- data: data
350
+ data: dataWithLinkDetail
352
351
  });
353
352
  topoDataTrans = transformTopoElements(topoData);
354
353