@centreon/ui 26.3.0 → 26.3.2

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": "26.3.0",
3
+ "version": "26.3.2",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -103,7 +103,7 @@ describe('Bar chart', () => {
103
103
  cy.contains('Centreon-Server: Round-Trip Maximum Time').should(
104
104
  'be.visible'
105
105
  );
106
- cy.contains('7.47 KB').should('be.visible');
106
+ cy.contains('7.47 KiB').should('be.visible');
107
107
 
108
108
  cy.makeSnapshot();
109
109
  });
@@ -68,6 +68,9 @@ const MemoizedGroup = ({
68
68
  [bar.key]: timeSerie[Number(bar.key)]
69
69
  }));
70
70
 
71
+ const unit = isStackedBar ? bar.key.split('-')[1] : (linesBar as Line).unit;
72
+ const yScale = unit === '' && yScalesPerUnit[unit] === undefined ? yScalesPerUnit[undefined] : yScalesPerUnit[unit];
73
+
71
74
  return isStackedBar ? (
72
75
  <BarStack
73
76
  isStacked
@@ -80,7 +83,7 @@ const MemoizedGroup = ({
80
83
  isTooltipHidden={isTooltipHidden}
81
84
  lines={linesBar as Array<Line>}
82
85
  timeSeries={timeSeriesBar}
83
- yScale={yScalesPerUnit[bar.key.split('-')[1] ?? undefined]}
86
+ yScale={yScale}
84
87
  neutralValue={neutralValue}
85
88
  />
86
89
  ) : (
@@ -94,7 +97,7 @@ const MemoizedGroup = ({
94
97
  isTooltipHidden={isTooltipHidden}
95
98
  lines={[linesBar as Line]}
96
99
  timeSeries={timeSeriesBar}
97
- yScale={yScalesPerUnit[(linesBar as Line).unit ?? undefined]}
100
+ yScale={yScale}
98
101
  neutralValue={neutralValue}
99
102
  />
100
103
  );
@@ -714,7 +714,7 @@ describe('Lines and bars', () => {
714
714
  cy.findByLabelText('B').click();
715
715
 
716
716
  cy.findAllByTestId('unit-selector').eq(0).should('have.value', 'B');
717
- cy.contains('8.79 KB').should('be.visible');
717
+ cy.contains('8.79 KiB').should('be.visible');
718
718
 
719
719
  cy.findAllByTestId('unit-selector').eq(1).parent().click();
720
720
  cy.findByLabelText('%').click();
@@ -374,10 +374,10 @@ describe('timeSeries', () => {
374
374
  describe(formatMetricValue, () => {
375
375
  const cases: Array<TestCase> = [
376
376
  [218857269, '', 1000, '218.86m'],
377
- [218857269, '', 1024, '208.72 M'],
377
+ [218857269, '', 1024, '208.72 Mi'],
378
378
  [0.12232323445, '', 1000, '0.12'],
379
- [1024, 'B', 1000, '1 KB'],
380
- [1024, 'B', 1024, '1 KB'],
379
+ [1024, 'B', 1000, '1 KiB'],
380
+ [1024, 'B', 1024, '1 KiB'],
381
381
  [null, 'B', 1024, null]
382
382
  ];
383
383
 
@@ -573,7 +573,7 @@ describe('Format value with unit', () => {
573
573
  return '324.23m';
574
574
  }
575
575
 
576
- return `309.21 M${unit}`;
576
+ return `309.21 Mi${unit}`;
577
577
  };
578
578
 
579
579
  const humanReadableTestCases = units.map((unit) => {
@@ -704,7 +704,7 @@ const formatMetricValue = ({
704
704
 
705
705
  const formattedMetricValue = numeral(Math.abs(value))
706
706
  .format(`0.[00]${formatSuffix}`)
707
- .replace(/(iB|B)/g, unit);
707
+ .replace(/B/, unit);
708
708
 
709
709
  if (lt(value, 0)) {
710
710
  return `-${formattedMetricValue}`;