@riil-frontend/component-topology 3.2.0 → 3.3.0

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 (51) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.js +36 -36
  4. package/demo/CHANGELOG/CHANGELOG.md +5 -0
  5. package/es/core/common/icons/icon.js +3 -29
  6. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +135 -10
  7. package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +5 -5
  8. package/es/core/models/TopoApp.js +1 -1
  9. package/es/core/models/topoData.js +21 -18
  10. package/es/core/models/utils/linkUtils.js +2 -1
  11. package/es/hooks/useResourceConfig.js +3 -2
  12. package/es/hooks/useSelection.js +16 -14
  13. package/es/models/topoConfig.js +20 -16
  14. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +4 -2
  15. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +15 -3
  16. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +3 -3
  17. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +145 -100
  18. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +45 -9
  19. package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +26 -7
  20. package/es/topoCenter/event/index.js +1 -0
  21. package/es/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
  22. package/es/topoCenter/services/link.js +43 -0
  23. package/es/topoCenter/utils/linPermissionUtil.js +25 -13
  24. package/es/utils/ResourceConfigUtil.js +38 -16
  25. package/es/utils/topoData.js +0 -1
  26. package/lib/core/common/icons/icon.js +3 -37
  27. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +145 -9
  28. package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +4 -5
  29. package/lib/core/models/TopoApp.js +1 -1
  30. package/lib/core/models/topoData.js +24 -17
  31. package/lib/core/models/utils/linkUtils.js +2 -1
  32. package/lib/hooks/useResourceConfig.js +3 -2
  33. package/lib/hooks/useSelection.js +15 -11
  34. package/lib/models/topoConfig.js +24 -16
  35. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -2
  36. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +16 -2
  37. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +2 -2
  38. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +144 -115
  39. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +46 -9
  40. package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +27 -7
  41. package/lib/topoCenter/event/index.js +2 -1
  42. package/lib/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
  43. package/lib/topoCenter/services/link.js +44 -0
  44. package/lib/topoCenter/utils/linPermissionUtil.js +25 -13
  45. package/lib/utils/ResourceConfigUtil.js +36 -14
  46. package/lib/utils/topoData.js +0 -1
  47. package/package.json +3 -3
  48. package/es/core/common/icons/defaultIcons.js +0 -44
  49. package/es/core/common/icons/networkTopoCiTypeIcons.js +0 -9
  50. package/lib/core/common/icons/defaultIcons.js +0 -53
  51. package/lib/core/common/icons/networkTopoCiTypeIcons.js +0 -22
@@ -8,9 +8,11 @@ import _Field from "@alifd/next/es/field";
8
8
  import _extends from "@babel/runtime/helpers/extends";
9
9
  import _Grid from "@alifd/next/es/grid";
10
10
  import _Form from "@alifd/next/es/form";
11
+ import _Radio from "@alifd/next/es/radio";
11
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
13
  import React, { useState, useEffect } from "react";
13
14
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
15
+ var RadioGroup = _Radio.Group;
14
16
  var FormItem = _Form.Item;
15
17
  var Row = _Grid.Row,
16
18
  Col = _Grid.Col; // import LindInfoPreview from "../../link/LindInfoPreview";
