mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
refactor: fix some @ts-expect-errors (#1216)
* refactor: fix AddonMultiSelector errors * refactor: fix FeatureOverviewTags errors * refactor: fix EditProjectRole error * refactor: fix ProjectCard error
This commit is contained in:
parent
d2225c62c9
commit
d3e853cf7f
@ -1,6 +1,5 @@
|
|||||||
import { styled } from '@mui/system';
|
import { styled } from '@mui/system';
|
||||||
import { FormControlLabel, TextField } from '@mui/material';
|
import { FormControlLabel, TextField } from '@mui/material';
|
||||||
import Autocomplete from '@mui/material/Autocomplete';
|
|
||||||
|
|
||||||
export const StyledForm = styled('form')({
|
export const StyledForm = styled('form')({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -9,10 +8,6 @@ export const StyledForm = styled('form')({
|
|||||||
gap: '1rem',
|
gap: '1rem',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledAutocomplete = styled(Autocomplete)({
|
|
||||||
paddingBottom: '36px',
|
|
||||||
marginTop: '0px',
|
|
||||||
});
|
|
||||||
export const StyledFormSection = styled('section')({
|
export const StyledFormSection = styled('section')({
|
||||||
marginBottom: '36px',
|
marginBottom: '36px',
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,13 @@ import {
|
|||||||
AutocompleteRenderOptionState,
|
AutocompleteRenderOptionState,
|
||||||
} from '@mui/material/Autocomplete';
|
} from '@mui/material/Autocomplete';
|
||||||
import { styled } from '@mui/system';
|
import { styled } from '@mui/system';
|
||||||
import { capitalize, Checkbox, Paper, TextField } from '@mui/material';
|
import {
|
||||||
|
capitalize,
|
||||||
|
Checkbox,
|
||||||
|
Paper,
|
||||||
|
TextField,
|
||||||
|
Autocomplete,
|
||||||
|
} from '@mui/material';
|
||||||
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
|
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
|
||||||
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
||||||
import { ConditionallyRender } from '../../../common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from '../../../common/ConditionallyRender/ConditionallyRender';
|
||||||
@ -16,7 +22,6 @@ import {
|
|||||||
StyledHelpText,
|
StyledHelpText,
|
||||||
StyledSelectAllFormControlLabel,
|
StyledSelectAllFormControlLabel,
|
||||||
StyledTitle,
|
StyledTitle,
|
||||||
StyledAutocomplete,
|
|
||||||
} from '../AddonForm.styles';
|
} from '../AddonForm.styles';
|
||||||
|
|
||||||
export interface IAddonMultiSelectorProps {
|
export interface IAddonMultiSelectorProps {
|
||||||
@ -153,19 +158,18 @@ export const AddonMultiSelector: VFC<IAddonMultiSelectorProps> = ({
|
|||||||
condition={selectAllEnabled}
|
condition={selectAllEnabled}
|
||||||
show={<SelectAllFormControl />}
|
show={<SelectAllFormControl />}
|
||||||
/>
|
/>
|
||||||
<StyledAutocomplete
|
<Autocomplete
|
||||||
|
sx={{ mb: 8 }}
|
||||||
disabled={isWildcardSelected}
|
disabled={isWildcardSelected}
|
||||||
multiple
|
multiple
|
||||||
limitTags={2}
|
limitTags={2}
|
||||||
options={options}
|
options={options}
|
||||||
disableCloseOnSelect
|
disableCloseOnSelect
|
||||||
//@ts-expect-error
|
|
||||||
getOptionLabel={({ label }) => label}
|
getOptionLabel={({ label }) => label}
|
||||||
fullWidth
|
fullWidth
|
||||||
groupBy={() => 'Select/Deselect all'}
|
groupBy={() => 'Select/Deselect all'}
|
||||||
renderGroup={renderGroup}
|
renderGroup={renderGroup}
|
||||||
PaperComponent={CustomPaper}
|
PaperComponent={CustomPaper}
|
||||||
//@ts-expect-error
|
|
||||||
renderOption={renderOption}
|
renderOption={renderOption}
|
||||||
renderInput={renderInput}
|
renderInput={renderInput}
|
||||||
value={
|
value={
|
||||||
@ -176,7 +180,6 @@ export const AddonMultiSelector: VFC<IAddonMultiSelectorProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
onChange={(_, input) => {
|
onChange={(_, input) => {
|
||||||
//@ts-expect-error
|
|
||||||
const state = input.map(({ value }) => value);
|
const state = input.map(({ value }) => value);
|
||||||
onChange(state);
|
onChange(state);
|
||||||
}}
|
}}
|
||||||
|
@ -6,7 +6,7 @@ import useProjectRolesApi from 'hooks/api/actions/useProjectRolesApi/useProjectR
|
|||||||
import useProjectRole from 'hooks/api/getters/useProjectRole/useProjectRole';
|
import useProjectRole from 'hooks/api/getters/useProjectRole/useProjectRole';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import { IPermission } from 'interfaces/user';
|
import { IPermission } from 'interfaces/project';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import useProjectRoleForm from '../hooks/useProjectRoleForm';
|
import useProjectRoleForm from '../hooks/useProjectRoleForm';
|
||||||
import ProjectRoleForm from '../ProjectRoleForm/ProjectRoleForm';
|
import ProjectRoleForm from '../ProjectRoleForm/ProjectRoleForm';
|
||||||
@ -43,7 +43,6 @@ const EditProjectRole = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initialCheckedPermissions = role?.permissions?.reduce(
|
const initialCheckedPermissions = role?.permissions?.reduce(
|
||||||
(acc: { [key: string]: IPermission }, curr: IPermission) => {
|
(acc: { [key: string]: IPermission }, curr: IPermission) => {
|
||||||
// @ts-expect-error
|
|
||||||
acc[getRoleKey(curr)] = curr;
|
acc[getRoleKey(curr)] = curr;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
|
@ -18,7 +18,7 @@ import AccessContext from 'contexts/AccessContext';
|
|||||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
|
|
||||||
interface IFeatureOverviewTagsProps extends React.HTMLProps<HTMLButtonElement> {
|
interface IFeatureOverviewTagsProps extends React.HTMLProps<HTMLDivElement> {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +119,6 @@ const FeatureOverviewTags: React.FC<IFeatureOverviewTagsProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
{/* @ts-expect-error */}
|
|
||||||
<div className={styles.container} {...rest}>
|
<div className={styles.container} {...rest}>
|
||||||
<Dialogue
|
<Dialogue
|
||||||
open={showDelDialog}
|
open={showDelDialog}
|
||||||
@ -144,7 +142,6 @@ const FeatureOverviewTags: React.FC<IFeatureOverviewTagsProps> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,13 +36,13 @@ export const ProjectCard = ({
|
|||||||
const { classes } = useStyles();
|
const { classes } = useStyles();
|
||||||
const { hasAccess } = useContext(AccessContext);
|
const { hasAccess } = useContext(AccessContext);
|
||||||
const { isOss } = useUiConfig();
|
const { isOss } = useUiConfig();
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState<Element | null>(null);
|
||||||
const [showDelDialog, setShowDelDialog] = useState(false);
|
const [showDelDialog, setShowDelDialog] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
// @ts-expect-error
|
|
||||||
const handleClick = e => {
|
const handleClick = (event: React.SyntheticEvent) => {
|
||||||
e.preventDefault();
|
event.preventDefault();
|
||||||
setAnchorEl(e.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
const canDeleteProject =
|
const canDeleteProject =
|
||||||
|
Loading…
Reference in New Issue
Block a user