Skip to content

Commit 9d38763

Browse files
authored
Merge pull request ceph#62601 from rhcs-dashboard/smb-tabs-route
mgr/dashboard: make smb tabs routable
2 parents 4b625ab + 36053d1 commit 9d38763

File tree

9 files changed

+87
-56
lines changed

9 files changed

+87
-56
lines changed

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

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,14 @@ import { MultiClusterComponent } from './ceph/cluster/multi-cluster/multi-cluste
5151
import { MultiClusterListComponent } from './ceph/cluster/multi-cluster/multi-cluster-list/multi-cluster-list.component';
5252
import { MultiClusterDetailsComponent } from './ceph/cluster/multi-cluster/multi-cluster-details/multi-cluster-details.component';
5353
import { SmbClusterFormComponent } from './ceph/smb/smb-cluster-form/smb-cluster-form.component';
54-
import { SmbTabsComponent } from './ceph/smb/smb-tabs/smb-tabs.component';
5554
import { SmbShareFormComponent } from './ceph/smb/smb-share-form/smb-share-form.component';
5655
import { SmbJoinAuthFormComponent } from './ceph/smb/smb-join-auth-form/smb-join-auth-form.component';
5756
import { SmbUsersgroupsFormComponent } from './ceph/smb/smb-usersgroups-form/smb-usersgroups-form.component';
5857
import { NfsClusterComponent } from './ceph/nfs/nfs-cluster/nfs-cluster.component';
58+
import { SmbClusterListComponent } from './ceph/smb/smb-cluster-list/smb-cluster-list.component';
59+
import { SmbJoinAuthListComponent } from './ceph/smb/smb-join-auth-list/smb-join-auth-list.component';
60+
import { SmbUsersgroupsListComponent } from './ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component';
61+
import { SmbOverviewComponent } from './ceph/smb/smb-overview/smb-overview.component';
5962

