]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Automatically refresh CephFS chart
authorStephan Müller <smueller@suse.com>
Wed, 14 Aug 2019 10:09:41 +0000 (12:09 +0200)
committerStephan Müller <smueller@suse.com>
Fri, 23 Aug 2019 11:39:52 +0000 (13:39 +0200)
Fixes: https://tracker.ceph.com/issues/40096
Signed-off-by: Stephan Müller <smueller@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts

index 062ea869c4812bbc474a0cd792bf518d267e114b..786076125a0ba720dc5f5d4e18247b4c6702816a 100644 (file)
@@ -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);
+  });
 });
index ec9e560b3ecc593f3cab7c7f11d3d0a191f3cf49..b7809c4c72c543e27c608fb3a431942cf5310f59 100644 (file)
@@ -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
   }
 
   /**