]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix Reads/Writes ratio of Clients IOPS donut chart 38867/head
authorKiefer Chang <kiefer.chang@suse.com>
Sun, 27 Dec 2020 01:04:06 +0000 (09:04 +0800)
committerLaura Paduano <lpaduano@suse.com>
Tue, 12 Jan 2021 10:20:01 +0000 (11:20 +0100)
Use the percentage of READ ops instead of its value.

Fixes: https://tracker.ceph.com/issues/48717
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
(cherry picked from commit 9ef1a729b5100b0ee32c0df367ef4b33ba762d4a)

src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts

index d2fea1406cdcd6aecd96e8adfc61eaf8899e4471..29e3f9a046a91dafed61705ab4d3b17eeb9b46e6 100644 (file)
@@ -220,15 +220,16 @@ describe('HealthComponent', () => {
   });
 
   it('event binding "prepareReadWriteRatio" is called', () => {
-    const prepareReadWriteRatio = spyOn(component, 'prepareReadWriteRatio');
+    const prepareReadWriteRatio = spyOn(component, 'prepareReadWriteRatio').and.callThrough();
 
     const payload = _.cloneDeep(healthPayload);
     payload.client_perf['read_op_per_sec'] = 1;
-    payload.client_perf['write_op_per_sec'] = 1;
+    payload.client_perf['write_op_per_sec'] = 3;
     getHealthSpy.and.returnValue(of(payload));
     fixture.detectChanges();
 
     expect(prepareReadWriteRatio).toHaveBeenCalled();
+    expect(prepareReadWriteRatio.calls.mostRecent().args[0].dataset[0].data).toEqual([25, 75]);
   });
 
   it('event binding "prepareRawUsage" is called', () => {
index f58dbb1390a3706293056b959e7e5709daf4a8ae..44c0f019769e5742ceb1c90053b647c1eacabe36 100644 (file)
@@ -94,7 +94,7 @@ export class HealthComponent implements OnInit, OnDestroy {
         this.healthData.client_perf.read_op_per_sec
       )} ${this.i18n(`/s`)}`
     );
-    ratioData.push(this.healthData.client_perf.read_op_per_sec);
+    ratioData.push(this.calcPercentage(this.healthData.client_perf.read_op_per_sec, total));
     ratioLabels.push(
       `${this.i18n(`Writes`)}: ${this.dimless.transform(
         this.healthData.client_perf.write_op_per_sec