Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Display 'No SBOM' in multi-arch images in HarborUI #21459

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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 @@ -464,7 +464,9 @@
(submitStopFinish)="submitSbomStopFinish($event)"
(scanFinished)="sbomFinished($event)"
*ngIf="
hasSbom(artifact) && !artifact?.accessoryLoading
hasSbom(artifact) &&
!artifact?.accessoryLoading &&
!hasChild(artifact)
"
[inputScanner]="
handleSbomOverview(artifact.sbom_overview)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,26 @@ describe('ArtifactListTabComponent', () => {
);
expect(comp.handleScanOverview(mockArtifacts[0])).not.toBeNull();
});
it('Should return true for artifacts with child references', async () => {
const artifactWithChild = {
...mockArtifacts[0],
references: [{ child_digest: 'childDigest123' }], // child reference
};

const result = comp.hasChild(artifactWithChild);

expect(result).toBeTruthy();
});
it('Should return false for artifacts without child references', async () => {
const artifactWithoutChild = {
...mockArtifacts[0],
references: [], // No child references
};

const result = comp.hasChild(artifactWithoutChild);

expect(result).toBeFalsy();
});
it('Test utils', async () => {
fixture = TestBed.createComponent(ArtifactListTabComponent);
comp = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,14 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
);
}

hasChild(artifact: Artifact): boolean {
return !!(
artifact &&
artifact.references &&
artifact.references.some(ref => ref['child_digest'])
);
}

submitFinish(e: boolean) {
this.scanFinishedArtifactLength += 1;
// all selected scan action has started
Expand Down
Loading