@riil-frontend/component-topology 6.0.0-alpha.63 → 6.0.0-alpha.64

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.
@@ -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 "6.0.0-alpha.63" === 'string' ? "6.0.0-alpha.63" : null;
26
+ var version = typeof "6.0.0-alpha.64" === 'string' ? "6.0.0-alpha.64" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -99,16 +99,16 @@ function _queryLinkLatestMetrics() {
99
99
  case 8:
100
100
  // format
101
101
  resultData = linkMetricCodes.map(function (code) {
102
- var _linkMetrics$find;
103
-
104
- var value = (_linkMetrics$find = linkMetrics.find(function (m) {
102
+ var metric = linkMetrics.find(function (m) {
105
103
  return m.metricCode === code;
106
- })) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
104
+ });
105
+ var value = metric === null || metric === void 0 ? void 0 : metric.metricValue;
107
106
  var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
108
107
  return {
109
108
  code: code,
110
109
  name: metricDef.name,
111
- value: formatMetric(value, metricDef) || ''
110
+ value: formatMetric(value, metricDef) || '',
111
+ ts: metric === null || metric === void 0 ? void 0 : metric.ts
112
112
  };
113
113
  });
114
114
  return _context3.abrupt("return", {
@@ -132,18 +132,14 @@ export function queryLinkInterfacesLatestMetrics(_x5) {
132
132
 
133
133
  function _queryLinkInterfacesLatestMetrics() {
134
134
  _queryLinkInterfacesLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(linkCi) {
135
- var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, parseInterfaceMetrics;
135
+ var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, findMetricsBySubCiId, parseInterfaceMetrics;
136
136
 
137
137
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
138
138
  while (1) {
139
139
  switch (_context4.prev = _context4.next) {
140
140
  case 0:
141
141
  parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
142
- var _metrics$;
143
-
144
- var metrics = interfaceMetrics.filter(function (metric) {
145
- return metric.subCiId === subCiId;
146
- });
142
+ var metrics = findMetricsBySubCiId(subCiId);
147
143
  return INTERFACE_METRIC_CODES.reduce(function (res, code) {
148
144
  var _metrics$find;
149
145
 
@@ -154,10 +150,14 @@ function _queryLinkInterfacesLatestMetrics() {
154
150
  var formatValue = formatMetric(value, metricDef);
155
151
  res[code] = formatValue === 'undefined' ? '-' : formatValue;
156
152
  return res;
157
- }, {
158
- _ts: (_metrics$ = metrics[0]) === null || _metrics$ === void 0 ? void 0 : _metrics$.ts // 指标时间
153
+ }, {});
154
+ };
159
155
 
156
+ findMetricsBySubCiId = function _findMetricsBySubCiId(subCiId) {
157
+ var metrics = interfaceMetrics.filter(function (metric) {
158
+ return metric.subCiId === subCiId;
160
159
  });
160
+ return metrics;
161
161
  };
162
162
 
163
163
  _linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
@@ -174,24 +174,29 @@ function _queryLinkInterfacesLatestMetrics() {
174
174
  typeCodes.push(destinationType);
175
175
  }
176
176
 
177
- _context4.next = 8;
177
+ _context4.next = 9;
178
178
  return ciTypeCache.load(typeCodes);
179
179
 
180
- case 8:
181
- _context4.next = 10;
180
+ case 9:
181
+ _context4.next = 11;
182
182
  return queryLatestMetrics(queryInterfaceMetricsParam);
183
183
 
184
- case 10:
184
+ case 11:
185
185
  interfaceMetrics = _context4.sent;
186
186
  // format
187
187
  resultData = {
188
188
  sourceMetrics: parseInterfaceMetrics(sourceId),
189
- destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null
189
+ destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null,
190
+ // 源目的接口指标原始数据。支持关键链路详情过滤最近一小时指标
191
+ originMetricData: {
192
+ source: findMetricsBySubCiId(sourceId),
193
+ destination: destinationId ? findMetricsBySubCiId(destinationId) : []
194
+ }
190
195
  };
191
196
  rlog.debug('查询链路接口指标 结果', linkCi);
192
197
  return _context4.abrupt("return", resultData);
193
198
 
194
- case 14:
199
+ case 15:
195
200
  case "end":
196
201
  return _context4.stop();
197
202
  }
@@ -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 "6.0.0-alpha.63" === 'string' ? "6.0.0-alpha.63" : null;
57
+ var version = typeof "6.0.0-alpha.64" === 'string' ? "6.0.0-alpha.64" : null;
58
58
  console.info("\u62D3\u6251\u7248\u672C: " + version);
59
59
  /**
60
60
  * 拓扑显示和编辑
@@ -117,18 +117,18 @@ function _queryLinkLatestMetrics() {
117
117
  case 8:
118
118
  // format
119
119
  resultData = linkMetricCodes.map(function (code) {
120
- var _linkMetrics$find;
121
-
122
- var value = (_linkMetrics$find = linkMetrics.find(function (m) {
120
+ var metric = linkMetrics.find(function (m) {
123
121
  return m.metricCode === code;
124
- })) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
122
+ });
123
+ var value = metric === null || metric === void 0 ? void 0 : metric.metricValue;
125
124
 
126
125
  var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType || linkCi.typeCode, code);
127
126
 
128
127
  return {
129
128
  code: code,
130
129
  name: metricDef.name,
131
- value: (0, _attributeFormatter.formatMetric)(value, metricDef) || ''
130
+ value: (0, _attributeFormatter.formatMetric)(value, metricDef) || '',
131
+ ts: metric === null || metric === void 0 ? void 0 : metric.ts
132
132
  };
133
133
  });
134
134
  return _context3.abrupt("return", {
@@ -152,18 +152,14 @@ function queryLinkInterfacesLatestMetrics(_x5) {
152
152
 
153
153
  function _queryLinkInterfacesLatestMetrics() {
154
154
  _queryLinkInterfacesLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(linkCi) {
155
- var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, parseInterfaceMetrics;
155
+ var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, findMetricsBySubCiId, parseInterfaceMetrics;
156
156
 
157
157
  return _regenerator["default"].wrap(function _callee4$(_context4) {
158
158
  while (1) {
159
159
  switch (_context4.prev = _context4.next) {
160
160
  case 0:
161
161
  parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
162
- var _metrics$;
163
-
164
- var metrics = interfaceMetrics.filter(function (metric) {
165
- return metric.subCiId === subCiId;
166
- });
162
+ var metrics = findMetricsBySubCiId(subCiId);
167
163
  return _constants.INTERFACE_METRIC_CODES.reduce(function (res, code) {
168
164
  var _metrics$find;
169
165
 
@@ -176,10 +172,14 @@ function _queryLinkInterfacesLatestMetrics() {
176
172
  var formatValue = (0, _attributeFormatter.formatMetric)(value, metricDef);
177
173
  res[code] = formatValue === 'undefined' ? '-' : formatValue;
178
174
  return res;
179
- }, {
180
- _ts: (_metrics$ = metrics[0]) === null || _metrics$ === void 0 ? void 0 : _metrics$.ts // 指标时间
175
+ }, {});
176
+ };
181
177
 
178
+ findMetricsBySubCiId = function _findMetricsBySubCiId(subCiId) {
179
+ var metrics = interfaceMetrics.filter(function (metric) {
180
+ return metric.subCiId === subCiId;
182
181
  });
182
+ return metrics;
183
183
  };
184
184
 
185
185
  _linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
@@ -198,26 +198,31 @@ function _queryLinkInterfacesLatestMetrics() {
198
198
  typeCodes.push(destinationType);
199
199
  }
200
200
 
201
- _context4.next = 8;
201
+ _context4.next = 9;
202
202
  return _CiTypeCache["default"].load(typeCodes);
203
203
 
204
- case 8:
205
- _context4.next = 10;
204
+ case 9:
205
+ _context4.next = 11;
206
206
  return queryLatestMetrics(queryInterfaceMetricsParam);
207
207
 
208
- case 10:
208
+ case 11:
209
209
  interfaceMetrics = _context4.sent;
210
210
  // format
211
211
  resultData = {
212
212
  sourceMetrics: parseInterfaceMetrics(sourceId),
213
- destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null
213
+ destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null,
214
+ // 源目的接口指标原始数据。支持关键链路详情过滤最近一小时指标
215
+ originMetricData: {
216
+ source: findMetricsBySubCiId(sourceId),
217
+ destination: destinationId ? findMetricsBySubCiId(destinationId) : []
218
+ }
214
219
  };
215
220
 
216
221
  _rlog["default"].debug('查询链路接口指标 结果', linkCi);
217
222
 
218
223
  return _context4.abrupt("return", resultData);
219
224
 
220
- case 14:
225
+ case 15:
221
226
  case "end":
222
227
  return _context4.stop();
223
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "6.0.0-alpha.63",
3
+ "version": "6.0.0-alpha.64",
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@6.0.0-alpha.63/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.64/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }