From daedc7516e34a6a1082ff4cfcc4a6b13de56345b Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Thu, 31 Oct 2019 09:39:31 -0100 Subject: [PATCH] mgr/dashboard: Fix data point alignment in MDS counters chart We were providing 2 data series with different number of elements and this was causing problems when the chart was rendered. Fixes: https://tracker.ceph.com/issues/42296 Signed-off-by: Tiago Melo --- .../cephfs/cephfs-chart/cephfs-chart.component.spec.ts | 6 +----- .../ceph/cephfs/cephfs-chart/cephfs-chart.component.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.spec.ts index 786076125a0..10f71c967ea 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.spec.ts @@ -33,12 +33,8 @@ describe('CephfsChartComponent', () => { it('completed the chart', () => { const lhs = component.chart.datasets[0].data; - expect(lhs.length).toBe(4); + expect(lhs.length).toBe(3); expect(lhs).toEqual([ - { - x: 0, - y: 15 - }, { x: 5000, y: 15 diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts index b7809c4c72c..f7cbafd8000 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts @@ -168,6 +168,14 @@ export class CephfsChartComponent implements OnChanges, OnInit { y: dp[1] }); }); + + /** + * MDS performance counters chart is expecting the same number of items + * from each data series. Since in deltaTimeSeries we are ignoring the first + * element, we will do the same here. + */ + data.shift(); + return data; } -- 2.47.3