refs #1116. CreateImagen UX
parent
7a095a0f47
commit
725acd7fac
|
@ -33,7 +33,7 @@ export class TaskLogsComponent implements OnInit {
|
||||||
{
|
{
|
||||||
columnDef: 'command',
|
columnDef: 'command',
|
||||||
header: 'Comando',
|
header: 'Comando',
|
||||||
cell: (trace: any) => `${trace.command?.name}`
|
cell: (trace: any) => `${trace.command}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnDef: 'client',
|
columnDef: 'client',
|
||||||
|
|
|
@ -32,22 +32,34 @@
|
||||||
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
|
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="column.columnDef !== 'remotePc'">
|
<ng-container *ngIf="column.columnDef === 'status'">
|
||||||
|
<mat-chip >
|
||||||
|
{{ getStatusLabel(image[column.columnDef]) }}
|
||||||
|
</mat-chip>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status'">
|
||||||
{{ column.cell(image) }}
|
{{ column.cell(image) }}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
>>>>>>> c168c87fc9ebcc4b5cf9a68effa16bdb2a848e00
|
|
||||||
|
|
||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;" joyrideStep="actionsHeader" text="Acciones disponibles para cada imagen.">Acciones</th>
|
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;">Acciones</th>
|
||||||
<td mat-cell *matCellDef="let client" style="text-align: center;">
|
<td mat-cell *matCellDef="let image" style="text-align: center;">
|
||||||
<button mat-icon-button color="primary" (click)="editImage($event, client)" joyrideStep="editImageButton" text="Editar la imagen seleccionada.">
|
<button mat-icon-button color="info" (click)="showImageInfo($event, image)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
|
||||||
<mat-icon>edit</mat-icon>
|
<button mat-icon-button color="primary" (click)="editImage($event, image)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-icon-button color="warn" (click)="deleteImage($event, image)">
|
||||||
|
<mat-icon i18n="@@deleteElementTooltip">delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn" (click)="deleteImage($event, client)" joyrideStep="deleteImageButton" text="Eliminar la imagen seleccionada.">
|
<button mat-icon-button [matMenuTriggerFor]="menu">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>menu</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<mat-menu #menu="matMenu">
|
||||||
|
<button mat-menu-item [disabled]="!image.imageFullSum" (click)="toggleAction(image, 'get-aux')">Obtener ficheros auxiliares</button>
|
||||||
|
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'delete-trash')">Eliminar imagen temporalmente</button>
|
||||||
|
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'trash'" (click)="toggleAction(image, 'recover')">Recuperar imagen de la papelera</button>
|
||||||
|
|
||||||
|
</mat-menu>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
|
|
@ -79,6 +79,25 @@ export class ImagesComponent implements OnInit {
|
||||||
this.search();
|
this.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStatusLabel(status: string): string {
|
||||||
|
switch (status) {
|
||||||
|
case 'pending':
|
||||||
|
return 'Pendiente';
|
||||||
|
case 'in-progress':
|
||||||
|
return 'En progreso';
|
||||||
|
case 'aux-file-pending':
|
||||||
|
return 'Archivos auxiliares pendientes';
|
||||||
|
case 'success':
|
||||||
|
return 'Creado con éxito';
|
||||||
|
case 'trash':
|
||||||
|
return 'Papelera temporal';
|
||||||
|
case 'failed':
|
||||||
|
return 'Fallido';
|
||||||
|
default:
|
||||||
|
return 'Estado desconocido';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addImage(): void {
|
addImage(): void {
|
||||||
const dialogRef = this.dialog.open(CreateImageComponent, {
|
const dialogRef = this.dialog.open(CreateImageComponent, {
|
||||||
width: '800px'
|
width: '800px'
|
||||||
|
@ -175,6 +194,28 @@ export class ImagesComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'delete-trash':
|
||||||
|
this.http.post(`${this.baseUrl}/images/server/${image.uuid}/delete-trash`, {}).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.toastService.success('Petición de eliminación de la papelera temporal enviada');
|
||||||
|
this.search()
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
this.toastService.error(error.error['hydra:description']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'recover':
|
||||||
|
this.http.post(`${this.baseUrl}/images/server/${image.uuid}/recover`, {}).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.toastService.success('Petición de recuperación de la imagen enviada');
|
||||||
|
this.search()
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
this.toastService.error(error.error['hydra:description']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error('Acción no soportada:', action);
|
console.error('Acción no soportada:', action);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue