@riil-frontend/component-topology 6.0.0-alpha.33 → 6.0.0-alpha.34

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 @@ function ButtonBox(props) {
23
23
  }, otherProps), children, showArrow && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0", /*#__PURE__*/React.createElement(_Icon, {
24
24
  type: "tree_fold_arrow",
25
25
  size: "xxs",
26
- className: classNames(styles.icon, (_classNames2 = {}, _classNames2[styles.active] = active, _classNames2))
26
+ className: classNames(styles.icon, (_classNames2 = {}, _classNames2[styles.active] = active, _classNames2[styles.disabled] = disabled, _classNames2))
27
27
  })));
28
28
  }
29
29
 
@@ -27,4 +27,7 @@
27
27
  &.active {
28
28
  transform: rotate(180deg) scale(0.5) !important;
29
29
  }
30
+ &.disabled {
31
+ color: #C9CED2;
32
+ }
30
33
  }
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
22
22
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
23
23
  import SelectionManager from "./SelectionManager"; // eslint-disable-next-line no-undef
24
24
 
25
- var version = typeof "6.0.0-alpha.33" === 'string' ? "6.0.0-alpha.33" : null;
25
+ var version = typeof "6.0.0-alpha.34" === 'string' ? "6.0.0-alpha.34" : null;
26
26
  console.info("\u62D3\u6251\u7248\u672C: " + version);
27
27
  /**
28
28
  * 拓扑显示和编辑
@@ -13,7 +13,8 @@ export default function useMetricPolling(_ref) {
13
13
  sourceMetrics: null,
14
14
  destinationMetrics: null,
15
15
  // 链路指标列表
16
- linkMetrics: []
16
+ linkMetrics: [],
17
+ linkMetricsTs: null
17
18
  }),
18
19
  data = _useState[0],
19
20
  setData = _useState[1]; // 轮询hooks
@@ -25,9 +26,7 @@ export default function useMetricPolling(_ref) {
25
26
  debounceInterval: 200,
26
27
  manual: true,
27
28
  onSuccess: function onSuccess(result) {
28
- setData(_extends({}, data, {
29
- linkMetrics: result
30
- }));
29
+ setData(_extends({}, data, result));
31
30
  rlog.info('链路拓扑指标轮询', result);
32
31
  }
33
32
  });
@@ -68,6 +68,8 @@ export function queryLinkLatestMetrics(_x3, _x4) {
68
68
 
69
69
  function _queryLinkLatestMetrics() {
70
70
  _queryLinkLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(linkCi, linkMetricCodes) {
71
+ var _linkMetrics$;
72
+
71
73
  var linkMetrics, resultData;
72
74
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
73
75
  while (1) {
@@ -91,6 +93,10 @@ function _queryLinkLatestMetrics() {
91
93
 
92
94
  case 5:
93
95
  linkMetrics = _context3.sent;
96
+ _context3.next = 8;
97
+ return ciTypeCache.load([linkCi.ciType || linkCi.typeCode]);
98
+
99
+ case 8:
94
100
  // format
95
101
  resultData = linkMetricCodes.map(function (code) {
96
102
  var _linkMetrics$find;
@@ -98,16 +104,19 @@ function _queryLinkLatestMetrics() {
98
104
  var value = (_linkMetrics$find = linkMetrics.find(function (m) {
99
105
  return m.metricCode === code;
100
106
  })) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
101
- var metricDef = ciTypeCache.getMetric(linkCi.ciType, code);
107
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
102
108
  return {
103
109
  code: code,
104
110
  name: metricDef.name,
105
111
  value: formatMetric(value, metricDef) || ''
106
112
  };
107
113
  });
108
- return _context3.abrupt("return", resultData);
114
+ return _context3.abrupt("return", {
115
+ linkMetrics: resultData,
116
+ linkMetricsTs: (_linkMetrics$ = linkMetrics[0]) === null || _linkMetrics$ === void 0 ? void 0 : _linkMetrics$.ts
117
+ });
109
118
 
110
- case 8:
119
+ case 10:
111
120
  case "end":
112
121
  return _context3.stop();
113
122
  }
@@ -130,6 +139,8 @@ function _queryLinkInterfacesLatestMetrics() {
130
139
  switch (_context4.prev = _context4.next) {
131
140
  case 0:
132
141
  parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
142
+ var _metrics$;
143
+
133
144
  var metrics = interfaceMetrics.filter(function (metric) {
134
145
  return metric.subCiId === subCiId;
135
146
  });
@@ -139,11 +150,14 @@ function _queryLinkInterfacesLatestMetrics() {
139
150
  var value = (_metrics$find = metrics.find(function (m) {
140
151
  return m.metricCode === code;
141
152
  })) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
142
- var metricDef = ciTypeCache.getMetric(linkCi.ciType, code);
153
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
143
154
  var formatValue = formatMetric(value, metricDef);
144
155
  res[code] = formatValue === 'undefined' ? '-' : formatValue;
145
156
  return res;
146
- }, {});
157
+ }, {
158
+ _ts: (_metrics$ = metrics[0]) === null || _metrics$ === void 0 ? void 0 : _metrics$.ts // 指标时间
159
+
160
+ });
147
161
  };
148
162
 
149
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;
@@ -36,7 +36,7 @@ function ButtonBox(props) {
36
36
  }, otherProps), children, showArrow && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "\xA0", /*#__PURE__*/_react["default"].createElement(_icon["default"], {
37
37
  type: "tree_fold_arrow",
38
38
  size: "xxs",
39
- className: (0, _classnames["default"])(_ButtonBoxModule["default"].icon, (_classNames2 = {}, _classNames2[_ButtonBoxModule["default"].active] = active, _classNames2))
39
+ className: (0, _classnames["default"])(_ButtonBoxModule["default"].icon, (_classNames2 = {}, _classNames2[_ButtonBoxModule["default"].active] = active, _classNames2[_ButtonBoxModule["default"].disabled] = disabled, _classNames2))
40
40
  })));
