Updated rempte Pc sync
parent
0144dc182c
commit
12111c3382
|
|
@ -905,6 +905,26 @@ mat-tree mat-tree-node.disabled:hover {
|
|||
word-break: break-all;
|
||||
}
|
||||
|
||||
.remote-pc-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: #1976d2;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 10px;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.remote-pc-icon {
|
||||
font-size: 12px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.clients-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
|
|
@ -399,6 +399,10 @@
|
|||
<span class="client-name truncate-cell-wide" [matTooltip]="client.name">{{ client.name }}</span>
|
||||
<span class="client-ip">{{ client.ip }}</span>
|
||||
<span class="client-mac">{{ client.mac }}</span>
|
||||
<span *ngIf="client.isRemotePcActive" class="remote-pc-badge">
|
||||
<mat-icon class="remote-pc-icon">computer</mat-icon>
|
||||
RemotePC
|
||||
</span>
|
||||
<div class="action-icons">
|
||||
|
||||
<app-execute-command [clientState]="client.status" [clientData]="[client]"
|
||||
|
|
|
|||
|
|
@ -135,3 +135,27 @@ mat-dialog-content {
|
|||
.submit-button {
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.sync-uds-button {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.remote-pc-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: #1976d2;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 10px;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.remote-pc-icon {
|
||||
font-size: 12px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@
|
|||
<span><strong>{{ client.name }}</strong></span>
|
||||
<span>{{ client.ip }}</span>
|
||||
<span>{{ client.mac }}</span>
|
||||
<span *ngIf="isRemotePcActive(client)" class="remote-pc-badge">
|
||||
<mat-icon class="remote-pc-icon">computer</mat-icon>
|
||||
RemotePC
|
||||
</span>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
|
@ -23,5 +27,12 @@
|
|||
</div>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<ng-container *ngIf="calendarUuid">
|
||||
<button *ngIf="!syncingUds" mat-raised-button color="primary" (click)="syncUds()" class="sync-uds-button">
|
||||
<mat-icon>sync</mat-icon>
|
||||
Sincronizar con UDS
|
||||
</button>
|
||||
<app-loading *ngIf="syncingUds" [isLoading]="syncingUds"></app-loading>
|
||||
</ng-container>
|
||||
<button class="submit-button" (click)="saveDisposition()">{{ 'saveDispositionButton' | translate }}</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export class ClassroomViewComponent implements OnInit, OnChanges {
|
|||
@Input() clients: any[] = [];
|
||||
@Input() pcInTable: number = 5;
|
||||
groupedClients: GroupedClients[] = [];
|
||||
syncingUds = false;
|
||||
|
||||
constructor(public dialog: MatDialog, private http: HttpClient, private toastService: ToastrService, private configService: ConfigService) {
|
||||
this.baseUrl = this.configService.apiUrl;
|
||||
|
|
@ -110,4 +111,32 @@ export class ClassroomViewComponent implements OnInit, OnChanges {
|
|||
} else
|
||||
this.toastService.success(this.translate.instant('updatedClient'), 'Éxito');
|
||||
}
|
||||
|
||||
get calendarUuid(): string | null {
|
||||
const client = this.clients.find(c => c.organizationalUnit?.remoteCalendar?.uuid);
|
||||
return client?.organizationalUnit?.remoteCalendar?.uuid || null;
|
||||
}
|
||||
|
||||
syncUds(): void {
|
||||
const uuid = this.calendarUuid;
|
||||
if (!uuid) {
|
||||
this.toastService.warning('Este aula no tiene un calendario remoto asociado');
|
||||
return;
|
||||
}
|
||||
this.syncingUds = true;
|
||||
this.http.post(`${this.baseUrl}/remote-calendars/${uuid}/sync-uds`, {}).subscribe({
|
||||
next: () => {
|
||||
this.toastService.success(this.translate.instant('calendarsSynchronizedCorrectly'));
|
||||
this.syncingUds = false;
|
||||
},
|
||||
error: (error: any) => {
|
||||
this.toastService.error(error.error?.['hydra:description'] || 'Error al sincronizar con UDS');
|
||||
this.syncingUds = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isRemotePcActive(client: any): boolean {
|
||||
return !!client.isRemotePcActive;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue