From: Nizamudeen A Date: Fri, 12 Nov 2021 08:14:51 +0000 (+0530) Subject: mgr/dashboard: Edit a service feature X-Git-Tag: v17.1.0~444^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43903%2Fhead;p=ceph.git mgr/dashboard: Edit a service feature Fixes: https://tracker.ceph.com/issues/53077 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index 457b759ead39..50bd6121ce5f 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -70,6 +70,16 @@ export class ServicesPageHelper extends PageHelper { } } + editService(name: string, count: string) { + this.navigateEdit(name, true, false); + cy.get(`${this.pages.create.id}`).within(() => { + cy.get('#service_type').should('be.disabled'); + cy.get('#service_id').should('be.disabled'); + cy.get('#count').clear().type(count); + cy.get('cd-submit-button').click(); + }); + } + checkServiceStatus(daemon: string) { this.getTableCell(this.serviceDetailColumnIndex.daemonType, daemon) .parent() @@ -80,6 +90,16 @@ export class ServicesPageHelper extends PageHelper { }); } + expectPlacementCount(serviceName: string, expectedCount: string) { + this.getTableCell(this.columnIndex.service_name, serviceName) + .parent() + .find(`datatable-body-cell:nth-child(${this.columnIndex.placement})`) + .should(($ele) => { + const running = $ele.text().split(';'); + expect(running).to.include(`count:${expectedCount}`); + }); + } + checkExist(serviceName: string, exist: boolean) { this.getTableCell(this.columnIndex.service_name, serviceName).should(($elements) => { const services = $elements.map((_, el) => el.textContent).get(); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts index 9f5e8ceda862..fb5e6ac8923a 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts @@ -2,6 +2,7 @@ import { ServicesPageHelper } from '../cluster/services.po'; describe('Services page', () => { const services = new ServicesPageHelper(); + const serviceName = 'rgw.foo'; beforeEach(() => { cy.login(); @@ -14,7 +15,13 @@ describe('Services page', () => { services.navigateTo('create'); services.addService('rgw'); - services.checkExist('rgw.foo', true); + services.checkExist(serviceName, true); + }); + + it('should edit a service', () => { + const count = '2'; + services.editService(serviceName, count); + services.expectPlacementCount(serviceName, count); }); it('should create and delete an ingress service', () => { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-services.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-services.e2e-spec.ts index 5060a22649b5..aec174a99cdb 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-services.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-services.e2e-spec.ts @@ -20,11 +20,19 @@ describe('Create cluster create services page', () => { }); describe('when Orchestrator is available', () => { + const serviceName = 'rgw.foo'; + it('should create an rgw service', () => { cy.get('.btn.btn-accent').first().click({ force: true }); - createClusterServicePage.addService('rgw', false, '3'); - createClusterServicePage.checkExist('rgw.foo', true); + createClusterServicePage.addService('rgw', false, '2'); + createClusterServicePage.checkExist(serviceName, true); + }); + + it('should edit a service', () => { + const count = '3'; + createClusterServicePage.editService(serviceName, count); + createClusterServicePage.expectPlacementCount(serviceName, count); }); it('should create and delete an ingress service', () => { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts index 176bca5a1477..85a536f05a9a 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts @@ -52,14 +52,16 @@ export abstract class PageHelper { /** * Navigates to the edit page */ - navigateEdit(name: string, select = true) { + navigateEdit(name: string, select = true, breadcrumb = true) { if (select) { this.navigateTo(); this.getFirstTableCell(name).click(); } cy.contains('Creating...').should('not.exist'); cy.contains('button', 'Edit').click(); - this.expectBreadcrumbText('Edit'); + if (breadcrumb) { + this.expectBreadcrumbText('Edit'); + } } /** diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index e1eb456ee8aa..959cb3769970 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -139,6 +139,11 @@ const routes: Routes = [ path: URLVerbs.CREATE, component: ServiceFormComponent, outlet: 'modal' + }, + { + path: `${URLVerbs.EDIT}/:type/:name`, + component: ServiceFormComponent, + outlet: 'modal' } ] }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.html index 5394dc1d33b2..4a4bb109472f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.html @@ -65,7 +65,7 @@ + [routedModal]="false">
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html index 99c0903dacf4..5582d300ddac 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html @@ -215,10 +215,10 @@ - -