Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ export class AssetDetailsComponent implements OnInit, AfterViewInit, OnDestroy {
this.policyAvailable[0] = true;
this.showLoader[0] = true;
} else {
this.violationErrorMessage = 'noDataAvailable';
this.violationErrorMessage = 'noViolationsForAsset';
this.policyValue = false;
this.showLoader[0] = true;
this.summary.violation = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
></app-asset-trend-graph>
</div>
</mat-card-content>
<mat-card-actions *ngIf="card.footer">
<mat-card-actions *ngIf="card.footer && !dataError">
<button (click)="card.cardButtonAction()">
{{ card.footer }} <img src="/assets/icons/right-arrow-icon.svg" />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ export class ComplianceDashboardComponent implements OnInit, OnDestroy {
this.policyDataError = '';
this.updatePoliciesTable();
this.getDistributionBySeverity();
this.getComplianceData();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Ensure proper error handling in getComplianceData.

  • The current implementation of getComplianceData does not include comprehensive error handling. While it checks for an error in the response and throws it, there is no catch block or subscription error handling to manage potential errors from the getOverallCompliance service call.

Category:

Analysis chain

Ensure proper error handling in getComplianceData.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that error handling is implemented in `getComplianceData`.

# Test: Search for error handling in the method. Expect: Error handling code.
rg --type typescript $'getComplianceData' webapp/src/app/pacman-features/modules/compliance/compliance-dashboard/compliance-dashboard.component.ts

Length of output: 180



Script:

#!/bin/bash
# Description: Verify that error handling is implemented in `getComplianceData`.

# Test: Search for error handling in the method. Expect: Error handling code.
rg --type ts 'getComplianceData' webapp/src/app/pacman-features/modules/compliance/compliance-dashboard/compliance-dashboard.component.ts

Length of output: 205



Script:

#!/bin/bash
# Description: Extract the full implementation of the `getComplianceData` method to verify error handling.

# Test: Use ast-grep to extract the method implementation.
ast-grep --lang typescript --pattern $'class ComplianceDashboardComponent {
  $$$
  private getComplianceData() {
    $$$
  }
  $$$  
}' webapp/src/app/pacman-features/modules/compliance/compliance-dashboard/compliance-dashboard.component.ts

Length of output: 242



Script:

#!/bin/bash
# Description: Extract the full implementation of the `getComplianceData` method to verify error handling.

# Test: Use rg with context lines to extract the method implementation.
rg 'private getComplianceData' -A 20 -B 2 webapp/src/app/pacman-features/modules/compliance/compliance-dashboard/compliance-dashboard.component.ts

Length of output: 1024

}

updatePoliciesTable() {
Expand Down
5 changes: 3 additions & 2 deletions webapp/src/app/shared/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ export const MESSAGES = {
image: '/assets/images/empty-state.svg',
},
noPolicyFound: {
title: '',
description: 'There are no active Policies for this Asset Type.',
image: '/assets/images/empty-state.svg',
},
noSearchFound: {
title: 'No Search Found!!',
Expand All @@ -133,5 +131,8 @@ export const MESSAGES = {
description: 'The trend graph requires upto two days to display data.',
image: '/assets/images/glass-timer.svg',
},
noViolationsForAsset: {
description: 'There are no violations for this asset.',
},
},
};