1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

feat: add last seen column to token table (#2520)

https://linear.app/unleash/issue/2-449/add-table-column-to-api-tokens-table-ui
This commit is contained in:
Nuno Góis 2022-11-30 06:07:13 +00:00 committed by GitHub
parent 348bbfeda3
commit 4d8817698a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -26,9 +26,11 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { HighlightCell } from 'component/common/Table/cells/HighlightCell/HighlightCell';
import { Search } from 'component/common/Search/Search';
import useHiddenColumns from 'hooks/useHiddenColumns';
import { TimeAgoCell } from 'component/common/Table/cells/TimeAgoCell/TimeAgoCell';
const hiddenColumnsSmall = ['Icon', 'createdAt'];
const hiddenColumnsFlagE = ['projects', 'environment'];
const hiddenColumnsFlagTokensLastSeen = ['seenAt'];
export const ApiTokenTable = () => {
const { tokens, loading } = useApiTokens();
@ -59,6 +61,11 @@ export const ApiTokenTable = () => {
useHiddenColumns(setHiddenColumns, hiddenColumnsSmall, isSmallScreen);
useHiddenColumns(setHiddenColumns, hiddenColumnsFlagE, !uiConfig.flags.E);
useHiddenColumns(
setHiddenColumns,
hiddenColumnsFlagTokensLastSeen,
!uiConfig.flags.tokensLastSeen
);
return (
<PageContent
@ -206,6 +213,13 @@ const COLUMNS = [
minWidth: 150,
disableGlobalFilter: true,
},
{
Header: 'Last seen',
accessor: 'seenAt',
Cell: TimeAgoCell,
minWidth: 150,
disableGlobalFilter: true,
},
{
Header: 'Actions',
id: 'Actions',

View File

@ -46,6 +46,7 @@ const tokenRowReducer = (acc, tokenRow) => {
expiresAt: token.expires_at,
createdAt: token.created_at,
alias: token.alias,
seenAt: token.seen_at,
};
}
const currentToken = acc[tokenRow.secret];