-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display time the endpoint was last successfully reached
- Loading branch information
1 parent
9d17a18
commit 09ec67a
Showing
7 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/components/shared/Entity/Details/Logs/Status/Overview/SectionUpdated.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Box, Grid, Stack, Typography } from '@mui/material'; | ||
import { diminishedTextColor } from 'context/Theme'; | ||
import { useIntl } from 'react-intl'; | ||
import { useEntityStatusStore } from 'stores/EntityStatus/Store'; | ||
|
||
export default function SectionUpdated() { | ||
const intl = useIntl(); | ||
|
||
const lastUpdated = useEntityStatusStore((state) => state.lastUpdated); | ||
|
||
return ( | ||
<Grid item xs={12} style={{ paddingTop: 12 }}> | ||
{lastUpdated ? ( | ||
<Stack direction="row" style={{ justifyContent: 'flex-end' }}> | ||
<Typography | ||
sx={{ | ||
color: (theme) => | ||
diminishedTextColor[theme.palette.mode], | ||
}} | ||
variant="caption" | ||
> | ||
{intl.formatMessage( | ||
{ | ||
id: 'details.ops.status.message.lastUpdated', | ||
}, | ||
{ | ||
timestamp: `${lastUpdated.toLocaleString({ | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
second: '2-digit', | ||
timeZoneName: 'short', | ||
})}, ${lastUpdated.toLocaleString({ | ||
day: '2-digit', | ||
month: '2-digit', | ||
year: 'numeric', | ||
})}`, | ||
} | ||
)} | ||
</Typography> | ||
</Stack> | ||
) : ( | ||
<Box style={{ height: 20 }} /> | ||
)} | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { EntityStatusResponse } from 'deps/control-plane/types'; | ||
import { DateTime } from 'luxon'; | ||
|
||
export interface EntityStatusState { | ||
response: EntityStatusResponse | null; | ||
setResponse: (value: EntityStatusResponse) => void; | ||
|
||
format: 'code' | 'dashboard'; | ||
lastUpdated: DateTime | null; | ||
setFormat: ( | ||
value: EntityStatusState['format'], | ||
invertedValue: EntityStatusState['format'] | ||
) => void; | ||
setLastUpdated: (value: EntityStatusState['lastUpdated']) => void; | ||
setResponse: (value: EntityStatusResponse) => void; | ||
} |