From: Stephan Müller Date: Wed, 14 Aug 2019 10:09:41 +0000 (+0200) Subject: mgr/dashboard: Automatically refresh CephFS chart X-Git-Tag: v15.1.0~1678^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56a94e913fb66e9c710bfc8ec9a28d37ece20931;p=ceph.git mgr/dashboard: Automatically refresh CephFS chart Fixes: https://tracker.ceph.com/issues/40096 Signed-off-by: Stephan Müller --- 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 062ea869c481..786076125a0b 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 @@ -70,4 +70,11 @@ describe('CephfsChartComponent', () => { } ]); }); + + it('should force angular to update the chart datasets array in order to update the graph', () => { + const oldDatasets = component.chart.datasets; + component.ngOnChanges(); + expect(oldDatasets).toEqual(component.chart.datasets); + expect(oldDatasets).not.toBe(component.chart.datasets); + }); }); 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 ec9e560b3ecc..b7809c4c72c5 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 @@ -151,6 +151,7 @@ export class CephfsChartComponent implements OnChanges, OnInit { _.merge(this.chart, { datasets: chartDataSets }); + this.chart.datasets = [...this.chart.datasets]; // Force angular to update } /**