@@ -1100,16 +1100,16 @@ export const getPluginIdsFromBuildStage = (
1100
1100
return pluginIds
1101
1101
}
1102
1102
1103
+ const SEVERITY_ORDER = [
1104
+ { key : SeveritiesDTO . CRITICAL , label : 'Critical' , variant : 'negative' } ,
1105
+ { key : SeveritiesDTO . HIGH , label : 'High' , variant : 'custom' , fontColor : 'R500' , bgColor : 'R100' } ,
1106
+ { key : SeveritiesDTO . MEDIUM , label : 'Medium' , variant : 'custom' , fontColor : 'O600' , bgColor : 'O100' } ,
1107
+ { key : SeveritiesDTO . LOW , label : 'Low' , variant : 'warning' } ,
1108
+ { key : SeveritiesDTO . UNKNOWN , label : 'Unknown' , variant : 'neutral' } ,
1109
+ ] as const
1110
+
1103
1111
export const getSeverityWithCount = ( severityCount : SeverityCount ) => {
1104
- const order = [
1105
- { key : SeveritiesDTO . CRITICAL , label : 'Critical' , variant : 'negative' } ,
1106
- { key : SeveritiesDTO . HIGH , label : 'High' , variant : 'custom' , fontColor : 'R500' , bgColor : 'R100' } ,
1107
- { key : SeveritiesDTO . MEDIUM , label : 'Medium' , variant : 'custom' , fontColor : 'O600' , bgColor : 'O100' } ,
1108
- { key : SeveritiesDTO . LOW , label : 'Low' , variant : 'warning' } ,
1109
- { key : SeveritiesDTO . UNKNOWN , label : 'Unknown' , variant : 'neutral' } ,
1110
- ] as const
1111
-
1112
- for ( const item of order ) {
1112
+ for ( const item of SEVERITY_ORDER ) {
1113
1113
if ( severityCount [ item . key ] ) {
1114
1114
if ( item . variant === 'custom' ) {
1115
1115
return (
@@ -1119,18 +1119,12 @@ export const getSeverityWithCount = (severityCount: SeverityCount) => {
1119
1119
fontColor = { item . fontColor }
1120
1120
bgColor = { item . bgColor }
1121
1121
/>
1122
- ) ;
1123
- } else {
1124
- return (
1125
- < Badge
1126
- label = { `${ severityCount [ item . key ] } ${ item . label } ` }
1127
- variant = { item . variant }
1128
- />
1129
- ) ;
1122
+ )
1130
1123
}
1124
+ return < Badge label = { `${ severityCount [ item . key ] } ${ item . label } ` } variant = { item . variant } />
1131
1125
}
1132
1126
}
1133
- return < Badge label = ' Passed' variant = ' positive' />
1127
+ return < Badge label = " Passed" variant = " positive" />
1134
1128
}
1135
1129
1136
1130
// FIXME: Ideally whole branch calculations should be in fe-lib
0 commit comments