Repository navigation
feat(web): Rules page with admin-only enable/disable toggle - #71
Merged
Merged
Conversation
Add the Rule API type, the rules query key, useRules, useRuleToggle (PATCH {"enabled"} then invalidate) and a pure describeCondition helper that keeps amounts in grouped integer minor units without float math.
Refs #70
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xzt3HRqVzoHnEyEUbTT3h9
Add /rules and a Rules nav item for all signed-in users. Admins get an Actions column with per-row Enable/Disable buttons; operators see a note instead. Toggle failures show a dismissible inline alert. Extend the test helpers with makeRule and role sign-in. Refs #70 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xzt3HRqVzoHnEyEUbTT3h9
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.
Summary
This adds a Rules page in the web app, a UI for the endpoints in #69:
The server stays the enforcement point. The UI only hides the controls and still handles a 403.
Closes #70
Architecture summary
features/rules/useRulesis auseQueryonqueryKeys.rules.useRuleTogglePATCHes{"enabled": next}with a JSON content type, then invalidatesqueryKeys.ruleson success and on error, so a 404 also refreshes a stale list.useApiFetchandrequestJson(from feat(web): Dashboard and Alerts pages backed by live data #67).describeCondition, a pure function:amount_minor gte 500000is shown as "Amount ≥ 500,000 minor units". Rules carry no currency, so thresholds stay in integer minor units, grouped through BigInt and string handling with no float math.currency/directioneqrules read "Currency = GBP" and "Direction = debit".RuleToggle, witharia-label"Disable rule " or "Enable rule " and a pending state per row.role="alert"message: one for 403, one for 404, and a generic one otherwise.DataStates.ListChecks) and the/rulesroute.Security considerations
AuthContextkeeps in memory. It is a UX hint only: authorization is enforced by the API (feat(api): enforce RBAC with admin-only rule management #69). A tampered client still gets 403, and the page handles it.@example.comaccounts and generated ids.Testing evidence
Number.MAX_SAFE_INTEGER, and the fallbacks.PATCHwith{"enabled":false}and then refetches.rule updatedentries withrule_id,enabledanduser_id.Known limitations
main. It will run once this PR is retargeted tomain.Follow-up issues
rule.updatedrealtime event (an AsyncAPI change) so open sessions update live.Checklist
main. This PR is stacked on feat(web): Dashboard and Alerts pages backed by live data #67 and will be retargeted tomainafter its base merges.git diff --checkis clean.