Merge pull request #10934 from AllForNothing/improve-scan

Improve scan funciton
This commit is contained in:
Will Sun 2020-03-05 09:59:13 +08:00 committed by GitHub
commit b72a102d37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 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() && selectedRow.length==1 && hasEnabledScanner && hasScanImagePermission && !depth)" (click)="scanNow()">
[disabled]="!(canScanNow() && hasVul() && selectedRow.length==1 && hasEnabledScanner && hasScanImagePermission && !depth)" (click)="scanNow()">
<clr-icon shape="shield-check" size="16"></clr-icon>&nbsp;{{'VULNERABILITY.SCAN_NOW' | translate}}
</button>

View File

@ -64,6 +64,7 @@ import { errorHandler } from "../../../../../../lib/utils/shared/shared.utils";
import { ArtifactFront as Artifact, mutipleFilter } from "../../../artifact/artifact";
import { Project } from "../../../../project";
import { ArtifactService as NewArtifactService } from "../../../../../../../ng-swagger-gen/services/artifact.service";
import { ADDITIONS } from "../../../artifact/artifact-additions/models";
export interface LabelState {
iconsShow: boolean;
label: Label;
@ -863,6 +864,12 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.channel.publishScanEvent(this.repoName + "/" + this.selectedRow[0].digest);
}
}
hasVul(): boolean {
return !!(this.selectedRow
&& this.selectedRow[0]
&& this.selectedRow[0].addition_links
&& this.selectedRow[0].addition_links[ADDITIONS.VULNERABILITIES]);
}
submitFinish(e: boolean) {
this.onSendingScanCommand = e;
}