mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 12:18:58 +08:00
fix(api-key): make the expires in human readable in api keys (#7864)
* fix(api-key): human readable expires in * fix(api-key): human readable expires in
This commit is contained in:
parent
503e4cdf00
commit
08d9a74055
@ -27,6 +27,7 @@ import axios, { AxiosError } from 'axios';
|
|||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
import { useGetAllAPIKeys } from 'hooks/APIKeys/useGetAllAPIKeys';
|
import { useGetAllAPIKeys } from 'hooks/APIKeys/useGetAllAPIKeys';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import {
|
import {
|
||||||
@ -52,6 +53,8 @@ import { useCopyToClipboard } from 'react-use';
|
|||||||
import { APIKeyProps } from 'types/api/pat/types';
|
import { APIKeyProps } from 'types/api/pat/types';
|
||||||
import { USER_ROLES } from 'types/roles';
|
import { USER_ROLES } from 'types/roles';
|
||||||
|
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
export const showErrorNotification = (
|
export const showErrorNotification = (
|
||||||
notifications: NotificationInstance,
|
notifications: NotificationInstance,
|
||||||
err: Error,
|
err: Error,
|
||||||
@ -495,7 +498,7 @@ function APIKeys(): JSX.Element {
|
|||||||
expiresIn <= 3 ? 'danger' : 'warning',
|
expiresIn <= 3 ? 'danger' : 'warning',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span className="dot" /> Expires in {expiresIn} Days
|
<span className="dot" /> Expires {dayjs().to(expiresOn)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user