Repository navigation
(CF-59) Fix/viewer host controls - #56
Merged
Merged
Conversation
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
A viewer (read-only role) still had several live write controls. The API refuses all of them with 403 (checked on the dev sandbox for adding and deleting a host), so nothing was ever written, but the viewer got a button that looked usable and then an error. Everything a viewer cannot do is now disabled rather than hidden, with "Your account has read-only access" as its tooltip, like the controls that already were.
Hosts
Rules
Linking
Disabled buttons look disabled
.btn, so a viewer's header Import / Rewrite / Redirect looked exactly like live buttons. Any disabled.btnis now dimmed with a not-allowed cursor, and its hover and press effects are off.Editors see no change apart from that dimming.
Known limit: the rule editor's locked fields are disabled inputs, so a viewer cannot select or copy their text, or scroll to the end of a value longer than its box.
Tests
Lint, typecheck, UI unit tests (586) and Playwright (189/189), all green. New or updated e2e specs, all run as a viewer:
hosts.e2e.ts: + and Delete are disabled with the tooltip and a host still opens; Tab skips both; the empty state's button is disabled and says to ask an editor.rules.e2e.ts: the "No rules yet" buttons are disabled and dimmed; a rule opens read-only with nothing to save and no write sent; a country rule does not start the distribution check.link.e2e.ts: the no-distribution screen shows the new heading and text, and no form or Link button.Each of these fails without the change.
Ticket
CF-59
Checklist
shared/schemas and theirshared/examples/were updated together (n/a)$refs the updated schemas — no inline redefinition (n/a)aws_cloudfront_distribution(except underexamples/)