Improve subnet synchronization with loading state and error handling
testing/ogGui-multibranch/pipeline/head Build queued...
Details
testing/ogGui-multibranch/pipeline/head Build queued...
Details
parent
4d32540784
commit
5baf4d8e3d
|
@ -91,15 +91,25 @@ export class OgDhcpSubnetsComponent implements OnInit {
|
|||
}
|
||||
|
||||
syncSubnets() {
|
||||
this.http.post(`${this.apiUrl}/sync`, {})
|
||||
.subscribe(response => {
|
||||
this.loading = true;
|
||||
const timeoutId = setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.toastService.error('Error al sincronizar: tiempo de espera agotado');
|
||||
}, 3500);
|
||||
|
||||
this.http.post(`${this.apiUrl}/sync`, {}).subscribe({
|
||||
next: (response) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.success('Sincronización con componente DHCP exitosa');
|
||||
this.loadSubnets()
|
||||
this.loadSubnets();
|
||||
this.loading = false;
|
||||
}, error => {
|
||||
},
|
||||
error: (error) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.loading = false;
|
||||
this.toastService.error('Error al sincronizar');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toggleAction(subnet: any, action: string): void {
|
||||
|
|
Loading…
Reference in New Issue