Merge pull request #10021 from AllForNothing/release-1.10.0

Disable scan now button if no default scanner(cherry-pick #10032)
This commit is contained in:
Will Sun 2019-11-29 10:04:34 +08:00 committed by GitHub
commit 2d21c3f2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 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

@ -100,6 +100,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,
@ -119,6 +120,9 @@ export class VulnerabilityConfigComponent implements OnInit, OnDestroy {
}
});
}
if (flag) {
this.hasDefaultScanner = true;
}
if (!flag) {
this.onGettingUpdatedTimeStr = false;
}

View File

@ -116,14 +116,7 @@ export class TagRetentionComponent implements OnInit {
level: "project",
ref: this.projectId
};
let resolverData = this.route.snapshot.parent.data;
if (resolverData) {
let project = <Project>resolverData["projectResolver"];
if (project.metadata && project.metadata.retention_id) {
this.retentionId = project.metadata.retention_id;
}
}
this.getRetention();
this.refreshAfterCreatRetention();
this.getMetadata();
}
openConfirm(cron: string) {