@@ -10,12 +10,7 @@ import {
10
10
mapSeveritiesToSegmentedBarChartEntities ,
11
11
stringifySeverities ,
12
12
} from '../utils'
13
- import {
14
- MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID ,
15
- SCAN_FAILED_EMPTY_STATE ,
16
- SCAN_IN_PROGRESS_EMPTY_STATE ,
17
- SEVERITY_DEFAULT_SORT_ORDER ,
18
- } from '../constants'
13
+ import { SCAN_FAILED_EMPTY_STATE , SCAN_IN_PROGRESS_EMPTY_STATE , SEVERITY_DEFAULT_SORT_ORDER } from '../constants'
19
14
import {
20
15
ScanResultDTO ,
21
16
CATEGORIES ,
@@ -164,6 +159,7 @@ const getMisconfigurationsDetail = (
164
159
lastScanTimeString : string ,
165
160
status : StatusType [ 'status' ] ,
166
161
scanToolName : StatusType [ 'scanToolName' ] ,
162
+ scanToolUrl : StatusType [ 'scanToolUrl' ] ,
167
163
) => ( {
168
164
titlePrefix : 'File path' ,
169
165
title : element . filePath ,
@@ -231,7 +227,8 @@ const getMisconfigurationsDetail = (
231
227
defaultSortIndex : 1 ,
232
228
entities : mapSeveritiesToSegmentedBarChartEntities ( element . misConfSummary . status ) ,
233
229
lastScanTimeString,
234
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ scanToolName ] ,
230
+ scanToolName,
231
+ scanToolUrl,
235
232
hasExpandableRows : true ,
236
233
status,
237
234
} )
@@ -242,6 +239,7 @@ export const getCodeScanMisconfigurations = (
242
239
lastScanTimeString : string ,
243
240
status : StatusType [ 'status' ] ,
244
241
scanToolName : StatusType [ 'scanToolName' ] ,
242
+ scanToolUrl : StatusType [ 'scanToolUrl' ] ,
245
243
) => ( {
246
244
headers : [
247
245
{ headerText : 'file path (relative)' , isSortable : true , width : 289 } ,
@@ -262,6 +260,7 @@ export const getCodeScanMisconfigurations = (
262
260
lastScanTimeString ,
263
261
status ,
264
262
scanToolName ,
263
+ scanToolUrl ,
265
264
) }
266
265
setDetailViewData = { setDetailViewData }
267
266
>
@@ -287,6 +286,7 @@ const getExposedSecretsDetail = (
287
286
lastScanTimeString : string ,
288
287
status : StatusType [ 'status' ] ,
289
288
scanToolName : StatusType [ 'scanToolName' ] ,
289
+ scanToolUrl : StatusType [ 'scanToolUrl' ] ,
290
290
) => ( {
291
291
titlePrefix : 'File' ,
292
292
title : element . filePath ,
@@ -336,7 +336,8 @@ const getExposedSecretsDetail = (
336
336
defaultSortIndex : 1 ,
337
337
entities : mapSeveritiesToSegmentedBarChartEntities ( element . summary . severities ) ,
338
338
lastScanTimeString,
339
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ scanToolName ] ,
339
+ scanToolName,
340
+ scanToolUrl,
340
341
hasExpandableRows : true ,
341
342
status,
342
343
} )
@@ -347,6 +348,7 @@ export const getCodeScanExposedSecrets = (
347
348
lastScanTimeString : string ,
348
349
status : StatusType [ 'status' ] ,
349
350
scanToolName : StatusType [ 'scanToolName' ] ,
351
+ scanToolUrl : StatusType [ 'scanToolUrl' ] ,
350
352
) => ( {
351
353
headers : [
352
354
{ headerText : 'file path (relative)' , isSortable : true , width : 372 } ,
@@ -366,6 +368,7 @@ export const getCodeScanExposedSecrets = (
366
368
lastScanTimeString ,
367
369
status ,
368
370
scanToolName ,
371
+ scanToolUrl ,
369
372
) }
370
373
setDetailViewData = { setDetailViewData }
371
374
>
@@ -400,6 +403,7 @@ export const getCodeScanTableData = (
400
403
data . StartedOn ,
401
404
data . status ,
402
405
data . scanToolName ,
406
+ data . scanToolUrl ,
403
407
)
404
408
case SUB_CATEGORIES . EXPOSED_SECRETS :
405
409
return getCodeScanExposedSecrets (
@@ -408,6 +412,7 @@ export const getCodeScanTableData = (
408
412
data . StartedOn ,
409
413
data . status ,
410
414
data . scanToolName ,
415
+ data . scanToolUrl ,
411
416
)
412
417
default :
413
418
return null
@@ -418,30 +423,32 @@ export const getCodeScanInfoCardData = (
418
423
data : CodeScan ,
419
424
subCategory : SecurityModalStateType [ 'subCategory' ] ,
420
425
) : InfoCardPropsType => {
426
+ const { StartedOn, scanToolName, scanToolUrl } = data
427
+ const scanInfo : Omit < InfoCardPropsType , 'entities' > = {
428
+ lastScanTimeString : StartedOn ,
429
+ scanToolName,
430
+ scanToolUrl,
431
+ }
421
432
switch ( subCategory ) {
422
433
case SUB_CATEGORIES . VULNERABILITIES :
423
434
return {
424
435
entities : mapSeveritiesToSegmentedBarChartEntities ( data [ subCategory ] ?. summary . severities ) ,
425
- lastScanTimeString : data . StartedOn ,
426
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ data . scanToolName ] ,
436
+ ...scanInfo ,
427
437
}
428
438
case SUB_CATEGORIES . LICENSE :
429
439
return {
430
440
entities : mapSeveritiesToSegmentedBarChartEntities ( data [ subCategory ] ?. summary . severities ) ,
431
- lastScanTimeString : data . StartedOn ,
432
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ data . scanToolName ] ,
441
+ ...scanInfo ,
433
442
}
434
443
case SUB_CATEGORIES . MISCONFIGURATIONS :
435
444
return {
436
445
entities : mapSeveritiesToSegmentedBarChartEntities ( data [ subCategory ] ?. misConfSummary . status ) ,
437
- lastScanTimeString : data . StartedOn ,
438
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ data . scanToolName ] ,
446
+ ...scanInfo ,
439
447
}
440
448
case SUB_CATEGORIES . EXPOSED_SECRETS :
441
449
return {
442
450
entities : mapSeveritiesToSegmentedBarChartEntities ( data [ subCategory ] ?. summary . severities ) ,
443
- lastScanTimeString : data . StartedOn ,
444
- scanToolId : MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ data . scanToolName ] ,
451
+ ...scanInfo ,
445
452
}
446
453
default :
447
454
return null
@@ -460,27 +467,28 @@ const getCompletedEmptyState = (
460
467
461
468
const detailViewTitleText = detailViewData ? `${ detailViewData . titlePrefix } : ${ detailViewData . title } ` : ''
462
469
const subTitleText = detailViewTitleText || 'code scan'
463
- const scanToolId = MAP_SCAN_TOOL_NAME_TO_SCAN_TOOL_ID [ data . scanToolName ]
470
+ const { scanToolName, scanToolUrl } = data
471
+ const scanCompletedState = getScanCompletedEmptyState ( scanToolName , scanToolUrl )
464
472
465
473
switch ( subCategory ) {
466
474
case SUB_CATEGORIES . VULNERABILITIES :
467
475
return {
468
- ...getScanCompletedEmptyState ( scanToolId ) ,
476
+ ...scanCompletedState ,
469
477
subTitle : `No security vulnerability found in ${ subTitleText } ` ,
470
478
}
471
479
case SUB_CATEGORIES . LICENSE :
472
480
return {
473
- ...getScanCompletedEmptyState ( scanToolId ) ,
481
+ ...scanCompletedState ,
474
482
subTitle : `No license risks found in ${ subTitleText } ` ,
475
483
}
476
484
case SUB_CATEGORIES . MISCONFIGURATIONS :
477
485
return {
478
- ...getScanCompletedEmptyState ( scanToolId ) ,
486
+ ...scanCompletedState ,
479
487
subTitle : `No misconfigurations found in ${ subTitleText } ` ,
480
488
}
481
489
case SUB_CATEGORIES . EXPOSED_SECRETS :
482
490
return {
483
- ...getScanCompletedEmptyState ( scanToolId ) ,
491
+ ...scanCompletedState ,
484
492
subTitle : `No exposed secrets found in ${ subTitleText } ` ,
485
493
}
486
494
default :
0 commit comments