Skip to content

Commit 94418d9

Browse files
committed
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 <[email protected]>
1 parent 9f29c0f commit 94418d9

File tree

9 files changed

+44
-18
lines changed

9 files changed

+44
-18
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/inventory.po.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export class InventoryPageHelper extends PageHelper {
1010
identify() {
1111
// Nothing we can do, just verify the form is there
1212
this.getFirstTableCell().click();
13-
cy.contains('cd-table-actions button', 'Identify').click();
14-
cy.get('cd-modal').within(() => {
13+
cy.contains('[data-testid="primary-action"]', 'Identify').click();
14+
cy.get('cds-modal').within(() => {
1515
cy.get('#duration').select('15 minutes');
1616
cy.get('#duration').select('10 minutes');
1717
cy.get('cd-back-button').click();
1818
});
19-
cy.get('cd-modal').should('not.exist');
19+
cy.get('cds-modal').should('not.exist');
2020
cy.get(`${this.pages.index.id}`);
2121
}
2222
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { InventoryPageHelper } from '../../cluster/inventory.po';
2+
3+
describe('Physical Disks page', () => {
4+
const inventory = new InventoryPageHelper();
5+
6+
beforeEach(() => {
7+
cy.login();
8+
inventory.navigateTo();
9+
});
10+
11+
it('should identify device', () => {
12+
inventory.identify();
13+
});
14+
});

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import { OrchestratorStatus } from '~/app/shared/models/orchestrator.interface';
2727
import { Permission } from '~/app/shared/models/permissions';
2828
import { DimlessBinaryPipe } from '~/app/shared/pipes/dimless-binary.pipe';
2929
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
30-
import { ModalService } from '~/app/shared/services/modal.service';
3130
import { NotificationService } from '~/app/shared/services/notification.service';
3231
import { InventoryDevice } from './inventory-device.model';
32+
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
3333

3434
@Component({
3535
selector: 'cd-inventory-devices',
@@ -84,7 +84,7 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
8484
constructor(
8585
private authStorageService: AuthStorageService,
8686
private dimlessBinary: DimlessBinaryPipe,
87-
private modalService: ModalService,
87+
private modalService: ModalCdsService,
8888
private notificationService: NotificationService,
8989
private orchService: OrchestratorService,
9090
private hostService: HostService

src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<cds-overflow-menu [customTrigger]="customTrigger"
22
[flip]="true">
3-
<li class="cds--overflow-menu-options__option mb-2">
4-
<button *ngIf="userPermission.read"
5-
routerLink="/user-management"
3+
<li class="cds--overflow-menu-options__option mb-2"
4+
*ngIf="userPermission.read">
5+
<button routerLink="/user-management"
66
class="cds--overflow-menu-options__btn"
77
i18n>User management</button>
88
</li>
9-
<li class="cds--overflow-menu-options__option mb-2">
10-
<button *ngIf="configOptPermission.read"
11-
routerLink="/telemetry"
9+
<li class="cds--overflow-menu-options__option mb-2"
10+
*ngIf="configOptPermission.read">
11+
<button routerLink="/telemetry"
1212
class="cds--overflow-menu-options__btn"
1313
i18n>Telemetry configuration</button>
1414
</li>

src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,30 @@ describe('BreadcrumbsComponent', () => {
142142
router.navigateByUrl('');
143143
});
144144
tick();
145-
expect(titleService.getTitle()).toEqual('Ceph');
145+
expect(titleService.getTitle()).toEqual('Ceph Dashboard');
146146
}));
147147

148148
it('should display no breadcrumbs in page title when a page is not found', fakeAsync(() => {
149149
fixture.ngZone.run(() => {
150150
router.navigateByUrl('/error');
151151
});
152152
tick();
153-
expect(titleService.getTitle()).toEqual('Ceph');
153+
expect(titleService.getTitle()).toEqual('Ceph Dashboard');
154154
}));
155155

156156
it('should display 2 breadcrumbs in page title when navigating to hosts', fakeAsync(() => {
157157
fixture.ngZone.run(() => {
158158
router.navigateByUrl('/hosts');
159159
});
160160
tick();
161-
expect(titleService.getTitle()).toEqual('Ceph: Cluster > Hosts');
161+
expect(titleService.getTitle()).toEqual('Ceph Dashboard: Cluster > Hosts');
162162
}));
163163

164164
it('should display 3 breadcrumbs in page title when navigating to RBD Add', fakeAsync(() => {
165165
fixture.ngZone.run(() => {
166166
router.navigateByUrl('/block/rbd/add');
167167
});
168168
tick();
169-
expect(titleService.getTitle()).toEqual('Ceph: Block > Images > Add');
169+
expect(titleService.getTitle()).toEqual('Ceph Dashboard: Block > Images > Add');
170170
}));
171171
});

src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '
2828

2929
import { concat, from, Observable, of, Subscription } from 'rxjs';
3030
import { distinct, filter, first, mergeMap, toArray } from 'rxjs/operators';
31+
import { AppConstants } from '~/app/shared/constants/app.constants';
3132

3233
import { BreadcrumbsResolver, IBreadcrumb } from '~/app/shared/models/breadcrumbs';
3334

@@ -149,9 +150,9 @@ export class BreadcrumbsComponent implements OnDestroy {
149150
})
150151
.join(' > ');
151152
if (currentLocation.length > 0) {
152-
return `Ceph: ${currentLocation}`;
153+
return `${AppConstants.projectName}: ${currentLocation}`;
153154
} else {
154-
return 'Ceph';
155+
return AppConstants.projectName;
155156
}
156157
}
157158
}

src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<cds-select *ngIf="field.type === 'select'"
6262
[label]="field.label"
6363
[for]="field.name"
64+
[id]="field.name"
6465
[formControlName]="field.name"
6566
[options]="field?.typeConfig?.options"
6667
[placeholder]="field?.typeConfig?.placeholder"

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ng-container *ngIf="!dropDownOnly; else dropDownOnlyTpl">
2-
<button *ngIf="currentAction"
2+
<button *ngIf="currentAction && tableActions.length > 0"
33
type="button"
44
[cdsButton]="currentAction.buttonKind"
55
title="{{ useDisableDesc(currentAction) }}"

src/pybind/mgr/dashboard/frontend/src/styles/ceph-custom/_forms.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,22 @@
5353
@extend .cd-col-form-input;
5454
}
5555

56+
// Until all the modals are converted to carbon
57+
// need to keep this so that modals won't get hidden
58+
// behind nav bar
59+
ngb-modal-window {
60+
.modal-dialog {
61+
margin-top: 3rem;
62+
}
63+
}
64+
5665
cd-modal {
5766
.modal {
5867
/* stylelint-disable */
5968
background-color: rgba(0, 0, 0, 0.4);
6069
/* stylelint-enable */
6170
display: block;
71+
margin-top: 3rem;
6272
}
6373

6474
.modal-dialog {

0 commit comments

Comments
 (0)