mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
feat: add tooltip to Scheduled badge (#5726)
Closes # [1-1831](https://linear.app/unleash/issue/1-1831/enhancement-tooltips-for-change-request-overview-page-to-add-hover) <img width="1332" alt="Screenshot 2023-12-22 at 12 59 15" src="https://github.com/Unleash/unleash/assets/104830839/1a851b47-4756-4f3f-a9e6-14067e395738"> <img width="1263" alt="Screenshot 2023-12-22 at 12 59 07" src="https://github.com/Unleash/unleash/assets/104830839/cdce0e81-3e04-4414-8965-13072b282dea"> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
a71b513e9a
commit
fbeb5425af
@ -8,6 +8,7 @@ import {
|
|||||||
Close,
|
Close,
|
||||||
Error as ErrorIcon,
|
Error as ErrorIcon,
|
||||||
} from '@mui/icons-material';
|
} from '@mui/icons-material';
|
||||||
|
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
||||||
|
|
||||||
interface IChangeRequestStatusBadgeProps {
|
interface IChangeRequestStatusBadgeProps {
|
||||||
changeRequest: IChangeRequest | undefined;
|
changeRequest: IChangeRequest | undefined;
|
||||||
@ -59,17 +60,30 @@ export const ChangeRequestStatusBadge: VFC<IChangeRequestStatusBadgeProps> = ({
|
|||||||
);
|
);
|
||||||
case 'Scheduled': {
|
case 'Scheduled': {
|
||||||
const { schedule } = changeRequest;
|
const { schedule } = changeRequest;
|
||||||
const color = schedule?.status === 'pending' ? 'warning' : 'error';
|
const color = schedule!.status === 'pending' ? 'warning' : 'error';
|
||||||
const icon =
|
const icon =
|
||||||
schedule?.status === 'pending' ? (
|
schedule?.status === 'pending' ? (
|
||||||
<AccessTime fontSize={'small'} />
|
<AccessTime fontSize={'small'} />
|
||||||
) : (
|
) : (
|
||||||
<ErrorIcon fontSize={'small'} />
|
<ErrorIcon fontSize={'small'} />
|
||||||
);
|
);
|
||||||
|
const scheduledAt = new Date(
|
||||||
|
schedule!.scheduledAt,
|
||||||
|
).toLocaleString();
|
||||||
|
|
||||||
|
const tooltipTitle =
|
||||||
|
schedule?.status === 'pending'
|
||||||
|
? `Scheduled for ${scheduledAt}`
|
||||||
|
: `Failed on ${scheduledAt} because of ${
|
||||||
|
schedule!.failureReason
|
||||||
|
}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<HtmlTooltip title={tooltipTitle} arrow>
|
||||||
<Badge color={color} icon={icon}>
|
<Badge color={color} icon={icon}>
|
||||||
Scheduled
|
Scheduled
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</HtmlTooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -5,7 +5,6 @@ import { SetStrategySortOrderSchema } from '../../openapi';
|
|||||||
|
|
||||||
export interface IChangeRequest {
|
export interface IChangeRequest {
|
||||||
id: number;
|
id: number;
|
||||||
state: ChangeRequestState;
|
|
||||||
title: string;
|
title: string;
|
||||||
project: string;
|
project: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
@ -18,6 +17,7 @@ export interface IChangeRequest {
|
|||||||
rejections: IChangeRequestApproval[];
|
rejections: IChangeRequestApproval[];
|
||||||
comments: IChangeRequestComment[];
|
comments: IChangeRequestComment[];
|
||||||
conflict?: string;
|
conflict?: string;
|
||||||
|
state: ChangeRequestState;
|
||||||
schedule?: IChangeRequestSchedule;
|
schedule?: IChangeRequestSchedule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user