@@ -2315,28 +2315,38 @@ export class TenableVulnerabilitiesComponent implements OnInit, OnDestroy {
2315
2315
2316
2316
async onPoamIconClick ( vulnerability : any , event : Event ) {
2317
2317
event . stopPropagation ( ) ;
2318
- const poamAssociation = this . existingPoamPluginIDs [ vulnerability . pluginID ] ;
2319
- if ( poamAssociation ?. poamId ) {
2320
- this . router . navigateByUrl ( `/poam-processing/poam-details/${ poamAssociation . poamId } ` ) ;
2321
- return ;
2322
- }
2323
-
2324
- await this . showDetails ( vulnerability , true ) ;
2325
- const pluginIAVData = this . iavInfo [ this . pluginData . id ] ;
2326
- let formattedIavComplyByDate = null ;
2327
- if ( pluginIAVData ?. navyComplyDate ) {
2328
- const complyDate = new Date ( pluginIAVData . navyComplyDate ) ;
2329
- formattedIavComplyByDate = format ( complyDate , 'yyyy-MM-dd' ) ;
2330
- }
2331
-
2332
- this . router . navigate ( [ '/poam-processing/poam-details/ADDPOAM' ] , {
2333
- state : {
2334
- vulnerabilitySource : 'Assured Compliance Assessment Solution (ACAS) Nessus Scanner' ,
2335
- pluginData : this . pluginData ,
2336
- iavNumber : pluginIAVData ?. iav ,
2337
- iavComplyByDate : formattedIavComplyByDate ,
2338
- } ,
2339
- } ) ;
2318
+ try {
2319
+ const poamAssociation = this . existingPoamPluginIDs [ vulnerability . pluginID ] ;
2320
+ if ( poamAssociation ?. poamId ) {
2321
+ this . router . navigateByUrl ( `/poam-processing/poam-details/${ poamAssociation . poamId } ` ) ;
2322
+ return ;
2323
+ }
2324
+
2325
+ await this . showDetails ( vulnerability , true ) ;
2326
+
2327
+ if ( ! this . pluginData ) {
2328
+ throw new Error ( 'Plugin data not available' ) ;
2329
+ }
2330
+
2331
+ const pluginIAVData = this . iavInfo [ this . pluginData . id ] ;
2332
+ let formattedIavComplyByDate = null ;
2333
+ if ( pluginIAVData ?. navyComplyDate ) {
2334
+ const complyDate = new Date ( pluginIAVData . navyComplyDate ) ;
2335
+ formattedIavComplyByDate = format ( complyDate , 'yyyy-MM-dd' ) ;
2336
+ }
2337
+
2338
+ this . router . navigate ( [ '/poam-processing/poam-details/ADDPOAM' ] , {
2339
+ state : {
2340
+ vulnerabilitySource : 'Assured Compliance Assessment Solution (ACAS) Nessus Scanner' ,
2341
+ pluginData : this . pluginData ,
2342
+ iavNumber : pluginIAVData ?. iav ,
2343
+ iavComplyByDate : formattedIavComplyByDate ,
2344
+ } ,
2345
+ } ) ;
2346
+ } catch ( error ) {
2347
+ console . error ( 'Error in onPoamIconClick:' , error ) ;
2348
+ this . showErrorMessage ( 'Error processing vulnerability data. Please try again.' ) ;
2349
+ }
2340
2350
}
2341
2351
2342
2352
getPoamStatusColor ( status : string ) : string {
@@ -2384,51 +2394,55 @@ export class TenableVulnerabilitiesComponent implements OnInit, OnDestroy {
2384
2394
}
2385
2395
}
2386
2396
2387
- showDetails ( vulnerability : any , createPoam : boolean = false ) {
2397
+ showDetails ( vulnerability : any , createPoam : boolean = false ) : Promise < void > {
2388
2398
if ( ! vulnerability || ! vulnerability . pluginID ) {
2389
2399
this . showErrorMessage ( 'Invalid vulnerability data' ) ;
2390
- return ;
2400
+ return Promise . reject ( 'Invalid vulnerability data' ) ;
2391
2401
}
2392
2402
2393
- this . importService . getTenablePlugin ( vulnerability . pluginID ) . pipe (
2394
- tap ( data => {
2395
- if ( ! data || ! data . response ) {
2396
- throw new Error ( 'Invalid response from getTenablePlugin' ) ;
2397
- }
2398
- } ) ,
2399
- map ( data => data . response )
2400
- ) . subscribe ( {
2401
- next : ( pluginData ) => {
2402
- this . pluginData = pluginData ;
2403
- this . formattedDescription = this . pluginData . description
2404
- ? this . sanitizer . bypassSecurityTrustHtml (
2405
- this . pluginData . description . replace ( / \n \n / g, '<br>' )
2406
- )
2407
- : '' ;
2408
-
2409
- if ( this . pluginData . xrefs && this . pluginData . xrefs . length > 0 ) {
2410
- this . parseReferences ( this . pluginData . xrefs ) ;
2411
- } else {
2412
- this . cveReferences = [ ] ;
2413
- this . iavReferences = [ ] ;
2414
- this . otherReferences = [ ] ;
2415
- }
2403
+ return new Promise ( ( resolve , reject ) => {
2404
+ this . importService . getTenablePlugin ( vulnerability . pluginID ) . pipe (
2405
+ tap ( data => {
2406
+ if ( ! data || ! data . response ) {
2407
+ throw new Error ( 'Invalid response from getTenablePlugin' ) ;
2408
+ }
2409
+ } ) ,
2410
+ map ( data => data . response )
2411
+ ) . subscribe ( {
2412
+ next : ( pluginData ) => {
2413
+ this . pluginData = pluginData ;
2414
+ this . formattedDescription = this . pluginData . description
2415
+ ? this . sanitizer . bypassSecurityTrustHtml (
2416
+ this . pluginData . description . replace ( / \n \n / g, '<br>' )
2417
+ )
2418
+ : '' ;
2419
+
2420
+ if ( this . pluginData . xrefs && this . pluginData . xrefs . length > 0 ) {
2421
+ this . parseReferences ( this . pluginData . xrefs ) ;
2422
+ } else {
2423
+ this . cveReferences = [ ] ;
2424
+ this . iavReferences = [ ] ;
2425
+ this . otherReferences = [ ] ;
2426
+ }
2416
2427
2417
- if ( Array . isArray ( this . pluginData . vprContext ) ) {
2418
- this . parseVprContext ( this . pluginData . vprContext ) ;
2419
- } else {
2420
- this . parsedVprContext = [ ] ;
2421
- }
2428
+ if ( Array . isArray ( this . pluginData . vprContext ) ) {
2429
+ this . parseVprContext ( this . pluginData . vprContext ) ;
2430
+ } else {
2431
+ this . parsedVprContext = [ ] ;
2432
+ }
2422
2433
2423
- this . selectedVulnerability = vulnerability ;
2424
- if ( ! createPoam ) {
2425
- this . displayDialog = true ;
2434
+ this . selectedVulnerability = vulnerability ;
2435
+ if ( ! createPoam ) {
2436
+ this . displayDialog = true ;
2437
+ }
2438
+ resolve ( ) ;
2439
+ } ,
2440
+ error : ( error ) => {
2441
+ console . error ( 'Error fetching plugin data:' , error ) ;
2442
+ this . showErrorMessage ( 'Error fetching plugin data. Please try again.' ) ;
2443
+ reject ( error ) ;
2426
2444
}
2427
- } ,
2428
- error : ( error ) => {
2429
- console . error ( 'Error fetching plugin data:' , error ) ;
2430
- this . showErrorMessage ( 'Error fetching plugin data. Please try again.' ) ;
2431
- }
2445
+ } ) ;
2432
2446
} ) ;
2433
2447
}
2434
2448
0 commit comments