wip - refactored dashboard

This commit is contained in:
2025-06-11 14:39:13 +02:00
parent ff6946d2bc
commit 99ec34186e
5 changed files with 70 additions and 72 deletions

View File

@ -171,6 +171,8 @@ class State(AccessProfile):
class Session(MongoBaseModel, AccessProfile): class Session(MongoBaseModel, AccessProfile):
deployment_id: str deployment_id: str
name: str name: str
prefix: str = ""
description: str = ""
SessionPartial = make_all_fields_optional(Session, "SessionPartial") SessionPartial = make_all_fields_optional(Session, "SessionPartial")

View File

@ -4,46 +4,23 @@
<img <img
src="assets/BEC-Atlas-full-transparent.png" src="assets/BEC-Atlas-full-transparent.png"
alt="BEC" alt="BEC"
width="80" width="25"
height="80" height="25"
style="margin: 10px" style="margin: 10px"
/> />
</div> </div>
<mat-divider></mat-divider>
<!-- Username expansion panel -->
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-icon>account_circle</mat-icon>
<span class="menu-text">Username</span>
</mat-expansion-panel-header>
<button mat-button>Profile</button>
<button mat-button>Settings</button>
<button mat-button (click)="logout()">Logout</button>
</mat-expansion-panel>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<app-sidepanel-icon icon="science" label="Experiment"></app-sidepanel-icon>
<!-- Data Browser --> <app-sidepanel-icon icon="description" label="Data"></app-sidepanel-icon>
<mat-expansion-panel> <app-sidepanel-icon
<mat-expansion-panel-header> icon="manage_accounts"
<mat-icon>table_chart</mat-icon> label="Access"
<span class="menu-text">Data Browser</span> [active]="true"
</mat-expansion-panel-header> ></app-sidepanel-icon>
<button
mat-button
class="menu-item"
[routerLink]="['/dashboard/scan-table']"
>
Scan Data
</button>
<button mat-button class="menu-item">Device Data</button>
</mat-expansion-panel>
<!-- Experiment Control Expansion --> <!-- Experiment Control Expansion -->
<mat-expansion-panel <!-- <mat-expansion-panel
(opened)="panelOpened()" (opened)="panelOpened()"
[hideToggle]="hideExperimentPanel" [hideToggle]="hideExperimentPanel"
> >
@ -70,10 +47,10 @@
<button mat-button class="menu-item" (click)="openDeploymentDialog()"> <button mat-button class="menu-item" (click)="openDeploymentDialog()">
<span class="menu-text">{{ selectOrSwitchButtonTitle }}</span> <span class="menu-text">{{ selectOrSwitchButtonTitle }}</span>
</button> </button>
</mat-expansion-panel> </mat-expansion-panel> -->
<!-- Help --> <!-- Help -->
<button mat-button class="menu-item"> <!-- <button mat-button class="menu-item">
<mat-icon>help</mat-icon> <mat-icon>help</mat-icon>
<span class="menu-text">Help</span> <span class="menu-text">Help</span>
</button> </button>
@ -84,7 +61,7 @@
<div class="menu-text">{{ realm_name }}</div> <div class="menu-text">{{ realm_name }}</div>
<div class="menu-text">{{ deployment_name }}</div> <div class="menu-text">{{ deployment_name }}</div>
</div> </div>
} } -->
</mat-sidenav> </mat-sidenav>
<mat-sidenav-content> <mat-sidenav-content>

View File

@ -7,10 +7,9 @@
} }
mat-sidenav { mat-sidenav {
width: 250px; width: 70px;
background: var(--mat-sys-surface-container); background: var(--mat-sys-surface-container);
border-radius: 0px; border-radius: 0px;
padding-left: 6px;
text-align: center; text-align: center;
@include mat.elevation(3); @include mat.elevation(3);
} }

View File

