diff --git a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.html b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.html index a4b385a..f28c5c3 100644 --- a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.html +++ b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.html @@ -14,10 +14,10 @@ [legend]="showLegend">
-

Total: {{ diskUsage.total }}

-

Ocupado: {{ diskUsage.used }}

-

Disponible: {{ diskUsage.available }}

-

Libre: {{ diskUsage.percentage }}

+

Total: {{ formatBytes(diskUsage.total) }}

+

Ocupado: {{ formatBytes(diskUsage.used) }}

+

Disponible: {{ formatBytes(diskUsage.available) }}

+

Libre: {{ diskUsage.percentage }}%

diff --git a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts index 69c2df6..7a041bb 100644 --- a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts +++ b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts @@ -15,7 +15,6 @@ export class OgbootStatusComponent implements OnInit { view: [number, number] = [1100, 500]; - // Opciones de la gráfica gradient: boolean = true; showLegend: boolean = true; showLabels: boolean = true; @@ -57,4 +56,16 @@ export class OgbootStatusComponent implements OnInit { status: this.servicesStatus[key] })); } + + formatBytes(bytes: number): string { + if (bytes >= 1e9) { + return (bytes / 1e9).toFixed(2) + ' GB'; + } else if (bytes >= 1e6) { + return (bytes / 1e6).toFixed(2) + ' MB'; + } else if (bytes >= 1e3) { + return (bytes / 1e3).toFixed(2) + ' KB'; + } else { + return bytes + ' B'; + } + } }