@riil-frontend/component-topology 3.5.12 → 3.5.15

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.
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
20
20
  import PluginManager from "./PluginManager";
21
21
  import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
22
22
 
23
- var version = typeof "3.5.12" === 'string' ? "3.5.12" : null;
23
+ var version = typeof "3.5.15" === 'string' ? "3.5.15" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -33,7 +33,9 @@ export default function useManageStatus(props) {
33
33
  topoState = _topo$store$useModel[0],
34
34
  topoDispatchers = _topo$store$useModel[1];
35
35
 
36
- var graphLoaded = topoState.graphLoaded;
36
+ var graphLoaded = topoState.graphLoaded,
37
+ viewState = topoState.viewState;
38
+ var isEditMode = viewState === 'edit';
37
39
  var resources = topo.dataModel.useCis();
38
40
  useTopoEventListener({
39
41
  type: 'manageStatus',
@@ -55,7 +57,7 @@ export default function useManageStatus(props) {
55
57
  });
56
58
  useEffect(function () {
57
59
  // 首次加载和监控状态变化后,更新节点和连线置灰状态
58
- if (graphLoaded) {
60
+ if (!isEditMode && graphLoaded) {
59
61
  resources.forEach(function (resource) {
60
62
  var type = resource.type,
61
63
  id = resource.id,
@@ -74,5 +76,5 @@ export default function useManageStatus(props) {
74
76
  }
75
77
  });
76
78
  }
77
- }, [graphLoaded, resources]);
79
+ }, [isEditMode, graphLoaded, resources]);
78
80
  }
@@ -72,24 +72,35 @@ function AddLinkDrawer(props) {
72
72
  while (1) {
73
73
  switch (_context.prev = _context.next) {
74
74
  case 0:
75
- _context.next = 2;
76
- return service.getPortsById(id);
75
+ if (!(id === null)) {
76
+ _context.next = 2;
77
+ break;
78
+ }
79
+
80
+ return _context.abrupt("return", {
81
+ ports: [],
82
+ portsDoc: {}
83
+ });
77
84
 
78
85
  case 2:
86
+ _context.next = 4;
87
+ return service.getPortsById(id);
88
+
89
+ case 4:
79
90
  result = _context.sent;
80
- _context.next = 5;
91
+ _context.next = 7;
81
92
  return service.queryLinksByNodeId(id);
82
93
 
83
- case 5:
94
+ case 7:
84
95
  links = _context.sent;
85
96
  ifTypes = result.map(function (item) {
86
97
  return item.type;
87
98
  }); // console.log("端口类型列表", ifTypes);
88
99
 
89
- _context.next = 9;
100
+ _context.next = 11;
90
101
  return getInterfaceObject(ifTypes);
91
102
 
92
- case 9:
103
+ case 11:
93
104
  ifDoc = _context.sent;
94
105
  // console.log("端口类型字典", ifDoc);
95
106
  usedPorts = [];
@@ -123,7 +134,7 @@ function AddLinkDrawer(props) {
123
134
  portsDoc: portsDoc
124
135
  });
125
136
 
126
- case 16:
137
+ case 18:
127
138
  case "end":
128
139
  return _context.stop();
129
140
  }
@@ -4,8 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  * 连线组标注、悬浮框数据构建
5
5
  */
6
6
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
- import groupBy from 'lodash/groupBy';
8
- import { getEdgeGroupByNodeTags, getEdgeGroups } from "../../utils/htElementUtils";
7
+ import { getEdgeGroups } from "../../utils/htElementUtils";
9
8
  import AttributeFormatter from "../../core/models/attributeFormatter"; // 参与计算的链路指标
10
9
 
11
10
  var metrics = [// 总流速
@@ -87,11 +86,6 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
87
86
  var edgeGroupsTagsTips = groups.map(function (_ref) {
88
87
  var groupId = _ref.groupId,
89
88
  linkChildren = _ref.children;
90
- console.error(1111, {
91
- ciConfigs: ciConfigs,
92
- linkChildren: linkChildren,
93
- data: data
94
- });
95
89
  var config = ciConfigs.find(function (item) {
96
90
  return item.id === linkChildren[0].id;
97
91
  });
@@ -101,10 +95,7 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
101
95
  linkChildren: linkChildren,
102
96
  data: data
103
97
  });
104
- }); // console.error({
105
- // noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
106
- // })
107
- // 获得连线组及子链路
98
+ }); // 获得连线组及子链路
108
99
  // 关联聚合链路、无子链路 时返回null
