Improve scan funciton

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
AllForNothing 2020-02-28 19:23:09 +08:00
parent 3a6b675dbd
commit f46a61e522
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;
}