@centreon/ui 25.7.0 → 25.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.7.0",
3
+ "version": "25.7.1",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -4,9 +4,11 @@ import {
4
4
  always,
5
5
  cond,
6
6
  equals,
7
+ flatten,
7
8
  gt,
8
9
  gte,
9
10
  head,
11
+ isEmpty,
10
12
  isNil,
11
13
  last,
12
14
  length,
@@ -220,20 +222,26 @@ export const getFormattedAxisValues = ({
220
222
  lines,
221
223
  threshold
222
224
  }: GetFormattedAxisValuesProps): Array<string> => {
223
- const metricId = (lines.find(({ unit }) => equals(unit, axisUnit)) as Line)
224
- ?.metric_id;
225
+ const filteredMetrics = lines.filter(({ unit }) => equals(unit, axisUnit));
225
226
 
226
- if (isNil(metricId)) {
227
+ if (isEmpty(filteredMetrics)) {
227
228
  return [];
228
229
  }
229
- const formattedData = timeSeries.map((data) =>
230
- formatMetricValue({
231
- value: data[metricId],
232
- unit: axisUnit,
233
- base
234
- })
230
+
231
+ const metricIds = pluck('metric_id', filteredMetrics);
232
+
233
+ const formattedData = metricIds.map((metricId) =>
234
+ timeSeries.map((data) =>
235
+ formatMetricValue({
236
+ value: data[metricId],
237
+ unit: axisUnit,
238
+ base
239
+ })
240
+ )
235
241
  );
236
242
 
243
+ const flattenedFormattedData = flatten(formattedData);
244
+
237
245
  const formattedThresholdValues = equals(thresholdUnit, axisUnit)
238
246
  ? threshold.map(({ value }) =>
239
247
  formatMetricValue({
@@ -244,7 +252,7 @@ export const getFormattedAxisValues = ({
244
252
  ) || []
245
253
  : [];
246
254
 
247
- return formattedData
255
+ return flattenedFormattedData
248
256
  .concat(formattedThresholdValues)
249
257
  .filter((v) => v) as Array<string>;
250
258
  };