-
Notifications
You must be signed in to change notification settings - Fork 229
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@backstage-community/plugin-rbac': minor | ||
--- | ||
|
||
Upgraded RBAC plugin from mui4 to mui5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,6 @@ type ComplexConditionRowButtonsProps = { | |
conditionRow: ConditionsData; | ||
onRuleChange: (newCondition: ConditionsData) => void; | ||
criteria: string; | ||
classes: any; | ||
selPluginResourceType: string; | ||
updateErrors: (_index: number) => void; | ||
isNestedConditionRule: (condition: Condition) => boolean; | ||
|
@@ -39,7 +38,6 @@ export const ComplexConditionRowButtons = ({ | |
conditionRow, | ||
onRuleChange, | ||
criteria, | ||
classes, | ||
selPluginResourceType, | ||
updateErrors, | ||
isNestedConditionRule, | ||
|
@@ -74,15 +72,23 @@ export const ComplexConditionRowButtons = ({ | |
(criteria === criterias.allOf || criteria === criterias.anyOf) && ( | ||
<Box mt={1} mb={1}> | ||
<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> | ||
Comment on lines
74
to
85
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
<Button | ||
className={classes.addNestedConditionButton} | ||
sx={{ | ||
display: 'flex !important', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, I think we can use the Button prop |
||
color: theme => theme.palette.primary.light, | ||
textTransform: 'none', | ||
}} | ||
size="small" | ||
onClick={() => handleAddNestedCondition(criteria)} | ||
> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,50 +15,15 @@ | |
*/ | ||
import React from 'react'; | ||
|
||
import { makeStyles } from '@material-ui/core'; | ||
import Drawer from '@material-ui/core/Drawer'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
import Box from '@mui/material/Box'; | ||
import Drawer from '@mui/material/Drawer'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
import { ConditionsForm } from './ConditionsForm'; | ||
import { ConditionsData, RulesData } from './types'; | ||
|
||
const useDrawerStyles = makeStyles(() => ({ | ||
paper: { | ||
['@media (max-width: 960px)']: { | ||
width: '-webkit-fill-available', | ||
}, | ||
width: '50vw', | ||
height: '100vh', | ||
gap: '3%', | ||
display: '-webkit-inline-box', | ||
}, | ||
})); | ||
|
||
const useDrawerContentStyles = makeStyles(theme => ({ | ||
sidebar: { | ||
display: 'flex', | ||
flexFlow: 'column', | ||
justifyContent: 'space-between', | ||
backgroundColor: `${theme.palette.background.default} !important`, | ||
}, | ||
header: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'baseline', | ||
padding: theme.spacing(2.5), | ||
fontFamily: theme.typography.fontFamily, | ||
}, | ||
headerSubtitle: { | ||
fontWeight: 400, | ||
fontFamily: theme.typography.fontFamily, | ||
paddingTop: theme.spacing(1), | ||
}, | ||
})); | ||
|
||
type ConditionalAccessSidebarProps = { | ||
open: boolean; | ||
onClose: () => void; | ||
|
@@ -76,27 +41,56 @@ export const ConditionalAccessSidebar = ({ | |
conditionRulesData, | ||
conditionsFormVal, | ||
}: ConditionalAccessSidebarProps) => { | ||
const classes = useDrawerStyles(); | ||
const contentClasses = useDrawerContentStyles(); | ||
return ( | ||
<Drawer | ||
anchor="right" | ||
open={open} | ||
data-testid="rules-sidebar" | ||
classes={{ | ||
paper: classes.paper, | ||
sx={{ | ||
['@media (max-width: 960px)']: { | ||
width: '-webkit-fill-available', | ||
}, | ||
width: '50vw', | ||
height: '100vh', | ||
gap: '3%', | ||
display: '-webkit-inline-box', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that you just moved the code. But anyway:
|
||
['& div.MuiDrawer-paper']: { | ||
width: '0px', | ||
}, | ||
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We try to hide what element here? |
||
}} | ||
> | ||
<Box className={contentClasses.sidebar}> | ||
<Box className={contentClasses.header}> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexFlow: 'column', | ||
justifyContent: 'space-between', | ||
height: '100%', | ||
backgroundColor: theme => | ||
`${theme.palette.background.default} !important`, | ||
Comment on lines
+68
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sx also support strings for picking up the theme. Idk what is "better". But please remove all |
||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'baseline', | ||
padding: theme => theme.spacing(2.5), | ||
fontFamily: theme => theme.typography.fontFamily, | ||
}} | ||
> | ||
<Typography variant="h5"> | ||
<Typography component="span" sx={{ fontWeight: 500 }}> | ||
Configure access for the | ||
</Typography>{' '} | ||
{selPluginResourceType} | ||
<Typography | ||
variant="body2" | ||
className={contentClasses.headerSubtitle} | ||
sx={{ | ||
fontWeight: 400, | ||
fontFamily: theme => theme.typography.fontFamily, | ||
paddingTop: theme => theme.spacing(1), | ||
}} | ||
align="left" | ||
> | ||
By default, the selected resource type will be visible to the | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