1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

Wip: hack together review status

This commit is contained in:
Thomas Heartman 2024-01-10 14:48:11 +05:30
parent 970334c9ec
commit 270520e7fc
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78
2 changed files with 52 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import {
Schedule,
Edit,
Error as ErrorIcon,
PauseCircle,
} from '@mui/icons-material';
import { Box, Typography, Divider } from '@mui/material';
@ -55,6 +56,14 @@ export const StyledScheduleFailedIcon = styled(ErrorIcon)(({ theme }) => ({
width: '35px',
marginRight: theme.spacing(1),
}));
export const StyledScheduleSuspendedIcon = styled(PauseCircle)(({ theme }) => ({
color: theme.palette.text.secondary,
height: '35px',
width: '35px',
marginRight: theme.spacing(1),
}));
export const StyledEditIcon = styled(Edit)(({ theme }) => ({
color: theme.palette.text.secondary,
height: '24px',

View File

@ -23,6 +23,7 @@ import {
StyledScheduledBox,
StyledErrorIcon,
StyledScheduleFailedIcon,
StyledScheduleSuspendedIcon,
} from './ChangeRequestReviewStatus.styles';
import {
ChangeRequestState,
@ -260,7 +261,15 @@ const Scheduled = ({ schedule, onEditClick }: IScheduledProps) => {
<ConditionallyRender
condition={schedule?.status === 'pending'}
show={<ScheduledPending schedule={schedule} />}
elseShow={<ScheduledFailed schedule={schedule} />}
elseShow={
<ConditionallyRender
condition={schedule?.status === 'failed'}
show={<ScheduledFailed schedule={schedule} />}
elseShow={
<ScheduledSuspended schedule={schedule} />
}
/>
}
/>
<StyledIconButton onClick={onEditClick}>
@ -301,6 +310,39 @@ const ScheduledFailed = ({
);
};
const ScheduledSuspended = ({
schedule,
}: { schedule: IChangeRequestSchedule }) => {
const theme = useTheme();
const timezone = getBrowserTimezone();
const { locationSettings } = useLocationSettings();
if (!schedule?.scheduledAt) {
return null;
}
const scheduledTime = formatDateYMDHMS(
new Date(schedule?.scheduledAt),
locationSettings?.locale,
);
return (
<StyledFlexAlignCenterBox>
<StyledScheduleSuspendedIcon />
<Box>
<StyledReviewTitle color={theme.palette.text.secondary}>
The change request is suspended for the following reason:{' '}
{(schedule as unknown as { reason: string }).reason}
</StyledReviewTitle>
<StyledReviewTitle color={theme.palette.text.secondary}>
It will not be applied on {scheduledTime}.
</StyledReviewTitle>
<Typography>Your timezone is {timezone}</Typography>
</Box>
</StyledFlexAlignCenterBox>
);
};
const ScheduledPending = ({
schedule,
}: { schedule: IChangeRequestSchedule }) => {