mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02:00
feat: list affected features (#3534)
This commit is contained in:
parent
0a9df052a6
commit
56f09ce392
@ -1,4 +1,3 @@
|
|||||||
import { UserAvatar } from 'component/common/UserAvatar/UserAvatar';
|
|
||||||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
|
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
|
||||||
import { styled, Typography } from '@mui/material';
|
import { styled, Typography } from '@mui/material';
|
||||||
|
|
||||||
@ -13,10 +12,6 @@ export const AvatarCell = ({ value }: any) => {
|
|||||||
return (
|
return (
|
||||||
<TextCell>
|
<TextCell>
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<UserAvatar
|
|
||||||
user={value}
|
|
||||||
sx={theme => ({ marginRight: theme.spacing(0.5) })}
|
|
||||||
/>
|
|
||||||
<Typography component={'span'} variant={'body2'}>
|
<Typography component={'span'} variant={'body2'}>
|
||||||
{' '}
|
{' '}
|
||||||
{value?.username}
|
{value?.username}
|
@ -1,4 +1,4 @@
|
|||||||
import { TextCell } from '../../../../common/Table/cells/TextCell/TextCell';
|
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
|
||||||
import { Link, styled, Typography } from '@mui/material';
|
import { Link, styled, Typography } from '@mui/material';
|
||||||
import { Link as RouterLink } from 'react-router-dom';
|
import { Link as RouterLink } from 'react-router-dom';
|
||||||
import { useTheme } from '@mui/system';
|
import { useTheme } from '@mui/system';
|
||||||
@ -20,7 +20,7 @@ export const ChangeRequestTitleCell = ({
|
|||||||
row: { original },
|
row: { original },
|
||||||
}: IChangeRequestTitleCellProps) => {
|
}: IChangeRequestTitleCellProps) => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const { id, features: changes } = original;
|
const { id, title, features: changes } = original;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const path = `/projects/${projectId}/change-requests/${id}`;
|
const path = `/projects/${projectId}/change-requests/${id}`;
|
||||||
|
|
||||||
@ -31,11 +31,7 @@ export const ChangeRequestTitleCell = ({
|
|||||||
return (
|
return (
|
||||||
<TextCell sx={{ minWidth: '200px' }}>
|
<TextCell sx={{ minWidth: '200px' }}>
|
||||||
<StyledLink>
|
<StyledLink>
|
||||||
<Typography
|
<Typography variant={'body2'}>
|
||||||
component={'span'}
|
|
||||||
variant={'body2'}
|
|
||||||
color={theme.palette.text.secondary}
|
|
||||||
>
|
|
||||||
<Link
|
<Link
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
underline={'hover'}
|
underline={'hover'}
|
||||||
@ -48,9 +44,8 @@ export const ChangeRequestTitleCell = ({
|
|||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
Change request
|
{title}
|
||||||
</Link>
|
</Link>
|
||||||
{`#${id}`}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
<span>
|
<span>
|
@ -19,13 +19,14 @@ import { useSearch } from 'hooks/useSearch';
|
|||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { TimeAgoCell } from 'component/common/Table/cells/TimeAgoCell/TimeAgoCell';
|
import { TimeAgoCell } from 'component/common/Table/cells/TimeAgoCell/TimeAgoCell';
|
||||||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
|
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
|
||||||
import { ChangeRequestStatusCell } from './ChangeRequestStatusCell/ChangeRequestStatusCell';
|
import { ChangeRequestStatusCell } from './ChangeRequestStatusCell';
|
||||||
import { AvatarCell } from './AvatarCell/AvatarCell';
|
import { AvatarCell } from './AvatarCell';
|
||||||
import { ChangeRequestTitleCell } from './ChangeRequestTitleCell/ChangeRequestTitleCell';
|
import { ChangeRequestTitleCell } from './ChangeRequestTitleCell';
|
||||||
import { TableBody, TableRow } from 'component/common/Table';
|
import { TableBody, TableRow } from 'component/common/Table';
|
||||||
import { createLocalStorage } from 'utils/createLocalStorage';
|
import { createLocalStorage } from 'utils/createLocalStorage';
|
||||||
import { useConditionallyHiddenColumns } from 'hooks/useConditionallyHiddenColumns';
|
import { useConditionallyHiddenColumns } from 'hooks/useConditionallyHiddenColumns';
|
||||||
import { useStyles } from './ChangeRequestsTabs.styles';
|
import { useStyles } from './ChangeRequestsTabs.styles';
|
||||||
|
import { FeaturesCell } from './FeaturesCell';
|
||||||
|
|
||||||
export interface IChangeRequestTableProps {
|
export interface IChangeRequestTableProps {
|
||||||
changeRequests: any[];
|
changeRequests: any[];
|
||||||
@ -105,13 +106,22 @@ export const ChangeRequestsTabs = ({
|
|||||||
accessor: 'id',
|
accessor: 'id',
|
||||||
Cell: ChangeRequestTitleCell,
|
Cell: ChangeRequestTitleCell,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'Updated feature toggles',
|
||||||
|
Header: 'Updated feature toggles',
|
||||||
|
canSort: false,
|
||||||
|
accessor: 'features',
|
||||||
|
Cell: ({ value }: any) => {
|
||||||
|
return <FeaturesCell project={projectId} value={value} />;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Header: 'By',
|
Header: 'By',
|
||||||
accessor: 'createdBy',
|
accessor: 'createdBy',
|
||||||
maxWidth: 100,
|
maxWidth: 180,
|
||||||
canSort: false,
|
canSort: false,
|
||||||
Cell: AvatarCell,
|
Cell: AvatarCell,
|
||||||
align: 'center',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Submitted',
|
Header: 'Submitted',
|
||||||
@ -132,8 +142,7 @@ export const ChangeRequestsTabs = ({
|
|||||||
Header: 'Status',
|
Header: 'Status',
|
||||||
accessor: 'state',
|
accessor: 'state',
|
||||||
searchable: true,
|
searchable: true,
|
||||||
minWidth: 150,
|
maxWidth: '170px',
|
||||||
width: 150,
|
|
||||||
Cell: ChangeRequestStatusCell,
|
Cell: ChangeRequestStatusCell,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
import { Box, styled } from '@mui/material';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import { VFC } from 'react';
|
||||||
|
import { ConditionallyRender } from '../../../common/ConditionallyRender/ConditionallyRender';
|
||||||
|
import { TooltipLink } from '../../../common/TooltipLink/TooltipLink';
|
||||||
|
|
||||||
|
const StyledBox = styled(Box)(({ theme }) => ({
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
width: '300px',
|
||||||
|
padding: theme.spacing(1, 0, 1, 2),
|
||||||
|
}));
|
||||||
|
|
||||||
|
const StyledLink = styled(Link)(({ theme }) => ({
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
textDecoration: 'none',
|
||||||
|
'&:hover, &:focus': {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const StyledTooltipLink = styled(Link)(({ theme }) => ({
|
||||||
|
textDecoration: 'none',
|
||||||
|
'&:hover, &:focus': {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const StyledTooltipContainer = styled(Box)(({ theme }) => ({
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
fontSize: theme.fontSizes.smallBody,
|
||||||
|
width: '100%',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
}));
|
||||||
|
|
||||||
|
interface FeaturesCellProps {
|
||||||
|
value: any;
|
||||||
|
project: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FeaturesCell: VFC<FeaturesCellProps> = ({ value, project }) => {
|
||||||
|
const featureNames = value?.map((feature: any) => feature.name);
|
||||||
|
return (
|
||||||
|
<StyledBox>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={featureNames?.length < 3}
|
||||||
|
show={featureNames?.map((featureName: string) => (
|
||||||
|
<StyledLink
|
||||||
|
title={featureName}
|
||||||
|
to={`/projects/${project}/features/${featureName}`}
|
||||||
|
>
|
||||||
|
{featureName}
|
||||||
|
</StyledLink>
|
||||||
|
))}
|
||||||
|
elseShow={
|
||||||
|
<TooltipLink
|
||||||
|
tooltipProps={{ maxWidth: '800px' }}
|
||||||
|
tooltip={
|
||||||
|
<StyledTooltipContainer>
|
||||||
|
{featureNames?.map((featureName: string) => (
|
||||||
|
<StyledTooltipLink
|
||||||
|
title={featureName}
|
||||||
|
to={`/projects/${project}/features/${featureName}`}
|
||||||
|
>
|
||||||
|
{featureName}
|
||||||
|
</StyledTooltipLink>
|
||||||
|
))}
|
||||||
|
</StyledTooltipContainer>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{featureNames?.length} toggles
|
||||||
|
</TooltipLink>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</StyledBox>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user