Disable scan now button if no default scanner

Signed-off-by: sshijun <sshijun@vmware.com>
This commit is contained in:
sshijun 2019-11-28 10:58:45 +08:00
parent 6c7ef36e60
commit a254e9e6f6
3 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<span>{{ updatedTimeStr }} </span>
</div>
<div class="button-group">
<cron-selection [labelCurrent]="getLabelCurrent" [labelEdit]='getLabelCurrent'
<cron-selection [disabled]="!hasDefaultScanner" [labelCurrent]="getLabelCurrent" [labelEdit]='getLabelCurrent'
[originCron]='originCron' (inputvalue)="saveSchedule($event)"></cron-selection>
</div>
</section>

View File

@ -103,6 +103,7 @@ describe('VulnerabilityConfigComponent', () => {
it('should stop looping manual metrics if manual scanning is finished', () => {
component.scanningMetrics.isScheduled = false;
component.scanningMetrics.ongoing = false;
component.hasDefaultScanner = true;
expect(component.scanAvailable).toBeTruthy();
});
});

View File

@ -41,6 +41,7 @@ export class VulnerabilityConfigComponent implements OnInit, OnDestroy {
private _loopManualInterval;
updatedTimeStr: string;
onGettingUpdatedTimeStr: boolean;
hasDefaultScanner: boolean = false;
constructor(
private scanningService: ScanAllRepoService,
private errorHandler: ErrorHandler,
@ -86,7 +87,8 @@ export class VulnerabilityConfigComponent implements OnInit, OnDestroy {
get scanAvailable(): boolean {
return !this.onSubmitting
&& !this.gettingMetrics
&& !this.isOnScanning();
&& !this.isOnScanning()
&& this.hasDefaultScanner;
}
getScanText() {
@ -119,6 +121,9 @@ export class VulnerabilityConfigComponent implements OnInit, OnDestroy {
}
});
}
if (flag) {
this.hasDefaultScanner = true;
}
if (!flag) {
this.onGettingUpdatedTimeStr = false;
}