Skip to content

Show when an alert is disabled and not running - #38286

Merged
manerow merged 19 commits into
mainfrom
feat/disabled-alert-ui-state
Nov 24, 2026
Merged

manerow merged 19 commits into
mainfrom
feat/disabled-alert-ui-state

Conversation

@manerow

@manerow manerow commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38280

Stacked on PR #38279; until it merges, only the last eleven commits are this change.

Problem. After PR #38279, a disabled alert reports 0 pending events and "processed all events: Yes". The API now returns enabled on eventsRecord and diagnosticInfo, but the UI did not show it, and there was no way to switch an alert off or on.

Fix.

  • Alert lists (Notifications, Observability classic and AI mode, profile Notifications panel): a Status column shows a BadgeWithDot: Active in green, Disabled in gray.
  • Event counts header: a disabled alert shows Pending as "Not running", with a tooltip, instead of 0.
  • Diagnostics tab: a Status row, Enabled or Disabled.
  • Alert forms (create and edit, notification and observability, classic and AI mode): an Enabled settings row before Name, on for new alerts and saved as enabled. Its description follows the state: on, the alert sends notifications for the configured events; off, it sends nothing and events from that time are not sent later. While a saved alert is off, its other fields are read-only; a new alert stays editable, so it can still be filled in and saved disabled. Save and Cancel stay active. Only users who can edit the alert can use the toggle (canEditAll): the edit page and drawer open only with it, and the profile form checks it.

While off, the classic form shows the description as a preview: the rich text editor cannot become read-only in place. AI mode hides empty Filters and Trigger sections, as in view mode.

Why this way. It reuses the alert's enabled field, the core Card, Toggle and BadgeWithDot, and existing keys. Five keys are new, translated in every locale.

Type of change:

  • Improvement

Tests:

Unit tests

  • New: AlertStatusBadge, AlertEnabledSwitch (accessible name, disabled without edit access, a description per state in a live region) and AlertPendingEvents.
  • The four lists show the Status column; the Diagnostics tab shows the Status row.
  • AddObservabilityPage, AlertAiFormFields, AlertEditModal, NotificationAlertForm: new alerts start enabled and stay editable when switched off; switching a saved alert off makes its fields read-only and changes the description while Save and Cancel stay active; switching on restores editing.
  • AlertsClassBase, ClassicAlertForm.utils: enabled is loaded and saved.
  • AlertAiFormFieldsPureUtils: which fields are read-only for a switched-off saved alert, a switched-off new alert, a view-only form and rules without selections. The permission tests run the real permission derivation over a minimal permission object.

After merging main, the 15 test files this PR changes pass (307 tests). ESLint and Prettier pass; yarn tsc:check reports no error in this PR's files (the existing ones are in OMSelectWidget.tsx and SSOUtils.test.ts).

Playwright (UI) tests

ObservabilityAlerts.spec.ts gains a step that switches an alert off from its form, checks the fields are read-only and the description changes, saves, then switches it back on. closeSourcePicker now clicks the start of the subtitle, which the source list, opening upward below the taller row, no longer covers.

Run locally against a server built from this branch, across the five alert specs: 30 of 35 pass, including the new step. The 5 failures need webhook delivery to a localhost receiver the Docker server cannot reach; CI can.

UI screen recording:

alert-status-and-switch.webm

Recorded locally on 04ee242: the Status column in both lists, an edit form on, switched off (read-only fields and the changed description) and back on, and the details page with "Not running" and the Diagnostics Status row.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests around the new logic.

Summary by Gitar

  • Backend progress:
    • Reports a disabled alert as having nothing pending or unread, while keeping its stored offsets
    • Adds an ADR and integration tests covering disabled, re-enabled, and older-release alerts
  • Alert form switch:
    • Adds an Enabled switch to alert forms, with fields read-only while the alert is disabled
    • Lets only users who can edit an alert switch it on or off

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 4/5

The latest changes add no new blocker, but the two earlier repository requirements still need to be satisfied before merging.

Findings

  1. P2 Helper breaks required file layout ▶
  2. P2 Permission tests skip required derivation ▶

Summary

The PR shows disabled alerts clearly and adds an Enabled switch to alert forms.

  • Disabled alerts show no work waiting to be sent.
  • Alert forms let users switch alerts off and back on.
  • Alert lists and progress panels show when an alert is disabled.

