feat: Add lastUsedAt to API keys (#7082)

* feat: Add lastUsedAt to API keys

* rename column to lastActiveAt

* switch order
This commit is contained in:
Hemachandar
2024-06-20 18:48:35 +05:30
committed by GitHub
parent a19fb25bea
commit 1bf9012992
9 changed files with 72 additions and 0 deletions

View File

@@ -24,6 +24,12 @@ class ApiKey extends Model {
@observable
expiresAt?: string;
/**
* An optional datetime that the API key was last used at.
*/
@observable
lastActiveAt?: string;
secret: string;
/**

View File

@@ -27,6 +27,12 @@ const ApiKeyListItem = ({ apiKey, isCopied, onCopy }: Props) => {
<Text type="tertiary">
{t(`Created`)} <Time dateTime={apiKey.createdAt} addSuffix /> &middot;{" "}
</Text>
{apiKey.lastActiveAt && (
<Text type={"tertiary"}>
{t("Last used")} <Time dateTime={apiKey.lastActiveAt} addSuffix />{" "}
&middot;{" "}
</Text>
)}
<Text type={apiKey.isExpired ? "danger" : "tertiary"}>
{apiKey.expiresAt
? dateToExpiry(apiKey.expiresAt, t, userLocale)