@@ -36,9 +38,9 @@ export default function EditLinkInfo(props) {
36
38
 
37
39
  var _topo$store$useModel2 = topo.store.useModel("topoBizMod"),
38
40
  bizState = _topo$store$useModel2[0],
39
- bizDispatchers = _topo$store$useModel2[1];
41
+ bizDispatchers = _topo$store$useModel2[1]; // const { resAndMetrics } = topoState;
42
+ // const { resAndMetrics } = bizState;
40
43
 
41
- var resAndMetrics = topoState.resAndMetrics; // const { resAndMetrics } = bizState;
42
44
 
43
45
  var source = lineData.source,
44
46
  target = lineData.target,
@@ -56,6 +58,10 @@ export default function EditLinkInfo(props) {
56
58
  targetValue = _useState3[0],
57
59
  setTarget = _useState3[1];
58
60
 
61
+ var _useState4 = useState(true),
62
+ connectEnable = _useState4[0],
63
+ setConnectEnable = _useState4[1];
64
+
59
65
  var fieldOnChange = function fieldOnChange(name, value) {
60
66
  var newValues = field.getValues();
61
67
  rlog.debug("Field-onChange", newValues, name, value);
@@ -83,7 +89,8 @@ export default function EditLinkInfo(props) {
83
89
  }
84
90
  };
85
91
 
86
- var linkTypeJudge = function linkTypeJudge(sourceType, destinationType) {
92
+ var linkTypeJudge = function linkTypeJudge(sourceType, destinationType, type) {
93
+ console.log("linkTypeJudge", sourceType, destinationType, type);
87
94
  var connect = "phy";
88
95
  var support = "m.physical_link";
89
96
 
@@ -92,8 +99,9 @@ export default function EditLinkInfo(props) {
92
99
  support = "m.agg_link";
93
100
  }
94
101
 
95
- if (sourceType === "" || destinationType === "") {
102
+ if (type === "exit") {
96
103
  connect = "exit";
104
+ support = "m.exit_link";
97
105
  }
98
106
 
99
107
  return {
@@ -102,6 +110,11 @@ export default function EditLinkInfo(props) {
102
110
  };
103
111
  };
104
112
 
113
+ var connectHandleChange = function connectHandleChange(v) {
114
+ console.log("connectHandleChange", v);
115
+ field.setValue("connect_type", v);
116
+ };
117
+
105
118
  var portsHandleChange = function portsHandleChange(type, value) {
106
119
  var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
107
120
 
@@ -127,14 +140,14 @@ export default function EditLinkInfo(props) {
127
140
  if (errors) {
128
141
  rlog.debug("saveHandleChange-error", errors, values);
129
142
  } else {
130
- var _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$ipAddres;
143
+ var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$ipAddres, _targetValue$id;
131
144
 
132
145
  rlog.debug("saveHandleChange", valus, source, target);
133
146
  var sourceId = valus["source_id"];
134
- var destinationId = valus["destination_id"];
147
+ var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
135
148
  var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
136
149
  var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
137
- var typeJudge = linkTypeJudge(sourceType, destinationType);
150
+ var typeJudge = linkTypeJudge(sourceType, destinationType, valus["connect_type"]);
138
151
  var obj = {
139
152
  display_name: valus["display_name"],
140
153
  // 链路名称
@@ -154,7 +167,7 @@ export default function EditLinkInfo(props) {
154
167
  // destination_type, // 必须
155
168
  "network_link.source_device_id": sourceValue.id,
156
169
  // 必须
157
- "network_link.destination_device_id": targetValue.id,
170
+ "network_link.destination_device_id": (_targetValue$id = targetValue.id) !== null && _targetValue$id !== void 0 ? _targetValue$id : "",
158
171
  // 必须
159
172
  "network_link.connect_type": typeJudge.connect,
160
173
  // 必须
@@ -171,6 +184,10 @@ export default function EditLinkInfo(props) {
171
184
  obj["destination_id"] = destinationId; // 目的端口
172
185
 
173
186
  obj["destination_type"] = destinationType;
187
+ } else {
188
+ obj["destination_id"] = ""; // 目的端口
189
+
190
+ obj["destination_type"] = "";
174
191
  }
175
192
 
176
193
  if (isAdd) {
@@ -273,7 +290,7 @@ export default function EditLinkInfo(props) {
273
290
  }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
274
291
  labelAlign: labelAlign,
275
292
  label: "\u76EE\u7684\u7AEF\u53E3",
276
- required: true,
293
+ required: valus["connect_type"] !== "exit",
277
294
  requiredMessage: "\u76EE\u7684\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
278
295
  }), targetValue.ipAddress ? /*#__PURE__*/React.createElement(_Select, {
279
296
  name: "destination_id",
@@ -320,6 +337,25 @@ export default function EditLinkInfo(props) {
320
337
  gutter: "16"
321
338
  }, /*#__PURE__*/React.createElement(Col, {
322
339
  span: "24"
340
+ }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
341
+ labelAlign: labelAlign,
342
+ label: "\u94FE\u63A5\u65B9\u5F0F"
343
+ }), /*#__PURE__*/React.createElement(RadioGroup, {
344
+ name: "connect_type",
345
+ onChange: function onChange(v) {
346
+ connectHandleChange(v);
347
+ }
348
+ }, /*#__PURE__*/React.createElement(_Radio, {
349
+ id: "phy",
350
+ value: "phy",
351
+ disabled: target.ciType === "customNode"
352
+ }, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
353
+ id: "exit",
354
+ value: "exit"
355
+ }, "\u51FA\u53E3"))))), /*#__PURE__*/React.createElement(Row, {
356
+ gutter: "16"
357
+ }, /*#__PURE__*/React.createElement(Col, {
358
+ span: "24"
323
359
  }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
324
360
  labelAlign: labelAlign,
325
361
  label: "\u5B9E\u9645\u5E26\u5BBD\uFF08Mbps\uFF09"
@@ -3,6 +3,7 @@ import _Collapse from "@alifd/next/es/collapse";
3
3
  import React, { useEffect } from "react";
4
4
  import styles from "./LinkInfoPreview.module.scss";
5
5
  import { formatMetric } from "../../../../../../core/models/attributeFormatter";
6
+ import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
7
  var CollapsePanel = _Collapse.Panel;
7
8
  export default function LindInfoPreview(props) {
8
9
  var topo = props.topo,
@@ -28,8 +29,13 @@ export default function LindInfoPreview(props) {
28
29
  }, {
29
30
  label: "目的端口",
30
31
  name: "destination_id"
31
- }, // { label: "取值端口", name: "network_link.work_mode" },
32
- {
32
+ }, {
33
+ label: "取值端口",
34
+ name: "network_link.value_port"
35
+ }, {
36
+ label: "链接方式",
37
+ name: "network_link.connect_type"
38
+ }, {
33
39
  label: "实际带宽",
34
40
  name: "network_link.actual_bandwidth"
35
41
  }, {
@@ -40,14 +46,27 @@ export default function LindInfoPreview(props) {
40
46
  var getValue = function getValue(name) {
41
47
  var value;
42
48
 
43
- if (data.attributes[name + "_object"]) {
44
- value = data.attributes[name + "_object"].displayName;
49
+ if (data) {
50
+ if (data.attributes[name + "_object"]) {
51
+ value = data.attributes[name + "_object"].displayName;
52
+ } else {
53
+ value = data.attributes[name];
54
+ }
55
+
56
+ var attrMeta = topo.ciTyeCache.getCiType("network_link").attributeMap[name];
57
+ value = formatMetric(value, attrMeta);
58
+
59
+ if (name === "network_link.value_port") {
60
+ value = "源端口";
61
+ }
62
+
63
+ if (name === "network_link.connect_type") {
64
+ value = data.attributes[name] === "exit" ? "出口" : "物理/聚合";
65
+ }
45
66
  } else {
46
- value = data.attributes[name];
67
+ value = "-";
47
68
  }
48
69
 
49
- var attrMeta = topo.ciTyeCache.getCiType("network_link").attributeMap[name];
50
- value = formatMetric(value, attrMeta);
51
70
  return value;
52
71
  };
53
72
 
@@ -2,4 +2,5 @@ var TopoCenterEvent = function TopoCenterEvent() {};
2
2
 
3
3
  TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE = "topo_link_enter_create_mode";
4
4
  TopoCenterEvent.TOPO_LINK_CREATED = "topo_link_created";
5
+ TopoCenterEvent.TOPO_LINK_SELECT_SOURCE_NODE = "topo_link_select_source_node";
5
6
  export { TopoCenterEvent as default };
@@ -41,31 +41,24 @@ export default (function (_ref) {
41
41
  return deleteable;
42
42
  }
43
43
 
44
- var deleteLink = function deleteLink(edge) {
45
- var id = edge.getTag();
46
- var link = topo.dataModel.getDataById(id);
47
- var isAgg = isAggLink(link);
48
-
49
- if (!checkLinkDeleteable(link)) {
50
- return;
51
- }
52
-
53
- var htTopo = topo.getHtTopo();
54
- confirmDeleteLink( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
- var success, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
44
+ var doDeleteLink = /*#__PURE__*/function () {
45
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(link, edge) {
46
+ var id, isAgg, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
56
47
 
57
48
  return _regeneratorRuntime.wrap(function _callee$(_context) {
58
49
  while (1) {
59
50
  switch (_context.prev = _context.next) {
60
51
  case 0:
61
- _context.next = 2;
52
+ id = link.id;
53
+ isAgg = isAggLink(link);
54
+ _context.next = 4;
62
55
  return linkService.deleteLink(id);
63
56
 
64
- case 2:
57
+ case 4:
65
58
  success = _context.sent;
66
59
 
67
60
  if (success) {
68
- _context.next = 6;
61
+ _context.next = 8;
69
62
  break;
70
63
  }
71
64
 
@@ -73,9 +66,10 @@ export default (function (_ref) {
73
66
 
74
67
  return _context.abrupt("return");
75
68
 
76
- case 6:
77
- _Message.success('删除成功'); // 获取两个节点间的连线数据列表
69
+ case 8:
70
+ _Message.success('删除成功');
78
71
 
72
+ htTopo = topo.getHtTopo(); // 获取两个节点间的连线数据列表
79
73
 
80
74
  edgesInNodes = htTopo.getEdgeDatasInNodes(edge.getSource(), edge.getTarget());
81
75
 
@@ -99,28 +93,56 @@ export default (function (_ref) {
99
93
 
100
94
  _topo$store$getModel = topo.store.getModel('topoMod'), topoState = _topo$store$getModel[0], topoDispatchers = _topo$store$getModel[1];
101
95
  _topoState$data = topoState.data, links = _topoState$data.links, linkGroups = _topoState$data.linkGroups;
102
- _context.next = 13;
96
+ _context.next = 16;
103
97
  return topoDispatchers.update({
104
98
  data: _extends({}, topoState.data, {
105
- links: links.filter(function (link) {
106
- return link.id !== id;
99
+ links: links.filter(function (item) {
100
+ return item.id !== id;
107
101
  }),
108
- linkGroups: linkGroups.filter(function (link) {
109
- return link.id !== id;
102
+ linkGroups: linkGroups.filter(function (item) {
103
+ return item.id !== id;
110
104
  })
111
105
  })
112
106
  });
113
107
 
114
- case 13:
108
+ case 16:
115
109
  // 刷新链路动态线宽
116
110
  topo.linkDynamicStyleExecutor.execute();
117
111
 
118
- case 14:
112
+ case 17:
119
113
  case "end":
120
114
  return _context.stop();
121
115
  }
122
116
  }
123
117
  }, _callee);
118
+ }));
119
+
120
+ return function doDeleteLink(_x, _x2) {
121
+ return _ref2.apply(this, arguments);
122
+ };
123
+ }();
124
+
125
+ var deleteLink = function deleteLink(edge) {
126
+ var id = edge.getTag();
127
+ var link = topo.dataModel.getDataById(id);
128
+
129
+ if (!checkLinkDeleteable(link)) {
130
+ return;
131
+ }
132
+
133
+ confirmDeleteLink( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
134
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
135
+ while (1) {
136
+ switch (_context2.prev = _context2.next) {
137
+ case 0:
138
+ doDeleteLink(link, edge);
139
+
140
+ case 1:
141
+ case "end":
142
+ return _context2.stop();
143
+ }
144
+ }
145
+ }, _callee2);
124
146
  })));
125
147
  };
126
148
  /**
@@ -139,5 +139,48 @@ export default {
139
139
  }
140
140
  }, _callee4, null, [[0, 7]]);
141
141
  }))();
142
+ },
143
+
144
+ /**
145
+ * 查询可关联链路
146
+ *
147
+ * @param {array} ciIds
148
+ */
149
+ queryAssociatedlinks: function queryAssociatedlinks(ids) {
150
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
151
+ var idtxt, parm, jsonParm, result;
152
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
153
+ while (1) {
154
+ switch (_context5.prev = _context5.next) {
155
+ case 0:
156
+ idtxt = "'" + ids[0] + "','" + ids[1] + "'";
157
+ parm = {
158
+ condition: "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id in [" + idtxt + "]",
159
+ sort: "name asc",
160
+ currentPage: 1,
161
+ pageSize: 20
162
+ };
163
+ jsonParm = JSON.stringify(parm);
164
+ console.log("queryAssociatedlinks", ids, idtxt, parm, jsonParm);
165
+ _context5.prev = 4;
166
+ _context5.next = 7;
167
+ return getRequest().post("/mdc/v1/api/cmdb/commonQueryCiData", jsonParm);
168
+
169
+ case 7:
170
+ result = _context5.sent;
171
+ return _context5.abrupt("return", result);
172
+
173
+ case 11:
174
+ _context5.prev = 11;
175
+ _context5.t0 = _context5["catch"](4);
176
+ rlog.error("查询可关联链路", _context5.t0);
177
+
178
+ case 14:
179
+ case "end":
180
+ return _context5.stop();
181
+ }
182
+ }
183
+ }, _callee5, null, [[4, 11]]);
184
+ }))();
142
185
  }
143
186
  };
@@ -1,24 +1,36 @@
1
+ var isWriteable = function isWriteable(link, source, target, linkType) {
2
+ if (linkType === "exit") {
3
+ return ["write", "delete"].indexOf(source === null || source === void 0 ? void 0 : source.operation) !== -1;
4
+ } else {
5
+ return [source, target].filter(function (node) {
6
+ return ["write", "delete"].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
7
+ }).length === 2;
8
+ }
9
+ };
1
10
  /**
2
11
  * 获得链路权限
3
- *
4
- * @param {*} link
5
- * @param {*} nodes
6
- * @returns
12
+ *
13
+ * @param {*} link
14
+ * @param {*} nodes
15
+ * @returns
7
16
  */
8
- export function getLinkPermission(link, nodes) {
17
+
18
+
19
+ export function getLinkPermission(edge, nodes, link) {
9
20
  var source = nodes.find(function (node) {
10
- return node.id === link.source;
21
+ return node.id === edge.source;
11
22
  });
12
23
  var target = nodes.find(function (node) {
13
- return node.id === link.target;
14
- });
24
+ return node.id === edge.target;
25
+ }); // console.log("getLinkPermission", edge, source, target, link);
26
+
27
+ var linkType = link.attributes["network_link.connect_type"]; //TODO 这里的逻辑因为 出口链路 可能需要调整
28
+
15
29
  return {
16
- readable: source.operation || target.operation,
17
- writeable: [source, target].filter(function (node) {
18
- return ['write', 'delete'].indexOf(node.operation) !== -1;
19
- }).length === 2,
30
+ readable: (source === null || source === void 0 ? void 0 : source.operation) || (target === null || target === void 0 ? void 0 : target.operation),
31
+ writeable: isWriteable(edge, source, target, linkType),
20
32
  deleteable: [source, target].filter(function (node) {
21
- return ['write', 'delete'].indexOf(node.operation) !== -1;
33
+ return ["write", "delete"].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
22
34
  }).length >= 1
23
35
  };
24
36
  }
@@ -1,21 +1,23 @@
1
- import sortBy from 'lodash/sortBy';
2
- import { getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
1
+ import sortBy from "lodash/sortBy";
2
+ import { getEdges, getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
3
3
  /**
4
4
  * 从拓扑图解析出拓扑资源配置
5
- *
6
- * @param {ht.DataModel} dataModel
5
+ *
6
+ * @param {ht.DataModel} dataModel
7
7
  * @returns {{layers, groups, resources}}
8
8
  */
9
9
 
10
- function getResourceConfigFromHt(dataModel) {
11
- // 获得分层
10
+ function getResourceConfigFromHt(topo) {
11
+ var htTopo = topo.getHtTopo();
12
+ var dataModel = topo.getDataModel(); // 获得分层
13
+
12
14
  var layerElements = getLayers(dataModel);
13
15
  var layers = layerElements.map(function (layerElement) {
14
16
  return {
15
17
  id: layerElement.getTag(),
16
- tag: layerElement.a('tag'),
17
- name: layerElement.s('label'),
18
- order: layerElement.a('order'),
18
+ tag: layerElement.a("tag"),
19
+ name: layerElement.s("label"),
20
+ order: layerElement.a("order"),
19
21
  resources: {
20
22
  "static": getLayerChildrenNodes(layerElement).filter(function (node) {
21
23
  return !!node.getTag();
@@ -32,7 +34,7 @@ function getResourceConfigFromHt(dataModel) {
32
34
  var viewNodes = getNodes(dataModel).filter(function (node) {
33
35
  return !node.getParent();
34
36
  }).filter(function (node) {
35
- return node.a('type') === 'node';
37
+ return node.a("type") === "node";
36
38
  }).filter(function (node) {
37
39
  return !!node.getTag();
38
40
  });
@@ -43,20 +45,40 @@ function getResourceConfigFromHt(dataModel) {
43
45
  }; // console.error('getResourceConfigFromHt', {
44
46
  // viewNodes,
45
47
  // });
48
+ // 查询出口链路列表
49
+
50
+ var exportLinkIdList = [];
51
+ var edges = getEdges(dataModel);
52
+ console.log(" 查询出口链路列表-edges", edges, dataModel);
53
+ edges.forEach(function (edge) {
54
+ var edgeData = htTopo.getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
55
+
56
+ var id = edgeData._attrObject.id;
57
+
58
+ if (id) {
59
+ var linkData = topo.dataModel.getDataById(id);
60
+ var connectType = linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"];
46
61
 
62
+ if (connectType === "exit" && !exportLinkIdList.includes(id)) {
63
+ exportLinkIdList.push(id);
64
+ }
65
+ }
66
+ });
47
67
  return {
48
- layers: sortBy(layers, 'order'),
49
- groups: sortBy([].concat(layers, groups), 'order'),
50
- resources: resources
68
+ layers: sortBy(layers, "order"),
69
+ groups: sortBy([].concat(layers, groups), "order"),
70
+ resources: resources,
71
+ exportLinkIdList: exportLinkIdList // 出口链路id列表
72
+
51
73
  };
52
74
  }
53
75
 
54
76
  function getGroupConfigByElement(groupElement) {
55
77
  return {
56
78
  id: groupElement.getTag(),
57
- tag: groupElement.a('tag'),
58
- name: groupElement.a('name'),
59
- order: groupElement.a('order'),
79
+ tag: groupElement.a("tag"),
80
+ name: groupElement.a("name"),
81
+ order: groupElement.a("order"),
60
82
  resources: {
61
83
  "static": getGroupChildrenNodes(groupElement).filter(function (node) {
62
84
  return !!node.getTag();
@@ -295,7 +295,6 @@ function buildGlobal(_ref2) {
295
295
  };
296
296
  }
297
297
 
298
- console.error(111, result);
299
298
  return {
300
299
  // 背景图
301
300
  backgroundImgUrl: (_engine$viewProps = engine.viewProps) !== null && _engine$viewProps !== void 0 && _engine$viewProps.hideBackground ? null : getBackgroundImageUrl(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.background),
@@ -8,61 +8,27 @@ exports.getCustomIconIdFromHtId = getCustomIconIdFromHtId;
8
8
  exports.getEditorIcons = getEditorIcons;
9
9
  exports.getGroupDefaultIcons = getGroupDefaultIcons;
10
10
  exports.getGroupIconGroups = getGroupIconGroups;
11
- exports.getIconLibs = getIconLibs;
12
11
  exports.getNodeDefaultIcons = getNodeDefaultIcons;
13
12
  exports.getNodeIconGroups = getNodeIconGroups;
14
- exports.getSystemIcons = getSystemIcons;
15
13
  exports.getUserCustomIcons = getUserCustomIcons;
16
14
  exports.transformCustomIcon2HtIcon = transformCustomIcon2HtIcon;
17
15
  exports.transformCustomIcons2HtIcons = transformCustomIcons2HtIcons;
18
16
 
19
17
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
20
18
 
21
- var _defaultIcons = require("./defaultIcons");
19
+ var _manager = _interopRequireDefault(require("@riil-frontend/component-topology-graph/es/manager"));
22
20
 
23
- var _networkTopoCiTypeIcons = _interopRequireDefault(require("./networkTopoCiTypeIcons"));
24
-
25
- var groupDefaultIcons = [{
26
- id: 'editor.icon.cloud.medium',
27
- name: '区域',
28
- url: '/img/topo/citype-icons/区域_平面.svg'
29
- }];
30
-
31
- function getSystemIcons() {
32
- var networkTopoCiTypeIcons = (0, _networkTopoCiTypeIcons["default"])().filter(function (icon) {
33
- return !_defaultIcons.DEFAULT_NODE_ICONS.filter(function (defaultIcon) {
34
- return defaultIcon.id === icon.id;
35
- }).length;
36
- });
37
- return [].concat(_defaultIcons.DEFAULT_NODE_ICONS, networkTopoCiTypeIcons);
38
- }
39
-
40
- console.error(getSystemIcons(), (0, _networkTopoCiTypeIcons["default"])());
41
-
42
- function getIconLibs() {
43
- return [{
44
- id: '1',
45
- name: '默认图标库1',
46
- icons: getSystemIcons()
47
- }, {
48
- id: '2',
49
- name: '默认图标库2',
50
- icons: getSystemIcons()
51
- }];
52
- }
53
21
  /**
54
22
  * 获取默认图标
55
23
  * @param {*} topo
56
24
  * @returns
57
25
  */
58
-
59
-
60
26
  function getNodeDefaultIcons(topo) {
61
- return [].concat(getSystemIcons(), topo.options.icons || []);
27
+ return [].concat(_manager["default"].iconLibManager.getNodeIcons(), topo.options.icons || []);
62
28
  }
63
29
 
64
30
  function getGroupDefaultIcons(topo) {
65
- return [].concat(groupDefaultIcons, getNodeDefaultIcons(topo));
31
+ return [].concat(_manager["default"].iconLibManager.getIcons());
66
32
  }
67
33
  /**
68
34
  * 获取编辑模式左侧图片列表