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:
parent
348bbfeda3
commit
4d8817698a
@ -26,9 +26,11 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
|
|||||||
import { HighlightCell } from 'component/common/Table/cells/HighlightCell/HighlightCell';
|
import { HighlightCell } from 'component/common/Table/cells/HighlightCell/HighlightCell';
|
||||||
import { Search } from 'component/common/Search/Search';
|
import { Search } from 'component/common/Search/Search';
|
||||||
import useHiddenColumns from 'hooks/useHiddenColumns';
|
import useHiddenColumns from 'hooks/useHiddenColumns';
|
||||||
|
import { TimeAgoCell } from 'component/common/Table/cells/TimeAgoCell/TimeAgoCell';
|
||||||
|
|
||||||
const hiddenColumnsSmall = ['Icon', 'createdAt'];
|
const hiddenColumnsSmall = ['Icon', 'createdAt'];
|
||||||
const hiddenColumnsFlagE = ['projects', 'environment'];
|
const hiddenColumnsFlagE = ['projects', 'environment'];
|
||||||
|
const hiddenColumnsFlagTokensLastSeen = ['seenAt'];
|
||||||
|
|
||||||
export const ApiTokenTable = () => {
|
export const ApiTokenTable = () => {
|
||||||
const { tokens, loading } = useApiTokens();
|
const { tokens, loading } = useApiTokens();
|
||||||
@ -59,6 +61,11 @@ export const ApiTokenTable = () => {
|
|||||||
|
|
||||||
useHiddenColumns(setHiddenColumns, hiddenColumnsSmall, isSmallScreen);
|
useHiddenColumns(setHiddenColumns, hiddenColumnsSmall, isSmallScreen);
|
||||||
useHiddenColumns(setHiddenColumns, hiddenColumnsFlagE, !uiConfig.flags.E);
|
useHiddenColumns(setHiddenColumns, hiddenColumnsFlagE, !uiConfig.flags.E);
|
||||||
|
useHiddenColumns(
|
||||||
|
setHiddenColumns,
|
||||||
|
hiddenColumnsFlagTokensLastSeen,
|
||||||
|
!uiConfig.flags.tokensLastSeen
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent
|
<PageContent
|
||||||
@ -206,6 +213,13 @@ const COLUMNS = [
|
|||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
disableGlobalFilter: true,
|
disableGlobalFilter: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Header: 'Last seen',
|
||||||
|
accessor: 'seenAt',
|
||||||
|
Cell: TimeAgoCell,
|
||||||
|
minWidth: 150,
|
||||||
|
disableGlobalFilter: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Header: 'Actions',
|
Header: 'Actions',
|
||||||
id: 'Actions',
|
id: 'Actions',
|
||||||
|
@ -46,6 +46,7 @@ const tokenRowReducer = (acc, tokenRow) => {
|
|||||||
expiresAt: token.expires_at,
|
expiresAt: token.expires_at,
|
||||||
createdAt: token.created_at,
|
createdAt: token.created_at,
|
||||||
alias: token.alias,
|
alias: token.alias,
|
||||||
|
seenAt: token.seen_at,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const currentToken = acc[tokenRow.secret];
|
const currentToken = acc[tokenRow.secret];
|
||||||
|
Loading…
Reference in New Issue
Block a user