@riil-frontend/component-topology 4.0.20 → 4.0.21

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.
@@ -8,6 +8,7 @@ exports.getInterfaceObject = void 0;
8
8
  exports.getLinksDetail = getLinksDetail;
9
9
  exports.isAggLink = isAggLink;
10
10
  exports.mergeLinksData = mergeLinksData;
11
+ exports.showLinkByConfig = exports.plurals = void 0;
11
12
 
12
13
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
14
 
@@ -23,6 +24,9 @@ var _lodash = _interopRequireDefault(require("lodash"));
23
24
 
24
25
  var _services = require("../../services");
25
26
 
27
+ var _htElementUtils = require("../../../utils/htElementUtils");
28
+
29
+ // 查询所有连线
26
30
  // const interfaceTypeMap = {
27
31
  // "network.interface": {
28
32
  // displayName: "网络接口",
@@ -158,7 +162,7 @@ function _getLinksDetail() {
158
162
  interfaceCis = _context2.sent;
159
163
  _context2.next = 13;
160
164
  return getInterfaceObject(interfaceTypes.filter(function (item) {
161
- return item !== 'ip';
165
+ return item !== "ip";
162
166
  }));
163
167
 
164
168
  case 13:
@@ -175,4 +179,60 @@ function _getLinksDetail() {
175
179
  return _getLinksDetail.apply(this, arguments);
176
180
  }
177
181
 
178
- function buildTopoLinkData() {}
182
+ function buildTopoLinkData() {}
183
+ /**
184
+ * 链路显示模式
185
+ */
186
+
187
+
188
+ var plurals = {
189
+ 0: [],
190
+ 1: [],
191
+ 2: ["phy"],
192
+ 3: ["agg"],
193
+ 4: ["phy", "agg"]
194
+ };
195
+ exports.plurals = plurals;
196
+
197
+ var showLinkByConfig = function showLinkByConfig(props) {
198
+ console.log("showLinkByConfig-----------------------------", props);
199
+ var topo = props.topo,
200
+ showType = props.showType; //const displayConfig = topo.store.getModelState("displayConfig");
201
+
202
+ var types = plurals[showType]; // 查询所有连线
203
+
204
+ var gv = topo.getGraphView();
205
+ var dm = gv.getDataModel();
206
+ var edges = (0, _htElementUtils.getEdges)(dm); // console.log("edges", edges);
207
+
208
+ var showPhy = types.indexOf("phy") >= 0;
209
+ var showAgg = types.indexOf("agg") >= 0;
210
+
211
+ if (Array.isArray(edges) && edges.length > 0) {
212
+ edges.map(function (edge) {
213
+ if (showType === 1) {
214
+ // 单链路全部显示
215
+ edge.s("2d.visible", true);
216
+ } else {
217
+ var d = topo.dataModel.getDataById(edge.getTag()); //console.log("edge", edge, d);
218
+ // 判断是否聚合链路
219
+
220
+ if (d.destination_type === "network.agg_interface" && d.source_type === "network.agg_interface") {
221
+ if (showAgg) {
222
+ edge.s("2d.visible", true);
223
+ } else {
224
+ edge.s("2d.visible", false);
225
+ }
226
+ } else {
227
+ if (showPhy) {
228
+ edge.s("2d.visible", true);
229
+ } else {
230
+ edge.s("2d.visible", false);
231
+ }
232
+ }
233
+ }
234
+ });
235
+ }
236
+ };
237
+
238
+ exports.showLinkByConfig = showLinkByConfig;
@@ -7,6 +7,8 @@ exports.updateEdgeExpanded = void 0;
7
7
 
8
8
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
9
9
 
10
+ var _linkUtils = require("../models/utils/linkUtils");
11
+
10
12
  /**
11
13
  * 根据配置更新连线展开折叠状态
12
14
  *
@@ -22,7 +24,9 @@ var updateEdgeExpanded = function updateEdgeExpanded(topo) {
22
24
  var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
23
25
  expandAllEdges = _topo$store$getModelS.expandAllEdges;
24
26
 
25
- if (expandAllEdges === false) {
27
+ console.log("expandAllEdges----------", expandAllEdges);
28
+
29
+ if (expandAllEdges === 1) {
26
30
  htTopo.collapseAllEdgeGroups();
27
31
 
28
32
  _rlog["default"].debug('updateEdgeExpanded 折叠');
@@ -32,6 +36,11 @@ var updateEdgeExpanded = function updateEdgeExpanded(topo) {
32
36
  _rlog["default"].debug('updateEdgeExpanded 展开');
33
37
  }
34
38
 
39
+ (0, _linkUtils.showLinkByConfig)({
40
+ topo: topo,
41
+ showType: expandAllEdges
42
+ });
43
+
35
44
  if (topo.linkDynamicStyleExecutor) {
36
45
  topo.linkDynamicStyleExecutor.execute();
37
46
  }
@@ -461,10 +461,13 @@ function _default(topoApp) {
461
461
  _rlog["default"].debug("topoMod.initTopoData Ci属性指标元数据", ciTypeMap);
462
462
 
463
463
  extraConfig = result.global.extraConfig;
464
- _context6.next = 49;
464
+
465
+ _rlog["default"].debug("topoMod.initTopoData extraConfig", extraConfig);
466
+
467
+ _context6.next = 50;
465
468
  return dispatch.displayConfig.setConfig(extraConfig);
466
469
 
467
- case 49:
470
+ case 50:
468
471
  _combTopoData = (0, _topoData.combTopoData)({
469
472
  engine: topoApp,
470
473
  data: result,
@@ -495,7 +498,7 @@ function _default(topoApp) {
495
498
 
496
499
  topoApp.options.onLoad();
497
500
 
498
- case 58:
501
+ case 59:
499
502
  case "end":
500
503
  return _context6.stop();
501
504
  }
@@ -45,6 +45,8 @@ var _LinkTagV = _interopRequireDefault(require("./viewer/displaySetting/LinkTagV
45
45
 
46
46
  var _useEdgeExpand = _interopRequireDefault(require("../hooks/useEdgeExpand"));
47
47
 
48
+ var _linkUtils = require("../../core/models/utils/linkUtils");
49
+
48
50
  var _excluded = ["topo", "titleBar", "onEnterEdit", "nodataPage", "notfoundPageProps", "noPermissionPageProps"];
49
51
 
50
52
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -87,19 +89,24 @@ function NetworkTopologyCore(props) {
87
89
  while (1) {
88
90
  switch (_context.prev = _context.next) {
89
91
  case 0:
90
- // 单多链路切换
91
- if (config.expandAllEdges !== false) {
92
+ console.log("hancleDisplaySettingOk", config.expandAllEdges); // 单多链路切换
93
+
94
+ if (config.expandAllEdges !== 1) {
92
95
  topo.getHtTopo().expandAllEdgeGroups();
93
96
  } else {
94
97
  topo.getHtTopo().collapseAllEdgeGroups();
95
- } // 更新链路动态样式
98
+ }
96
99
 
100
+ (0, _linkUtils.showLinkByConfig)({
101
+ topo: topo,
102
+ showType: config.expandAllEdges
103
+ }); // 更新链路动态样式
97
104
 
98
105
  if (topo.linkDynamicStyleExecutor) {
99
106
  topo.linkDynamicStyleExecutor.execute();
100
107
  }
101
108
 
102
- case 2:
109
+ case 4:
103
110
  case "end":
104
111
  return _context.stop();
105
112
  }
@@ -478,8 +478,9 @@ function AddLinkDrawer(props) {
478
478
  try {
479
479
  // 获取两个节点间的连线数据列表
480
480
  var edgesInNodes = (0, _htElementUtils.getEdgesBetweenNodes)(source, target);
481
+ var _isGroup = false; // linkType === "agg"
481
482
 
482
- if (linkType === "agg") {
483
+ if (_isGroup) {
483
484
  // 聚合链路
484
485
  if (edgesInNodes.length === 0) {
485
486
  htTopo.createEdge(source, target, linkData);
@@ -578,9 +579,8 @@ function AddLinkDrawer(props) {
578
579
  result = _context5.sent;
579
580
 
580
581
  case 13:
581
- setLoading(false);
582
582
  linkType = data["network_link.connect_type"];
583
- _context5.prev = 15;
583
+ _context5.prev = 14;
584
584
 
585
585
  if (!result) {
586
586
  _context5.next = 55;
@@ -590,7 +590,7 @@ function AddLinkDrawer(props) {
590
590
  config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
591
591
 
592
592
  if (!isAddMode) {
593
- _context5.next = 31;
593
+ _context5.next = 30;
594
594
  break;
595
595
  }
596
596
 
@@ -604,10 +604,10 @@ function AddLinkDrawer(props) {
604
604
  exportLinkIdList: exportLinkIdList
605
605
  })); // const linkType = data["network_link.connect_type"];
606
606
 
607
- _context5.next = 24;
607
+ _context5.next = 23;
608
608
  return editDispatchers.fetchDataByConfig();
609
609
 
610
- case 24:
610
+ case 23:
611
611
  _yield$editDispatcher = _context5.sent;
612
612
  elements = _yield$editDispatcher.elements;
613
613
  linkData = elements.find(function (element) {
@@ -622,12 +622,12 @@ function AddLinkDrawer(props) {
622
622
 
623
623
  _message["default"].success("创建成功");
624
624
 
625
- _context5.next = 53;
625
+ _context5.next = 52;
626
626
  break;
627
627
 
628
- case 31:
628
+ case 30:
629
629
  if (!(linkType === "exit")) {
630
- _context5.next = 46;
630
+ _context5.next = 45;
631
631
  break;
632
632
  }
633
633
 
@@ -653,27 +653,28 @@ function AddLinkDrawer(props) {
653
653
  topoDispatchers.update({
654
654
  data: newData
655
655
  });
656
- _context5.next = 52;
656
+ _context5.next = 51;
657
657
  break;
658
658
 
659
- case 46:
659
+ case 45:
660
660
  _config = topo.resourceConfig.getConfigFromHt();
661
661
  topo.resourceConfig.updateConfig(_config);
662
- _context5.next = 50;
662
+ _context5.next = 49;
663
663
  return editDispatchers.fetchDataByConfig();
664
664
 
665
- case 50:
665
+ case 49:
666
666
  _yield$editDispatcher2 = _context5.sent;
667
667
  _elements = _yield$editDispatcher2.elements;
668
668
 
669
- case 52:
669
+ case 51:
670
670
  _message["default"].success("保存成功");
671
671
 
672
- case 53:
672
+ case 52:
673
673
  editDispatchers.update({
674
674
  addLinkIsOpen: false,
675
675
  currentLink: null
676
676
  });
677
+ setLoading(false);
677
678
  topo.linkDynamicStyleExecutor.execute();
678
679
 
679
680
  case 55:
@@ -682,7 +683,7 @@ function AddLinkDrawer(props) {
682
683
 
683
684
  case 57:
684
685
  _context5.prev = 57;
685
- _context5.t0 = _context5["catch"](15);
686
+ _context5.t0 = _context5["catch"](14);
686
687
 
687
688
  _rlog["default"].debug("保存链路信息异常", _context5.t0);
688
689
 
@@ -691,7 +692,7 @@ function AddLinkDrawer(props) {
691
692
  return _context5.stop();
692
693
  }
693
694
  }
694
- }, _callee5, null, [[15, 57]]);
695
+ }, _callee5, null, [[14, 57]]);
695
696
  }));
696
697
 
697
698
  return function onSave(_x4) {
@@ -51,12 +51,8 @@ function _addLinkData() {
51
51
  case 3:
52
52
  links = _context.sent;
53
53
  return _context.abrupt("return", {
54
- links: links.filter(function (link) {
55
- return link.attributes['network_link.connect_type'] !== 'agg';
56
- }),
57
- linkGroups: links.filter(function (link) {
58
- return link.attributes['network_link.connect_type'] === 'agg';
59
- })
54
+ links: links,
55
+ linkGroups: []
60
56
  });
61
57
 
62
58
  case 5:
@@ -57,14 +57,15 @@ var _default = function _default(_ref) {
57
57
 
58
58
  var doDeleteLink = /*#__PURE__*/function () {
59
59
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(link, edge) {
60
- var id, isAgg, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
60
+ var id, isGroup, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
61
61
 
62
62
  return _regenerator["default"].wrap(function _callee$(_context) {
63
63
  while (1) {
64
64
  switch (_context.prev = _context.next) {
65
65
  case 0:
66
66
  id = link.id;
67
- isAgg = (0, _linkUtils.isAggLink)(link);
67
+ isGroup = false; // isAggLink(link);
68
+
68
69
  _context.next = 4;
69
70
  return _link["default"].deleteLink(id);
70
71
 
@@ -88,7 +89,7 @@ var _default = function _default(_ref) {
88
89
  edgesInNodes = htTopo.getEdgeDatasInNodes(edge.getSource(), edge.getTarget());
89
90
 
90
91
  if (edgesInNodes.length >= 2) {
91
- if (isAgg) {
92
+ if (isGroup) {
92
93
  htTopo.setEdgeGroupData(edge.getSource(), edge.getTarget(), null);
93
94
  } else {
94
95
  htTopo.deleteEdge(edge);
@@ -98,10 +99,10 @@ var _default = function _default(_ref) {
98
99
  edgeGroupData = htTopo.getEdgeGroupData(edge.getSource(), edge.getTarget());
99
100
  edgeData = htTopo.getEdgeData(edge);
100
101
 
101
- if (isAgg && edgeData) {
102
+ if (isGroup && edgeData) {
102
103
  // 当前是连线组代理 且 有连线数据,清空组数据
103
104
  htTopo.setEdgeGroupData(edge.getSource(), edge.getTarget(), null);
104
- } else if (!isAgg && edgeGroupData) {
105
+ } else if (!isGroup && edgeGroupData) {
105
106
  htTopo.setEdgeData(edge, null);
106
107
  } else {
107
108
  htTopo.deleteEdge(edge);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "4.0.20",
3
+ "version": "4.0.21",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -114,6 +114,6 @@
114
114
  "access": "public"
115
115
  },
116
116
  "license": "MIT",
117
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@4.0.20/build/index.html",
117
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@4.0.21/build/index.html",
118
118
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
119
119
  }