From 94418d90d2b6326ff01f5a577091c56367c10d1c Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Mon, 9 Sep 2024 16:45:15 +0530 Subject: [PATCH] mgr/dashboard: fix UI modal issues - Fix bs-modal getting hidden behind navbar - Reuse the project name for tab title - Readonly user shows an empty space in the administration dropdown - Physical Disks Identify modal not opening up - add e2e in cephadm to make sure the modal always comes up - Primary action doesn't need to be displayed for the read-only user Fixes: https://tracker.ceph.com/issues/67547 Signed-off-by: Nizamudeen A --- .../frontend/cypress/e2e/cluster/inventory.po.ts | 6 +++--- .../orchestrator/workflow/11-inventory.e2e-spec.ts | 14 ++++++++++++++ .../inventory-devices.component.ts | 4 ++-- .../administration/administration.component.html | 12 ++++++------ .../breadcrumbs/breadcrumbs.component.spec.ts | 8 ++++---- .../breadcrumbs/breadcrumbs.component.ts | 5 +++-- .../form-modal/form-modal.component.html | 1 + .../table-actions/table-actions.component.html | 2 +- .../frontend/src/styles/ceph-custom/_forms.scss | 10 ++++++++++ 9 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/11-inventory.e2e-spec.ts diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/inventory.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/inventory.po.ts index 5a9abdc036c..3da482cfe90 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/inventory.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/inventory.po.ts @@ -10,13 +10,13 @@ export class InventoryPageHelper extends PageHelper { identify() { // Nothing we can do, just verify the form is there this.getFirstTableCell().click(); - cy.contains('cd-table-actions button', 'Identify').click(); - cy.get('cd-modal').within(() => { + cy.contains('[data-testid="primary-action"]', 'Identify').click(); + cy.get('cds-modal').within(() => { cy.get('#duration').select('15 minutes'); cy.get('#duration').select('10 minutes'); cy.get('cd-back-button').click(); }); - cy.get('cd-modal').should('not.exist'); + cy.get('cds-modal').should('not.exist'); cy.get(`${this.pages.index.id}`); } } diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/11-inventory.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/11-inventory.e2e-spec.ts new file mode 100644 index 00000000000..0397a335d7b --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/11-inventory.e2e-spec.ts @@ -0,0 +1,14 @@ +import { InventoryPageHelper } from '../../cluster/inventory.po'; + +describe('Physical Disks page', () => { + const inventory = new InventoryPageHelper(); + + beforeEach(() => { + cy.login(); + inventory.navigateTo(); + }); + + it('should identify device', () => { + inventory.identify(); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts index 0ef0449c481..b377b28f293 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts @@ -27,9 +27,9 @@ import { OrchestratorStatus } from '~/app/shared/models/orchestrator.interface'; import { Permission } from '~/app/shared/models/permissions'; import { DimlessBinaryPipe } from '~/app/shared/pipes/dimless-binary.pipe'; import { AuthStorageService } from '~/app/shared/services/auth-storage.service'; -import { ModalService } from '~/app/shared/services/modal.service'; import { NotificationService } from '~/app/shared/services/notification.service'; import { InventoryDevice } from './inventory-device.model'; +import { ModalCdsService } from '~/app/shared/services/modal-cds.service'; @Component({ selector: 'cd-inventory-devices', @@ -84,7 +84,7 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy { constructor( private authStorageService: AuthStorageService, private dimlessBinary: DimlessBinaryPipe, - private modalService: ModalService, + private modalService: ModalCdsService, private notificationService: NotificationService, private orchService: OrchestratorService, private hostService: HostService diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html index 8a96de0a0e1..e0d508172fe 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html @@ -1,14 +1,14 @@ -
  • -
  • -
  • -
  • diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts index b92b2ae497e..688c51b3709 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts @@ -142,7 +142,7 @@ describe('BreadcrumbsComponent', () => { router.navigateByUrl(''); }); tick(); - expect(titleService.getTitle()).toEqual('Ceph'); + expect(titleService.getTitle()).toEqual('Ceph Dashboard'); })); it('should display no breadcrumbs in page title when a page is not found', fakeAsync(() => { @@ -150,7 +150,7 @@ describe('BreadcrumbsComponent', () => { router.navigateByUrl('/error'); }); tick(); - expect(titleService.getTitle()).toEqual('Ceph'); + expect(titleService.getTitle()).toEqual('Ceph Dashboard'); })); it('should display 2 breadcrumbs in page title when navigating to hosts', fakeAsync(() => { @@ -158,7 +158,7 @@ describe('BreadcrumbsComponent', () => { router.navigateByUrl('/hosts'); }); tick(); - expect(titleService.getTitle()).toEqual('Ceph: Cluster > Hosts'); + expect(titleService.getTitle()).toEqual('Ceph Dashboard: Cluster > Hosts'); })); it('should display 3 breadcrumbs in page title when navigating to RBD Add', fakeAsync(() => { @@ -166,6 +166,6 @@ describe('BreadcrumbsComponent', () => { router.navigateByUrl('/block/rbd/add'); }); tick(); - expect(titleService.getTitle()).toEqual('Ceph: Block > Images > Add'); + expect(titleService.getTitle()).toEqual('Ceph Dashboard: Block > Images > Add'); })); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts index 82d69fbf5d1..cae2341fe6f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts @@ -28,6 +28,7 @@ import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from ' import { concat, from, Observable, of, Subscription } from 'rxjs'; import { distinct, filter, first, mergeMap, toArray } from 'rxjs/operators'; +import { AppConstants } from '~/app/shared/constants/app.constants'; import { BreadcrumbsResolver, IBreadcrumb } from '~/app/shared/models/breadcrumbs'; @@ -149,9 +150,9 @@ export class BreadcrumbsComponent implements OnDestroy { }) .join(' > '); if (currentLocation.length > 0) { - return `Ceph: ${currentLocation}`; + return `${AppConstants.projectName}: ${currentLocation}`; } else { - return 'Ceph'; + return AppConstants.projectName; } } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html index c98ef586115..163890abf6b 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html @@ -61,6 +61,7 @@ -