Skip to content

feat(phoenix-ng): add NotificationService with 4 severity levels and configurable auto-dismiss#895

Open
deveshbervar wants to merge 1 commit into
HSF:mainfrom
deveshbervar:feat/notification-service-wa1
Open

feat(phoenix-ng): add NotificationService with 4 severity levels and configurable auto-dismiss#895
deveshbervar wants to merge 1 commit into
HSF:mainfrom
deveshbervar:feat/notification-service-wa1

Conversation

@deveshbervar
Copy link
Copy Markdown
Collaborator

Summary

Adds NotificationService as part of Work Area 1 (WA1).

WA1 arc:

What this adds

notification.service.ts — Injectable Angular service:

notificationService.success('File loaded successfully.');
notificationService.info('Loading event data...');
notificationService.warning('File may be malformed.');
notificationService.error('Could not parse event file.');

Follows the same ActiveVariable pattern as ErrorMessageService.
Components subscribe via subscribeToNotifications().

Default auto-dismiss durations:

  • success — 5000ms
  • info — 5000ms
  • warning — 8000ms
  • error — 0ms (manual dismiss required)

Custom duration supported via optional second parameter.

notification.service.component.test.ts — 6 tests:

  • All 4 severity levels emit correct message and severity
  • Default durations per severity level
  • Custom duration override
  • Multiple subscribers supported

Why

PR #879 added try/catch to route IO errors through InfoLogger.
This PR adds the service layer that allows any Phoenix component
to emit user-visible notifications programmatically.

The next step (separate PR) will add the UI component that
subscribes to this service and renders toasts via MatSnackBar.

Scope

  • 2 new files in phoenix-ui-components/lib/services/
  • 1 line added to index.ts for export
  • No changes to existing files beyond the export
  • 6 tests passing locally

@sponce
Copy link
Copy Markdown
Collaborator

sponce commented May 18, 2026

Nice service, now I would not merge it before it's effectively used. By the way, I see you want to use MatSnackBar to display the messages, that would be a new dependency to my knowledge. Don't we already have a way to display messages ? @EdwardMoyse ?

@deveshbervar
Copy link
Copy Markdown
Collaborator Author

Thanks @sponce

Understood on merging before use — I'll integrate it with
its first usage before it merges.
On the existing system: InfoLogger writes to the persistent
Info Panel (requires the panel to be open). The
NotificationService is designed as a complementary transient
layer — auto-dismissing toasts that appear immediately.

On MatSnackBar:- @angular/material is already a dependency
in phoenix-ui-components — so no new dependency is introduced.

@EdwardMoyse - happy to hear your thoughts too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants