@@ -88,7 +88,52 @@ function getExecutionListenerLabel(jobData) {
8888 return 'execution listener' ;
8989}
9090
91+ function getStatusDetails ( entry ) {
92+ const data = entry . data ;
93+
94+ if ( ! data ) {
95+ return [ ] ;
96+ }
97+
98+ const details = [ ] ;
99+
100+ if ( entry . status === 'deploying' ) {
101+ const response = data . response ;
102+ if ( ! response ) return [ ] ;
103+ const deployment = response . deployments ?. [ 0 ] ;
104+ const processDef = deployment ?. processDefinition ;
105+
106+ if ( processDef ?. processDefinitionId ) details . push ( { label : 'Process' , value : processDef . processDefinitionId } ) ;
107+ if ( processDef ?. processDefinitionKey ) details . push ( { label : 'Definition Key' , value : processDef . processDefinitionKey } ) ;
108+ if ( processDef ?. processDefinitionVersion ) details . push ( { label : 'Version' , value : String ( processDef . processDefinitionVersion ) } ) ;
109+ if ( response . deploymentKey ) details . push ( { label : 'Deployment Key' , value : response . deploymentKey } ) ;
110+ }
111+
112+ if ( entry . status === 'starting-instance' ) {
113+ const response = data . response ;
114+ if ( data . processInstanceKey ) details . push ( { label : 'Instance Key' , value : data . processInstanceKey } ) ;
115+ if ( response ?. processDefinitionId ) details . push ( { label : 'Process' , value : response . processDefinitionId } ) ;
116+ if ( response ?. processDefinitionKey ) details . push ( { label : 'Definition Key' , value : response . processDefinitionKey } ) ;
117+ }
118+
119+ if ( entry . status === 'completed' || entry . status === 'terminated' ) {
120+ if ( data . processInstanceKey ) details . push ( { label : 'Instance Key' , value : data . processInstanceKey } ) ;
121+ }
122+
123+ if ( entry . status === 'incident' ) {
124+ if ( data . processInstanceKey ) details . push ( { label : 'Instance Key' , value : data . processInstanceKey } ) ;
125+ if ( data . incident ?. errorType ) details . push ( { label : 'Error Type' , value : data . incident . errorType } ) ;
126+ if ( data . incident ?. errorMessage ) details . push ( { label : 'Error' , value : data . incident . errorMessage } ) ;
127+ }
128+
129+ return details ;
130+ }
131+
91132function getEntryDetails ( entry ) {
133+ if ( entry . type === 'status' ) {
134+ return getStatusDetails ( entry ) ;
135+ }
136+
92137 if ( entry . type === 'job' ) {
93138 const data = entry . data ;
94139 const details = [ ] ;
@@ -184,12 +229,23 @@ export function ExecutionLog({ entries, tasklistBaseUrl, currentOperateUrl }) {
184229}
185230
186231function StatusEntry ( { entry } ) {
232+ const [ expanded , setExpanded ] = useState ( false ) ;
187233 const label = STATUS_LABELS [ entry . status ] ;
188234
189235 if ( ! label ) {
190236 return null ;
191237 }
192238
239+ const details = getStatusDetails ( entry ) ;
240+ const hasDetails = details . length > 0 ;
241+ const isExpandable = hasDetails ;
242+
243+ const handleExpandToggle = ( ) => {
244+ if ( isExpandable ) {
245+ setExpanded ( ! expanded ) ;
246+ }
247+ } ;
248+
193249 const wrapperClass = [
194250 'execution-log__entry-wrapper' ,
195251 entry . status === 'completed' ? 'execution-log__entry-wrapper--success' : '' ,
@@ -198,12 +254,43 @@ function StatusEntry({ entry }) {
198254 entry . status === 'canceled' ? 'execution-log__entry-wrapper--canceled' : ''
199255 ] . filter ( Boolean ) . join ( ' ' ) ;
200256
257+ const entryClass = [
258+ 'execution-log__entry' ,
259+ isExpandable ? 'execution-log__entry--expandable' : ''
260+ ] . filter ( Boolean ) . join ( ' ' ) ;
261+
201262 return (
202263 < li className = { wrapperClass } >
203- < div className = "execution-log__entry" data-type = "status" data-timestamp = { entry . timestamp } >
264+ < div
265+ className = { entryClass }
266+ data-type = "status"
267+ data-timestamp = { entry . timestamp }
268+ onClick = { isExpandable ? handleExpandToggle : undefined }
269+ >
204270 < span className = "execution-log__timestamp" > { formatTime ( entry . timestamp ) } </ span >
205271 < span className = "execution-log__label" > { label } </ span >
272+ { isExpandable && (
273+ < span
274+ className = "execution-log__toggle"
275+ onClick = { ( event ) => {
276+ event . stopPropagation ( ) ;
277+ handleExpandToggle ( ) ;
278+ } }
279+ >
280+ { expanded ? < ChevronDown size = { 14 } /> : < ChevronRight size = { 14 } /> }
281+ </ span >
282+ ) }
206283 </ div >
284+ { expanded && hasDetails && (
285+ < dl className = "execution-log__details" >
286+ { details . map ( ( { label, value } , i ) => (
287+ < div key = { i } className = "execution-log__details-row" >
288+ < dt className = "execution-log__details-label" > { label } </ dt >
289+ < dd className = "execution-log__details-value" > { value } </ dd >
290+ </ div >
291+ ) ) }
292+ </ dl >
293+ ) }
207294 </ li >
208295 ) ;
209296}
0 commit comments