Reviews (7) · Last reviewed commit: "Close the profile source picker from the..." · Reviewed by Greptile

@manerow manerow added the UI UI specific issues label Nov 20, 2026
@manerow manerow added the safe to test Add this label to run secure Github workflows on PRs label Nov 20, 2026
@manerow
manerow marked this pull request as ready for review November 20, 2026 10:32
@manerow
manerow requested review from a team as code owners November 20, 2026 10:32
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1070 passed · 154 skipped

Changed code executed by these browser tests: 5 / 5 lines (100%)

File Changed lines Executed %
src/components/Alerts/AlertStatusBadge/AlertStatusBadge.tsx 4 4 100%
src/pages/NotificationListPage/NotificationListPage.tsx 1 1 100%
Changed files no browser test loads
  • src/components/Alerts/AlertEnabledSwitch/AlertEnabledSwitch.tsx
  • src/components/Alerts/AlertPendingEvents/AlertPendingEvents.tsx
  • src/components/discovery/personal-space/Profile/tabs/notification/NotificationAlertDetail.tsx
  • src/components/discovery/personal-space/Profile/tabs/notification/NotificationAlertForm.tsx
  • src/components/discovery/personal-space/Profile/tabs/notification/NotificationAlertsPanel.tsx
  • src/components/observability/Alerts/AlertAiEventCounts.tsx
  • src/components/observability/Alerts/AlertAiForm.component.tsx
  • src/components/observability/Alerts/AlertAiFormFields.component.tsx
  • src/components/observability/Alerts/AlertAiFormFields.interface.ts
  • src/components/observability/Alerts/AlertAiFormFieldsPureUtils.ts
  • src/components/observability/Alerts/AlertEditModal.component.tsx
  • src/components/observability/Alerts/ObservabilityAlertsAiTable.component.tsx
  • src/pages/AddObservabilityPage/components/ObservabilityAlertForm.tsx
  • src/pages/AddObservabilityPage/components/ObservabilityAlertFormFields.tsx
  • src/pages/AddObservabilityPage/hooks/useObservabilityAlertForm.ts
  • src/utils/Alerts/AlertsUtil.tsx
  • src/utils/Alerts/AlertsUtilPure.ts
  • src/utils/Alerts/ClassicAlertForm.utils.ts
  • src/utils/AlertsClassBase.ts

@ShaileshParmar11 ShaileshParmar11 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.

Review of the UI changes only, at 3352471.

Spec compliance: pass.

  • The Status column is in all four lists.
  • "Not running" shows in all three places that show the pending count.
  • The Diagnostics tab has a Status row.
  • All three form surfaces have the Enabled switch.
  • enabled is loaded and saved for both classic and AI forms. Both AI edit mappers spread the alert, so a disabled alert opens with the switch off.
  • View mode hides the basic fields, so the switch never shows on a read-only page.
  • The isViewMode prop now passed to extension widgets is already handled by Collate's template section.

Blocking issues: none. The inline comments are 🟡 nits.

Checked and found clean:

  • The classic Input isDisabled is not passed to the react-hook-form controller, so a disabled field keeps its value on save.
  • When the alert is switched back on, the description editor is mounted again with the current text.
  • The Playwright step checks enabled in the PATCH response.
  • No new antd components and no raw palette classes.

@gitar-bot

gitar-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

The Enabled toggle changes whether configured alerts send notifications; switching one off could suppress future event notifications until it is re-enabled.

Adds an Enabled switch to alert forms and status display across alert lists and details, so disabled alerts show as "Not running" instead of 0 pending events. The AI form now hides empty Filters and Trigger sections while disabled, and the typography text colour is set via the color prop. No open issues found.

✅ 2 closed
✅ Bug: Disabled AI form does not hide empty Filters/Trigger sections as claimed