@ -16,6 +16,9 @@ import {
import { DeploymentSelectionComponent } from '../deployment-selection/deployment-selection.component'; import { DeploymentSelectionComponent } from '../deployment-selection/deployment-selection.component';
import { RedisConnectorService } from '../core/redis-connector.service'; import { RedisConnectorService } from '../core/redis-connector.service';
import { AuthDataService } from '../core/remote-data.service'; import { AuthDataService } from '../core/remote-data.service';
import { SidePanelComponent } from '../scan-table/side-panel/side-panel.component';
import { SidepanelIconComponent } from './sidepanel-icon/sidepanel-icon.component';
@Component({ @Component({
selector: 'app-dashboard', selector: 'app-dashboard',
imports: [ imports: [
@ -27,6 +30,8 @@ import { AuthDataService } from '../core/remote-data.service';
MatButtonModule, MatButtonModule,
MatDialogModule, MatDialogModule,
RouterModule, RouterModule,
SidePanelComponent,
SidepanelIconComponent,
], ],
providers: [DeploymentService, RedisConnectorService], providers: [DeploymentService, RedisConnectorService],
templateUrl: './dashboard.component.html', templateUrl: './dashboard.component.html',
@ -50,21 +55,20 @@ export class DashboardComponent {
ngOnInit(): void { ngOnInit(): void {
// check if the user has already selected a deployment // check if the user has already selected a deployment
// if not, open the deployment selection dialog // if not, open the deployment selection dialog
this.deploymentService.selectedDeployment.subscribe((deployment) => { // this.deploymentService.selectedDeployment.subscribe((deployment) => {
if (deployment) { // if (deployment) {
console.log('Updating deployment name to: ', deployment.name); // console.log('Updating deployment name to: ', deployment.name);
this.deployment_name = deployment.name; // this.deployment_name = deployment.name;
this.realm_name = deployment.realm_id; // this.realm_name = deployment.realm_id;
this.hideExperimentPanel = false; // this.hideExperimentPanel = false;
this.selectOrSwitchButtonTitle = 'Switch Deployment'; // this.selectOrSwitchButtonTitle = 'Switch Deployment';
} else { // } else {
this.deployment_name = ''; // this.deployment_name = '';
this.realm_name = ''; // this.realm_name = '';
this.hideExperimentPanel = true; // this.hideExperimentPanel = true;
this.selectOrSwitchButtonTitle = 'Select Deployment'; // this.selectOrSwitchButtonTitle = 'Select Deployment';
} // }
}); // });
// this.breakpointObserver // this.breakpointObserver
// .observe([Breakpoints.Small, Breakpoints.XSmall]) // .observe([Breakpoints.Small, Breakpoints.XSmall])
// .subscribe((result) => { // .subscribe((result) => {
@ -72,26 +76,26 @@ export class DashboardComponent {
// }); // });
} }
openDeploymentDialog() { // openDeploymentDialog() {
// open deployment dialog // // open deployment dialog
let dialogConfig: MatDialogConfig = { // let dialogConfig: MatDialogConfig = {
disableClose: true, // disableClose: true,
width: '80%', // width: '80%',
}; // };
let dialogRef = this.dialog.open( // let dialogRef = this.dialog.open(
DeploymentSelectionComponent, // DeploymentSelectionComponent,
dialogConfig // dialogConfig
); // );
dialogRef.afterClosed().subscribe((result) => { // dialogRef.afterClosed().subscribe((result) => {
this.deploymentService.selectDeployment(result); // this.deploymentService.selectDeployment(result);
}); // });
} // }
panelOpened() { // panelOpened() {
if (!this.deploymentService.selectedDeployment.value) { // if (!this.deploymentService.selectedDeployment.value) {
this.openDeploymentDialog(); // this.openDeploymentDialog();
} // }
} // }
logout() { logout() {
this.authDataService.logout(); this.authDataService.logout();

View File

@ -18,6 +18,22 @@
href="https://fonts.googleapis.com/icon?family=Material+Icons" href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet" rel="stylesheet"
/> />
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons+Outlined"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons+Round"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons+Sharp"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons+Two+Tone"
rel="stylesheet"
/>
</head> </head>
<body class="mat-typography"> <body class="mat-typography">
<app-root></app-root> <app-root></app-root>