From: Alfonso Martínez Date: Thu, 7 Nov 2019 09:15:30 +0000 (+0100) Subject: mgr/dashboard: do not show non-pool data in pool details X-Git-Tag: v14.2.5~20^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d9215112ac3ef12c2b543cd4d4d1e4656fe90fdd;p=ceph.git mgr/dashboard: do not show non-pool data in pool details Fixes: https://tracker.ceph.com/issues/42674 Signed-off-by: Alfonso Martínez (cherry picked from commit 9db76caf8bb9307a573f9acbb83cadbc5cee63ae) --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.html index 5fd9edbad3b..db33fad77c7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.html @@ -4,7 +4,7 @@ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts index 7ee21b57e99..4bf43944a14 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts @@ -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(); + }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts index d6e5ae65103..fed286e693a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts @@ -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']); + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts index 9097d9dae93..db850079f63 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts @@ -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; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts index c9b90418d3d..d617ec48303 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts @@ -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));