Skip to content

Commit aebdc40

Browse files
feat(log-panel): Add a button to show log panel in popup window
Resolves: flyteorg/flyte#5108 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
1 parent 7e0f2bd commit aebdc40

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

packages/oss-console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React, { FC, useEffect, useMemo, useRef, useState } from 'react';
22
import IconButton from '@mui/material/IconButton';
33
import Typography from '@mui/material/Typography';
4+
import Modal from '@mui/material/Modal';
45
import Tab from '@mui/material/Tab';
56
import Tabs from '@mui/material/Tabs';
67
import ArrowBackIos from '@mui/icons-material/ArrowBackIos';
78
import Close from '@mui/icons-material/Close';
9+
import OpenInFullIcon from '@mui/icons-material/OpenInFull';
810
import classnames from 'classnames';
911
import { LocationDescriptor } from 'history';
1012
import Skeleton from 'react-loading-skeleton';
@@ -105,8 +107,8 @@ const StatusContainer = styled('div')(({ theme }) => ({
105107
marginLeft: theme.spacing(1),
106108
cursor: 'pointer',
107109
},
108-
'& .statusBody': {
109-
marginTop: theme.spacing(2),
110+
'& .reasonsIconContainer': {
111+
textAlign: 'right',
110112
},
111113
}));
112114

@@ -126,6 +128,23 @@ const NotRunStatus = styled('div')(({ theme }) => ({
126128
fontWeight: 'bold',
127129
}));
128130

131+
const ModalScrollableMonospaceText = styled(ScrollableMonospaceText)(({ theme }) => ({
132+
'&': {
133+
position: 'absolute' as 'absolute',
134+
top: '50%',
135+
left: '50%',
136+
transform: 'translate(-50%, -50%)',
137+
width: '85%',
138+
height: '85%',
139+
boxShadow: 12,
140+
},
141+
'& .container': {
142+
maxHeight: '100%',
143+
height: '100%',
144+
flexDirection: 'column',
145+
},
146+
}));
147+
129148
const tabIds = {
130149
executions: 'executions',
131150
inputs: 'inputs',
@@ -227,6 +246,26 @@ const WorkflowTabs: React.FC<{
227246
);
228247
};
229248

249+
const TaskExecutionDetailReasons: React.FC<{ text: string }> = ({ text }) => {
250+
const [open, setOpen] = useState(false);
251+
const handleModalOpen = () => setOpen(true);
252+
const handleModalClose = () => setOpen(false);
253+
254+
return (
255+
<div>
256+
<div className="reasonsIconContainer">
257+
<IconButton onClick={handleModalOpen} title="Open in popup">
258+
<OpenInFullIcon />
259+
</IconButton>
260+
</div>
261+
<ScrollableMonospaceText text={text} />
262+
<Modal open={open} onClose={handleModalClose}>
263+
<ModalScrollableMonospaceText text={text} />
264+
</Modal>
265+
</div>
266+
);
267+
};
268+
230269
interface NodeExecutionStatusProps {
231270
nodeExecution?: NodeExecution;
232271
frontendPhase: NodeExecutionPhase;
@@ -248,11 +287,7 @@ const NodeExecutionStatus: FC<NodeExecutionStatusProps> = ({ nodeExecution, fron
248287
<div className="statusHeaderContainer">
249288
<ExecutionStatusBadge phase={frontendPhase} type="node" />
250289
</div>
251-
{reasons?.length ? (
252-
<div className="statusBody">
253-
<ScrollableMonospaceText text={reasons.join('\n\n')} />
254-
</div>
255-
) : null}
290+
{reasons?.length && <TaskExecutionDetailReasons text={reasons.join('\n\n')} />}
256291
</StatusContainer>
257292
) : (
258293
<NotRunStatus>NOT RUN</NotRunStatus>

0 commit comments

Comments
 (0)