109
100
 
110
101
  function getGroupInfo(group) {
@@ -1,3 +1,4 @@
1
+ import rlog from "@riil-frontend/component-topology-utils/es/rlog";
1
2
  import sortBy from "lodash/sortBy";
2
3
  import { getEdges, getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
3
4
  /**
@@ -49,18 +50,21 @@ function getResourceConfigFromHt(topo) {
49
50
 
50
51
  var exportLinkIdList = [];
51
52
  var edges = getEdges(dataModel);
52
- console.log(" 查询出口链路列表-edges", edges, dataModel);
53
+ rlog.debug(" 查询出口链路列表-edges", edges, dataModel);
53
54
  edges.forEach(function (edge) {
54
- var edgeData = htTopo.getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
55
+ var edgeData = htTopo.getEdgeData(edge); // 有组无子连线返回null
55
56
 
56
- var id = edgeData._attrObject.id;
57
+ if (edgeData) {
58
+ // eslint-disable-next-line no-underscore-dangle
59
+ var id = edgeData._attrObject.id;
57
60
 
58
- if (id) {
59
- var linkData = topo.dataModel.getDataById(id);
60
- var connectType = linkData !== null && linkData !== void 0 && linkData.attributes ? linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"] : undefined;
61
+ if (id) {
62
+ var linkData = topo.dataModel.getDataById(id);
63
+ var connectType = linkData !== null && linkData !== void 0 && linkData.attributes ? linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"] : undefined;
61
64
 
62
- if (connectType === "exit" && !exportLinkIdList.includes(id)) {
63
- exportLinkIdList.push(id);
65
+ if (connectType === "exit" && !exportLinkIdList.includes(id)) {
66
+ exportLinkIdList.push(id);
67
+ }
64
68
  }
65
69
  }
66
70
  });
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
48
48
  var _topoFactory = _interopRequireDefault(require("./topoFactory"));
49
49
 
50
50
  // eslint-disable-next-line no-undef
51
- var version = typeof "3.5.12" === 'string' ? "3.5.12" : null;
51
+ var version = typeof "3.5.15" === 'string' ? "3.5.15" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -43,7 +43,9 @@ function useManageStatus(props) {
43
43
  topoState = _topo$store$useModel[0],
44
44
  topoDispatchers = _topo$store$useModel[1];
45
45
 
46
- var graphLoaded = topoState.graphLoaded;
46
+ var graphLoaded = topoState.graphLoaded,
47
+ viewState = topoState.viewState;
48
+ var isEditMode = viewState === 'edit';
47
49
  var resources = topo.dataModel.useCis();
48
50
  (0, _useTopoEventListener["default"])({
49
51
  type: 'manageStatus',
@@ -64,7 +66,7 @@ function useManageStatus(props) {
64
66
  });
65
67
  (0, _react.useEffect)(function () {
66
68
  // 首次加载和监控状态变化后,更新节点和连线置灰状态
67
- if (graphLoaded) {
69
+ if (!isEditMode && graphLoaded) {
68
70
  resources.forEach(function (resource) {
69
71
  var type = resource.type,
70
72
  id = resource.id,
@@ -83,5 +85,5 @@ function useManageStatus(props) {
83
85
  }
84
86
  });
85
87
  }
86
- }, [graphLoaded, resources]);
88
+ }, [isEditMode, graphLoaded, resources]);
87
89
  }
@@ -101,24 +101,35 @@ function AddLinkDrawer(props) {
101
101
  while (1) {
102
102
  switch (_context.prev = _context.next) {
103
103
  case 0:
104
- _context.next = 2;
105
- return _server["default"].getPortsById(id);
104
+ if (!(id === null)) {
105
+ _context.next = 2;
106
+ break;
107
+ }
108
+
109
+ return _context.abrupt("return", {
110
+ ports: [],
111
+ portsDoc: {}
112
+ });
106
113
 
107
114
  case 2:
115
+ _context.next = 4;
116
+ return _server["default"].getPortsById(id);
117
+
118
+ case 4:
108
119
  result = _context.sent;
109
- _context.next = 5;
120
+ _context.next = 7;
110
121
  return _server["default"].queryLinksByNodeId(id);
111
122
 
112
- case 5:
123
+ case 7:
113
124
  links = _context.sent;
114
125
  ifTypes = result.map(function (item) {
115
126
  return item.type;
116
127
  }); // console.log("端口类型列表", ifTypes);
117
128
 
118
- _context.next = 9;
129
+ _context.next = 11;
119
130
  return (0, _linkUtils.getInterfaceObject)(ifTypes);
120
131
 
121
- case 9:
132
+ case 11:
122
133
  ifDoc = _context.sent;
123
134
  // console.log("端口类型字典", ifDoc);
124
135
  usedPorts = [];
@@ -152,7 +163,7 @@ function AddLinkDrawer(props) {
152
163
  portsDoc: portsDoc
153
164
  });
154
165
 
155
- case 16:
166
+ case 18:
156
167
  case "end":
157
168
  return _context.stop();
158
169
  }
@@ -9,8 +9,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
 
10
10
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
11
11
 
12
- var _groupBy = _interopRequireDefault(require("lodash/groupBy"));
13
-
14
12
  var _htElementUtils = require("../../utils/htElementUtils");
15
13
 
16
14
  var _attributeFormatter = _interopRequireDefault(require("../../core/models/attributeFormatter"));
@@ -98,11 +96,6 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
98
96
  var edgeGroupsTagsTips = groups.map(function (_ref) {
99
97
  var groupId = _ref.groupId,
100
98
  linkChildren = _ref.children;
101
- console.error(1111, {
102
- ciConfigs: ciConfigs,
103
- linkChildren: linkChildren,
104
- data: data
105
- });
106
99
  var config = ciConfigs.find(function (item) {
107
100
  return item.id === linkChildren[0].id;
108
101
  });
@@ -112,10 +105,7 @@ var LinkTagsTipsBuilder = /*#__PURE__*/function () {
112
105
  linkChildren: linkChildren,
113
106
  data: data
114
107
  });
115
- }); // console.error({
116
- // noParentLinks, groupMap, edgeGroups: edgeGroupsTagsTips, ciTagsAndTips, data
117
- // })
118
- // 获得连线组及子链路
108
+ }); // 获得连线组及子链路
119
109
  // 关联聚合链路、无子链路 时返回null
