Skip to content

NMS-20118: Event Notifications tab - #8710

Open
joseanesONMS wants to merge 4 commits into
jira/NMS-20100-notifications-pagefrom
jira/NMS-20118-event-notifications
Open

NMS-20118: Event Notifications tab#8710
joseanesONMS wants to merge 4 commits into
jira/NMS-20100-notifications-pagefrom
jira/NMS-20118-event-notifications

Conversation

@joseanesONMS

Copy link
Copy Markdown

NMS-20118 (NMS-20100 epic): adds the Event Notifications tab to the Configure Notifications dialog. Stacked on #8709, so this PR shows only its own commit.

  • Tab with the event-notification list and per-notification on/off toggles.
  • Add/edit dialog with a searchable UEI picker fed by the event configuration; delete with confirmation.
  • /rest/notification-config/event-notifications endpoints wrap the notifications.xml factory the legacy wizard uses; payloads are validated up front because the factory removes the old entry before a failing save.
  • Replaces fork PR NMS-20100: Event Notifications tab #8706.

@joseanesONMS

Copy link
Copy Markdown
Author

@marshallmassengill review requested — stacks on #8709 (only the top commit is new here).

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly ok but a couple things:

Deleting the last event notification corrupts the running config. notifications.xsd requires at least one notification element. removeNotification drops the entry from memory and then calls saveCurrent(), which marshals with a schema attached. Memory ends up with zero notifications, notifications.xml still has one, the client gets a 500, and NotificationFactory.update() only reloads when the file mtime changes, which it didn't. notifd serves an empty notification config until OpenNMS restarts. The PR's validation can't catch this because DELETE has no body.

status is missing from validateEventNotification. replaceNotification overwrites the live object field by field through setters that assert non-empty, in this order: writeable, name, description, uei, rule, destinationPath, noticeQueue, textMessage, subject, numericMessage, status, varbind, parameters, then save. A PUT omitting status therefore passes validation, then throws inside setStatus after five fields have already been written onto the live object. Nothing saves, nothing rolls back, and the next successful save of any other notification persists the half-updated entry. POST has the same exposure via addNotification.

@joseanesONMS

Copy link
Copy Markdown
Author

All addressed: deleting the last notification now 400s with a pointer to turn it off instead; validation covers status (and parameter names/values, which the in-place chain can also die on after clearing the live entry's parameters); and the comment now describes what addNotification and replaceNotification actually do. Tests cover the delete-last guard and the missing-status atomicity on both POST and PUT.

@marshallmassengill
marshallmassengill self-requested a review July 31, 2026 17:38
@joseanesONMS
joseanesONMS force-pushed the jira/NMS-20118-event-notifications branch 2 times, most recently from 3e6c8ec to 27d3ec9 Compare August 1, 2026 01:44

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete guard's message still never reaches the user. notificationConfigService.ts:141 discards err.response.data and Delete is not disabled at length === 1, so the guard works but reads as an unexplained failure.

TAB_LOADERS['event-notifications'] returns literal true, and this PR makes it the default tab. All three siblings have this now, so it belongs in the base rather than fixed three times.

@joseanesONMS
joseanesONMS requested a review from synqotik August 3, 2026 13:59
@joseanesONMS
joseanesONMS force-pushed the jira/NMS-20118-event-notifications branch 2 times, most recently from e62bc00 to 6e5951f Compare August 3, 2026 17:10
Replaces the event-notifications placeholder with the tab content: the
notification list with per-notification on/off toggles, an add/edit
dialog with a searchable UEI picker fed by the event configuration, and
delete with confirmation. The /rest/notification-config
event-notifications endpoints wrap the notifications.xml factory the
legacy wizard uses.

Deleting the last event notification is rejected (notifications.xsd
requires at least one, and the schema-validated save would diverge
memory from the file until a restart), and validation covers every field
whose asserting setter could kill the factory's in-place update chain,
including status and parameter names/values.
…ification

Deleting an event notification now surfaces the server's reason instead of a
generic failure, so the "last event notification cannot be deleted" guard reads
as an explanation rather than an unexplained error. The Delete button is disabled
when only one notification remains, with a title pointing the user at turning it
off instead.
The event-notifications tab loader now returns every([...]).every(Boolean)
instead of a literal true: getEventNotifications returns null on failure and the
store reports a boolean, so a failed fetch retries instead of latching the default
tab on "No event notifications configured." Rebased onto the updated base. Adds a
store test pinning the failure contract.
Migrate the Event Notifications tab — its table and the add/edit
dialog — onto the Onms-* seam wrappers so the page passes the
no-direct-primevue lint rule. iftalabel stays on PrimeVue (no wrapper).
The UEI autocomplete drops its custom two-line suggestion slot, which
OnmsAutoComplete does not forward; suggestions show the UEI via
optionLabel.
@joseanesONMS
joseanesONMS force-pushed the jira/NMS-20118-event-notifications branch from 6e5951f to b513ea2 Compare August 3, 2026 21:53
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