@@ -50,6 +50,10 @@ export interface TriggerExecutionData {
5050 logs : ExecutionLogEntry [ ] ;
5151}
5252
53+ // Success rate thresholds for color coding (percentage)
54+ const SUCCESS_CRITERIA_EXCELLENT = 90 ;
55+ const SUCCESS_CRITERIA_ACCEPTABLE = 70 ;
56+
5357// Helper function to map ExecutionStatus to display status
5458const mapExecutionStatus = (
5559 status : ExecutionStatus
@@ -164,6 +168,13 @@ const getStatusColor = (status: ExecutionLogEntry['status']) => {
164168 }
165169} ;
166170
171+ const getSuccessRateColorClass = ( rate : number | null ) : string => {
172+ if ( rate === null ) return 'text-text-label' ;
173+ if ( rate >= SUCCESS_CRITERIA_EXCELLENT ) return 'text-icon-success' ;
174+ if ( rate >= SUCCESS_CRITERIA_ACCEPTABLE ) return 'text-icon-warning' ;
175+ return 'text-icon-caution' ;
176+ } ;
177+
167178interface ExecutionLogsProps {
168179 triggerId : number ;
169180}
@@ -275,12 +286,12 @@ export function ExecutionLogs({ triggerId }: ExecutionLogsProps) {
275286 const successfulExecutions = Array . isArray ( executions )
276287 ? executions . filter ( ( e ) => e . status === ExecutionStatus . Completed )
277288 : [ ] ;
278- const successRate =
289+ const successRate : number | null =
279290 completedExecutions . length > 0
280291 ? Math . round (
281292 ( successfulExecutions . length / completedExecutions . length ) * 100
282293 )
283- : 0 ;
294+ : null ;
284295
285296 return (
286297 < div className = "flex h-full flex-col" >
@@ -314,9 +325,9 @@ export function ExecutionLogs({ triggerId }: ExecutionLogsProps) {
314325 </ div >
315326 < div className = "border-r-1 mr-4 flex flex-col border-y-0 border-l-0 border-solid border-border-tertiary pr-4" >
316327 < span
317- className = { `text-label-sm font-medium ${ successRate >= 90 ? 'text-icon-success' : successRate >= 70 ? 'text-icon-warning' : 'text-icon-cuation' } ` }
328+ className = { `text-label-sm font-medium ${ getSuccessRateColorClass ( successRate ) } ` }
318329 >
319- { successRate } %
330+ { successRate !== null ? ` ${ successRate } %` : '-' }
320331 </ span >
321332 < span className = "text-label-xs text-text-label" >
322333 { t ( 'triggers.success-rate' ) }
0 commit comments