@riil-frontend/component-topology 8.0.0-a.8 → 8.0.0-a.9

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.
@@ -21,9 +21,9 @@ var usePolling = function usePolling(props) {
21
21
  var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
22
22
 
23
23
  var _useRequest = useRequest(refresh, {
24
- pollingInterval: 1000 * 15,
25
- // pollingWhenHidden: false,
26
- // debounceInterval: 1000,
24
+ pollingInterval: 60 * 1000,
25
+ pollingWhenHidden: false,
26
+ // debounceInterval: 200,
27
27
  manual: true,
28
28
  onSuccess: function onSuccess(result) {
29
29
  if (result) {
@@ -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 "8.0.0-a.8" === 'string' ? "8.0.0-a.8" : null;
26
+ var version = typeof "8.0.0-a.9" === 'string' ? "8.0.0-a.9" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -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
4
  import keyBy from 'lodash/keyBy';
6
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,40 +33,6 @@ 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
37
  var linkCiMap = keyBy(links, 'id');
72
38
  return links.map(function (link) {
@@ -110,57 +76,59 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
110
76
  });
111
77
  });
112
78
  }
113
- export function getLinksDetail(_x2, _x3) {
79
+ export function getLinksDetail(_x, _x2) {
114
80
  return _getLinksDetail.apply(this, arguments);
115
81
  }
116
82
 
117
83
  function _getLinksDetail() {
118
- _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(links, nodes) {
84
+ _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
119
85
  var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
120
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
121
87
  while (1) {
122
- switch (_context2.prev = _context2.next) {
88
+ switch (_context.prev = _context.next) {
123
89
  case 0:
124
90
  if (!(!links || !links.length)) {
125
- _context2.next = 2;
91
+ _context.next = 2;
126
92
  break;
127
93
  }
128
94
 
129
- return _context2.abrupt("return", []);
95
+ return _context.abrupt("return", []);
130
96
 
131
97
  case 2:
132
98
  // const linkCis = await topoService.relation.batchQueryRelation(
133
99
  // links.map((link) => link.id)
134
100
  // );
135
101
  linkCis = links;
136
- interfaceIds = [];
137
- interfaceTypes = [];
138
- linkCis.forEach(function (item) {
139
- interfaceIds.push(item.attributes.source_id);
140
- interfaceIds.push(item.attributes.destination_id);
141
- interfaceTypes.push(item.attributes.source_type);
142
- interfaceTypes.push(item.attributes.destination_type);
102
+ interfaceIds = [].concat(linkCis.map(function (item) {
103
+ return item.attributes.source_id;
104
+ }), linkCis.map(function (item) {
105
+ return item.attributes.destination_id;
106
+ }));
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';
143
113
  });
144
- _context2.next = 8;
114
+ _context.next = 7;
145
115
  return queryCisByIds(interfaceIds);
146
116
 
147
- case 8:
148
- interfaceCis = _context2.sent;
149
- _context2.next = 11;
150
- return getInterfaceObject(interfaceTypes.filter(function (item) {
151
- return item !== 'ip';
152
- }));
117
+ case 7:
118
+ interfaceCis = _context.sent;
119
+ _context.next = 10;
120
+ return CiTypeCache.getCiTypeMap(interfaceTypes);
153
121
 
154
- case 11:
155
- interfaceDoc = _context2.sent;
156
- 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));
157
125
 
158
- case 13:
126
+ case 12:
159
127
  case "end":
160
- return _context2.stop();
128
+ return _context.stop();
161
129
  }
162
130
  }
163
- }, _callee2);
131
+ }, _callee);
164
132
  }));
165
133
  return _getLinksDetail.apply(this, arguments);
166
134
  }
@@ -954,7 +954,8 @@ export default function ResourceOverview(props) {
954
954
  ciAttrAndMetricData: ciAttrAndMetricData
955
955
  },
956
956
  data: metric,
