Skip to content

Commit

Permalink
Merge cosign check and notation check (goharbor#19079)
Browse files Browse the repository at this point in the history
1.Merge cosign check and notaion check into one API call, related issue goharbor#19077

Signed-off-by: AllForNothing <[email protected]>
  • Loading branch information
AllForNothing authored Aug 3, 2023
1 parent 1132a66 commit cdd3f26
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,16 @@
</clr-dg-cell>
<clr-dg-cell>
<span
*ngIf="artifact.coSigned === 'checking'"
*ngIf="artifact.signed === 'checking'"
class="spinner spinner-inline ml-2"></span>
<clr-icon
shape="check-circle"
*ngIf="artifact.coSigned === 'true'"
*ngIf="artifact.signed === 'true'"
size="20"
class="signed"></clr-icon>
<clr-icon
shape="times-circle"
*ngIf="artifact.coSigned === 'false'"
*ngIf="artifact.signed === 'false'"
size="16"
class="color-red"></clr-icon>
</clr-dg-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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;
},
});
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ArtifactFront extends Artifact {
pullCommand?: string;
annotationsArray?: Array<{ [key: string]: any }>;
tagNumber?: number;
coSigned?: string;
signed?: string;
accessoryNumber?: number;
}

Expand Down

0 comments on commit cdd3f26

Please sign in to comment.