From: Nizamudeen A Date: Tue, 18 Jun 2024 07:44:02 +0000 (+0530) Subject: mgr/dashboard: fix (multi) cluster switcher disappearance after carbon UI X-Git-Tag: v20.0.0~1666^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F58110%2Fhead;p=ceph.git mgr/dashboard: fix (multi) cluster switcher disappearance after carbon UI Fixes: https://tracker.ceph.com/issues/66538 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html index 085733c20dbcb..ff16553a03689 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html @@ -12,6 +12,21 @@ + + + + + + + + {{ cluster.value.name }} - {{ cluster.value?.cluster_alias }} - {{ cluster.value?.user }} + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss index 0dcecd98442be..56dc7e749a3ed 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss @@ -24,6 +24,14 @@ height: 25px; } +cds-header-item { + width: 500px; +} + +.cluster-switcher { + margin-left: 6rem; +} + ::ng-deep cd-navigation .cd-navbar-top { .cd-navbar-brand { background: vv.$secondary; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.spec.ts index c674cfdcf5c07..9bf0bde51e222 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.spec.ts @@ -24,6 +24,7 @@ import { AdministrationComponent } from '../administration/administration.compon import { IdentityComponent } from '../identity/identity.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { DashboardHelpComponent } from '../dashboard-help/dashboard-help.component'; +import { DialogModule, GridModule, ThemeModule, UIShellModule } from 'carbon-components-angular'; function everythingPermittedExcept(disabledPermissions: string[] = []): any { const permissions: Permissions = new Permissions({}); @@ -71,7 +72,11 @@ describe('NavigationComponent', () => { ToastrModule.forRoot(), RouterTestingModule, SimplebarAngularModule, - NgbModule + NgbModule, + UIShellModule, + ThemeModule, + DialogModule, + GridModule ], providers: [AuthStorageService, SummaryService, FeatureTogglesService, PrometheusAlertService] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts index fefe1d8dab5bc..55c9ab7e88dcc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts @@ -40,7 +40,13 @@ export class NavigationComponent implements OnInit, OnDestroy { private subs = new Subscription(); clustersMap: Map = new Map(); - selectedCluster: object; + selectedCluster: { + name: string; + cluster_alias: string; + user: string; + cluster_connection_status?: number; + }; + currentClusterName: string; constructor( private authStorageService: AuthStorageService, @@ -74,6 +80,7 @@ export class NavigationComponent implements OnInit, OnDestroy { }); this.selectedCluster = this.clustersMap.get(`${resp['current_url']}-${resp['current_user']}`) || {}; + this.currentClusterName = `${this.selectedCluster?.name} - ${this.selectedCluster?.cluster_alias} - ${this.selectedCluster?.user}`; } }) ); @@ -182,4 +189,8 @@ export class NavigationComponent implements OnInit, OnDestroy { } ); } + + trackByFn(item: any) { + return item; + } }