From a63a6bf7183b395321e6dc6e5aa6514efb84f6bf Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Wed, 13 Jul 2022 20:34:52 +0530 Subject: [PATCH] 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 --- .../resources/ui/src/assets/svg/error.svg | 24 +++++++++--------- .../BotsDetail/BotsDetail.component.tsx | 25 +++++++++++++++++-- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/error.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/error.svg index 6b799c9175a..1edc19c338b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/assets/svg/error.svg +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/error.svg @@ -1,12 +1,12 @@ - - - - background - - - - Layer 1 - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BotsDetail/BotsDetail.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/BotsDetail/BotsDetail.component.tsx index 8b4fd374ca3..f69452b0102 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BotsDetail/BotsDetail.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/BotsDetail/BotsDetail.component.tsx @@ -293,15 +293,36 @@ const BotsDetail: FC = ({ 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 (

- Expires on {moment(botsTokenExpiry).format('ddd Do MMMM, YYYY')} + {isTokenExpired + ? `Expired on ${tokenExpiryDate}` + : `Expires on ${tokenExpiryDate}`} + .

); } else { - return null; + return ( +

+ + + This token has no expiration date. + +

+ ); } };