Refactor Global Status component to improve disk usage data handling and ensure proper chart data structure
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/18/head
Lucas Lara García 2025-03-19 13:19:13 +01:00
parent 6c8ad465ea
commit 07acbc5f87
1 changed files with 11 additions and 4 deletions

View File

@ -48,17 +48,24 @@ export class GlobalStatusComponent implements OnInit {
this.loading = true;
const timeoutId = setTimeout(() => {
this.loading = false;
this.toastService.error('Error al sincronizar: Tiempo de espera excedido')
this.toastService.error('Error al sincronizar: Tiempo de espera excedido');
}, 5000);
this.http.get<any>(apiUrl).subscribe({
next: data => {
diskUsage = data.message.disk_usage;
diskUsage.used = data.message.disk_usage.used;
diskUsage.available = data.message.disk_usage.available;
diskUsage.total = data.message.disk_usage.total;
diskUsage.percentage = data.message.disk_usage.percentage;
servicesStatus = data.message.services_status;
this.installedOgLives = data.message.installed_oglives;
diskUsageChartData = [
diskUsageChartData.length = 0;
diskUsageChartData.push(
{ name: 'Usado', value: parseFloat(diskUsage.used) },
{ name: 'Disponible', value: parseFloat(diskUsage.available) }
];
);
this.loading = false;
clearTimeout(timeoutId);
},