Repository navigation
Closed
Description
Follow-up to #68 (#69). That issue added GET /rules (any role) and PATCH /rules/{id}, which is admin-only and enforced server-side. This issue adds the web UI for those endpoints.
Scope
- A new
/rulesroute and a Rules nav item, visible to every signed-in user. - Rules table:
- A semantic table with a caption showing name, condition, severity, status (enabled/disabled) and created time.
- The condition is rendered readably, for example
amount_minor gte 500000shown as "Amount ≥ 500,000 minor units". - Rules carry no currency, so an amount threshold is shown as integer minor units with grouping. It is never converted to a major-unit decimal.
currencyanddirectionvalues are shown as literals.
- Admins:
- Each row has an Enable/Disable control with an accessible name that includes the rule's name. The control is disabled while its request is pending.
- After a change, the rules query is refreshed.
- Errors are shown as a non-fatal inline message. A 403 says the role is insufficient; a 404 says the rule no longer exists.
- Operators: they see the same table read-only. There are no toggles, and a short note says that only admins can change rules.
- The server remains the enforcement point. The UI only hides controls, and a 403 is still handled.
- Data goes through
useApiFetchandrequestJson, with query keys under a newqueryKeys.rules. Loading, empty and error states are reused from the existing components.
Acceptance criteria
- An admin can disable and re-enable a rule. An operator sees no controls.
- A 403 or 404 on toggle produces a readable message.
- Accessible: table caption and headers, labelled controls, and status shown as text rather than colour only.
- Vitest coverage for the hook and the role-based rendering, including toggle success and the 403 and 404 cases.
- Lint, typecheck, test and build all pass.
Dependencies
- Builds on feat(web): Dashboard and Alerts pages backed by live data #66 (feat(web): Dashboard and Alerts pages backed by live data #67) for the shared frontend data helpers.
- Needs feat(api): enforce RBAC with admin-only rule management #68 (feat(api): enforce RBAC with admin-only rule management #69) at runtime for the API.
Out of scope
- Creating, deleting or editing rules beyond the enabled flag.
Activity