6063
@Injectable()
6164
export class PerformanceCounterBreadcrumbsResolver extends BreadcrumbsResolver {
@@ -437,7 +440,7 @@ const routes: Routes = [
437440
},
438441
{
439442
path: 'smb',
440-
canActivateChild: [ModuleStatusGuardService],
443+
canActivate: [ModuleStatusGuardService],
441444
data: {
442445
moduleStatusGuardConfig: {
443446
uiApiPath: 'smb',
@@ -449,41 +452,67 @@ const routes: Routes = [
449452
breadcrumbs: 'File/SMB'
450453
},
451454
children: [
452-
{ path: '', component: SmbTabsComponent },
455+
{ path: '', component: SmbClusterListComponent },
453456
{
454-
path: `${URLVerbs.CREATE}`,
455-
component: SmbClusterFormComponent,
456-
data: { breadcrumbs: ActionLabels.CREATE }
457-
},
458-
{
459-
path: `share/${URLVerbs.CREATE}/:clusterId`,
460-
component: SmbShareFormComponent,
461-
data: { breadcrumbs: ActionLabels.CREATE }
457+
path: 'clusters',
458+
data: { breadcrumbs: 'Clusters' },
459+
children: [
460+
{ path: '', component: SmbClusterListComponent },
461+
{
462+
path: `${URLVerbs.CREATE}`,
463+
component: SmbClusterFormComponent,
464+
data: { breadcrumbs: ActionLabels.CREATE }
465+
},
466+
{
467+
path: `${URLVerbs.EDIT}/:cluster_id`,
468+
component: SmbClusterFormComponent,
469+
data: { breadcrumbs: ActionLabels.EDIT }
470+
}
471+
]
462472
},
463473
{
464-
path: `${URLVerbs.EDIT}/:cluster_id`,
465-
component: SmbClusterFormComponent,
466-
data: { breadcrumbs: ActionLabels.EDIT }
474+
path: 'active-directory',
475+
data: { breadcrumbs: 'Active Directory' },
476+
children: [
477+
{ path: '', component: SmbJoinAuthListComponent },
478+
{
479+
path: `${URLVerbs.CREATE}`,
480+
component: SmbJoinAuthFormComponent,
481+
data: { breadcrumbs: ActionLabels.CREATE }
482+
},
483+
{
484+
path: `${URLVerbs.EDIT}/:authId`,
485+
component: SmbJoinAuthFormComponent,
486+
data: { breadcrumbs: ActionLabels.EDIT }
487+
}
488+
]
467489
},
468490
{
469-
path: `ad/${URLVerbs.CREATE}`,
470-
component: SmbJoinAuthFormComponent,
471-
data: { breadcrumbs: ActionLabels.CREATE }
491+
path: 'standalone',
492+
data: { breadcrumbs: 'Standalone' },
493+
children: [
494+
{ path: '', component: SmbUsersgroupsListComponent },
495+
{
496+
path: `${URLVerbs.CREATE}`,
497+
component: SmbUsersgroupsFormComponent,
498+
data: { breadcrumbs: ActionLabels.CREATE }
499+
},
500+
{
501+
path: `${URLVerbs.EDIT}/:usersGroupsId`,
502+
component: SmbUsersgroupsFormComponent
503+
}
504+
]
472505
},
473506
{
474-
path: `ad/${URLVerbs.EDIT}/:authId`,
475-
component: SmbJoinAuthFormComponent,
476-
data: { breadcrumbs: ActionLabels.EDIT }
507+
path: 'overview',
508+
component: SmbOverviewComponent,
509+
data: { breadcrumbs: 'Overview' }
477510
},
478511
{
479-
path: `standalone/${URLVerbs.CREATE}`,
480-
component: SmbUsersgroupsFormComponent,
512+
path: `share/${URLVerbs.CREATE}/:clusterId`,
513+
component: SmbShareFormComponent,
481514
data: { breadcrumbs: ActionLabels.CREATE }
482515
},
483-
{
484-
path: `standalone/${URLVerbs.EDIT}/:usersGroupsId`,
485-
component: SmbUsersgroupsFormComponent
486-
},
487516
{
488517
path: `share/${URLVerbs.EDIT}/:clusterId/:shareId`,
489518
component: SmbShareFormComponent,

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<cd-smb-tabs></cd-smb-tabs>
2+
13
<ng-container *ngIf="smbClusters$ | async as smbClusters">
24
<cd-table
35
headerTitle="Clusters"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete
2424
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
2525
import { FinishedTask } from '~/app/shared/models/finished-task';
2626

27-
const BASE_URL = 'cephfs/smb';
27+
const BASE_URL = 'cephfs/smb/clusters';
2828
@Component({
2929
selector: 'cd-smb-cluster-list',
3030
templateUrl: './smb-cluster-list.component.html',

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-join-auth-list/smb-join-auth-list.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<cd-smb-tabs></cd-smb-tabs>
2+
13
<cd-table
24
headerTitle="Active directory access resources"
35
headerDescription="Logical management units for authorization on active directory (AD) servers"

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-join-auth-list/smb-join-auth-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
1818
import { FinishedTask } from '~/app/shared/models/finished-task';
1919
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
2020

21-
export const JOINAUTH_URL = '/cephfs/smb/ad';
21+
export const JOINAUTH_URL = '/cephfs/smb/active-directory';
2222

2323
@Component({
2424
selector: 'cd-smb-join-auth-list',

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-overview/smb-overview.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<cd-smb-tabs></cd-smb-tabs>
2+
13
<cd-grafana
24
i18n-title
35
title="SMB overview"

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.html

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,26 @@
55
[cacheActive]="false">
66
<cds-tab
77
heading="Clusters"
8-
[tabContent]="clusters"
98
i18n-heading
9+
[active]="activeTab === Tabs.clusters"
1010
(selected)="onSelected(Tabs.clusters)">
1111
</cds-tab>
1212
<cds-tab
1313
heading="Active Directory"
14-
[tabContent]="joinAuth"
1514
i18n-heading
16-
(selected)="onSelected(Tabs.joinAuths)">
15+
[active]="activeTab === Tabs.activeDirectory"
16+
(selected)="onSelected(Tabs.activeDirectory)">
1717
</cds-tab>
1818
<cds-tab
1919
heading="Standalone"
20-
[tabContent]="usersgroups"
2120
i18n-heading
22-
(selected)="onSelected(Tabs.usersgroups)">
21+
[active]="activeTab === Tabs.standalone"
22+
(selected)="onSelected(Tabs.standalone)">
2323
</cds-tab>
2424
<cds-tab
2525
heading="Overview"
26-
[tabContent]="overview"
2726
i18n-heading
27+
[active]="activeTab === Tabs.overview"
2828
(selected)="onSelected(Tabs.overview)">
2929
</cds-tab>
3030
</cds-tabs>
31-
32-
<ng-template #clusters>
33-
<cd-smb-cluster-list></cd-smb-cluster-list>
34-
</ng-template>
35-
36-
<ng-template #joinAuth>
37-
<cd-smb-join-auth-list></cd-smb-join-auth-list>
38-
</ng-template>
39-
40-
<ng-template #usersgroups>
41-
<cd-smb-users-list></cd-smb-users-list>
42-
</ng-template>
43-
44-
<ng-template #overview>
45-
<cd-smb-overview></cd-smb-overview>
46-
</ng-template>

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
2+
import { Router } from '@angular/router';
23

34
enum TABS {
4-
'clusters',
5-
'joinAuths',
6-
'usersgroups',
7-
'overview'
5+
clusters = 'clusters',
6+
activeDirectory = 'active-directory',
7+
standalone = 'standalone',
8+
overview = 'overview'
89
}
910

1011
@Component({
1112
selector: 'cd-smb-tabs',
1213
templateUrl: './smb-tabs.component.html',
1314
styleUrls: ['./smb-tabs.component.scss']
1415
})
15-
export class SmbTabsComponent {
16+
export class SmbTabsComponent implements OnInit {
1617
selectedTab: TABS;
18+
activeTab: TABS = TABS.clusters;
19+
20+
constructor(private router: Router) {}
21+
22+
ngOnInit(): void {
23+
const currentPath = this.router.url;
24+
this.activeTab = Object.values(TABS).find((tab) => currentPath.includes(tab)) || TABS.clusters;
25+
}
1726

1827
onSelected(tab: TABS) {
1928
this.selectedTab = tab;
29+
this.router.navigate([`/cephfs/smb/${tab}`]);
2030
}
2131

2232
public get Tabs(): typeof TABS {

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<cd-smb-tabs></cd-smb-tabs>
2+
13
<ng-container *ngIf="usersGroups$ | async as usersGroups">
24
<cd-table
35
headerTitle="Standalone access resoruces"

0 commit comments

Comments
 (0)