mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
wip: quick and dirty hack to fix the badge
This commit is contained in:
parent
be579ba63b
commit
970334c9ec
@ -7,6 +7,7 @@ import {
|
|||||||
CircleOutlined,
|
CircleOutlined,
|
||||||
Close,
|
Close,
|
||||||
Error as ErrorIcon,
|
Error as ErrorIcon,
|
||||||
|
PauseCircle,
|
||||||
} from '@mui/icons-material';
|
} from '@mui/icons-material';
|
||||||
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
||||||
|
|
||||||
@ -60,23 +61,39 @@ export const ChangeRequestStatusBadge: VFC<IChangeRequestStatusBadgeProps> = ({
|
|||||||
);
|
);
|
||||||
case 'Scheduled': {
|
case 'Scheduled': {
|
||||||
const { schedule } = changeRequest;
|
const { schedule } = changeRequest;
|
||||||
const color = schedule!.status === 'pending' ? 'warning' : 'error';
|
|
||||||
const icon =
|
|
||||||
schedule?.status === 'pending' ? (
|
|
||||||
<AccessTime fontSize={'small'} />
|
|
||||||
) : (
|
|
||||||
<ErrorIcon fontSize={'small'} />
|
|
||||||
);
|
|
||||||
const scheduledAt = new Date(
|
const scheduledAt = new Date(
|
||||||
schedule!.scheduledAt,
|
schedule!.scheduledAt,
|
||||||
).toLocaleString();
|
).toLocaleString();
|
||||||
|
|
||||||
const tooltipTitle =
|
const { color, icon, tooltipTitle } = (() => {
|
||||||
schedule?.status === 'pending'
|
switch (schedule!.status) {
|
||||||
? `Scheduled for ${scheduledAt}`
|
case 'pending':
|
||||||
: `Failed on ${scheduledAt} because of ${
|
return {
|
||||||
schedule!.failureReason
|
color: 'warning' as const,
|
||||||
}`;
|
icon: <AccessTime fontSize={'small'} />,
|
||||||
|
tooltipTitle: `Scheduled for ${scheduledAt}`,
|
||||||
|
};
|
||||||
|
case 'failed':
|
||||||
|
return {
|
||||||
|
color: 'error' as const,
|
||||||
|
icon: <ErrorIcon fontSize={'small'} />,
|
||||||
|
tooltipTitle: `Failed on ${scheduledAt} because of ${
|
||||||
|
// @ts-ignore
|
||||||
|
schedule!.reason ?? schedule!.failureReason
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
// @ts-ignore
|
||||||
|
case 'suspended':
|
||||||
|
return {
|
||||||
|
color: 'disabled' as const,
|
||||||
|
icon: <PauseCircle fontSize={'small'} />,
|
||||||
|
tooltipTitle: `Suspended because: ${
|
||||||
|
// @ts-ignore
|
||||||
|
schedule!.reason
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HtmlTooltip title={tooltipTitle} arrow>
|
<HtmlTooltip title={tooltipTitle} arrow>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user