<cds-hamburger [active]="showMenuSidebar"
data-testid="main-menu-toggler"
(selected)="showMenuSidebar = !showMenuSidebar"></cds-hamburger>
+ <!-- ************************* -->
+ <!-- CLUSTER SWITCHER TEMPLATE -->
+ <!-- ************************* -->
+ <cds-header-navigation class="cluster-switcher"
+ *ngIf="clustersMap?.size > 1">
+ <cds-header-menu [title]="currentClusterName">
+ <ng-container *ngFor="let cluster of clustersMap | keyvalue; trackBy:trackByFn ">
+ <cds-header-item (click)="onClusterSelection(cluster.value)"
+ [class.disabled]="cluster.value.cluster_connection_status === 1">
+ {{ cluster.value.name }} - {{ cluster.value?.cluster_alias }} - {{ cluster.value?.user }}
+ </cds-header-item>
+ </ng-container>
+ </cds-header-menu>
+ </cds-header-navigation>
+
<cds-header-global>
<cds-header-navigation>
<cd-language-selector class="d-flex"></cd-language-selector>
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;
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({});
ToastrModule.forRoot(),
RouterTestingModule,
SimplebarAngularModule,
- NgbModule
+ NgbModule,
+ UIShellModule,
+ ThemeModule,
+ DialogModule,
+ GridModule
],
providers: [AuthStorageService, SummaryService, FeatureTogglesService, PrometheusAlertService]
});
private subs = new Subscription();
clustersMap: Map<string, any> = new Map<string, any>();
- selectedCluster: object;
+ selectedCluster: {
+ name: string;
+ cluster_alias: string;
+ user: string;
+ cluster_connection_status?: number;
+ };
+ currentClusterName: string;
constructor(
private authStorageService: AuthStorageService,
});
this.selectedCluster =
this.clustersMap.get(`${resp['current_url']}-${resp['current_user']}`) || {};
+ this.currentClusterName = `${this.selectedCluster?.name} - ${this.selectedCluster?.cluster_alias} - ${this.selectedCluster?.user}`;
}
})
);
}
);
}
+
+ trackByFn(item: any) {
+ return item;
+ }
}