Improvements sync ogCore
parent
76de24f656
commit
2a8cd04129
|
@ -97,3 +97,13 @@ table {
|
|||
.example-headers-align .mat-mdc-form-field + .mat-mdc-form-field {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.example-button-row {
|
||||
display: table-cell;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.example-button-row .mat-mdc-button-base {
|
||||
margin: 8px 8px 8px 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
</mat-expansion-panel-header>
|
||||
<p *ngIf="alertMessage">Oglives creados en servidor ogBoot: {{ alertMessage }}</p>
|
||||
<p *ngIf="alertMessage">Oglives creados en servidor ogCore (base de datos): {{ length }}</p>
|
||||
|
||||
<div class="example-button-row">
|
||||
<button mat-flat-button color="primary" (click)="syncOgCore()"> Sincronizar OgCore</button>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
|
|
|
@ -108,10 +108,12 @@ export class ImagesComponent implements OnInit {
|
|||
this.http.post(`${this.apiUrl}/server/${image.uuid}/set-default`, {}).subscribe({
|
||||
next: () => {
|
||||
console.log('Imagen cambiada');
|
||||
this.toastService.success('Petición de cambio de imagen enviada');
|
||||
this.loadImages();
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error al cambiar la imagen:', error);
|
||||
this.toastService.error('Error al instalar la imagen por defecto');
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -119,10 +121,12 @@ export class ImagesComponent implements OnInit {
|
|||
this.http.post(`${this.apiUrl}/server/${image.uuid}/install`, {}).subscribe({
|
||||
next: () => {
|
||||
console.log('Imagen cambiada');
|
||||
this.toastService.success('Petición de instalación enviada');
|
||||
this.loadImages();
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error al cambiar la imagen:', error);
|
||||
console.error('Error al instalar la imagen:', error);
|
||||
this.toastService.error('Error al instalar la imagen');
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -130,10 +134,12 @@ export class ImagesComponent implements OnInit {
|
|||
this.http.post(`${this.apiUrl}/server/${image.uuid}/uninstall`, {}).subscribe({
|
||||
next: () => {
|
||||
console.log('Imagen cambiada');
|
||||
this.toastService.success('Petición de desinstalación enviada');
|
||||
this.loadImages();
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error al cambiar la imagen:', error);
|
||||
console.error('Error al desinstalar la imagen:', error);
|
||||
this.toastService.error('Error al desinstalar la imagen');
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -191,7 +197,7 @@ export class ImagesComponent implements OnInit {
|
|||
this.http.get(`${this.apiUrl}/server/get-collection`)
|
||||
.subscribe(response => {
|
||||
// @ts-ignore
|
||||
this.alertMessage = response.length
|
||||
this.alertMessage = response.installed_ogLives.length
|
||||
}, error => {
|
||||
console.error('Error al cargar la información del alert', error);
|
||||
});
|
||||
|
@ -204,4 +210,15 @@ export class ImagesComponent implements OnInit {
|
|||
return { name: 'cancel', color: 'red' }; // Icono de cruz roja
|
||||
}
|
||||
}
|
||||
|
||||
syncOgCore(): void {
|
||||
this.http.post(`${this.apiUrl}/sync`, {})
|
||||
.subscribe(response => {
|
||||
this.toastService.success('Sincronización completada');
|
||||
this.loadImages()
|
||||
}, error => {
|
||||
console.error('Error al sincronizar', error);
|
||||
this.toastService.error('Error al sincronizar');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue