From: Stephan Müller Date: Wed, 24 Oct 2018 14:02:24 +0000 (+0200) Subject: mgr/dashboard: Show info button for crush rules in pool form X-Git-Tag: v14.1.0~951^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F24627%2Fhead;p=ceph.git mgr/dashboard: Show info button for crush rules in pool form Signed-off-by: Stephan Müller --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts index 971aece14132..c87f2c059e2a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts @@ -7,6 +7,7 @@ import { Pool } from '../pool'; export class PoolFormData { poolTypes = ['erasure', 'replicated']; erasureInfo = false; + crushInfo = false; applications = { selected: [], available: [ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html index fe04c437fe1c..4d99d8e84c15 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html @@ -138,42 +138,59 @@ - - -
-
    -
  1. - {{ describeCrushStep(step) }} -
  2. -
-
-
-
-
- +
+
+ + + + +
+ + + + + + + +
    +
  1. + {{ describeCrushStep(step) }} +
  2. +
+
+
+
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts index 361f8e6d187e..5770d240f5ea 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts @@ -7,6 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ToastModule } from 'ng2-toastr'; import { BsModalService } from 'ngx-bootstrap/modal'; +import { TabsModule } from 'ngx-bootstrap/tabs'; import { of } from 'rxjs'; import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper'; @@ -127,6 +128,7 @@ describe('PoolFormComponent', () => { HttpClientTestingModule, RouterTestingModule.withRoutes(routes), ToastModule.forRoot(), + TabsModule.forRoot(), PoolModule ], providers: [ @@ -734,6 +736,30 @@ describe('PoolFormComponent', () => { }); }); + describe('crushRule', () => { + beforeEach(() => { + createCrushRule({ name: 'replicatedRule' }); + fixture.detectChanges(); + formHelper.setValue('poolType', 'replicated'); + fixture.detectChanges(); + }); + + it('should not show info per default', () => { + formHelper.expectElementVisible(fixture, '#crushRule', true); + formHelper.expectElementVisible(fixture, '#crush-info-block', false); + }); + + it('should show info if the info button is clicked', () => { + fixture.detectChanges(); + const infoButton = fixture.debugElement.query(By.css('#crush-info-button')); + infoButton.triggerEventHandler('click', null); + expect(component.data.crushInfo).toBeTruthy(); + fixture.detectChanges(); + expect(infoButton.classes['active']).toBeTruthy(); + formHelper.expectIdElementsVisible(fixture, ['crushRule', 'crush-info-block'], true); + }); + }); + describe('erasure code profile', () => { const setSelectedEcp = (name: string) => { formHelper.setValue('erasureProfile', { name: name });