Skip to content

Commit

Permalink
Fix-20459 Wrong sbom status displayed in UI
Browse files Browse the repository at this point in the history
Signed-off-by: xuelichao <xuel@vmware.com>
  • Loading branch information
xuelichao committed May 21, 2024
1 parent be839e6 commit 83c2093
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,10 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.selectedRow[i].sbomDigest =
artifact.sbom_overview.sbom_digest;
}
if (artifact.accessories !== undefined) {
if (
artifact.accessories !== undefined &&
artifact.accessories.length > 0
) {
this.selectedRow[i].accessories = artifact.accessories;
}
this.selectedRow.splice(i, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('ResultSbomComponent (inline template)', () => {
expect(component.sbomOverview.scan_status).toBe(
SBOM_SCAN_STATUS.SUCCESS
);
expect(textContent).toBe('SBOM Detail');
expect(textContent.trim()).toBe('SBOM.Details');
});
});
it('Test ResultSbomComponent getScanner', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export class ResultSbomComponent implements OnInit, OnDestroy {
repositoryName: dbEncodeURIComponent(this.repoName),
reference: this.artifactDigest,
withSbomOverview: true,
withAccessory: true,
XAcceptVulnerabilities: DEFAULT_SUPPORTED_MIME_TYPES,
})
.subscribe(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<div class="tip-wrapper width-215">
<div class="tip-wrapper width-120">
<clr-tooltip>
<div clrTooltipTrigger class="tip-block">
<div *ngIf="showSbomDetailLink()" class="circle-block">
<a
href="javascript:void(0)"
class="digest margin-left-5"
class="digest"
(click)="goIntoArtifactSbomSummaryPage()"
title="{{ 'SBOM.Details' | translate }">
{{ 'SBOM.Details' | translate }}</a
>
</div>
<div
*ngIf="showNoSbom()"
class="pl-1 margin-left-5 tip-wrapper bar-block-none shadow-none width-150">
class="tip-wrapper bar-block-none shadow-none width-120">
{{ 'SBOM.NO_SBOM' | translate }}
</div>
<div
*ngIf="!showSbomDetailLink() && !showNoSbom()"
class="pl-1 margin-left-5 tip-wrapper bar-block-none shadow-none width-150">
{{ 'SBOM.COMPLETED,' | translate }}
class="tip-wrapper width-120">
{{ 'SBOM.COMPLETED' | translate }}
</div>
</div>
<clr-tooltip-content
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.tip-wrapper {
display: flex;
align-items: center;
color: #fff;
text-align: center;
font-size: 10px;
align-items: left;
text-align: left;
font-size: .65rem;
height: 15px;
line-height: 15px;
}
Expand Down Expand Up @@ -33,12 +32,8 @@ hr {
margin-left: 5px;
}

.width-215 {
width: 215px;
}

.width-150 {
width: 150px;
.width-120 {
width: 120px;
}

.level-border>div{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ export class SbomTipHistogramComponent {
}

showSbomDetailLink(): boolean {
return this.sbomDigest && this.getSbomAccessories.length > 0;
return this.sbomDigest && this.getSbomAccessories().length > 0;
}

showNoSbom(): boolean {
return !this.sbomDigest && this.getSbomAccessories.length === 0;
return !this.sbomDigest && this.getSbomAccessories().length === 0;
}

isThemeLight() {
Expand Down

0 comments on commit 83c2093

Please sign in to comment.