From 1d8e5b38c6263c6f330945499d49fd811f3ae55e Mon Sep 17 00:00:00 2001 From: jmbardallo Date: Thu, 14 May 2026 14:38:20 +0200 Subject: [PATCH] =?UTF-8?q?modificada=20recepcion=20de=20mensajes=20de=20m?= =?UTF-8?q?ercure=20durante=20la=20importaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++ .../import-legacy/import-legacy.component.ts | 40 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46cb2d8..7ced925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [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) => { -- 2.40.1