diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html index d5516f10725..b25a72d81c3 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html @@ -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) diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts index bc9559e7211..eaeb610c707 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.spec.ts @@ -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; diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts index cf3d1c7dd5b..e16c800e91b 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts @@ -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