Skip to content

Commit

Permalink
Updates for comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <[email protected]>
  • Loading branch information
ciiay committed Jul 11, 2024
1 parent 815be0a commit 0351ee0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions plugins/rbac/dev/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TestApiProvider,
} from '@backstage/test-utils';

import { createDevAppThemes } from '@redhat-developer/red-hat-developer-hub-theme';
import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme';

import {
PermissionAction,
Expand Down Expand Up @@ -154,7 +154,7 @@ const mockConfigApi = new MockConfigApi({

createDevApp()
.registerPlugin(rbacPlugin)
.addThemes(createDevAppThemes())
.addThemes(getAllThemes())
.addPage({
element: (
<TestApiProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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';

Expand All @@ -27,7 +27,6 @@ const useDrawerContentStyles = makeStyles(theme => ({
display: 'flex',
flexFlow: 'column',
justifyContent: 'space-between',
backgroundColor: `${theme.palette.background.default} !important`,
},
header: {
display: 'flex',
Expand Down
10 changes: 7 additions & 3 deletions plugins/rbac/src/components/ConditionalAccess/ConditionsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';

import { makeStyles } from '@material-ui/core';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import { Box, Button, makeStyles } from '@material-ui/core';

import { ConditionsFormRow } from './ConditionsFormRow';
import { criterias } from './const';
Expand All @@ -25,6 +23,9 @@ const useStyles = makeStyles(theme => ({
alignItems: 'baseline',
borderTop: `2px solid ${theme.palette.border}`,
padding: theme.spacing(2.5),
'& button': {
textTransform: 'none',
},
},
}));

Expand Down Expand Up @@ -109,6 +110,7 @@ export const ConditionsForm = ({
<Box className={classes.footer}>
<Button
variant="contained"
color="primary"
data-testid="save-conditions"
disabled={isSaveDisabled()}
onClick={() => {
Expand All @@ -121,13 +123,15 @@ export const ConditionsForm = ({
</Button>
<Button
variant="outlined"
color="primary"
onClick={onClose}
data-testid="cancel-conditions"
>
Cancel
</Button>
<Button
variant="text"
color="primary"
disabled={removeAllClicked || isNoRuleSelected()}
onClick={() => {
setRemoveAllClicked(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React from 'react';
import { PermissionCondition } from '@backstage/plugin-permission-common';

import { IconButton, makeStyles, useTheme } from '@material-ui/core';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import AddIcon from '@mui/icons-material/Add';
import RemoveIcon from '@mui/icons-material/Remove';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';

import { ConditionsFormRowFields } from './ConditionsFormRowFields';
import { conditionButtons, criterias } from './const';
Expand All @@ -21,21 +21,23 @@ const useStyles = makeStyles(theme => ({
borderRadius: '4px',
backgroundColor: theme.palette.background.default,
'& input': {
backgroundColor: `${theme.palette.background.paper}!important`,
backgroundColor: `${theme.palette.background.default}!important`,
color: `${theme.palette.textContrast}!important`,
},
'& button': {
textTransform: 'none',
},
},
criteriaButtonGroup: {
backgroundColor: theme.palette.background.paper,
backgroundColor: 'inherit',
width: '80%',
},
criteriaButton: {
width: '100%',
textTransform: 'none',
padding: theme.spacing(1),
padding: `${theme.spacing(1)}px !important`,
},
addRuleButton: {
color: theme.palette.primary.light,
textTransform: 'none',
marginTop: theme.spacing(1),
},
removeRuleButton: {
Expand Down Expand Up @@ -149,6 +151,7 @@ export const ConditionsFormRow = ({
: {}
}
className={classes.criteriaButton}
disabled={val === criteria}
size="large"
>
{label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ import { RulesDropdownOption } from './RulesDropdownOption';
import { ConditionsData, RuleParamsErrors, RulesData } from './types';

const useStyles = makeStyles(theme => ({
bgPaper: {
backgroundColor: theme.palette.background.paper,
},
params: {
fontFamily: theme.typography.fontFamily,
color: theme.typography.body1.color, // doesn't work
},
}));

Expand Down Expand Up @@ -115,7 +112,6 @@ export const ConditionsFormRowFields = ({
renderInput={(params: any) => (
<TextField
{...params}
className={classes.bgPaper}
label="Rule"
variant="outlined"
placeholder="Select a rule"
Expand Down Expand Up @@ -148,7 +144,6 @@ export const ConditionsFormRowFields = ({
) : (
<TextField
style={{ width: '100%', marginTop: '27px' }}
className={classes.bgPaper}
disabled
label="string, string"
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import { FieldProps } from '@rjsf/utils';
import { getInnerSchemaForArrayItem } from '@rjsf/utils/lib/schema/getDefaultFormState';

const useStyles = makeStyles(theme => ({
bgPaper: {
backgroundColor: theme.palette.background.paper,
},
arrayFieldDescription: {
marginTop: '5px',
fontWeight: 500,
color: theme.palette.grey[700],
color: `${theme.palette.grey[500]} !important`,
},
}));

Expand All @@ -39,7 +36,6 @@ export const CustomArrayField = (props: FieldProps) => {
setFieldVal(value);
onChange(value ? value.split(',').map(val => val.trim()) : []);
}}
className={classes.bgPaper}
required={required}
placeholder="string, string"
/>
Expand Down

0 comments on commit 0351ee0

Please sign in to comment.