957
- loading: metricInitLoading
957
+ loading: metricInitLoading,
958
+ formatMetricLatestValue: resourceOverviewProps.formatMetricLatestValue
958
959
  })), /*#__PURE__*/React.createElement(EventsCard, {
959
960
  alarmRiskList: alarmRiskList,
960
961
  closeDetailDrawer: onClose,
@@ -60,7 +60,8 @@ export default function ResourceOverviewMetric(props) {
60
60
  var topo = props.topo,
61
61
  type = props.type,
62
62
  data = props.data,
63
- loading = props.loading;
63
+ loading = props.loading,
64
+ formatMetricLatestValue = props.formatMetricLatestValue;
64
65
 
65
66
  function formatValue(itemData) {
66
67
  var _list;
@@ -69,7 +70,8 @@ export default function ResourceOverviewMetric(props) {
69
70
  metricItem = itemData.metricItem,
70
71
  list = itemData.list;
71
72
  var format = metricValueFormat({
72
- value: (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
73
+ // 支持业务拓扑历史时间点指标值处理
74
+ value: formatMetricLatestValue ? formatMetricLatestValue(list) : (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
73
75
  dataType: metricItem.dataType,
74
76
  dict: topo.dictCache.getDictObject(),
75
77
  unit: metricItem.unit,
@@ -21,7 +21,7 @@ export default function useMetricPolling(_ref) {
21
21
 
22
22
 
23
23
  var queryLinkMetricsRequest = useRequest(queryLinkLatestMetrics, {
24
- pollingInterval: 1000 * 15,
24
+ pollingInterval: 60 * 1000,
25
25
  pollingWhenHidden: false,
26
26
  debounceInterval: 200,
27
27
  manual: true,
@@ -31,7 +31,7 @@ export default function useMetricPolling(_ref) {
31
31
  }
32
32
  });
33
33
  var queryInterfaceMetricsRequest = useRequest(queryLinkInterfacesLatestMetrics, {
34
- pollingInterval: 1000 * 15,
34
+ pollingInterval: 60 * 1000,
35
35
  pollingWhenHidden: false,
36
36
  debounceInterval: 200,
37
37
  manual: true,
@@ -92,9 +92,9 @@ var useMetricModels = function useMetricModels(props) {
92
92
  }
93
93
 
94
94
  var request = useRequest(fetchData, {
95
- pollingInterval: 1000 * 5,
96
- // pollingWhenHidden: false,
97
- // debounceInterval: 1000,
95
+ pollingInterval: 1000 * 60,
96
+ pollingWhenHidden: false,
97
+ // debounceInterval: 200,
98
98
  manual: true,
99
99
  onSuccess: function onSuccess(newMetricModels) {
100
100
  var a = metricModels.map(function (item) {
@@ -34,9 +34,9 @@ var usePolling = function usePolling(props) {
34
34
  var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
35
35
 
36
36
  var _useRequest = (0, _ahooks.useRequest)(refresh, {
37
- pollingInterval: 1000 * 15,
38
- // pollingWhenHidden: false,
39
- // debounceInterval: 1000,
37
+ pollingInterval: 60 * 1000,
38
+ pollingWhenHidden: false,
39
+ // debounceInterval: 200,
40
40
  manual: true,
41
41
  onSuccess: function onSuccess(result) {
42
42
  if (result) {
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
54
54
  var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
55
55
 
56
56
  // eslint-disable-next-line no-undef
57
- var version = typeof "8.0.0-a.8" === 'string' ? "8.0.0-a.8" : null;
57
+ var version = typeof "8.0.0-a.9" === 'string' ? "8.0.0-a.9" : null;
58
58
  console.info("\u62D3\u6251\u7248\u672C: " + version);
59
59
  /**
60
60
  * 拓扑显示和编辑
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.buildTopoLinkData = buildTopoLinkData;
7
- exports.getInterfaceObject = exports.compatibleWith = void 0;
7
+ exports.compatibleWith = void 0;
8
8
  exports.getLinksDetail = getLinksDetail;
9
9
  exports.isCrucialLink = isCrucialLink;
10
10
  exports.isExitLink = isExitLink;
@@ -13,11 +13,9 @@ exports.showLinkByConfig = exports.plurals = void 0;
13
13
 
14
14
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
15
 
16
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
-
18
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
17
 
20
- var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
18
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
21
19
 
22
20
  var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
23
21
 
@@ -27,6 +25,8 @@ var _services = require("../../services");
27
25
 
28
26
  var _htElementUtils = require("../../../utils/htElementUtils");
29
27
 
28
+ var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
29
+
30
30
  // 查询所有连线
31
31
  // const interfaceTypeMap = {
32
32
  // "network.interface": {
@@ -56,43 +56,6 @@ function isExitLink(link) {
56
56
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
57
57
  }
58
58
 
59
- var getInterfaceObject = /*#__PURE__*/function () {
60
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(codes) {
61
- var query, promises, result, ifDoc;
62
- return _regenerator["default"].wrap(function _callee$(_context) {
63
- while (1) {
64
- switch (_context.prev = _context.next) {
65
- case 0:
66
- query = _lodash["default"].compact(_lodash["default"].uniq(codes));
67
- promises = query.map(_services.queryModelAsset);
68
- _context.next = 4;
69
- return Promise.all(promises);
70
-
71
- case 4:
72
- result = _context.sent;
73
- ifDoc = {};
74
- result.map(function (ifItem) {
75
- ifDoc[ifItem.code] = {
76
- displayName: ifItem.displayName
77
- };
78
- });
79
- return _context.abrupt("return", ifDoc);
80
-
81
- case 8:
82
- case "end":
83
- return _context.stop();
84
- }
85
- }
86
- }, _callee);
87
- }));
88
-
89
- return function getInterfaceObject(_x) {
90
- return _ref.apply(this, arguments);
91
- };
92
- }();
93
-
94
- exports.getInterfaceObject = getInterfaceObject;
95
-
96
59
  function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
97
60
  var linkCiMap = (0, _keyBy["default"])(links, 'id');
98
61
  return links.map(function (link) {
@@ -135,57 +98,59 @@ function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
135
98
  });
136
99
  }
137
100
 
138
- function getLinksDetail(_x2, _x3) {
101
+ function getLinksDetail(_x, _x2) {
139
102
  return _getLinksDetail.apply(this, arguments);
140
103
  }
141
104
 
142
105
  function _getLinksDetail() {
143
- _getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(links, nodes) {
106
+ _getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(links, nodes) {
144
107
  var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
145
- return _regenerator["default"].wrap(function _callee2$(_context2) {
108
+ return _regenerator["default"].wrap(function _callee$(_context) {
146
109
  while (1) {
147
- switch (_context2.prev = _context2.next) {
110
+ switch (_context.prev = _context.next) {
148
111
  case 0:
149
112
  if (!(!links || !links.length)) {
150
- _context2.next = 2;
113
+ _context.next = 2;
151
114
  break;
152
115
  }
153
116
 
154
- return _context2.abrupt("return", []);
117
+ return _context.abrupt("return", []);
155
118
 
156
119
  case 2:
157
120
  // const linkCis = await topoService.relation.batchQueryRelation(
158
121
  // links.map((link) => link.id)
159
122
  // );
160
123
  linkCis = links;
161
- interfaceIds = [];
162
- interfaceTypes = [];
163
- linkCis.forEach(function (item) {
164
- interfaceIds.push(item.attributes.source_id);
165
- interfaceIds.push(item.attributes.destination_id);
166
- interfaceTypes.push(item.attributes.source_type);
167
- interfaceTypes.push(item.attributes.destination_type);
124
+ interfaceIds = [].concat(linkCis.map(function (item) {
125
+ return item.attributes.source_id;
126
+ }), linkCis.map(function (item) {
127
+ return item.attributes.destination_id;
128
+ }));
129
+ interfaceTypes = _lodash["default"].compact(_lodash["default"].uniq([].concat(linkCis.map(function (item) {
130
+ return item.attributes.source_type;
131
+ }), linkCis.map(function (item) {
132
+ return item.attributes.destination_type;
133
+ })))).filter(function (item) {
134
+ return item !== 'ip';
168
135
  });
169
- _context2.next = 8;
136
+ _context.next = 7;
170
137
  return (0, _services.queryCisByIds)(interfaceIds);
171
138
 
172
- case 8:
173
- interfaceCis = _context2.sent;
174
- _context2.next = 11;
175
- return getInterfaceObject(interfaceTypes.filter(function (item) {
176
- return item !== 'ip';
177
- }));
139
+ case 7:
140
+ interfaceCis = _context.sent;
141
+ _context.next = 10;
142
+ return _CiTypeCache["default"].getCiTypeMap(interfaceTypes);
178
143
 
179
- case 11:
180
- interfaceDoc = _context2.sent;
181
- return _context2.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
144
+ case 10:
145
+ interfaceDoc = _context.sent;
146
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
182
147
 
183
- case 13:
148
+ case 12:
184
149
  case "end":
185
- return _context2.stop();
150
+ return _context.stop();
186
151
  }
187
152
  }
188
- }, _callee2);
153
+ }, _callee);
189
154
  }));
190
155
  return _getLinksDetail.apply(this, arguments);
191
156
  }
@@ -989,7 +989,8 @@ function ResourceOverview(props) {
989
989
  ciAttrAndMetricData: ciAttrAndMetricData
990
990
  },
991
991
  data: metric,
992
- loading: metricInitLoading
992
+ loading: metricInitLoading,
993
+ formatMetricLatestValue: resourceOverviewProps.formatMetricLatestValue
993
994
  })), /*#__PURE__*/_react["default"].createElement(_EventsCard["default"], {
994
995
  alarmRiskList: alarmRiskList,
995
996
  closeDetailDrawer: onClose,
@@ -78,7 +78,8 @@ function ResourceOverviewMetric(props) {
78
78
  var topo = props.topo,
79
79
  type = props.type,
80
80
  data = props.data,
81
- loading = props.loading;
81
+ loading = props.loading,
82
+ formatMetricLatestValue = props.formatMetricLatestValue;
82
83
 
83
84
  function formatValue(itemData) {
84
85
  var _list;
@@ -87,7 +88,8 @@ function ResourceOverviewMetric(props) {
87
88
  metricItem = itemData.metricItem,
88
89
  list = itemData.list;
89
90
  var format = (0, _utils.metricValueFormat)({
90
- value: (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
91
+ // 支持业务拓扑历史时间点指标值处理
92
+ value: formatMetricLatestValue ? formatMetricLatestValue(list) : (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
91
93
  dataType: metricItem.dataType,
92
94
  dict: topo.dictCache.getDictObject(),
93
95
  unit: metricItem.unit,
@@ -37,7 +37,7 @@ function useMetricPolling(_ref) {
37
37
 
38
38
 
39
39
  var queryLinkMetricsRequest = (0, _ahooks.useRequest)(_services.queryLinkLatestMetrics, {
40
- pollingInterval: 1000 * 15,
40
+ pollingInterval: 60 * 1000,
41
41
  pollingWhenHidden: false,
42
42
  debounceInterval: 200,
43
43
  manual: true,
@@ -48,7 +48,7 @@ function useMetricPolling(_ref) {
48
48
  }
49
49
  });
50
50
  var queryInterfaceMetricsRequest = (0, _ahooks.useRequest)(_services.queryLinkInterfacesLatestMetrics, {
51
- pollingInterval: 1000 * 15,
51
+ pollingInterval: 60 * 1000,
52
52
  pollingWhenHidden: false,
53
53
  debounceInterval: 200,
54
54
  manual: true,
@@ -103,9 +103,9 @@ var useMetricModels = function useMetricModels(props) {
103
103
  }
104
104
 
105
105
  var request = (0, _ahooks.useRequest)(fetchData, {
106
- pollingInterval: 1000 * 5,
107
- // pollingWhenHidden: false,
108
- // debounceInterval: 1000,
106
+ pollingInterval: 1000 * 60,
107
+ pollingWhenHidden: false,
108
+ // debounceInterval: 200,
109
109
  manual: true,
110
110
  onSuccess: function onSuccess(newMetricModels) {
111
111
  var a = metricModels.map(function (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "8.0.0-a.8",
3
+ "version": "8.0.0-a.9",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@8.0.0-a.8/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@8.0.0-a.9/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }