From e6fde5e480f2b27dc76417c02576941fdfe62326 Mon Sep 17 00:00:00 2001 From: Devesh Bervar Date: Tue, 7 Jul 2026 14:48:32 +0530 Subject: [PATCH] feat(io-options-dialog): wire NotificationService to surface IO errors as toasts --- .../io-options-dialog.component.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/io-options/io-options-dialog/io-options-dialog.component.ts b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/io-options/io-options-dialog/io-options-dialog.component.ts index 40e607bee..826394db2 100644 --- a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/io-options/io-options-dialog/io-options-dialog.component.ts +++ b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/io-options/io-options-dialog/io-options-dialog.component.ts @@ -1,3 +1,4 @@ +import { NotificationService } from '../../../../services/notification.service'; import { type OnInit, Component, Input } from '@angular/core'; import { CMSLoader, @@ -68,6 +69,7 @@ export class IOOptionsDialogComponent implements OnInit { constructor( private eventDisplay: EventDisplayService, public dialogRef: MatDialogRef, + private notificationService: NotificationService, ) {} ngOnInit() { @@ -121,6 +123,9 @@ export class IOOptionsDialogComponent implements OnInit { 'Could not parse JSON event file. Please ensure it is valid JSON.', 'Error', ); + this.notificationService.error( + 'Could not parse JSON event file. Please ensure it is valid JSON.', + ); console.error('Error parsing JSON event file:', error); } }; @@ -143,6 +148,9 @@ export class IOOptionsDialogComponent implements OnInit { 'Could not parse EDM4HEP JSON file. Please ensure it is valid JSON.', 'Error', ); + this.notificationService.error( + 'Could not parse EDM4HEP JSON file. Please ensure it is valid JSON.', + ); console.error('Error parsing EDM4HEP JSON file:', error); } }; @@ -260,6 +268,9 @@ export class IOOptionsDialogComponent implements OnInit { this.eventDisplay .getInfoLogger() .add('Failed to load PHYSLITE file: ' + error.message, 'Error'); + this.notificationService.error( + 'Failed to load PHYSLITE file: ' + error.message, + ); } this.onClose(); @@ -288,6 +299,7 @@ export class IOOptionsDialogComponent implements OnInit { } catch (error) { console.error('Error while reading zip', error); this.eventDisplay.getInfoLogger().add('Could not read zip file', 'Error'); + this.notificationService.error('Could not read zip file.'); return; } @@ -332,6 +344,7 @@ export class IOOptionsDialogComponent implements OnInit { const errorMessage = `Failed to read file "${file.name}". The file may be corrupted, too large, or inaccessible.`; console.error('FileReader error:', reader.error); this.eventDisplay.getInfoLogger().add(errorMessage, 'Error'); + this.notificationService.error(errorMessage); }; reader.readAsText(file); } @@ -354,6 +367,7 @@ export class IOOptionsDialogComponent implements OnInit { accepted; console.error('Error: ' + msg); this.eventDisplay.getInfoLogger().add(msg, 'Error'); + this.notificationService.error(msg); return false; }