Skip to content

Commit

Permalink
move refresh button out
Browse files Browse the repository at this point in the history
Signed-off-by: Lyon Lu <[email protected]>
  • Loading branch information
lyonlu13 committed Dec 12, 2024
1 parent f5d884f commit 290f3ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Grid from '@mui/material/Grid';
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,13 +54,11 @@ export const FlyteDeckButton: FC<FlyteDeckButtonProps> = ({
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)}
>
<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 @@ -90,10 +90,17 @@ export const FlyteDeckButton: FC<FlyteDeckButtonProps> = ({
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 @@ -108,7 +115,7 @@ export const FlyteDeckButton: FC<FlyteDeckButtonProps> = ({
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
Expand Up @@ -9,8 +9,8 @@ import { WaitForData } from '../../common/WaitForData';
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 Down Expand Up @@ -40,22 +40,6 @@ export const ExecutionNodeDeck: React.FC<{
If you're not using the real-time deck, it's because the corresponding task is still in
progress.
</p>
<button
onClick={() => downloadLink.fetch()}
style={{
marginTop: '20px',
padding: '10px 20px',
fontSize: '16px',
fontWeight: 'bold',
color: '#fff',
backgroundColor: '#a31aff',
border: 'none',
borderRadius: '4px',
cursor: 'pointer',
}}
>
Refresh
</button>
</div>
);
}
Expand Down

0 comments on commit 290f3ae

Please sign in to comment.