]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: do not show non-pool data in pool details 31516/head
authorAlfonso Martínez <almartin@redhat.com>
Thu, 7 Nov 2019 09:15:30 +0000 (10:15 +0100)
committerAlfonso Martínez <almartin@redhat.com>
Mon, 11 Nov 2019 07:37:46 +0000 (08:37 +0100)
Fixes: https://tracker.ceph.com/issues/42674
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
(cherry picked from commit 9db76caf8bb9307a573f9acbb83cadbc5cee63ae)

src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts

index 5fd9edbad3b9d970fd7ebdcd6f5c0ed0dd06802f..db33fad77c7a26d5b85ec696e3fe5fc1729b123d 100644 (file)
@@ -4,7 +4,7 @@
   <tab i18n-heading
        heading="Details">
     <cd-table-key-value [renderObjects]="true"
-                        [data]="selection.first()"
+                        [data]="filterNonPoolData(selection.first())"
                         [autoReload]="false">
     </cd-table-key-value>
   </tab>
index 7ee21b57e999d24a8ad632e7ba1cc0067823737e..4bf43944a140667bd44fb1c884ecf296838c75d8 100644 (file)
@@ -71,7 +71,7 @@ describe('PoolDetailsComponent', () => {
       expect(tabs[0].active).toBeTruthy();
     });
 
-    it('current active status of tabs should not change when selection is same with previour selection', () => {
+    it('current active status of tabs should not change when selection is the same as previous selection', () => {
       fixture.detectChanges();
       const tabs = poolDetailsComponent.tabsetChild.tabs;
       expect(tabs[0].active).toBeTruthy();
@@ -80,5 +80,23 @@ describe('PoolDetailsComponent', () => {
       fixture.detectChanges();
       expect(tabs[1].active).toBeTruthy();
     });
+
+    it('returns pool details correctly', () => {
+      const pool = { prop1: 1, cdIsBinary: true, prop2: 2, cdExecuting: true, prop3: 3 };
+      const expectedPool = { prop1: 1, prop2: 2, prop3: 3 };
+
+      expect(poolDetailsComponent.filterNonPoolData(pool)).toEqual(expectedPool);
+    });
+
+    it('pool data filtering is called', () => {
+      const filterNonPoolDataSpy = spyOn(
+        poolDetailsComponent,
+        'filterNonPoolData'
+      ).and.callThrough();
+
+      fixture.detectChanges();
+
+      expect(filterNonPoolDataSpy).toHaveBeenCalled();
+    });
   });
 });
index d6e5ae651036b854bdffd1dcf2efe611bdbdd724..fed286e693aac81e9a05254c9ce0b50d1cd36df1 100644 (file)
@@ -1,6 +1,7 @@
 import { Component, Input, OnChanges, ViewChild } from '@angular/core';
 
 import { I18n } from '@ngx-translate/i18n-polyfill';
+import * as _ from 'lodash';
 import { TabsetComponent } from 'ngx-bootstrap/tabs';
 
 import { PoolService } from '../../../shared/api/pool.service';
@@ -69,4 +70,8 @@ export class PoolDetailsComponent implements OnChanges {
       });
     }
   }
+
+  filterNonPoolData(pool: object): object {
+    return _.omit(pool, ['cdExecuting', 'cdIsBinary']);
+  }
 }
index 9097d9dae93b83d834a220513113962d22d9d5b4..db850079f631cb8b54253c646822ed5850bb5741 100644 (file)
@@ -74,12 +74,6 @@ describe('PoolListComponent', () => {
     expect(component.columns.every((column) => Boolean(column.prop))).toBeTruthy();
   });
 
-  it('returns pool details correctly', () => {
-    const pool = { prop1: 1, cdIsBinary: true, prop2: 2, cdExecuting: true, prop3: 3 };
-    const expected = { prop1: 1, prop2: 2, prop3: 3 };
-    expect(component.getPoolDetails(pool)).toEqual(expected);
-  });
-
   describe('monAllowPoolDelete', () => {
     let configurationService: ConfigurationService;
 
index c9b90418d3ddb3b3d1cb3e0e4af81894b1914137..d617ec483036f661bbb05a41c32312b7761e6c6e 100644 (file)
@@ -272,10 +272,6 @@ export class PoolListComponent implements OnInit {
     return strings.join(', ');
   }
 
-  getPoolDetails(pool: object) {
-    return _.omit(pool, ['cdExecuting', 'cdIsBinary']);
-  }
-
   getSelectionTiers() {
     const cacheTierIds = this.selection.hasSingleSelection ? this.selection.first()['tiers'] : [];
     this.selectionCacheTiers = this.pools.filter((pool) => cacheTierIds.includes(pool.pool));