41
41
  }
42
42
 
@@ -27,4 +27,7 @@
27
27
  &.active {
28
28
  transform: rotate(180deg) scale(0.5) !important;
29
29
  }
30
+ &.disabled {
31
+ color: #C9CED2;
32
+ }
30
33
  }
@@ -52,7 +52,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
52
52
  var _SelectionManager = _interopRequireDefault(require("./SelectionManager"));
53
53
 
54
54
  // eslint-disable-next-line no-undef
55
- var version = typeof "6.0.0-alpha.33" === 'string' ? "6.0.0-alpha.33" : null;
55
+ var version = typeof "6.0.0-alpha.34" === 'string' ? "6.0.0-alpha.34" : null;
56
56
  console.info("\u62D3\u6251\u7248\u672C: " + version);
57
57
  /**
58
58
  * 拓扑显示和编辑
@@ -29,7 +29,8 @@ function useMetricPolling(_ref) {
29
29
  sourceMetrics: null,
30
30
  destinationMetrics: null,
31
31
  // 链路指标列表
32
- linkMetrics: []
32
+ linkMetrics: [],
33
+ linkMetricsTs: null
33
34
  }),
34
35
  data = _useState[0],
35
36
  setData = _useState[1]; // 轮询hooks
@@ -41,9 +42,7 @@ function useMetricPolling(_ref) {
41
42
  debounceInterval: 200,
42
43
  manual: true,
43
44
  onSuccess: function onSuccess(result) {
44
- setData((0, _extends2["default"])({}, data, {
45
- linkMetrics: result
46
- }));
45
+ setData((0, _extends2["default"])({}, data, result));
47
46
 
48
47
  _rlog["default"].info('链路拓扑指标轮询', result);
49
48
  }
@@ -86,6 +86,8 @@ function queryLinkLatestMetrics(_x3, _x4) {
86
86
 
87
87
  function _queryLinkLatestMetrics() {
88
88
  _queryLinkLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(linkCi, linkMetricCodes) {
89
+ var _linkMetrics$;
90
+
89
91
  var linkMetrics, resultData;
90
92
  return _regenerator["default"].wrap(function _callee3$(_context3) {
91
93
  while (1) {
@@ -109,6 +111,10 @@ function _queryLinkLatestMetrics() {
109
111
 
110
112
  case 5:
111
113
  linkMetrics = _context3.sent;
114
+ _context3.next = 8;
115
+ return _CiTypeCache["default"].load([linkCi.ciType || linkCi.typeCode]);
116
+
117
+ case 8:
112
118
  // format
113
119
  resultData = linkMetricCodes.map(function (code) {
114
120
  var _linkMetrics$find;
@@ -117,7 +123,7 @@ function _queryLinkLatestMetrics() {
117
123
  return m.metricCode === code;
118
124
  })) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
119
125
 
120
- var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType, code);
126
+ var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType || linkCi.typeCode, code);
121
127
 
122
128
  return {
123
129
  code: code,
@@ -125,9 +131,12 @@ function _queryLinkLatestMetrics() {
125
131
  value: (0, _attributeFormatter.formatMetric)(value, metricDef) || ''
126
132
  };
127
133
  });
128
- return _context3.abrupt("return", resultData);
134
+ return _context3.abrupt("return", {
135
+ linkMetrics: resultData,
136
+ linkMetricsTs: (_linkMetrics$ = linkMetrics[0]) === null || _linkMetrics$ === void 0 ? void 0 : _linkMetrics$.ts
137
+ });
129
138
 
130
- case 8:
139
+ case 10:
131
140
  case "end":
132
141
  return _context3.stop();
133
142
  }
@@ -150,6 +159,8 @@ function _queryLinkInterfacesLatestMetrics() {
150
159
  switch (_context4.prev = _context4.next) {
151
160
  case 0:
152
161
  parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
162
+ var _metrics$;
163
+
153
164
  var metrics = interfaceMetrics.filter(function (metric) {
154
165
  return metric.subCiId === subCiId;
155
166
  });
@@ -160,12 +171,15 @@ function _queryLinkInterfacesLatestMetrics() {
160
171
  return m.metricCode === code;
161
172
  })) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
162
173
 
163
- var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType, code);
174
+ var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType || linkCi.typeCode, code);
164
175
 
165
176
  var formatValue = (0, _attributeFormatter.formatMetric)(value, metricDef);
166
177
  res[code] = formatValue === 'undefined' ? '-' : formatValue;
167
178
  return res;
168
- }, {});
179
+ }, {
180
+ _ts: (_metrics$ = metrics[0]) === null || _metrics$ === void 0 ? void 0 : _metrics$.ts // 指标时间
181
+
182
+ });
169
183
  };
170
184
 
171
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "6.0.0-alpha.33",
3
+ "version": "6.0.0-alpha.34",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -115,6 +115,6 @@
115
115
  "access": "public"
116
116
  },
117
117
  "license": "MIT",
118
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.33/build/index.html",
118
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.34/build/index.html",
119
119
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
120
120
  }