From cdd3f267b5a0065fd929f786e868b1fb3eb871db Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:06:15 +0800 Subject: [PATCH] Merge cosign check and notation check (#19079) 1.Merge cosign check and notaion check into one API call, related issue #19077 Signed-off-by: AllForNothing --- .../artifact-list-tab.component.html | 6 +-- .../artifact-list-tab.component.ts | 49 +++++++------------ .../project/repository/artifact/artifact.ts | 2 +- 3 files changed, 21 insertions(+), 36 deletions(-) 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 9114cb4ca..fb90facf5 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 @@ -343,16 +343,16 @@ 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 d9f149f15..5d4ffad46 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 @@ -881,8 +881,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { projectName: this.projectName, repositoryName: dbEncodeURIComponent(this.repoName), reference: item.digest, - withSignature: true, - withImmutableStatus: true, page: 1, pageSize: 8, }; @@ -935,43 +933,30 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { if (artifacts) { if (artifacts.length) { artifacts.forEach(item => { - item.coSigned = CHECKING; - const listTagParams: NewArtifactService.ListAccessoriesParams = - { + item.signed = CHECKING; + this.newArtifactService + .listAccessories({ projectName: this.projectName, repositoryName: dbEncodeURIComponent(this.repoName), reference: item.digest, page: 1, pageSize: ACCESSORY_PAGE_SIZE, - }; - forkJoin([ - this.newArtifactService.listAccessories({ - ...listTagParams, q: encodeURIComponent( - `type=${AccessoryType.COSIGN}` + `type={${AccessoryType.COSIGN} ${AccessoryType.NOTATION}}` ), - }), - this.newArtifactService.listAccessories({ - ...listTagParams, - q: encodeURIComponent( - `type=${AccessoryType.NOTATION}` - ), - }), - ]).subscribe({ - next: res => { - if ( - res?.length && - (res[0]?.length || res[1]?.length) - ) { - item.coSigned = TRUE; - } else { - item.coSigned = FALSE; - } - }, - error: err => { - item.coSigned = FALSE; - }, - }); + }) + .subscribe({ + next: res => { + if (res?.length) { + item.signed = TRUE; + } else { + item.signed = FALSE; + } + }, + error: err => { + item.signed = FALSE; + }, + }); }); } } diff --git a/src/portal/src/app/base/project/repository/artifact/artifact.ts b/src/portal/src/app/base/project/repository/artifact/artifact.ts index 3b262789d..9a2c379ae 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact.ts @@ -9,7 +9,7 @@ export interface ArtifactFront extends Artifact { pullCommand?: string; annotationsArray?: Array<{ [key: string]: any }>; tagNumber?: number; - coSigned?: string; + signed?: string; accessoryNumber?: number; }