Merge pull request #10032 from AllForNothing/scan-all-m

Disable scan now button if no default scanner
This commit is contained in:
Will Sun 2019-11-29 10:05:37 +08:00 committed by GitHub
commit 31bc3b9274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<span>{{ updatedTimeStr }} </span> <span>{{ updatedTimeStr }} </span>
</div> </div>
<div class="button-group"> <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> [originCron]='originCron' (inputvalue)="saveSchedule($event)"></cron-selection>
</div> </div>
</section> </section>

View File

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

View File

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