Merge pull request #10947 from AllForNothing/scan-unsupported

Add new status "scan unsupported" for artifact list
This commit is contained in:
Will Sun 2020-03-05 16:20:43 +08:00 committed by GitHub
commit a30782e464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 11 deletions

View File

@ -91,7 +91,7 @@
[(clrDgSelected)]="selectedRow">
<clr-dg-action-bar>
<button [clrLoading]="scanBtnState" type="button" class="btn btn-secondary scan-btn"
[disabled]="!(canScanNow() && hasVul() && selectedRow.length==1 && hasEnabledScanner && hasScanImagePermission && !depth)" (click)="scanNow()">
[disabled]="!(canScanNow() && selectedRowHasVul() && selectedRow.length==1 && hasEnabledScanner && hasScanImagePermission )" (click)="scanNow()">
<clr-icon shape="shield-check" size="16"></clr-icon>&nbsp;{{'VULNERABILITY.SCAN_NOW' | translate}}
</button>
@ -238,7 +238,10 @@
</clr-dg-cell>
<clr-dg-cell>
<div class="cell">
<hbr-vulnerability-bar [scanner]="handleScanOverview(artifact.scan_overview)?.scanner"
<span *ngIf="!hasVul(artifact)">
{{'ARTIFACT.SCAN_UNSUPPORTED' | translate}}
</span>
<hbr-vulnerability-bar *ngIf="hasVul(artifact)" [scanner]="handleScanOverview(artifact.scan_overview)?.scanner"
(submitFinish)="submitFinish($event)" [projectName]="projectName" [repoName]="repoName"
[artifactDigest]="artifact.digest" [summary]="handleScanOverview(artifact.scan_overview)">
</hbr-vulnerability-bar>

View File

@ -370,7 +370,12 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
let childParams: NewArtifactService.GetArtifactParams = {
repositoryName: this.repoName,
projectName: this.projectName,
reference: child.child_digest
reference: child.child_digest,
withImmutableStatus: true,
withLabel: true,
withScanOverview: true,
withSignature: true,
withTag: true
};
observableLists.push(this.newArtifactService.getArtifact(childParams));
}
@ -864,12 +869,15 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.channel.publishScanEvent(this.repoName + "/" + this.selectedRow[0].digest);
}
}
hasVul(): boolean {
selectedRowHasVul(): boolean {
return !!(this.selectedRow
&& this.selectedRow[0]
&& this.selectedRow[0].addition_links
&& this.selectedRow[0].addition_links[ADDITIONS.VULNERABILITIES]);
}
hasVul(artifact: Artifact): boolean {
return !!(artifact && artifact.addition_links && artifact.addition_links[ADDITIONS.VULNERABILITIES]);
}
submitFinish(e: boolean) {
this.onSendingScanCommand = e;
}

View File

@ -5,7 +5,7 @@
</div>
<div class="title-block">
<h2 sub-header-title class="custom-h2" *ngIf="!artifactDigest">{{showCurrentTitle}}</h2>
<h2 sub-header-title class="custom-h2" *ngIf="artifactDigest">{{artifactDigest | slice:1:15}}</h2>
<h2 sub-header-title class="custom-h2" *ngIf="artifactDigest">{{artifactDigest | slice:0:15}}</h2>
</div>
</div>
</section>

View File

@ -1004,7 +1004,8 @@
"TAGGED": "Tagged",
"UNTAGGED": "Untagged",
"ALL": "All",
"PLACEHOLDER": "We couldn't find any artifactds!"
"PLACEHOLDER": "We couldn't find any artifactds!",
"SCAN_UNSUPPORTED": "Scan Unsupported"
},
"TAG": {
"CREATION_TIME_PREFIX": "Create on",

View File

@ -1003,7 +1003,8 @@
"TAGGED": "Tagged",
"UNTAGGED": "Untagged",
"ALL": "All",
"PLACEHOLDER": "We couldn't find any artifacts!"
"PLACEHOLDER": "We couldn't find any artifacts!",
"SCAN_UNSUPPORTED": "Scan Unsupported"
},
"TAG": {
"CREATION_TIME_PREFIX": "Create on",

View File

@ -976,7 +976,8 @@
"TAGGED": "Tagged",
"UNTAGGED": "Untagged",
"ALL": "All",
"PLACEHOLDER": "We couldn't find any artifacts!"
"PLACEHOLDER": "We couldn't find any artifacts!",
"SCAN_UNSUPPORTED": "Scan Unsupported"
},
"TAG": {
"CREATION_TIME_PREFIX": "Créer le",

View File

@ -999,7 +999,8 @@
"TAGGED": "Tagged",
"UNTAGGED": "Untagged",
"ALL": "All",
"PLACEHOLDER": "We couldn't find any artifacts!"
"PLACEHOLDER": "We couldn't find any artifacts!",
"SCAN_UNSUPPORTED": "Scan Unsupported"
},
"TAG": {
"CREATION_TIME_PREFIX": "Criado em",

View File

@ -1003,7 +1003,8 @@
"TAGGED": "Tagged",
"UNTAGGED": "Untagged",
"ALL": "All",
"PLACEHOLDER": "We couldn't find any artifacts!"
"PLACEHOLDER": "We couldn't find any artifacts!",
"SCAN_UNSUPPORTED": "Scan Unsupported"
},
"TAG": {
"CREATION_TIME_PREFIX": "Oluştur",

View File

@ -1003,7 +1003,8 @@
"TAGGED": "含有 Tag",
"UNTAGGED": "不含有 Tag",
"ALL": "所有",
"PLACEHOLDER": "未发现任何 artifacts!"
"PLACEHOLDER": "未发现任何 artifacts!",
"SCAN_UNSUPPORTED": "不支持扫描"
},
"TAG": {
"CREATION_TIME_PREFIX": "创建时间:",