Added button sync client

oggui/translations
Manuel Aranda Rosales 2024-10-22 21:40:12 +02:00
parent ba96d93a8b
commit b0147c4eca
2 changed files with 19 additions and 0 deletions

View File

@ -59,6 +59,8 @@
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;">Acciones</th>
<td mat-cell *matCellDef="let client" style="text-align: center;">
<button *ngIf="!syncStatus" mat-icon-button color="primary" (click)="getStatus(client)"><mat-icon>sync</mat-icon></button>
<button *ngIf="syncStatus" mat-icon-button color="primary"><mat-spinner diameter="24"></mat-spinner></button>
<button mat-icon-button color="info" (click)="handleClientClick($event, client)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
<button mat-icon-button color="primary" (click)="onEditClick($event, client.uuid)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
<button mat-icon-button color="warn" (click)="onDeleteClick($event, client)">

View File

@ -24,6 +24,7 @@ export class ClientTabViewComponent {
dataSource = new MatTableDataSource<any>();
length: number = 0;
loading:boolean = false;
syncStatus: boolean = false;
itemsPerPage: number = 10;
pageSizeOptions: number[] = [5, 10, 25, 100];
page: number = 0;
@ -132,6 +133,22 @@ export class ClientTabViewComponent {
});
}
getStatus(client: any): void {
this.syncStatus = true;
this.http.post(`${this.baseUrl}${client['@id']}/agent/status`, {}).subscribe(
response => {
this.toastService.success('Cliente actualizado correctamente');
this.search()
this.syncStatus = false;
},
error => {
this.toastService.error(error.error['hydra:description']);
this.syncStatus = false;
}
);
}
handleClientClick(event: MouseEvent, client: any): void {
event.stopPropagation();
/* const dialogRef = this.dialog.open(ClientViewComponent, { data: { client }, width: '800px', height:'700px' }); */