Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-21009: Make distro settings page readonly if user lacks edit permissions #2086

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

sophstad
Copy link
Contributor

@sophstad sophstad commented Oct 4, 2023

EVG-21009

Description

  • Make all forms disabled if user lacks edit permissions for a given distro. The save button would currently fail under these conditions, but making the page clearly view-only is more helpful than only notifying a user once their save fails.
  • Limiting users who lack view permissions already works as designed
  • Create, copy, and delete functionality is also appropriately gated

Screenshots

Disabled general settings page. You can see that the "New distro" button is omitted, and the delete button is disabled as well.
Screenshot 2023-10-04 at 1 57 34 PM

Existing functionality for a user who lacks view permissions:
image

@cypress
Copy link

cypress bot commented Oct 4, 2023

Passing run #13128 ↗︎

0 599 7 0 Flakiness 0

Details:

Add tests
Project: Spruce Commit: 86176a35bd
Status: Passed Duration: 18:37 💡
Started: Oct 5, 2023 6:27 PM Ended: Oct 5, 2023 6:45 PM

Review all test suite changes for PR #2086 ↗︎

@sophstad sophstad requested a review from a team October 4, 2023 18:53
@sophstad sophstad marked this pull request as ready for review October 4, 2023 18:53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that the disabled form auto-collapses the expandable cards? It may give a mistaken impression that they are empty 🤔

Screenshot 2023-10-04 at 8 06 17 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this was set up as such for project settings so that read-only repo settings wouldn't be as prominent on the page. Frankly I don't think it's a huge problem as the expandable card is decently obvious but we can revisit if we receive feedback on this!

@@ -15,12 +21,22 @@ export const BaseTab = <T extends WritableDistroSettingsType>({
initialFormState,
...rest
}: BaseTabProps<T>) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd like, I think it would be possible to overwrite the user's permissions in Cypress like what is done here, so that you can test the view-only UI in Cypress

P.S. I created EVG-21024

@sophstad sophstad merged commit f05d428 into evergreen-ci:main Oct 5, 2023
2 checks passed
@sophstad sophstad deleted the EVG-21009 branch October 5, 2023 19:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants