Fix #6026 UI - Ability to show JWT Tokens as expired once the expiry date passes (#6029)

* Fix #6026 UI - Ability to show JWT Tokens as expired once the expiry date passes

* Addressing review comment.

* Minor logic change

* Add text for no expiration date
This commit is contained in:
Sachin Chaurasiya 2022-07-13 20:34:52 +05:30 committed by GitHub
parent aa3f2662ea
commit a63a6bf718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 14 deletions

View File

@ -1,12 +1,12 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
<g>
<title>background</title>
<rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
</g>
<g>
<title>Layer 1</title>
<circle fill="#ffffff" r="16" id="BG" cy="16" cx="16"/>
<path fill="#d72828" id="Exclamatory_x5F_Sign" d="m14.5,25l3,0l0,-3l-3,0l0,3zm0,-19l0,13l3,0l0,-13l-3,0z"/>
</g>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11354_12245)">
<path d="M7.99993 9.9989C7.72381 9.9989 7.5 9.77505 7.5 9.49897V5.99944C7.5 5.72336 7.72381 5.49951 7.99993 5.49951C8.27605 5.49951 8.49986 5.72336 8.49986 5.99944V9.49897C8.49986 9.77508 8.27605 9.9989 7.99993 9.9989Z" fill="#6B7280"/>
<path d="M15.7884 12.5088L9.56452 2.13584C8.85837 0.958466 7.14311 0.956185 6.43558 2.13584L0.21171 12.5088C-0.376866 13.4898 0.331256 14.7482 1.47966 14.7482H14.5204C15.669 14.7482 16.3768 13.4896 15.7884 12.5088V12.5088ZM14.5204 13.7483H1.47969C1.10718 13.7483 0.878774 13.3399 1.06912 13.0231L7.29296 2.65014C7.61226 2.11793 8.38744 2.11731 8.70714 2.65014L14.931 13.0231C15.1211 13.3396 14.8932 13.7483 14.5204 13.7483Z" fill="#6B7280"/>
<path d="M7.9999 11.9986C8.41405 11.9986 8.74979 11.6628 8.74979 11.2487C8.74979 10.8345 8.41405 10.4988 7.9999 10.4988C7.58574 10.4988 7.25 10.8345 7.25 11.2487C7.25 11.6628 7.58574 11.9986 7.9999 11.9986Z" fill="#6B7280"/>
</g>
<defs>
<clipPath id="clip0_11354_12245">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -293,15 +293,36 @@ const BotsDetail: FC<BotsDetailProp> = ({
const getBotsTokenExpiryDate = () => {
if (botsTokenExpiry) {
// get the current date timestamp
const currentTimeStamp = Date.now();
const isTokenExpired = currentTimeStamp >= Number(botsTokenExpiry);
// get the token expiry date
const tokenExpiryDate =
moment(botsTokenExpiry).format('ddd Do MMMM, YYYY');
return (
<p
className="tw-text-grey-muted tw-mt-2 tw-italic"
data-testid="token-expiry">
Expires on {moment(botsTokenExpiry).format('ddd Do MMMM, YYYY')}
{isTokenExpired
? `Expired on ${tokenExpiryDate}`
: `Expires on ${tokenExpiryDate}`}
.
</p>
);
} else {
return null;
return (
<p
className="tw-text-grey-muted tw-mt-2 tw-italic"
data-testid="token-expiry">
<SVGIcons alt="warning" icon="error" />
<span className="tw-ml-1 tw-align-middle">
This token has no expiration date.
</span>
</p>
);
}
};