@centreon/ui 25.10.0 → 25.10.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.10.0",
3
+ "version": "25.10.1",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -8,6 +8,7 @@ import dataLastWeek from '../mockedData/lastWeek.json';
8
8
  import dataPingService from '../mockedData/pingService.json';
9
9
  import dataPingServiceMixedStacked from '../mockedData/pingServiceMixedStacked.json';
10
10
  import dataPingServiceStacked from '../mockedData/pingServiceStacked.json';
11
+ import dataMissingPoint from '../mockedData/dataWithMissingPoint.json';
11
12
 
12
13
  import BarChart, { BarChartProps } from './BarChart';
13
14
 
@@ -312,4 +313,12 @@ describe('Bar chart', () => {
312
313
  cy.contains('1 s').should('be.visible');
313
314
  cy.contains('1%').should('be.visible');
314
315
  });
316
+
317
+ it('displays the stacked bar chart correctly when a point is missing compare to the time serie', () => {
318
+ initialize({ data: dataMissingPoint });
319
+
320
+ cy.findByTestId('stacked-bar-2-0-139').should('be.visible');
321
+
322
+ cy.makeSnapshot();
323
+ });
315
324
  });
@@ -72,7 +72,7 @@ const toTimeTickValue = (
72
72
  const getMetricsForIndex = (): Omit<TimeValue, 'timeTick'> => {
73
73
  const addMetricForTimeIndex = (acc, { metric_id, data }): TimeValue => ({
74
74
  ...acc,
75
- [metric_id]: data[timeIndex]
75
+ [metric_id]: data[timeIndex] === undefined ? null : data[timeIndex]
76
76
  });
77
77
 
78
78
  return reduce(addMetricForTimeIndex, {} as TimeValue, metrics);
@@ -240,7 +240,10 @@ const getStackedMetricValues = ({
240
240
  timeSeries
241
241
  }: LinesTimeSeries): Array<number> => {
242
242
  const getTimeSeriesValuesForMetric = (metric_id): Array<number> =>
243
- map((timeValue) => getValueForMetric(timeValue)(metric_id), timeSeries);
243
+ map(
244
+ (timeValue) => getValueForMetric(timeValue)(metric_id) || 0,
245
+ timeSeries
246
+ );
244
247
 
245
248
  const metricsValues = pipe(
246
249
  map(prop('metric_id')) as (metric) => Array<number>,
@@ -0,0 +1,74 @@
1
+ {
2
+ "global": {},
3
+ "metrics": [
4
+ {
5
+ "metric": "count",
6
+ "metric_id": 1,
7
+ "legend": "count",
8
+ "displayAs": "bar",
9
+ "ds_data": {
10
+ "ds_stack": true,
11
+ "ds_transparency": 0,
12
+ "ds_filled": false,
13
+ "ds_color_area": "#4269d0",
14
+ "ds_color_line": "#4269d0"
15
+ },
16
+ "datasourceOptions": {
17
+ "field": null,
18
+ "group_by": null,
19
+ "op": "count-doc",
20
+ "query": "severity_text:\"Fatal\" OR severity_text:\"Error\"",
21
+ "period": 3600
22
+ },
23
+ "data": [
24
+ 217, 270, 293, 300, 303, 295, 298, 283, 299, 299, 297, 285, 270, 248,
25
+ 274, 292, 284, 47
26
+ ]
27
+ },
28
+ {
29
+ "metric": "count",
30
+ "metric_id": 2,
31
+ "legend": "count",
32
+ "displayAs": "bar",
33
+ "ds_data": {
34
+ "ds_stack": true,
35
+ "ds_transparency": 0,
36
+ "ds_filled": false,
37
+ "ds_color_area": "#efb118",
38
+ "ds_color_line": "#efb118"
39
+ },
40
+ "datasourceOptions": {
41
+ "field": null,
42
+ "group_by": null,
43
+ "op": "count-doc",
44
+ "query": "",
45
+ "period": 3600
46
+ },
47
+ "data": [
48
+ 32, 825, 939, 922, 918, 939, 943, 947, 946, 909, 931, 939, 883, 907,
49
+ 928, 904, 923, 893, 139
50
+ ]
51
+ }
52
+ ],
53
+ "times": [
54
+ "2025-10-04T16:19:30.000Z",
55
+ "2025-10-04T16:20:00.000Z",
56
+ "2025-10-04T16:20:30.000Z",
57
+ "2025-10-04T16:21:00.000Z",
58
+ "2025-10-04T16:21:30.000Z",
59
+ "2025-10-04T16:22:00.000Z",
60
+ "2025-10-04T16:22:30.000Z",
61
+ "2025-10-04T16:23:00.000Z",
62
+ "2025-10-04T16:23:30.000Z",
63
+ "2025-10-04T16:24:00.000Z",
64
+ "2025-10-04T16:24:30.000Z",
65
+ "2025-10-04T16:25:00.000Z",
66
+ "2025-10-04T16:25:30.000Z",
67
+ "2025-10-04T16:26:00.000Z",
68
+ "2025-10-04T16:26:30.000Z",
69
+ "2025-10-04T16:27:00.000Z",
70
+ "2025-10-04T16:27:30.000Z",
71
+ "2025-10-04T16:28:00.000Z",
72
+ "2025-10-04T16:28:30.000Z"
73
+ ]
74
+ }