@@ -7,6 +7,7 @@ import type {
77 InsightsEolScanComponent ,
88 InsightsEolScanComponentInfo ,
99} from '../api/types/nes.types.ts' ;
10+ import { config } from '../config/constants.ts' ;
1011import { resolvePurlPackageName } from '../service/eol/eol.svc.ts' ;
1112import { parseMomentToSimpleDate } from './date.ui.ts' ;
1213import { INDICATORS , MAX_PURL_LENGTH , MAX_TABLE_COLUMN_WIDTH , STATUS_COLORS } from './shared.ui.ts' ;
@@ -44,13 +45,13 @@ function formatDetailedComponent(purl: string, info: InsightsEolScanComponentInf
4445 const eolAtString = parseMomentToSimpleDate ( eolAt ) ;
4546 const daysEolString = getDaysEolString ( daysEol ) ;
4647
47- const output = [
48- ` ${ simpleComponent } ` ,
49- ` ⮑ EOL Date: ${ eolAtString } ( ${ daysEolString } )` ,
50- ` ⮑ # of Vulns: ${ vulnCount ?? '' } ` ,
51- ]
52- . filter ( Boolean )
53- . join ( '\n' ) ;
48+ const eolString = [ ` ${ simpleComponent } ` , ` ⮑ EOL Date: ${ eolAtString } ( ${ daysEolString } )` ] ;
49+
50+ if ( config . showVulnCount ) {
51+ eolString . push ( ` ⮑ # of Vulns: ${ vulnCount ?? '' } ` ) ;
52+ }
53+
54+ const output = eolString . filter ( Boolean ) . join ( '\n' ) ;
5455
5556 return output ;
5657}
@@ -90,6 +91,19 @@ export function createTableForStatus(
9091 const data = grouped [ status ] . map ( ( component ) => convertComponentToTableRow ( component ) ) ;
9192
9293 if ( status === 'EOL' || status === 'SUPPORTED' ) {
94+ if ( config . showVulnCount ) {
95+ return makeTable ( {
96+ data,
97+ columns : [
98+ { key : 'name' , name : 'NAME' , width : MAX_TABLE_COLUMN_WIDTH } ,
99+ { key : 'version' , name : 'VERSION' , width : 10 } ,
100+ { key : 'eol' , name : 'EOL' , width : 12 } ,
101+ { key : 'daysEol' , name : 'DAYS EOL' , width : 10 } ,
102+ { key : 'type' , name : 'TYPE' , width : 12 } ,
103+ { key : 'vulnCount' , name : '# OF VULNS' , width : 12 } ,
104+ ] ,
105+ } ) ;
106+ }
93107 return makeTable ( {
94108 data,
95109 columns : [
@@ -98,17 +112,28 @@ export function createTableForStatus(
98112 { key : 'eol' , name : 'EOL' , width : 12 } ,
99113 { key : 'daysEol' , name : 'DAYS EOL' , width : 10 } ,
100114 { key : 'type' , name : 'TYPE' , width : 12 } ,
115+ ] ,
116+ } ) ;
117+ }
118+
119+ if ( config . showVulnCount ) {
120+ return makeTable ( {
121+ data,
122+ columns : [
123+ { key : 'name' , name : 'NAME' , width : MAX_TABLE_COLUMN_WIDTH } ,
124+ { key : 'version' , name : 'VERSION' , width : 10 } ,
125+ { key : 'type' , name : 'TYPE' , width : 12 } ,
101126 { key : 'vulnCount' , name : '# OF VULNS' , width : 12 } ,
102127 ] ,
103128 } ) ;
104129 }
130+
105131 return makeTable ( {
106132 data,
107133 columns : [
108134 { key : 'name' , name : 'NAME' , width : MAX_TABLE_COLUMN_WIDTH } ,
109135 { key : 'version' , name : 'VERSION' , width : 10 } ,
110136 { key : 'type' , name : 'TYPE' , width : 12 } ,
111- { key : 'vulnCount' , name : '# OF VULNS' , width : 12 } ,
112137 ] ,
113138 } ) ;
114139}
0 commit comments