refs #1724 OgBoot status added to global status component
testing/ogGui-multibranch/pipeline/head Something is wrong with the build of this commit Details

pull/18/head
Lucas Lara García 2025-03-18 13:55:40 +01:00
parent f004de1ebd
commit f7dcafbd52
3 changed files with 84 additions and 18 deletions

View File

@ -1,8 +1,39 @@
.action-container { .dashboard {
display: flex; display: flex;
justify-content: flex-end; flex-direction: column;
gap: 1em; }
padding: 1.5em;
mat-dialog-content {
padding-top: 0.5em !important;
}
.disk-usage-container {
display: flex;
flex-direction: column;
}
.disk-usage {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.service-list {
margin-top: 0em;
margin-bottom: 0.5em;
}
.services-status {
display: flex;
flex-direction: column;
}
.services-status li {
margin: 5px 0;
display: flex;
align-items: center;
} }
.status-led { .status-led {
@ -19,4 +50,34 @@
.status-led.inactive { .status-led.inactive {
background-color: red; background-color: red;
}
.disk-title {
margin-bottom: 0px;
}
.service-title {
margin-top: 0px;
}
table {
width: 100%;
border-collapse: collapse;
}
th,
td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f4f4f4;
}
.action-container {
display: flex;
justify-content: flex-end;
gap: 1em;
padding: 1.5em;
} }

View File

@ -7,24 +7,26 @@
<app-loading [isLoading]="loading"></app-loading> <app-loading [isLoading]="loading"></app-loading>
<div *ngIf="!loading" class="dashboard"> <div *ngIf="!loading" class="dashboard">
<!-- Disk Usage Section --> <!-- Disk Usage Section -->
<div class="disk-usage" joyrideStep="diskUsageStep" text="{{ 'diskUsageDescription' | translate }}"> <div class="disk-usage-container">
<h3>{{ 'diskUsageTitle' | translate }}</h3> <h3 class="disk-title">{{ 'diskUsageTitle' | translate }}</h3>
<ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="diskUsageChartData" <div class="disk-usage" joyrideStep="diskUsageStep" text="{{ 'diskUsageDescription' | translate }}">
[gradient]="gradient" [doughnut]="isDoughnut" [labels]="showLabels"> <ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="diskUsageChartData"
</ngx-charts-pie-chart> [doughnut]="isDoughnut" [labels]="showLabels">
<div class="disk-usage-info"> </ngx-charts-pie-chart>
<p>{{ 'totalLabel' | translate }}: {{ formatBytes(ogBootDiskUsage.total) }}</p> <div class="disk-usage-info">
<p>{{ 'usedLabel' | translate }}: {{ formatBytes(ogBootDiskUsage.used) }}</p> <p>{{ 'totalLabel' | translate }}: <strong>{{ formatBytes(ogBootDiskUsage.total) }}</strong></p>
<p>{{ 'availableLabel' | translate }}: {{ formatBytes(ogBootDiskUsage.available) }}</p> <p>{{ 'usedLabel' | translate }}: <strong>{{ formatBytes(ogBootDiskUsage.used) }}</strong></p>
<p>{{ 'freeLabel' | translate }}: {{ ogBootDiskUsage.percentage }}%</p> <p>{{ 'availableLabel' | translate }}: <strong>{{ formatBytes(ogBootDiskUsage.available) }}</strong></p>
<p>{{ 'freeLabel' | translate }}: <strong>{{ ogBootDiskUsage.percentage }}</strong></p>
</div>
</div> </div>
</div> </div>
<!-- Services Status Section --> <!-- Services Status Section -->
<div class="services-status" joyrideStep="servicesStatusStep" <div class="services-status" joyrideStep="servicesStatusStep"
text="{{ 'servicesStatusDescription' | translate }}"> text="{{ 'servicesStatusDescription' | translate }}">
<h3>{{ 'servicesTitle' | translate }}</h3> <h3 class="service-title">{{ 'servicesTitle' | translate }}</h3>
<ul> <ul class="service-list">
<li *ngFor="let service of getServices()"> <li *ngFor="let service of getServices()">
<span class="status-led" <span class="status-led"
[ngClass]="{ 'active': service.status === 'active', 'inactive': service.status !== 'active' }"></span> [ngClass]="{ 'active': service.status === 'active', 'inactive': service.status !== 'active' }"></span>

View File

@ -24,7 +24,7 @@ export class GlobalStatusComponent implements OnInit {
colorScheme: any = { colorScheme: any = {
domain: ['#df200d', '#26a700'] domain: ['#df200d', '#26a700']
}; };
view: [number, number] = [1100, 500]; view: [number, number] = [400, 220];
constructor( constructor(
private configService: ConfigService, private configService: ConfigService,
@ -55,6 +55,7 @@ export class GlobalStatusComponent implements OnInit {
this.loading = false; this.loading = false;
} }
}); });
this.loading = true;
} }
onTabChange(event: MatTabChangeEvent): void { onTabChange(event: MatTabChangeEvent): void {
@ -67,10 +68,12 @@ export class GlobalStatusComponent implements OnInit {
if (!this.ogBootServicesStatus) { if (!this.ogBootServicesStatus) {
return []; return [];
} }
return Object.keys(this.ogBootServicesStatus).map(key => ({ const services = Object.keys(this.ogBootServicesStatus).map(key => ({
name: key, name: key,
status: this.ogBootServicesStatus[key] status: this.ogBootServicesStatus[key]
})) }))
console.log(services);
return services;
} }
formatBytes(bytes: number): string { formatBytes(bytes: number): string {