Skip to content
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

feat(rbac): upgrade to mui5 #1985

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

divyanshiGupta
Copy link
Contributor

@divyanshiGupta divyanshiGupta commented Nov 18, 2024

Hey, I just made a Pull Request!

Upgrade RBAC plugin from mui4 to mui5

Story: https://issues.redhat.com/browse/RHIDP-4307

Todo:

Fix unit tests

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@backstage-goalie
Copy link
Contributor

Thanks for the contribution!
All commits need to be DCO signed before they are reviewed. Please refer to the the DCO section in CONTRIBUTING.md or the DCO status for more info.

@backstage-goalie
Copy link
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-rbac workspaces/rbac/plugins/rbac minor v1.32.4

Signed-off-by: Divyanshi Gupta <[email protected]>
Copy link
Member

@christoph-jerolimov christoph-jerolimov left a comment

Choose a reason for hiding this comment

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

Didn't tested it myself, but here are some suggestions from checking the diff here on GH:

Comment on lines -49 to -51
"@material-ui/core": "^4.9.13",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.45",

Choose a reason for hiding this comment

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

🥳

Comment on lines 74 to 85
<Button
className={classes.addRuleButton}
sx={{
display: 'flex !important',
color: theme => theme.palette.primary.light,
textTransform: 'none',
}}
size="small"
onClick={handleAddRule}
>
<AddIcon fontSize="small" />
Add rule
</Button>

Choose a reason for hiding this comment

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

I know, this was mostly the same code as before. But instead of custom styles the Button supports this props as well. Can you check if this looks the same:

<Button color="primary" size="small" startIcon={<Add Icon fontSize="small" />}>
  Add rule
</Button>

If primary color light and primary color isn't the same here, we can maybe anyway use startIcon?

size="small"
onClick={handleAddRule}
>
<AddIcon fontSize="small" />
Add rule
</Button>
<Button
className={classes.addNestedConditionButton}
sx={{
display: 'flex !important',

Choose a reason for hiding this comment

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

As above, I think we can use the Button prop startIcon instead.

width: '50vw',
height: '100vh',
gap: '3%',
display: '-webkit-inline-box',

Choose a reason for hiding this comment

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

I see that you just moved the code. But anyway:

  • Is this really necessary?
  • Does this work well on Firefox?

Comment on lines +57 to +59
['& div.MuiDrawer-paper']: {
width: '0px',
},

Choose a reason for hiding this comment

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

We try to hide what element here?

<Box style={{ display: 'flex', flexFlow: 'column' }}>
<Typography className={classes.optionLabel}>{label}</Typography>
<Typography className={classes.optionDescription}>
<li

Choose a reason for hiding this comment

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

🥳

@@ -56,9 +59,9 @@ export const AddedMembersTable = ({
data={selectedMembers}
columns={selectedMembersColumns(selectedMembers, setFieldValue)}
emptyContent={
<div className={classes.empty}>
<EmptyContent className={classes.emptyContent}>

Choose a reason for hiding this comment

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

Can't be this done with a Box like:

Suggested change
<EmptyContent className={classes.emptyContent}>
<Box sx={{ display: 'flex', justifyContent: 'center', p: 2 }}>

Comment on lines +45 to +49
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
}}

Choose a reason for hiding this comment

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

Isn't this the default when using block elements?

Maybe you can remove this custom style by using a div instead of a span below?

@@ -68,13 +71,13 @@ function DownloadCSVLink() {
};

return (
<a
<Link

Choose a reason for hiding this comment

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

Can we switch to a Button when this isn't really like a link (cmd+click, right click open in new tab)?

Unable to create role.
</AlertTitle>
To enable create/edit role button, make sure required users/groups are
available in catalog as a role cannot be created without users/groups
and also the role associated with your user should have the permission
policies mentioned{' '}
<a
<Link
href="https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac#prerequisites"
target="blank"

Choose a reason for hiding this comment

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

Suggested change
target="blank"
target="_blank"

There is also a Link in @backstage/core-components that handles this automatically.

@its-mitesh-kumar
Copy link

@divyanshiGupta ! Few unit tests are failing , can we fix that . Also I tried running yarn tsc I can see some failure there , too .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants