Skip to content

feat: add resource-action pills to custom roles table #14354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 3, 2024

Conversation

jaaydenh
Copy link
Contributor

resolves #14247

  1. Change permissions column from a number of resource actions to one pill for each resource that list the actions for that resource
  2. Create new colors for the custom role pills. These could be eventually be incorporated into other pill designs if there is agreement on this design.
  3. Use vertical layout for the overflow pills
Screenshot 2024-08-19 at 1 58 09 PM Screenshot 2024-08-19 at 1 57 51 PM Screenshot 2024-08-19 at 1 57 28 PM

@jaaydenh jaaydenh self-assigned this Aug 19, 2024
Copy link

alwaysmeticulous bot commented Aug 19, 2024

🤖 Meticulous spotted visual differences in 91 of 1477 screens tested: view and approve differences detected.

Meticulous tested 111/112 of the executable lines edited in this PR1.

1. These lines will likely automatically gain test coverage over the coming days, however if you wish to increase coverage immediately you can do so by interacting with your feature on localhost.

Last updated for commit d21771f. This comment will update as new commits are pushed.

background: colors.zinc[200],
outline: colors.zinc[300],
text: colors.zinc[700],
} satisfies Permission;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if permission should be treated as a theme or not as a design token in this case, but I'm okay with it for now. Perhaps having a 'muted' pill variant could be better. 🤔 Wdyt @aslilac ?

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

I'm missing tests for this PR. I would also extract the permission pills into a PermissionsList component to test how it behaves when there isn’t much space available, when it shows the '+n' button, and what happens when this button/pill is hovered.

@BrunoQuaresma
Copy link
Collaborator

BrunoQuaresma commented Aug 19, 2024

I have reviewed this pull request, and it is functioning as expected. It looks great! Good work. However, it still requires tests and another review for usage permissions as a design token.

Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

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

I'd really like to avoid the changes to the Theme type, but otherwise this looks great! I think this design strikes a great balance between compactness and clearness.

Comment on lines 1 to 5
export interface Permission {
background: string;
outline: string;
text: string;
}
Copy link
Member

Choose a reason for hiding this comment

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

Imho, this is way too specific of a thing to add to the theme. We've been missing a clear "neutral" role choice for a while, and I've been meaning to resolve that for a while but it just hasn't come up recently. That being said, you got me thinking about it again today and I have proposed a fix in #14356. If that PR gets merged, I'd much rather use theme.roles.info colors for these than complicate the global Theme for this one specific use case.

Copy link
Contributor Author

@jaaydenh jaaydenh Aug 20, 2024

Choose a reason for hiding this comment

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

I really just added the Permission theme to have a short discussion about it. I was originally going to use or modify role but semantically permissions are not roles (roles are assigned permissions) and if we are using a feature concept such as roles in the theme it would make sense to add permissions as well. And this will also make it more likely for others in the future to have the idea to add theming for features (like I did) then adding theming for UI concepts. For example, this could happen with other elements that have a lot of variations such as avatars, buttons, cards, status indicators, etc.

The other way to do it is more like in mui.ts where its about UI elements and tags. If we following that line of thinking then we could use the name pills in the theme instead of roles. In this case we are thinking more about the UI component itself than the feature it is used for.

Copy link
Member

@aslilac aslilac Aug 20, 2024

Choose a reason for hiding this comment

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

Sorry about the confusion. The theme.roles property is entirely unrelated to the "Roles" feature in the product. 😄 #14356 has been merged now though, so theme.roles.info is there to use as a neutral color set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

theme.roles.info.background and theme.roles.info.outline are different than the colors I want to use. Where would you suggest placing the colors I wanted to use from theme.roles.default?

@jaaydenh jaaydenh force-pushed the jaaydenh/add-custom-role-pills branch from b3c3361 to 9879c09 Compare August 21, 2024 15:31
export interface Roles {
export interface ColorRoles {
/** The default color role for general use */
default: ColorRole;
Copy link
Member

Choose a reason for hiding this comment

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

I'm gonna be defensive about this because I put a lot of thought into the design of this bit of our theme: default, the way that you are using it, is not a UI role. As a user, when the app uses the error colors I can say "The UI is showing me something is wrong", but I can't say "The UI is showing me a default color role for general use". I think the intent of these roles is really important for consistency throughout the product.

I'm also not convinced that ColorRole is a better name. The colors they represent are a consequence, not the primary motivation. Otherwise they'd just be named red, orange, etc. You're supposed to think about what you're trying to communicate with the color first, and then the colors come from that naturally. Maybe UiRole or something if you really think it needs to be changed.

default could potentially be an appropriate role name if it was identifying things in the UI as a default target. The default org, the default template version, so on. But there isn't anything about the permissions given to an org role that makes them "default" of that role, especially not when used to highlight all of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I want is a way to define styles for a default pill, and although info can work, the name feels like its a special case and not the standard/default color. I would ideally like to keep defaults in palette or someplace outside of roles in case it doesn't fit into background, outline, text, or the fill colors.

@github-actions github-actions bot added stale This issue is like stale bread. and removed stale This issue is like stale bread. labels Aug 29, 2024
Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

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

  • if you want to add new colors, you can add them to experimental
  • I'd prefer if we reverted the ColorRole changes and tackled that as its own thing, rather than pushing it through by tacking it on to another change

@jaaydenh
Copy link
Contributor Author

jaaydenh commented Sep 3, 2024

@aslilac If I add a color to experimental, do I just give it a descriptive name next to l1 and l2? or should it go inside l1 or l2? If l1 means primary and l2 means secondary, how do those colors get translated elsewhere once they leave experimental?

@aslilac
Copy link
Member

aslilac commented Sep 3, 2024

as long as it's inside experimental I don't really have any strong feelings. 😄 when they leave, they get translated however we want them to, as long as there's a bit of consensus that they're worth promoting.

@jaaydenh jaaydenh force-pushed the jaaydenh/add-custom-role-pills branch from e0542c9 to de5e171 Compare September 3, 2024 19:27
export const PermissionPillsList: FC<PermissionPillsListProps> = ({
permissions,
}) => {
const resourceTypes: string[] = getUniqueResourceTypes(permissions);
Copy link
Member

Choose a reason for hiding this comment

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

is this type annotation here still necessary? maybe if TypeScript is having trouble inferring the type here you could add : string[] to the function declaration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessary, just leftover from implementation work.

@jaaydenh jaaydenh merged commit 093d243 into main Sep 3, 2024
28 checks passed
@jaaydenh jaaydenh deleted the jaaydenh/add-custom-role-pills branch September 3, 2024 20:39
@github-actions github-actions bot locked and limited conversation to collaborators Sep 3, 2024
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.

Improve display for permissions column view on custom roles table
3 participants