Skip to content

Needs Attention overview, header pill and alert silencing; remove manual alerts - #206

Merged
olsonjp merged 3 commits into
mainfrom
needs-attention-overview
Nov 11, 2026
Merged

olsonjp merged 3 commits into
mainfrom
needs-attention-overview

Conversation

@olsonjp

@olsonjp olsonjp commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #205 (base is that PR's branch). When #205 is squash-merged and its branch is deleted, GitHub should retarget this to main. Because #205 is squash-merged, this branch will then need main merged into it once (as happened with #203); I will do that.

What it does

  • One shared module, reports/attention.py, works out what needs attention. The header pill, the overview page and the Reports page all read from it, so they agree. Each item has a stable key (low_stock:consumable:12). Adding a source means writing a function and registering it; the README explains how. This is also what a future email job should use, with the keys and levels to avoid sending the same alert twice.
  • Header pill on the Dashboard replaces the Alerts tile: All clear, or N need attention, amber for a warning and red for an alert. It opens the overview.
  • Needs Attention page (the existing /reports/alerts/, rewritten). Grouped by source, with a link to each item and why it is flagged. Managers and admins get a Silence button (with the confirm dialog). Silenced items stay listed under Silenced (N) with Turn back on.
  • Sources today: Low stock (alert when out of stock, otherwise warning) and Expiring soon (warning, same window as the dashboard tile: today to 30 days). Both only appear when Consumables are on in Settings. The low-count source comes with Low-count alerts for samples with few stored aliquots #196.
  • Silencing lives on the record: new Consumable.alerts_silenced (migration consumables/0002, default off). A silenced consumable also leaves the Low Stock and Expiring Soon tiles, their filtered lists, and the reorder list, so every count agrees. The overview shows silenced items; the pill does not count them.
  • Manual alerts removed: the Create Alert dialog and its view and URL, plus acknowledge, resolve and the class-based list. The Alert model and its migrations are kept; the table had 0 rows in the 8 November backup. The Reports page's Active Alerts card became a Needs Attention card and its recent-alerts list is gone. /reports/dashboard/stats/ still returns an alerts number, now the attention count.

Things to check

Not in this PR

The low-count source and per-sample silence (#196), email notifications (Django email is not configured), and moving Start Audit out of Quick Actions.

Verification

  • reports/test_attention.py (31 tests: both sources, levels, keys, the 30-day window, silenced consumables leaving the tile, filter and reorder list, the overview page and roles, the silence endpoint including refusals and bad input, the Reports page card, removal of the old URLs) and the dashboard pill tests. Existing tests that patched the Alert model now patch the attention summary. Full suite: 688 tests, OK. makemigrations --check is clean.
  • Needs python manage.py migrate locally for the new column.
  • Not checked by me: how it looks in a browser. The overview page and pill states have not been reviewed visually; the page uses theme colours, so dark mode should follow.

🤖 Generated with Claude Code

olsonjp and others added 2 commits November 11, 2026 09:53
…idebar section

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ual alerts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Base automatically changed from dashboard-grouped-sections to main November 11, 2026 16:56
#205 was squash-merged, so keep this branch's versions of the files it changes on top of it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@olsonjp
olsonjp merged commit e0671d6 into main Nov 11, 2026
1 check passed
@olsonjp
olsonjp deleted the needs-attention-overview branch November 11, 2026 17:02
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.

1 participant