11import React , { FC , useEffect , useMemo , useRef , useState } from 'react' ;
22import IconButton from '@mui/material/IconButton' ;
33import Typography from '@mui/material/Typography' ;
4+ import Modal from '@mui/material/Modal' ;
45import Tab from '@mui/material/Tab' ;
56import Tabs from '@mui/material/Tabs' ;
67import ArrowBackIos from '@mui/icons-material/ArrowBackIos' ;
78import Close from '@mui/icons-material/Close' ;
9+ import OpenInFullIcon from '@mui/icons-material/OpenInFull' ;
810import classnames from 'classnames' ;
911import { LocationDescriptor } from 'history' ;
1012import 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+
129148const 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+
230269interface 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