refs #2944. New datasize column in Imange entity
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
parent
382eb3e6db
commit
d2cf87510b
|
|
@ -60,6 +60,12 @@
|
|||
{{ image.partitionInfo?.osName }}
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="column.columnDef === 'datasize'">
|
||||
<div>{{ formatSize(image.datasize) }}</div>
|
||||
<div style="font-size: 0.75rem; color: gray;">
|
||||
Comprimido: {{ formatSize(image.size) }}
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="column.columnDef === 'isGlobal'">
|
||||
<mat-chip>
|
||||
{{ image.image?.isGlobal ? 'Sí' : 'No' }}
|
||||
|
|
@ -78,7 +84,7 @@
|
|||
</mat-chip>
|
||||
</ng-container>
|
||||
<ng-container
|
||||
*ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status' && column.columnDef !== 'isGlobal' && column.columnDef !== 'name'">
|
||||
*ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status' && column.columnDef !== 'isGlobal' && column.columnDef !== 'name' && column.columnDef !== 'datasize'">
|
||||
{{ column.cell(image) }}
|
||||
</ng-container>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@ export class ShowMonoliticImagesComponent implements OnInit {
|
|||
header: 'Estado',
|
||||
cell: (image: any) => image.status
|
||||
},
|
||||
{
|
||||
columnDef: 'datasize',
|
||||
header: 'Tamaño',
|
||||
cell: (image: any) => this.formatSize(image.datasize)
|
||||
},
|
||||
{
|
||||
columnDef: 'description',
|
||||
header: 'Descripción',
|
||||
|
|
@ -144,17 +149,19 @@ export class ShowMonoliticImagesComponent implements OnInit {
|
|||
|
||||
showImageInfo(event: MouseEvent, image:any) {
|
||||
event.stopPropagation();
|
||||
this.loading = true;
|
||||
this.loadImageAlert(image).subscribe(
|
||||
response => {
|
||||
this.alertMessage = response;
|
||||
this.loading = false;
|
||||
|
||||
this.loadData();
|
||||
this.dialog.open(ServerInfoDialogComponent, {
|
||||
width: '800px',
|
||||
data: {
|
||||
message: this.alertMessage
|
||||
}
|
||||
});
|
||||
this.loading = false;
|
||||
},
|
||||
error => {
|
||||
this.toastService.error(error.error['hydra:description']);
|
||||
|
|
@ -427,5 +434,19 @@ export class ShowMonoliticImagesComponent implements OnInit {
|
|||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
formatSize(bytes: string | number | null | undefined): string {
|
||||
if (bytes === null || bytes === undefined || bytes === '') return '-';
|
||||
const n = Number(bytes);
|
||||
if (isNaN(n) || n === 0) return '-';
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
let i = 0;
|
||||
let value = n;
|
||||
while (value >= 1024 && i < units.length - 1) {
|
||||
value /= 1024;
|
||||
i++;
|
||||
}
|
||||
return `${value.toFixed(2)} ${units[i]}`;
|
||||
}
|
||||
|
||||
protected readonly isDevMode = isDevMode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue