fix(ui): apply site scope and the history status filter in the server query, before paging (UI-7, UI-9, UI-10, WP1 task 1.7)
UI-7: Site Calls and the Notification report sent an unscoped query and dropped other sites' rows client-side after paging - Site Calls pages went short (Next disabled, own rows hidden), Notifications showed other sites' counts and empty pages. New additive SourceSitesFilter on SiteCallQueryRequest / NotificationOutboxQueryRequest (+ SourceSites / SourceSiteIds on the repository filters; OPENJSON IN-list in the SiteCalls keyset SQL, Contains in EF) carries the permitted identifiers; an empty set matches nothing. Next is gated on the server page size. UI-9: Secured Writes history paged over every status and filtered terminal rows client-side. Additive ListSecuredWritesCommand.Statuses reaches the repository query and count. UI-10: Notification KPIs per-site table is narrowed to the caller's sites (SiteScopeService.Resolve on the principal). Tests: MSSQL mixed-site keyset/offset paging + count for both repos and the secured-write status set; handler forwards Statuses; UI pages send the permitted set (scoped) / none (system-wide); history requests the terminal statuses; KPI per-site rows narrowed.
This commit is contained in:
@@ -279,13 +279,14 @@ Per-leaf alarm rendering (leaf nodes are individual conditions for native alarms
|
||||
- Each row exposes a **"View audit history"** action that opens the Audit Log page pre-filtered to `CorrelationId = NotificationId`, surfacing every operational audit event recorded for that notification.
|
||||
- **Stuck rows are visually badged** — a notification is stuck if it is `Pending` or `Retrying` and older than the configurable stuck-age threshold. Stuck detection is display-only; there is no automated escalation or alerting.
|
||||
- All queries are served from the central `Notifications` table — no remote per-site queries are needed, unlike the Parked Message Management page.
|
||||
- **Site scope is applied in the query (code review 2026-12-02 UI-7).** For a site-scoped user the permitted sites' identifiers ride `NotificationOutboxQueryRequest.SourceSitesFilter`, so the page and the total count cover only rows they may see; the client-side row filter remains only as a backstop. (Before, the query was unscoped and the rows were filtered after paging — pages came back partly or wholly empty and the pager counted other sites' rows.) The **Notification KPIs** page (`/notifications/kpis`) likewise narrows its per-site breakdown to the caller's sites (UI-10); the global tiles and trends are unchanged.
|
||||
|
||||
### Secured Writes (Operator / Verifier / Administrator Roles)
|
||||
- A **Secured Writes** page (`/operations/secured-writes`) drives the **two-person** authorization workflow for writes through the MxAccess Gateway: an **Operator** initiates the write, a separate **Verifier** approves it, and only an approved write reaches the site.
|
||||
- The **page itself is gated by `RequireSecuredWriteAccess`** — satisfied by any of `Operator` / `Verifier` / `Administrator`. Although the pending/history lists are read-only, they expose process-sensitive tag values, so the page is not open to every authenticated user; this aligns with the ManagementActor `ListSecuredWritesCommand` any-of gate (arch-review UA1). The submit and approve/reject sub-actions are further gated by `RequireOperator` / `RequireVerifier` respectively (below).
|
||||
- **Operator (submit)** — a submit form gated by `RequireOperator`: pick the site → an **MxGateway** connection on that site → the tag path → a typed value → an optional comment. Submission inserts a `Pending` `PendingSecuredWrite` row centrally; it does **not** write anything yet.
|
||||
- **Verifier (approve / reject)** — a pending queue gated by `RequireVerifier` with **Approve** / **Reject** (+comment) actions. Approve shows a confirmation of the exact site / connection / tag / value before firing, and surfaces the **submission age** (`Submitted <age> ago (<UTC timestamp>)`) so a verifier can catch a stale setpoint before it reaches the device. The two confirmations are deliberately styled apart: **Approve is amber (`DialogSeverity.Caution`) and Reject stays red** — see the confirm-severity contract under Technology for why (register row 75). The verifier's **own submissions are disabled in the UI and rejected server-side** (no self-approval). On approve, central marks the row `Approved` and relays the write to the site MxGateway (records `Executed` / `Failed`); reject moves it to `Rejected` with a reason. The pending queue is **unpaged** — it is bounded by the submission **TTL**: a `Pending` row that is neither approved nor rejected before the TTL elapses expires to the terminal **`Expired`** status and drops out of the queue into History.
|
||||
- **History** — terminal rows (Executed / Failed / Rejected / **Expired**, where `Expired` is a real TTL-driven terminal status) with the full who/when/outcome trail (operator, verifier, comments, timestamps, any execution error). Terminal rows accumulate without bound, so the History table is **offset-paged** (page-size 50, Prev/Next) driven by the server's unpaged `TotalCount` (`ListSecuredWritesCommand` `Skip`/`Take`); the pager buttons disable at the real bounds.
|
||||
- **History** — terminal rows (Executed / Failed / Rejected / **Expired**, where `Expired` is a real TTL-driven terminal status) with the full who/when/outcome trail (operator, verifier, comments, timestamps, any execution error). Terminal rows accumulate without bound, so the History table is **offset-paged** (page-size 50, Prev/Next) driven by the server's unpaged `TotalCount` (`ListSecuredWritesCommand` `Skip`/`Take`); the pager buttons disable at the real bounds. The terminal-status filter runs **server-side** (`ListSecuredWritesCommand.Statuses`, code review 2026-12-02 UI-9), so `Pending` rows no longer occupy history page slots or inflate `TotalCount`.
|
||||
- Every lifecycle event (submit / approve / reject / execute) is written to the central Audit Log; the rows share the `PendingSecuredWrite.Id` as `CorrelationId` so they join into one operation (see Component-ManagementService.md, Component-AuditLog.md).
|
||||
- **Dev caveat**: with `DisableLogin` on, the auto-login identity holds all roles, so the two-person flow cannot be exercised end-to-end by a single user via the dev UI — no-self-approval is covered by handler tests; real two-person use requires two real identities.
|
||||
|
||||
@@ -295,6 +296,7 @@ Per-leaf alarm rendering (leaf nodes are individual conditions for native alarms
|
||||
- **Retry** and **Discard** actions are available on `Parked` rows only — `Failed` rows are not actionable, since a permanent failure would simply fail again and its error was already returned synchronously to the calling script. The actions issue central→site commands to the owning site; if the site is offline the UI surfaces a "site unreachable" message.
|
||||
- Each row exposes a **"View audit history"** action that opens the Audit Log page pre-filtered to `CorrelationId = TrackedOperationId`, showing every operational audit event recorded for that cached call.
|
||||
- Data is served from the central Site Call Audit component's `SiteCalls` table. The page is **read-mostly** — an eventually-consistent mirror of site state; the site remains the source of truth.
|
||||
- **Site scope is applied in the query (code review 2026-12-02 UI-7):** a site-scoped user's permitted site identifiers ride `SiteCallQueryRequest.SourceSitesFilter`, so keyset paging runs over in-scope rows and Next is gated on the server page size. Before, the query was unscoped and the client dropped other sites' rows after paging, so any page with an out-of-scope row was "short" and disabled Next.
|
||||
|
||||
### Health Monitoring Dashboard (All Roles)
|
||||
- Overview of all sites with online/offline status.
|
||||
|
||||
Reference in New Issue
Block a user