From 36053d1591c8c7803896246dbce1fb4fa14c2b5f Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Tue, 1 Apr 2025 17:00:54 +0530 Subject: [PATCH] mgr/dashboard: make smb tabs routable Fixes: https://tracker.ceph.com/issues/70759 Signed-off-by: Nizamudeen A --- .../frontend/src/app/app-routing.module.ts | 81 +++++++++++++------ .../smb-cluster-list.component.html | 2 + .../smb-cluster-list.component.ts | 2 +- .../smb-join-auth-list.component.html | 2 + .../smb-join-auth-list.component.ts | 2 +- .../smb-overview/smb-overview.component.html | 2 + .../ceph/smb/smb-tabs/smb-tabs.component.html | 28 ++----- .../ceph/smb/smb-tabs/smb-tabs.component.ts | 22 +++-- .../smb-usersgroups-list.component.html | 2 + 9 files changed, 87 insertions(+), 56 deletions(-) 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 82e0c9c98724e..59c576330d94c 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 @@ -51,11 +51,14 @@ import { MultiClusterComponent } from './ceph/cluster/multi-cluster/multi-cluste import { MultiClusterListComponent } from './ceph/cluster/multi-cluster/multi-cluster-list/multi-cluster-list.component'; import { MultiClusterDetailsComponent } from './ceph/cluster/multi-cluster/multi-cluster-details/multi-cluster-details.component'; import { SmbClusterFormComponent } from './ceph/smb/smb-cluster-form/smb-cluster-form.component'; -import { SmbTabsComponent } from './ceph/smb/smb-tabs/smb-tabs.component'; import { SmbShareFormComponent } from './ceph/smb/smb-share-form/smb-share-form.component'; import { SmbJoinAuthFormComponent } from './ceph/smb/smb-join-auth-form/smb-join-auth-form.component'; import { SmbUsersgroupsFormComponent } from './ceph/smb/smb-usersgroups-form/smb-usersgroups-form.component'; import { NfsClusterComponent } from './ceph/nfs/nfs-cluster/nfs-cluster.component'; +import { SmbClusterListComponent } from './ceph/smb/smb-cluster-list/smb-cluster-list.component'; +import { SmbJoinAuthListComponent } from './ceph/smb/smb-join-auth-list/smb-join-auth-list.component'; +import { SmbUsersgroupsListComponent } from './ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component'; +import { SmbOverviewComponent } from './ceph/smb/smb-overview/smb-overview.component'; @Injectable() export class PerformanceCounterBreadcrumbsResolver extends BreadcrumbsResolver { @@ -437,7 +440,7 @@ const routes: Routes = [ }, { path: 'smb', - canActivateChild: [ModuleStatusGuardService], + canActivate: [ModuleStatusGuardService], data: { moduleStatusGuardConfig: { uiApiPath: 'smb', @@ -449,41 +452,67 @@ const routes: Routes = [ breadcrumbs: 'File/SMB' }, children: [ - { path: '', component: SmbTabsComponent }, + { path: '', component: SmbClusterListComponent }, { - path: `${URLVerbs.CREATE}`, - component: SmbClusterFormComponent, - data: { breadcrumbs: ActionLabels.CREATE } - }, - { - path: `share/${URLVerbs.CREATE}/:clusterId`, - component: SmbShareFormComponent, - data: { breadcrumbs: ActionLabels.CREATE } + path: 'clusters', + data: { breadcrumbs: 'Clusters' }, + children: [ + { path: '', component: SmbClusterListComponent }, + { + path: `${URLVerbs.CREATE}`, + component: SmbClusterFormComponent, + data: { breadcrumbs: ActionLabels.CREATE } + }, + { + path: `${URLVerbs.EDIT}/:cluster_id`, + component: SmbClusterFormComponent, + data: { breadcrumbs: ActionLabels.EDIT } + } + ] }, { - path: `${URLVerbs.EDIT}/:cluster_id`, - component: SmbClusterFormComponent, - data: { breadcrumbs: ActionLabels.EDIT } + path: 'active-directory', + data: { breadcrumbs: 'Active Directory' }, + children: [ + { path: '', component: SmbJoinAuthListComponent }, + { + path: `${URLVerbs.CREATE}`, + component: SmbJoinAuthFormComponent, + data: { breadcrumbs: ActionLabels.CREATE } + }, + { + path: `${URLVerbs.EDIT}/:authId`, + component: SmbJoinAuthFormComponent, + data: { breadcrumbs: ActionLabels.EDIT } + } + ] }, { - path: `ad/${URLVerbs.CREATE}`, - component: SmbJoinAuthFormComponent, - data: { breadcrumbs: ActionLabels.CREATE } + path: 'standalone', + data: { breadcrumbs: 'Standalone' }, + children: [ + { path: '', component: SmbUsersgroupsListComponent }, + { + path: `${URLVerbs.CREATE}`, + component: SmbUsersgroupsFormComponent, + data: { breadcrumbs: ActionLabels.CREATE } + }, + { + path: `${URLVerbs.EDIT}/:usersGroupsId`, + component: SmbUsersgroupsFormComponent + } + ] }, { - path: `ad/${URLVerbs.EDIT}/:authId`, - component: SmbJoinAuthFormComponent, - data: { breadcrumbs: ActionLabels.EDIT } + path: 'overview', + component: SmbOverviewComponent, + data: { breadcrumbs: 'Overview' } }, { - path: `standalone/${URLVerbs.CREATE}`, - component: SmbUsersgroupsFormComponent, + path: `share/${URLVerbs.CREATE}/:clusterId`, + component: SmbShareFormComponent, data: { breadcrumbs: ActionLabels.CREATE } }, - { - path: `standalone/${URLVerbs.EDIT}/:usersGroupsId`, - component: SmbUsersgroupsFormComponent - }, { path: `share/${URLVerbs.EDIT}/:clusterId/:shareId`, component: SmbShareFormComponent, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.html index 3417d30adb62b..7c9f591fb38a9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.html @@ -1,3 +1,5 @@ + + + + + [active]="activeTab === Tabs.activeDirectory" + (selected)="onSelected(Tabs.activeDirectory)"> + [active]="activeTab === Tabs.standalone" + (selected)="onSelected(Tabs.standalone)"> - - - - - - - - - - - - - - - - diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.ts index 3d7584007a402..fb0be8fff30cc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-tabs/smb-tabs.component.ts @@ -1,10 +1,11 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; enum TABS { - 'clusters', - 'joinAuths', - 'usersgroups', - 'overview' + clusters = 'clusters', + activeDirectory = 'active-directory', + standalone = 'standalone', + overview = 'overview' } @Component({ @@ -12,11 +13,20 @@ enum TABS { templateUrl: './smb-tabs.component.html', styleUrls: ['./smb-tabs.component.scss'] }) -export class SmbTabsComponent { +export class SmbTabsComponent implements OnInit { selectedTab: TABS; + activeTab: TABS = TABS.clusters; + + constructor(private router: Router) {} + + ngOnInit(): void { + const currentPath = this.router.url; + this.activeTab = Object.values(TABS).find((tab) => currentPath.includes(tab)) || TABS.clusters; + } onSelected(tab: TABS) { this.selectedTab = tab; + this.router.navigate([`/cephfs/smb/${tab}`]); } public get Tabs(): typeof TABS { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.html index 9d5ab9d98fe6d..ea5ae0a958b16 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.html @@ -1,3 +1,5 @@ + +