Avoid formatting missing account token access times
This commit is contained in:
parent
4b0a4eee3b
commit
5d93cb400a
1 changed files with 85 additions and 78 deletions
|
|
@ -1056,7 +1056,11 @@ const TokensTable = (props) => {
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{tokens.map((token) => (
|
{tokens.map((token) => {
|
||||||
|
const hasLastAccess = Number.isFinite(token.last_access) && token.last_access > 0;
|
||||||
|
const hasLastOrigin = !!token.last_origin;
|
||||||
|
|
||||||
|
return (
|
||||||
<TableRow key={token.token} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
<TableRow key={token.token} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
||||||
<TableCell
|
<TableCell
|
||||||
component="th"
|
component="th"
|
||||||
|
|
@ -1083,7 +1087,8 @@ const TokensTable = (props) => {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell sx={{ whiteSpace: "nowrap" }} aria-label={t("account_tokens_table_last_access_header")}>
|
<TableCell sx={{ whiteSpace: "nowrap" }} aria-label={t("account_tokens_table_last_access_header")}>
|
||||||
<div style={{ display: "flex", alignItems: "center" }}>
|
<div style={{ display: "flex", alignItems: "center" }}>
|
||||||
<span>{formatShortDateTime(token.last_access, i18n.language)}</span>
|
{hasLastAccess ? <span>{formatShortDateTime(token.last_access, i18n.language)}</span> : <em>-</em>}
|
||||||
|
{hasLastOrigin && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={t("account_tokens_table_last_origin_tooltip", {
|
title={t("account_tokens_table_last_origin_tooltip", {
|
||||||
ip: token.last_origin,
|
ip: token.last_origin,
|
||||||
|
|
@ -1093,6 +1098,7 @@ const TokensTable = (props) => {
|
||||||
<Public />
|
<Public />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right" sx={{ whiteSpace: "nowrap" }}>
|
<TableCell align="right" sx={{ whiteSpace: "nowrap" }}>
|
||||||
|
|
@ -1136,7 +1142,8 @@ const TokensTable = (props) => {
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
<Portal>
|
<Portal>
|
||||||
<Snackbar
|
<Snackbar
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue