Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flyteconsole] Streaming Decks #890

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import IconButton from '@mui/material/IconButton';
import Typography from '@mui/material/Typography';
import DialogContent from '@mui/material/DialogContent';
import { useDownloadLink } from '@clients/oss-console/components/hooks/useDataProxy';
import RefreshIcon from '@mui/icons-material/Refresh';
import t from '../strings';
import { WorkflowNodeExecution } from '../../contexts';
import { NodeExecutionPhase } from '../../../../models/Execution/enums';
Expand Down Expand Up @@ -52,14 +54,11 @@
setSetFullScreen(!fullScreen);
};

const downloadLink = useDownloadLink(nodeExecution?.id);

Check warning on line 57 in packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx#L57

Added line #L57 was not covered by tests

return nodeExecution?.closure?.deckUri ? (
<>
<Button
variant="outlined"
color="primary"
onClick={() => setShowDeck(true)}
disabled={phase !== NodeExecutionPhase.SUCCEEDED}
>
<Button variant="outlined" color="primary" onClick={() => setShowDeck(true)}>

Check warning on line 61 in packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx#L61

Added line #L61 was not covered by tests
{flyteDeckText || t('flyteDeck')}
</Button>
<Dialog
Expand Down Expand Up @@ -91,10 +90,17 @@
fontSize: '24px',
lineHeight: '32px',
marginBlock: 0,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
gap: 1,
}}
py={2}
>
{t('flyteDeck')}
<IconButton onClick={() => downloadLink.fetch()}>

Check warning on line 101 in packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions/FlyteDeckButton.tsx#L101

Added line #L101 was not covered by tests
<RefreshIcon />
</IconButton>
</Typography>
</Grid>
<Grid item>
Expand All @@ -109,7 +115,7 @@
overflow: 'hidden',
}}
>
<ExecutionNodeDeck nodeExecutionId={nodeExecution.id} />
<ExecutionNodeDeck nodeExecutionId={nodeExecution.id} downloadLink={downloadLink} />
</DialogContent>
</Dialog>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Core from '@clients/common/flyteidl/core';
import NotFoundError from '@clients/common/Errors/NotFoundError';
import { LoadingSpinner } from '@clients/primitives/LoadingSpinner';
import { useDownloadLink } from '../../hooks/useDataProxy';
import { WaitForData } from '../../common/WaitForData';
Expand All @@ -8,8 +9,8 @@
export const ExecutionNodeDeck: React.FC<{
nodeExecutionId: Core.NodeExecutionIdentifier;
className?: string;
}> = ({ nodeExecutionId, className = '' }) => {
const downloadLink = useDownloadLink(nodeExecutionId);
downloadLink: ReturnType<typeof useDownloadLink>;
}> = ({ className = '', downloadLink }) => {
const iFrameSrc = downloadLink?.value?.signedUrl?.[0];

// Taken from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
Expand All @@ -27,6 +28,22 @@
'allow-downloads',
].join(' ');

if (downloadLink?.lastError instanceof NotFoundError) {
return (

Check warning on line 32 in packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx#L31-L32

Added lines #L31 - L32 were not covered by tests
<div style={{ textAlign: 'center' }}>
<h1>The deck will be ready soon. Please try again later.</h1>
<p>
If you're using the real-time deck, it's because the 'publish' function has not been
invoked yet.
</p>
<p>
If you're not using the real-time deck, it's because the corresponding task is still in
progress.
</p>
</div>
);
}

return (
<WaitForData {...downloadLink} loadingComponent={LoadingSpinner}>
<iframe
Expand Down
Loading