📄 openmetadata-ui/src/main/resources/ui/src/components/observability/Alerts/AlertAiFormFields.component.tsx:97-110 📄 openmetadata-ui/src/main/resources/ui/src/components/observability/Alerts/AlertAiFormFields.component.tsx:181-182
The PR description says that in AI mode a disabled alert hides empty Filters and Trigger sections, as view mode does. The code doesn't do this. getAlertAiSectionVisibility (and getAlertAiSectionInputs) still get the raw isViewOnly, while the new isFieldDisabled (which also covers enabled === false) only feeds areRulesReadOnly. So when the switch is off, shouldRenderFiltersSection/shouldRenderActionsSection stay true even when nothing is selected, and the user sees empty read-only rule sections they cannot fill in. To fix this, pass isViewOnly || value.enabled === false into the section-visibility call (or compute isFieldDisabled first and pass that), or remove the claim from the description.

✅ Quality: Typography text colour set via className, not the color prop

📄 openmetadata-ui/src/main/resources/ui/src/components/Alerts/AlertEnabledSwitch/AlertEnabledSwitch.tsx:46-57
The new settings row sets text colour on core Typography with className (tw:text-primary on the title, tw:text-tertiary on the description). That goes against ADR:2026-10-11-migrated-antd-components-adopt-core-styling, which says Typography takes size/weight/color props and callers must not set text colour through className. Core already has this colour: color="secondary" maps to exactly tw:text-tertiary (foundations/typography.tsx colorClasses). The default Typography colour already serves as primary text, so the tw:text-primary override can be dropped.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@ShaileshParmar11 ShaileshParmar11 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.

Approving the UI changes at 637f2ef. I did not review the backend, spec or ADR changes.

All seven inline comments from the earlier review are resolved:

  • The duplicated permission check is removed from AlertEditModal and AddObservabilityPage.
  • Switching off an alert now locks its fields only when editing a saved alert. isEditMode reaches both the AI form and the classic form, and new tests cover create mode and edit mode.
  • The aria-disabled attribute and the test that only checked a mock are removed.
  • The props now have a named interface.
  • alertStatusOf stays as a helper. This is correct, because sonarjs/no-nested-conditional is set to error in eslint.config.mjs.

ui-checkstyle, ui-coverage-tests and the browser-test shards all pass.

@manerow
manerow merged commit 40e75c1 into main Nov 24, 2026
83 checks passed
@manerow
manerow deleted the feat/disabled-alert-ui-state branch November 24, 2026 10:17
manerow added a commit that referenced this pull request Nov 24, 2026
* Report nothing pending for a disabled alert

* Cover alerts created disabled with a position an older release wrote

* Share the read-nothing progress and test the no-row read

* Keep the raw alert offset getter Collate tests read

* Say a disabled alert is not running and report its stored offsets

* Show when an alert is disabled and not running

* Map the notification list page to its alert specs

* Describe the status row neutrally and test each disabled alert screen

* Organise the alert badge imports

* Show alert status in a column and switch alerts on or off from the form

* Show a disabled alert's description as a preview instead of a locked editor

* Organise the alert status and switch imports

* Format the alert form fields and map the enabled switch to its spec

* Show alert status as a dot badge, green for active and gray for disabled

* Turn the alert Enabled switch into a settings row whose description explains the state

* Close the profile source picker from the start of the header subtitle

* Follow the helper placement, core styling and permission test rules in the alert UI

* Lock a switched-off alert only when editing it and drop permission checks the entry points already make
harsh-vador added a commit that referenced this pull request Nov 24, 2026
…title (#38605)

* test(playwright): dismiss AI alert popovers from the start of the subtitle

#38286 added the Enabled row to the alert form, so on the profile alert
page the source picker opens its list upwards over the middle of the
header subtitle and dismissPopover's click lands on an option row.
Click the subtitle's start, as closeSourcePicker already does.

* test(playwright): close the profile source picker through dismissPopover

closeSourcePicker repeated dismissPopover's subtitle click, and the two
drifted apart once already. Reuse it.
harsh-vador added a commit that referenced this pull request Nov 25, 2026
…title (#38605) (#38653)

* test(playwright): dismiss AI alert popovers from the start of the subtitle

#38286 added the Enabled row to the alert form, so on the profile alert
page the source picker opens its list upwards over the middle of the
header subtitle and dismissPopover's click lands on an option row.
Click the subtitle's start, as closeSourcePicker already does.

* test(playwright): close the profile source picker through dismissPopover

closeSourcePicker repeated dismissPopover's subtitle click, and the two
drifted apart once already. Reuse it.

(cherry picked from commit 2d215b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A disabled alert reports and loads a backlog of events it will never send

3 participants