From 56a94e913fb66e9c710bfc8ec9a28d37ece20931 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 14 Aug 2019 12:09:41 +0200 Subject: [PATCH] mgr/dashboard: Automatically refresh CephFS chart MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: https://tracker.ceph.com/issues/40096 Signed-off-by: Stephan Müller --- .../cephfs/cephfs-chart/cephfs-chart.component.spec.ts | 7 +++++++ .../app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts | 1 + 2 files changed, 8 insertions(+) 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 } /** -- 2.47.3