diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b54c92..7924f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ `@Input() identifiers: string[]`; respuesta parseada como array de entries JSON estructurados con formato `[timestamp] IDENTIFIER: mensaje` +## [1.6.1] - 2026-05-14 +### Improved +- Modificada recepcion de mensajes de mercure durante la importación + ## [1.6.0] - 2026-05-08 ### Added - Añadida opción en Administración para importar una base de datos OG 1.1 en la nueva version. Permite subir fichero .sql o .zip o usar parametros de conexión a la base de datos de OG 1.1 diff --git a/ogWebconsole/src/app/components/admin/import-legacy/import-legacy.component.ts b/ogWebconsole/src/app/components/admin/import-legacy/import-legacy.component.ts index a34747a..acdc40e 100644 --- a/ogWebconsole/src/app/components/admin/import-legacy/import-legacy.component.ts +++ b/ogWebconsole/src/app/components/admin/import-legacy/import-legacy.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, NgZone, ChangeDetectorRef } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; import { MatSnackBar } from '@angular/material/snack-bar'; @@ -23,7 +23,9 @@ export class ImportLegacyComponent { private http: HttpClient, private snackBar: MatSnackBar, private translate: TranslateService, - private configService: ConfigService + private configService: ConfigService, + private ngZone: NgZone, + private cdr: ChangeDetectorRef ) { this.dbForm = this.fb.group({ legacyHost: ['', Validators.required], @@ -58,23 +60,27 @@ export class ImportLegacyComponent { const eventSource = new EventSource(url.toString()); eventSource.onmessage = (event) => { - const data = JSON.parse(event.data); - - if (data.type === 'migration_progress') { - this.outputLog = data.output; - } - else if (data.type === 'migration_result') { - this.isLoading = false; - this.migrationStatus = data.status; - this.outputLog = data.output; + this.ngZone.run(() => { + const data = JSON.parse(event.data); - if (data.status === 'success') { - this.snackBar.open(this.translate.instant('migrationSuccess'), 'OK', { duration: 5000 }); - } else { - this.snackBar.open(this.translate.instant('migrationError'), 'OK', { duration: 5000 }); + if (data.type === 'migration_progress') { + this.outputLog = data.output; + this.cdr.detectChanges(); + } + else if (data.type === 'migration_result') { + this.isLoading = false; + this.migrationStatus = data.status; + this.outputLog = data.output; + this.cdr.detectChanges(); + + if (data.status === 'success') { + this.snackBar.open(this.translate.instant('migrationSuccess'), 'OK', { duration: 5000 }); + } else { + this.snackBar.open(this.translate.instant('migrationError'), 'OK', { duration: 5000 }); + } + eventSource.close(); } - eventSource.close(); - } + }); }; eventSource.onerror = (err) => {