Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
likawind committed Jun 6, 2023
1 parent 81b8a25 commit efd2144
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Alert, Box, Divider, Typography } from '@mui/material';
import { Alert, Box, Typography } from '@mui/material';
import React from 'react';
import ExecutionStatus from '../../../../../utils/shared';

import ArtifactContent from '../../../../../components/workflows/artifact/content';
import { ArtifactResultResponse } from '../../../../../handlers/responses/node';
Expand All @@ -22,57 +23,49 @@ export const Preview: React.FC<PreviewProps> = ({
contentLoading,
contentError,
}) => {
let preview = (
<>
<Divider sx={{ marginY: '32px' }} />

<Box marginBottom="32px">
<Alert severity="warning">
An upstream operator failed, causing this artifact to not be created.
</Alert>
</Box>
</>
);

if (upstreamPending) {
preview = (
<>
<Divider sx={{ marginY: '32px' }} />
return (
<Alert severity="warning">
An upstream operator is in progress so this artifact is not yet created.
</Alert>
);
}

if (previewAvailable) {
if (artifactResult?.exec_state?.status === ExecutionStatus.Deleted) {
return (
<Box marginBottom="32px">
<Alert severity="warning">
An upstream operator is in progress so this artifact is not yet
created.
<Alert severity="info">
This artifact has succeeded, but the snapshot has been deleted.
</Alert>
</Box>
</>
);
} else if (previewAvailable) {
preview = (
<>
<Divider sx={{ marginY: '32px' }} />
<Box width="100%" marginTop="12px">
<Typography
variant="h6"
component="div"
marginBottom="8px"
fontWeight="normal"
>
Preview
</Typography>
<ArtifactContent
artifactResult={artifactResult}
content={content}
contentLoading={contentLoading}
contentError={contentError}
/>
</Box>

<Divider sx={{ marginY: '32px' }} />
</>
);
}
return (
<Box width="100%">
<Typography
variant="h6"
component="div"
marginBottom="8px"
fontWeight="normal"
>
Preview
</Typography>
<ArtifactContent
artifactResult={artifactResult}
content={content}
contentLoading={contentLoading}
contentError={contentError}
/>
</Box>
);
}
return preview;

return (
<Alert severity="warning">
An upstream operator failed, causing this artifact to not be created.
</Alert>
);
};

export default Preview;
5 changes: 5 additions & 0 deletions src/ui/common/src/components/pages/artifact/id/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CircularProgress } from '@mui/material';
import { Divider } from '@mui/material';
import Box from '@mui/material/Box';
import React from 'react';
import { useLocation, useParams } from 'react-router-dom';
Expand Down Expand Up @@ -141,6 +142,8 @@ const ArtifactDetailsPage: React.FC<ArtifactDetailsPageProps> = ({
)}
</Box>

<Divider sx={{ marginY: '32px' }} />

<Preview
upstreamPending={upstreamPending}
previewAvailable={previewAvailable}
Expand All @@ -150,6 +153,8 @@ const ArtifactDetailsPage: React.FC<ArtifactDetailsPageProps> = ({
contentError={contentError ? (contentError as string) : ''}
/>

<Divider sx={{ marginY: '32px' }} />

<Box display="flex" width="100%">
<MetricsOverview metrics={metrics} nodeResults={nodeResults} />
<Box width="96px" />
Expand Down
6 changes: 1 addition & 5 deletions src/ui/common/src/components/tables/CheckTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ export const CheckTableItem: React.FC<CheckTableItemProps> = ({
return <>{value}</>;
}

if (status) {
return <StatusIndicator status={status} size={'16px'} monochrome={false} />;
}

return (
<StatusIndicator
status={ExecutionStatus.Unknown}
status={status ?? ExecutionStatus.Unknown}
size={'16px'}
monochrome={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ArtifactContent: React.FC<Props> = ({
);
}

if (!content || !content.content || !artifactResult) {
if (!content?.content || !artifactResult) {
return (
<Typography variant="h5" component="div" marginBottom="8px">
No result to show for this artifact.
Expand Down
5 changes: 4 additions & 1 deletion src/ui/common/src/components/workflows/nodes/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const artifactNodeStatusLabels = {
[ExecutionStatus.Running]: 'Running',
[ExecutionStatus.Warning]: 'Warning',
[ExecutionStatus.Unknown]: 'Unknown',
[ExecutionStatus.Deleted]: 'Deleted',
};

const operatorNodeStatusLabels = {
Expand All @@ -51,6 +52,7 @@ const operatorNodeStatusLabels = {
[ExecutionStatus.Running]: 'Running',
[ExecutionStatus.Warning]: 'Warning',
[ExecutionStatus.Unknown]: 'Unknown',
[ExecutionStatus.Deleted]: 'Deleted',
};

const checkNodeStatusLabels = {
Expand All @@ -62,6 +64,7 @@ const checkNodeStatusLabels = {
[ExecutionStatus.Running]: 'Running',
[ExecutionStatus.Warning]: 'Warning',
[ExecutionStatus.Unknown]: 'Unknown',
[ExecutionStatus.Deleted]: 'Deleted',
};

export const artifactTypeToIconMapping = {
Expand Down Expand Up @@ -163,6 +166,7 @@ export const Node: React.FC<Props> = ({ data, isConnectable }) => {
let backgroundColor;
switch (status) {
case ExecutionStatus.Succeeded:
case ExecutionStatus.Deleted:
backgroundColor = theme.palette.green[100];
break;
case ExecutionStatus.Warning:
Expand All @@ -173,7 +177,6 @@ export const Node: React.FC<Props> = ({ data, isConnectable }) => {
break;
case ExecutionStatus.Canceled:
case ExecutionStatus.Pending:
case ExecutionStatus.Deleted:
default:
backgroundColor = theme.palette.gray[400];
}
Expand Down

0 comments on commit efd2144

Please sign in to comment.