Skip to content

Commit 4726684

Browse files
authored
Merge pull request ceph#56658 from afreen23/wip-nfs-route
mgr/dashboard: Fix NFS routing Reviewed-by: Ankush Behl <[email protected]> Reviewed-by: Nizamudeen A <[email protected]>
2 parents 1e7a753 + 97359d6 commit 4726684

File tree

19 files changed

+514
-553
lines changed

19 files changed

+514
-553
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/urls.po.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class UrlsCollection extends PageHelper {
4242
'rgw daemons': { url: '#/rgw/daemon', id: 'cd-rgw-daemon-list' },
4343

4444
// CephFS
45-
cephfs: { url: '#/cephfs', id: 'cd-cephfs-list' },
46-
'create cephfs': { url: '#/cephfs/create', id: 'cd-cephfs-form' }
45+
cephfs: { url: '#/cephfs/fs', id: 'cd-cephfs-list' },
46+
'create cephfs': { url: '#/cephfs/fs/create', id: 'cd-cephfs-form' }
4747
};
4848
}

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/10-nfs-exports.e2e-spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ describe('nfsExport page', () => {
1919

2020
beforeEach(() => {
2121
cy.login();
22-
nfsExport.navigateTo();
2322
});
2423

2524
describe('breadcrumb test', () => {
2625
it('should open and show breadcrumb', () => {
26+
nfsExport.navigateTo('rgw_index');
2727
nfsExport.expectBreadcrumbText('NFS');
2828
});
2929
});
@@ -43,36 +43,38 @@ describe('nfsExport page', () => {
4343
buckets.navigateTo('create');
4444
buckets.create(bucketName, 'dashboard');
4545

46-
nfsExport.navigateTo();
46+
nfsExport.navigateTo('rgw_index');
4747
nfsExport.existTableCell(rgwPseudo, false);
48-
nfsExport.navigateTo('create');
48+
nfsExport.navigateTo('rgw_create');
4949
nfsExport.create(backends[1], squash, client, rgwPseudo, bucketName);
5050
nfsExport.existTableCell(rgwPseudo);
5151
});
5252

5353
// @TODO: uncomment this when a CephFS volume can be created through Dashboard.
5454
// it('should create a nfs-export with CephFS backend', () => {
55-
// nfsExport.navigateTo();
55+
// nfsExport.navigateTo('cephfs_index');
5656
// nfsExport.existTableCell(fsPseudo, false);
57-
// nfsExport.navigateTo('create');
57+
// nfsExport.navigateTo('cephfs_create');
5858
// nfsExport.create(backends[0], squash, client, fsPseudo);
5959
// nfsExport.existTableCell(fsPseudo);
6060
// });
6161

6262
it('should show Clients', () => {
63+
nfsExport.navigateTo('rgw_index');
6364
nfsExport.clickTab('cd-nfs-details', rgwPseudo, 'Clients (1)');
6465
cy.get('cd-nfs-details').within(() => {
6566
nfsExport.getTableCount('total').should('be.gte', 0);
6667
});
6768
});
6869

6970
it('should edit an export', () => {
70-
nfsExport.editExport(rgwPseudo, editPseudo);
71+
nfsExport.editExport(rgwPseudo, editPseudo, 'rgw_index');
7172

7273
nfsExport.existTableCell(editPseudo);
7374
});
7475

7576
it('should delete exports and bucket', () => {
77+
nfsExport.navigateTo('rgw_index');
7678
nfsExport.delete(editPseudo);
7779

7880
buckets.navigateTo();

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/nfs/nfs-export.po.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ import { PageHelper } from '../../../page-helper.po';
33
/* tslint:enable*/
44

55
const pages = {
6-
index: { url: '#/nfs', id: 'cd-nfs-list' },
7-
create: { url: '#/nfs/create', id: 'cd-nfs-form' }
6+
cephfs_index: { url: '#cephfs/nfs', id: 'cd-nfs-list' },
7+
cephfs_create: { url: '#cephfs/nfs/create', id: 'cd-nfs-form' },
8+
rgw_index: { url: '#rgw/nfs', id: 'cd-nfs-list' },
9+
rgw_create: { url: '#rgw/nfs/create', id: 'cd-nfs-form' }
810
};
911

1012
export class NFSPageHelper extends PageHelper {
1113
pages = pages;
12-
13-
@PageHelper.restrictTo(pages.create.url)
1414
create(backend: string, squash: string, client: object, pseudo: string, rgwPath?: string) {
1515
this.selectOption('cluster_id', 'testnfs');
16-
// select a storage backend
17-
this.selectOption('name', backend);
1816
if (backend === 'CephFS') {
1917
this.selectOption('fs_name', 'myfs');
20-
2118
cy.get('#security_label').click({ force: true });
2219
} else {
2320
cy.get('input[data-testid=rgw_path]').type(rgwPath);
@@ -38,8 +35,8 @@ export class NFSPageHelper extends PageHelper {
3835
cy.get('cd-submit-button').click();
3936
}
4037

41-
editExport(pseudo: string, editPseudo: string) {
42-
this.navigateEdit(pseudo);
38+
editExport(pseudo: string, editPseudo: string, url: string) {
39+
this.navigateEdit(pseudo, true, true, url);
4340

4441
cy.get('input[name=pseudo]').clear().type(editPseudo);
4542

src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export abstract class PageHelper {
5252
/**
5353
* Navigates to the edit page
5454
*/
55-
navigateEdit(name: string, select = true, breadcrumb = true) {
55+
navigateEdit(name: string, select = true, breadcrumb = true, navigateTo: string = null) {
5656
if (select) {
57-
this.navigateTo();
57+
this.navigateTo(navigateTo);
5858
this.getFirstTableCell(name).click();
5959
}
6060
cy.contains('Creating...').should('not.exist');

src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -370,18 +370,48 @@ const routes: Routes = [
370370
{
371371
path: 'cephfs',
372372
canActivate: [FeatureTogglesGuardService],
373-
data: { breadcrumbs: 'File/File Systems' },
374373
children: [
375-
{ path: '', component: CephfsListComponent },
376374
{
377-
path: URLVerbs.CREATE,
375+
path: 'fs',
376+
component: CephfsListComponent,
377+
data: { breadcrumbs: 'File/File Systems' }
378+
},
379+
{
380+
path: `fs/${URLVerbs.CREATE}`,
378381
component: CephfsVolumeFormComponent,
379382
data: { breadcrumbs: ActionLabels.CREATE }
380383
},
381384
{
382-
path: `${URLVerbs.EDIT}/:id`,
385+
path: `fs/${URLVerbs.EDIT}/:id`,
383386
component: CephfsVolumeFormComponent,
384387
data: { breadcrumbs: ActionLabels.EDIT }
388+
},
389+
{
390+
path: 'nfs',
391+
canActivateChild: [FeatureTogglesGuardService, ModuleStatusGuardService],
392+
data: {
393+
moduleStatusGuardConfig: {
394+
uiApiPath: 'nfs-ganesha',
395+
redirectTo: 'error',
396+
section: 'nfs-ganesha',
397+
section_info: 'NFS GANESHA',
398+
header: 'NFS-Ganesha is not configured'
399+
},
400+
breadcrumbs: 'File/NFS'
401+
},
402+
children: [
403+
{ path: '', component: NfsListComponent },
404+
{
405+
path: URLVerbs.CREATE,
406+
component: NfsFormComponent,
407+
data: { breadcrumbs: ActionLabels.CREATE }
408+
},
409+
{
410+
path: `${URLVerbs.EDIT}/:cluster_id/:export_id`,
411+
component: NfsFormComponent,
412+
data: { breadcrumbs: ActionLabels.EDIT }
413+
}
414+
]
385415
}
386416
]
387417
},
@@ -421,34 +451,6 @@ const routes: Routes = [
421451
data: { breadcrumbs: ActionLabels.EDIT }
422452
}
423453
]
424-
},
425-
// NFS
426-
{
427-
path: 'nfs',
428-
canActivateChild: [FeatureTogglesGuardService, ModuleStatusGuardService],
429-
data: {
430-
moduleStatusGuardConfig: {
431-
uiApiPath: 'nfs-ganesha',
432-
redirectTo: 'error',
433-
section: 'nfs-ganesha',
434-
section_info: 'NFS GANESHA',
435-
header: 'NFS-Ganesha is not configured'
436-
},
437-
breadcrumbs: 'NFS'
438-
},
439-
children: [
440-
{ path: '', component: NfsListComponent },
441-
{
442-
path: URLVerbs.CREATE,
443-
component: NfsFormComponent,
444-
data: { breadcrumbs: ActionLabels.CREATE }
445-
},
446-
{
447-
path: `${URLVerbs.EDIT}/:cluster_id/:export_id`,
448-
component: NfsFormComponent,
449-
data: { breadcrumbs: ActionLabels.EDIT }
450-
}
451-
]
452454
}
453455
]
454456
},

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-form/cephfs-form.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class CephfsVolumeFormComponent extends CdForm implements OnInit {
6868
private route: ActivatedRoute
6969
) {
7070
super();
71-
this.editing = this.router.url.startsWith(`/cephfs/${URLVerbs.EDIT}`);
71+
this.editing = this.router.url.startsWith(`/cephfs/fs/${URLVerbs.EDIT}`);
7272
this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
7373
this.resource = $localize`File System`;
7474
this.hosts = {
@@ -176,7 +176,7 @@ export class CephfsVolumeFormComponent extends CdForm implements OnInit {
176176
this.form.setErrors({ cdSubmitButton: true });
177177
},
178178
complete: () => {
179-
this.router.navigate([BASE_URL]);
179+
this.router.navigate([`${BASE_URL}/fs`]);
180180
}
181181
});
182182
} else {
@@ -210,7 +210,7 @@ export class CephfsVolumeFormComponent extends CdForm implements OnInit {
210210
self.form.setErrors({ cdSubmitButton: true });
211211
},
212212
complete: () => {
213-
this.router.navigate([BASE_URL]);
213+
this.router.navigate([`${BASE_URL}/fs`]);
214214
}
215215
});
216216
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { map, switchMap } from 'rxjs/operators';
2727
import { HealthService } from '~/app/shared/api/health.service';
2828
import { CephfsAuthModalComponent } from '~/app/ceph/cephfs/cephfs-auth-modal/cephfs-auth-modal.component';
2929

30-
const BASE_URL = 'cephfs';
30+
const BASE_URL = 'cephfs/fs';
3131

3232
@Component({
3333
selector: 'cd-cephfs-list',
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
export enum SUPPORTED_FSAL {
2+
CEPH = 'CEPH',
3+
RGW = 'RGW'
4+
}
15
export interface NfsFSAbstractionLayer {
2-
value: string;
6+
value: SUPPORTED_FSAL;
37
descr: string;
48
disabled: boolean;
59
}

0 commit comments

Comments
 (0)