feat(notifications): redesign the console Notifications pane (channels, alert-text editor, quiet hours) - #583
Merged
Merged
Conversation
…s, alert-text editor, quiet hours) Notifications-pane UX overhaul (server + web console): WU-1 Pushover/global channel visibility - The engine fans out to every enabled channel regardless of owner, but the console listed only the caller's own + global channels, hiding a channel created under another account. Admins now list ALL channels with owner attribution (list_all_notification_channels, LEFT JOIN users); non-admin scope (own only) unchanged. - ChannelResponse gains `global` (bool) and `owner_username`; the global checkbox was cosmetic (missing field) and a no-op on edit (UpdateChannelRequest dropped it). UpdateChannelRequest/Params gain an admin-only owner toggle; a non-admin supplying `global` on update is rejected (403). WU-3 System-alert editor - Replace the per-row inline "Customize alert text" wall with a compact "Customize" button + "Customized" chip and ONE shared modal (#sysalert-editor-modal): message textarea, conditional Title (only when a Pushover/ntfy destination is configured, named in the hint), a per-alert token legend (click-to-insert), and a live preview rendered as a generic notification card with a sample-image slot gated on real delivery. - Save issues the per-alert PUT, decoupled from the row-toggle bulk save (notifSaveSystemAlerts no longer reads/sends templates). WU-4 Quiet hours - Both quiet-hours pairs become whole-hour <select>s (— off — + 24 friendly 12h options) inside collapsed details.detail-section with live summaries; per-camera overrides collapse too. - Server-side 0..=23 validation (do_upsert_rule, put_notification_settings): a value like 2200 was stored verbatim and clamped at read time to a zero-width window, so quiet hours silently never fired. Rejected now; the console renders any legacy bad value as "— off —" with a warning. WU-6 Motion-cache polish - Surface the per-camera updated_at as "as of Ns ago" and a header hint that 0 seg / 0 B during or after motion is normal. Tests (services/api/tests/notification_pane.rs): quiet-hours range validation (rules + system settings), admin-lists-all-channels with owner attribution, global round-trip on update, non-admin cannot toggle global. The shared test harness caps DB_POOL_SIZE at 4 so concurrent tests don't exhaust a stock max_connections. Docs: DECISIONS.md entry (modal editor + quiet-hours validation + admin listing), COMPONENT-MAP notifications row, AI-INSTALL channels-API note. Signed-off-by: badbread <badbread@users.noreply.github.com>
# Conflicts: # docs/DECISIONS.md
…o modal) Replace the per-alert alert-text affordance in the console's System alerts table. The compact "Customize" button + "Customized" chip that opened a shared .modal-overlay is gone; each alert row now shows a small inline pencil (✎) icon on its control row, right next to "Bypass quiet hours". Clicking it expands the editor in place as a panel directly under that row (no modal), and clicking it again (or another alert's icon) collapses it, so only one editor is open at a time and the list reads as a clean list with a tiny icon per row. The icon carries the customized state itself (accent border + a dot) when a template override is set, so the separate chip is no longer needed. All of the editor content and behavior is unchanged: message textarea, conditional Title (Pushover/ntfy only), per-alert token legend with samples, live preview, Restore default, and the per-alert PUT save decoupled from the bulk row-toggle save. Update the same-day DECISIONS.md entry so the modal is not "restored". Signed-off-by: badbread <badbread@users.noreply.github.com>
Owner
Author
|
Adjusted the per-alert alert-text affordance to match the requested "little icon to click, inline with Bypass quiet hours". What changed (admin.html):
Verification:
DECISIONS.md: updated the same-day entry, the "one shared modal" decision is now "inline ✎ icon opens the editor in place (no modal)", with a note not to restore the modal. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #582.
Redesign of the console Notifications pane (server + web console). Scope is the Notifications pane; the Home Assistant camera-editor rework and the Android embed are out of scope for this PR.
WU-1 Channel visibility + global round-trip (server + console)
db::list_all_notification_channels, aLEFT JOIN users); non-admin scope (own only) is unchanged. This makes a channel created under another account visible, testable, and removable, while the engine fan-out (every enabled channel) is untouched.ChannelResponsegainsglobal(bool) andowner_username.UpdateChannelRequest/UpdateChannelParamsgain an admin-only owner toggle (global→user_id = NULL, or claim ownership). A non-admin supplyingglobalon update is rejected (403). The console shows an owner chip (Global / Yours / owner name) and only renders the global checkbox for admins (gated viaGET /auth/me).WU-3 System-alert text editor
#sysalert-editor-modal, reusing the existing.modal-overlaypattern).plate_watchlist_hit, with an SVG fallback).notifSaveSystemAlertsno longer reads or sends templates).WU-4 Quiet hours
<select>s ("— off —" + 24 friendly 12h options) inside collapseddetails.detail-sectionsections with live-state summaries; per-camera overrides collapse too.0..=23validation added todo_upsert_ruleandput_notification_settings; the engine-side clamp stays as defense, and the console renders any legacy out-of-range value as "— off —" with a warning line. Copy states hours are server local time.WU-6 Motion-cache polish
updated_atas "as of Ns ago" and a header hint that0 seg / 0 Bduring or after motion is normal (no footage lost).Tests
services/api/tests/notification_pane.rs: quiet-hours range validation (rules + system settings), admin-lists-all-channels with owner attribution, global round-trip on update, non-admin cannot toggle global. The shared test harness capsDB_POOL_SIZEat 4 so concurrent tests don't exhaust a stockmax_connections.Gate run on a fresh throwaway Postgres:
cargo fmt --all --check,cargo clippy --all-targets -D warnings, andcargo test --workspaceall green (every binary0 failed); the new DB-backed tests confirmed to run (not skipped) with bothDATABASE_URLandTEST_DATABASE_URLset.node --checkpasses on the extracted admin.html script.Docs
docs/DECISIONS.mdentry (modal editor + quiet-hours validation + admin listing),docs/COMPONENT-MAP.mdnotifications row, and a minimaldocs/AI-INSTALL.mdnote on the additiveglobal/owner_usernameresponse fields (flagging that AI-INSTALL is being audited separately).