Remember per-user filter and sort on the decisions list (D-0061) #142

Merged
hannah-vernon merged 1 commit from feature/decisions-sticky-view into dev 2026-09-27 13:45:54 -05:00
Owner

What does this PR do?

The /decisions list now remembers each operator's filter and sort selections and restores them automatically on the next visit, so returning to the tab reopens the same view. Typed Search text is remembered the same way (D-0061).

Implementation follows the existing per-user display-preferences pattern (time zone, page size, status-refresh):

  • New AdminUserPreferences.DecisionsView field holds the remembered view as a canonical query string. EF migration AddDecisionsDefaultView adds a non-null decisions_view column (max length 512, default empty) that auto-applies on deploy. In-memory and Postgres stores round-trip and length-clamp it.
  • The Decisions page persists the current view on any render that carries filter/sort parameters, writing only when the canonical view actually changed (so paging within a filter set causes no write). On a bare visit (no view parameters, e.g. the nav link) it redirects to the stored view.
  • Remembered scope is filters (search, outcome, min/max severity, unreviewed-only) plus the effective sort column/direction. Page position and page size are excluded, so a restore lands on page 1 of the remembered filters and sort.
  • "Clear" now links to /decisions?clear=1, which resets the stored view to empty and lands on the unfiltered list. An ordinary render never stores an empty view, so Clear is the only way to reset.
  • The account-preferences save path carries the existing DecisionsView forward, so editing time zone / page size / refresh does not reset the remembered view.

Per-user display convenience only: no pipeline behaviour, endpoint contract, step-up, or read-only-API change. Consistent with the existing page-size and time-zone preferences, which are also per-user and not on the read-only API.

Fixes #

How was this tested?

  • dotnet build - 0 errors, 0 warnings
  • dotnet test - AdminApi 230 passed, Application 595 passed (added one store round-trip/clamp test for DecisionsView)
  • dotnet ef migrations has-pending-model-changes - model in sync with the new migration
  • Manually tested on ___ (please verify in a browser: filter/sort, navigate away, return to /decisions and confirm the view is restored; Clear resets it)

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Documentation updated (DECISIONS.md D-0061, AGENT-README.md Changes entry + range bumped to D-0061)
  • New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (no new dependencies)
  • No secrets, credentials, or real infrastructure identifiers in the diff
  • No commented-out code or debug leftovers
## What does this PR do? The `/decisions` list now remembers each operator's filter and sort selections and restores them automatically on the next visit, so returning to the tab reopens the same view. Typed Search text is remembered the same way (D-0061). Implementation follows the existing per-user display-preferences pattern (time zone, page size, status-refresh): - New `AdminUserPreferences.DecisionsView` field holds the remembered view as a canonical query string. EF migration `AddDecisionsDefaultView` adds a non-null `decisions_view` column (max length 512, default empty) that auto-applies on deploy. In-memory and Postgres stores round-trip and length-clamp it. - The Decisions page persists the current view on any render that carries filter/sort parameters, writing only when the canonical view actually changed (so paging within a filter set causes no write). On a bare visit (no view parameters, e.g. the nav link) it redirects to the stored view. - Remembered scope is filters (search, outcome, min/max severity, unreviewed-only) plus the effective sort column/direction. Page position and page size are excluded, so a restore lands on page 1 of the remembered filters and sort. - "Clear" now links to `/decisions?clear=1`, which resets the stored view to empty and lands on the unfiltered list. An ordinary render never stores an empty view, so Clear is the only way to reset. - The account-preferences save path carries the existing `DecisionsView` forward, so editing time zone / page size / refresh does not reset the remembered view. Per-user display convenience only: no pipeline behaviour, endpoint contract, step-up, or read-only-API change. Consistent with the existing page-size and time-zone preferences, which are also per-user and not on the read-only API. Fixes # ## How was this tested? - [x] `dotnet build` - 0 errors, 0 warnings - [x] `dotnet test` - AdminApi 230 passed, Application 595 passed (added one store round-trip/clamp test for `DecisionsView`) - [x] `dotnet ef migrations has-pending-model-changes` - model in sync with the new migration - [ ] Manually tested on ___ (please verify in a browser: filter/sort, navigate away, return to /decisions and confirm the view is restored; Clear resets it) ## Checklist - [x] I have read the Contributing Guide - [x] Changes are focused - one logical change per PR - [x] Documentation updated (DECISIONS.md D-0061, AGENT-README.md Changes entry + range bumped to D-0061) - [x] New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (no new dependencies) - [x] No secrets, credentials, or real infrastructure identifiers in the diff - [x] No commented-out code or debug leftovers
The /decisions list now remembers each operator's filter and sort
selections and restores them on the next visit, so returning to the
tab reopens the same view. Typed search text is remembered the same
way.

The remembered view is stored per user as a canonical query string in
a new AdminUserPreferences.DecisionsView field (EF migration
AddDecisionsDefaultView adds a non-null decisions_view column, max
length 512, default empty), following the existing display-preferences
pattern. The page persists the current view on any filter/sort-bearing
render (writing only when the canonical view changed, so paging causes
no write) and, on a bare visit, redirects to the stored view. Page
position and page size are excluded, so a restore lands on page 1 of
the remembered filters and sort.

Clear now links to /decisions?clear=1, which resets the stored view to
empty; an ordinary render never stores an empty view, so Clear is the
only reset. The account-preferences save carries the existing
DecisionsView forward so editing other preferences does not reset it.

Per-user display convenience only: no pipeline behaviour, endpoint
contract, step-up, or read-only-API change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hannah-vernon/viegard-sentinel!142
No description provided.