File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed
WorkflowDefinitionViewerPage Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ const WorkflowDefinitionDetailsCard = ({
62
62
status = {
63
63
formattedWorkflowOverview ?. lastRunStatus as ProcessInstanceStateValues
64
64
}
65
+ lastRunId = { formattedWorkflowOverview ?. lastRunId }
65
66
/>
66
67
) : (
67
68
VALUE_UNAVAILABLE
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
3
+ import { Link } from '@backstage/core-components' ;
4
+ import { useRouteRef } from '@backstage/core-plugin-api' ;
5
+
3
6
import DotIcon from '@material-ui/icons/FiberManualRecord' ;
4
7
5
8
import {
@@ -9,13 +12,17 @@ import {
9
12
10
13
import { VALUE_UNAVAILABLE } from '../constants' ;
11
14
import { useWorkflowInstanceStateColors } from '../hooks/useWorkflowInstanceStatusColors' ;
15
+ import { workflowInstanceRouteRef } from '../routes' ;
12
16
13
17
export const WorkflowInstanceStatusIndicator = ( {
14
18
status,
19
+ lastRunId,
15
20
} : {
16
21
status ?: ProcessInstanceStateValues ;
22
+ lastRunId ?: string ;
17
23
} ) => {
18
24
const iconColor = useWorkflowInstanceStateColors ( status ) ;
25
+ const workflowInstanceLink = useRouteRef ( workflowInstanceRouteRef ) ;
19
26
20
27
if ( ! status ) {
21
28
return VALUE_UNAVAILABLE ;
@@ -24,7 +31,13 @@ export const WorkflowInstanceStatusIndicator = ({
24
31
return (
25
32
< >
26
33
< DotIcon style = { { fontSize : '0.75rem' } } className = { iconColor } /> { ' ' }
27
- { capitalize ( status ) }
34
+ { lastRunId ? (
35
+ < Link to = { workflowInstanceLink ( { instanceId : lastRunId } ) } >
36
+ { capitalize ( status ) }
37
+ </ Link >
38
+ ) : (
39
+ < > { capitalize ( status ) } </ >
40
+ ) }
28
41
</ >
29
42
) ;
30
43
} ;
Original file line number Diff line number Diff line change @@ -104,9 +104,11 @@ export const WorkflowsTable = ({ items }: WorkflowsTableProps) => {
104
104
title : 'Last run status' ,
105
105
field : 'lastRunStatus' ,
106
106
render : rowData =>
107
- rowData . lastRunStatus !== VALUE_UNAVAILABLE ? (
107
+ rowData . lastRunStatus !== VALUE_UNAVAILABLE &&
108
+ rowData . lastRunId !== VALUE_UNAVAILABLE ? (
108
109
< WorkflowInstanceStatusIndicator
109
110
status = { rowData . lastRunStatus as ProcessInstanceStateValues }
111
+ lastRunId = { rowData . lastRunId }
110
112
/>
111
113
) : (
112
114
VALUE_UNAVAILABLE
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export interface FormattedWorkflowOverview {
13
13
readonly name : string ;
14
14
readonly lastTriggered : string ;
15
15
readonly lastRunStatus : string ;
16
+ readonly lastRunId : string ;
16
17
readonly category : string ;
17
18
readonly avgDuration : string ;
18
19
readonly description : string ;
@@ -34,6 +35,7 @@ const WorkflowOverviewFormatter: DataFormatter<
34
35
? moment ( data . lastTriggeredMs ) . toDate ( ) . toLocaleString ( )
35
36
: VALUE_UNAVAILABLE ,
36
37
lastRunStatus : data . lastRunStatus ?? VALUE_UNAVAILABLE ,
38
+ lastRunId : data . lastRunId ?? VALUE_UNAVAILABLE ,
37
39
category : data . category ?? VALUE_UNAVAILABLE ,
38
40
avgDuration : data . avgDurationMs
39
41
? formatDuration ( data . avgDurationMs )
You can’t perform that action at this time.
0 commit comments