Ogboot Status hardcode delete
parent
648414a45b
commit
ad9bce6b9a
|
|
@ -1,40 +1,40 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-ogboot-status',
|
selector: 'app-ogboot-status',
|
||||||
templateUrl: './ogboot-status.component.html',
|
templateUrl: './ogboot-status.component.html',
|
||||||
styleUrl: './ogboot-status.component.css'
|
styleUrls: ['./ogboot-status.component.css']
|
||||||
})
|
})
|
||||||
export class OgbootStatusComponent {
|
export class OgbootStatusComponent implements OnInit {
|
||||||
diskUsage: any = {
|
diskUsage: any = {};
|
||||||
total: '11G',
|
servicesStatus: any = {};
|
||||||
used: '9.4G',
|
installedOglives: any[] = [];
|
||||||
available: '794M',
|
diskUsageChartData: any[] = [];
|
||||||
percentage: '93%'
|
|
||||||
|
view: [number, number] = [1300, 500];
|
||||||
|
|
||||||
|
gradient: boolean = true;
|
||||||
|
showLegend: boolean = true;
|
||||||
|
showLabels: boolean = true;
|
||||||
|
isDoughnut: boolean = true;
|
||||||
|
colorScheme: any = {
|
||||||
|
domain: ['#FF6384', '#3f51b5']
|
||||||
};
|
};
|
||||||
|
|
||||||
servicesStatus: any = {
|
constructor(private http: HttpClient) {}
|
||||||
oglive_daemon: 'active',
|
|
||||||
tftpboot: 'active',
|
|
||||||
nginx: 'inactive'
|
|
||||||
};
|
|
||||||
|
|
||||||
installedOglives: any[] = [
|
ngOnInit(): void {
|
||||||
{
|
this.loadStatus();
|
||||||
id: 'f7a8ba47d27d0fbceb82b55d8b5f8ccc',
|
|
||||||
kernel: '5.11.0',
|
|
||||||
architecture: 'amd64',
|
|
||||||
revision: 'r20210413'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '6153d21e7bd7f2486c027c5b9b3b93b6',
|
|
||||||
kernel: '5.13.0',
|
|
||||||
architecture: 'amd64',
|
|
||||||
revision: 'r20210706'
|
|
||||||
}
|
}
|
||||||
];
|
|
||||||
|
|
||||||
diskUsageChartData: any[] = [
|
loadStatus(): void {
|
||||||
|
this.http.get<any>('http://127.0.0.1:8080/og-boot/status').subscribe(data => {
|
||||||
|
this.diskUsage = data.disk_usage;
|
||||||
|
this.servicesStatus = data.services_status;
|
||||||
|
this.installedOglives = data.installed_oglives;
|
||||||
|
|
||||||
|
this.diskUsageChartData = [
|
||||||
{
|
{
|
||||||
name: 'Usado',
|
name: 'Usado',
|
||||||
value: parseFloat(this.diskUsage.used)
|
value: parseFloat(this.diskUsage.used)
|
||||||
|
|
@ -44,23 +44,10 @@ export class OgbootStatusComponent {
|
||||||
value: parseFloat(this.diskUsage.available)
|
value: parseFloat(this.diskUsage.available)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
}, error => {
|
||||||
view: [number, number] = [1300, 500]; // Tamaño de la gráfica
|
console.error('Error fetching status', error);
|
||||||
|
});
|
||||||
// Opciones de la gráfica
|
}
|
||||||
gradient: boolean = true;
|
|
||||||
showLegend: boolean = true;
|
|
||||||
showLabels: boolean = true;
|
|
||||||
isDoughnut: boolean = true;
|
|
||||||
colorScheme: any = {
|
|
||||||
domain: ['#FF6384', '#3f51b5']
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
// Método para obtener los servicios en un formato adecuado para ser mostrado
|
|
||||||
getServices(): { name: string, status: string }[] {
|
getServices(): { name: string, status: string }[] {
|
||||||
return Object.keys(this.servicesStatus).map(key => ({
|
return Object.keys(this.servicesStatus).map(key => ({
|
||||||
name: key,
|
name: key,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue