Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

05 — Screen Inventory (Audit Module)

Every screen of the Audit module, its intent, route, composition, states, permissions, platform behaviour and events. Authoritative components in 00-shared/03; module-specific components in 07_Component_Library.md. Data fields are exact from audit-log.schema.ts:13-56.


Legend

States = idle / loading / success / empty / error(offline, rate, invalid) / disabled / permission. Analytics events follow {module}.{screen}.{action} (proposed; SDK open — 00-shared/10 §8).


1. Audit Log List (/settings/audit)

FieldDetail
PurposeBrowse + filter the tenant's immutable action trail
EntrySettings → Audit log; RBAC "Access audit"; deep link
Exitrow → detail; back → Settings; export (planned)
SourceGET /api/v1/audit-logs?page&limit&action&entityType&actorId (audit.controller.ts:19-25)
CompositionAppBar "Audit log" (+ count total); AuditFilterBar; result list: desktop/tablet = AuditTable (Time, Action, Actor, Resource, Context), phone = AuditEntryRow cards; footer "N of M" + Load more
Statesloading (AppSkeleton rows), success, empty (AppEmptyState "No activity recorded" — also when total===0), error (AppErrorState by code), permission (route hidden w/o audit.read), offline (AppOfflineBanner + cached list)
RealtimeWS appends (journey 5) → prepend + banner "1 new entry"
Pull-to-refreshRefreshIndicatorload(page=1) bypassing cache
Analyticsaudit.list.view, audit.list.filter, audit.list.clear, audit.list.load_more, audit.list.refresh, audit.list.realtime_append (proposed)

Data per row (exact schema): _id, action, actorId, actorType, entityType?, entityId?, occurredAt, ipAddress?, device?, browser?, userAgent?, before?, after?, correlationId?, metadata? (audit-log.schema.ts:15-55) plus inherited tenantId, version, isDeleted, createdBy/updatedBy/deletedBy (base.schema.ts:8-34) — inherited markers are not displayed.

2. Audit Filter Bar (part of list screen)

FieldDetail
PurposeAND-combined narrowing: action / entity type / actor (audit.controller.ts:26-29)
ControlsAppDropdown Action (free list from data), AppDropdown Entity type, AppDropdown/AppTextField Actor (id or name→id), Clear button, (planned) date range + search
Behaviourany change → page=1 + reload; clear → unfiltered reload
Statesdefault (all empty), active (chips with values + clear), empty-result hint when entityType chosen (see OQ-1)
Analyticsaudit.list.filter with values

3. Audit Entry Detail (/settings/audit/:id)

FieldDetail
PurposeInspect one entry: who/what/when + before/after snapshot
Entryrow tap; deep link (in-memory lookup, OQ-4)
Exitback → list (state preserved)
CompositionHeader: AuditActionChip (action), actor line (actorId mono + name if resolved), occurredAt local-time + UTC tooltip, correlationId (copy), meta actorType; body: AuditDiffView (before/after) or JsonTreeView (after = payload, audit.handler.ts:43) or empty state; footer: immutability note
Statesentry found / not found (deep link with no match → empty state + "back to list"), loading n/a (in-memory)
ActionsCopy ID, Copy JSON, Expand nested values, Export (planned)
Analyticsaudit.detail.view, audit.detail.copy_json, audit.detail.expand (proposed)

4. Export Sheet (/settings/audit/export) (planned)

FieldDetail
PurposeCSV/PDF export of current filter scope (blueprint: streamed, itself an audited action — AUDITING.md:87)
Entrylist overflow menu
CompositionFormat radio (CSV/PDF), scope summary (filters + pages), timezone selector, CTA "Export"
Statesdisabled with note — no backend endpoint (gated until backend lands)
Analyticsaudit.export.request (proposed)

5. Entry Timeline (proposed) — optional richer view

Grouped-by-resource timeline (all entries for one entityId/correlationId in reverse chronology). Requires backend ?entityId= filter support (OQ-1) or client-side grouping of the loaded set only. (proposed) — not in code.


Shared components used

AppSkeleton, AppEmptyState, AppErrorState, AppOfflineBanner, AppSnackbar, AppDropdown, AppSearchBar, AppChips, AppCard, AppListTile, AppMenu, AppBottomSheet, AppRefreshIndicator, AppBadge, AppButton. Module-specific: AuditTable, AuditEntryRow, AuditActionChip, AuditFilterBar, AuditDiffView, JsonTreeView, EntryTimeline (proposed) — defined in 07_Component_Library.md.

Keyboard, landscape, tablet, desktop

  • Desktop: full-width table with sticky header; / focuses filter; arrows + Enter navigate rows.
  • Tablet ≥ 840 px: master-detail (list left, detail right).
  • Phone: cards, single pane; landscape scrolls.