From: Tiago Melo Date: Thu, 31 Oct 2019 10:39:31 +0000 (-0100) Subject: mgr/dashboard: Fix data point alignment in MDS counters chart X-Git-Tag: v15.1.0~960^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31288%2Fhead;p=ceph.git 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 --- 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; }