feat(ExecutionStep): show execution date

This commit is contained in:
Ali BARIN
2023-05-12 20:13:47 +00:00
parent bad5e0b855
commit a5dbac9817
3 changed files with 27 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ function ExecutionDate(props: Pick<IExecution, 'createdAt'>) {
const relativeCreatedAt = createdAt.toRelative(); const relativeCreatedAt = createdAt.toRelative();
return ( return (
<Tooltip title={createdAt.toLocaleString(DateTime.DATE_MED)}> <Tooltip title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}>
<Typography variant="body1" gutterBottom> <Typography variant="body1" gutterBottom>
{relativeCreatedAt} {relativeCreatedAt}
</Typography> </Typography>

View File

@@ -1,4 +1,5 @@
import * as React from 'react'; import * as React from 'react';
import { DateTime } from 'luxon';
import { useQuery } from '@apollo/client'; import { useQuery } from '@apollo/client';
import Stack from '@mui/material/Stack'; import Stack from '@mui/material/Stack';
import ErrorIcon from '@mui/icons-material/Error'; import ErrorIcon from '@mui/icons-material/Error';
@@ -6,6 +7,7 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import Tabs from '@mui/material/Tabs'; import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab'; import Tab from '@mui/material/Tab';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import Tooltip from '@mui/material/Tooltip';
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import type { IApp, IExecutionStep, IStep } from '@automatisch/types'; import type { IApp, IExecutionStep, IStep } from '@automatisch/types';
@@ -29,6 +31,22 @@ type ExecutionStepProps = {
executionStep: IExecutionStep; executionStep: IExecutionStep;
}; };
function ExecutionStepDate(props: Pick<IExecutionStep, 'createdAt'>) {
const formatMessage = useFormatMessage();
const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10));
const relativeCreatedAt = createdAt.toRelative();
return (
<Tooltip title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}>
<Typography variant="caption" gutterBottom>
{formatMessage('executionStep.executedAt', {
datetime: relativeCreatedAt
})}
</Typography>
</Tooltip>
);
}
const validIcon = <CheckCircleIcon color="success" />; const validIcon = <CheckCircleIcon color="success" />;
const errorIcon = <ErrorIcon color="error" />; const errorIcon = <ErrorIcon color="error" />;
@@ -56,7 +74,7 @@ export default function ExecutionStep(
return ( return (
<Wrapper elevation={1} data-test="execution-step"> <Wrapper elevation={1} data-test="execution-step">
<Header> <Header>
<Stack direction="row" alignItems="center" gap={2}> <Stack direction="row" gap={2}>
<AppIconWrapper> <AppIconWrapper>
<AppIcon url={app?.iconUrl} name={app?.name} /> <AppIcon url={app?.iconUrl} name={app?.name} />
@@ -65,7 +83,7 @@ export default function ExecutionStep(
</AppIconStatusIconWrapper> </AppIconStatusIconWrapper>
</AppIconWrapper> </AppIconWrapper>
<div> <Box flex="1">
<Typography variant="caption"> <Typography variant="caption">
{isTrigger {isTrigger
? formatMessage('flowStep.triggerType') ? formatMessage('flowStep.triggerType')
@@ -75,7 +93,11 @@ export default function ExecutionStep(
<Typography variant="body2"> <Typography variant="body2">
{step.position}. {app?.name} {step.position}. {app?.name}
</Typography> </Typography>
</div> </Box>
<Box alignSelf="flex-end">
<ExecutionStepDate createdAt={executionStep.createdAt} />
</Box>
</Stack> </Stack>
</Header> </Header>

View File

@@ -83,6 +83,7 @@
"execution.statusFailure": "Failure", "execution.statusFailure": "Failure",
"execution.noDataTitle": "No data", "execution.noDataTitle": "No data",
"execution.noDataMessage": "We successfully ran the execution, but there was no new data to process.", "execution.noDataMessage": "We successfully ran the execution, but there was no new data to process.",
"executionStep.executedAt": "executed {datetime}",
"profileSettings.title": "My Profile", "profileSettings.title": "My Profile",
"profileSettings.fullName": "Full name", "profileSettings.fullName": "Full name",
"profileSettings.email": "Email", "profileSettings.email": "Email",