From 3261c4f12017064d5ab3863b0af0884c72c8c551 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 24 Oct 2018 16:02:24 +0200 Subject: [PATCH] mgr/dashboard: Show info button for crush rules in pool form MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Müller --- .../app/ceph/pool/pool-form/pool-form-data.ts | 1 + .../pool/pool-form/pool-form.component.html | 75 ++++++++++++------- .../pool-form/pool-form.component.spec.ts | 26 +++++++ 3 files changed, 73 insertions(+), 29 deletions(-) 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 971aece1413..c87f2c059e2 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 fe04c437fe1..4d99d8e84c1 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 361f8e6d187..5770d240f5e 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 }); -- 2.39.5