120
110
 
121
111
  function getGroupInfo(group) {
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports["default"] = void 0;
7
7
 
8
+ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
9
+
8
10
  var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
9
11
 
10
12
  var _htElementUtils = require("./htElementUtils");
@@ -57,18 +59,23 @@ function getResourceConfigFromHt(topo) {
57
59
 
58
60
  var exportLinkIdList = [];
59
61
  var edges = (0, _htElementUtils.getEdges)(dataModel);
60
- console.log(" 查询出口链路列表-edges", edges, dataModel);
62
+
63
+ _rlog["default"].debug(" 查询出口链路列表-edges", edges, dataModel);
64
+
61
65
  edges.forEach(function (edge) {
62
- var edgeData = htTopo.getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
66
+ var edgeData = htTopo.getEdgeData(edge); // 有组无子连线返回null
63
67
 
64
- var id = edgeData._attrObject.id;
68
+ if (edgeData) {
69
+ // eslint-disable-next-line no-underscore-dangle
70
+ var id = edgeData._attrObject.id;
65
71
 
66
- if (id) {
67
- var linkData = topo.dataModel.getDataById(id);
68
- var connectType = linkData !== null && linkData !== void 0 && linkData.attributes ? linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"] : undefined;
72
+ if (id) {
73
+ var linkData = topo.dataModel.getDataById(id);
74
+ var connectType = linkData !== null && linkData !== void 0 && linkData.attributes ? linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"] : undefined;
69
75
 
70
- if (connectType === "exit" && !exportLinkIdList.includes(id)) {
71
- exportLinkIdList.push(id);
76
+ if (connectType === "exit" && !exportLinkIdList.includes(id)) {
77
+ exportLinkIdList.push(id);
78
+ }
72
79
  }
73
80
  }
74
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "3.5.12",
3
+ "version": "3.5.15",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.12/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.15/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }