mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 04:35:16 +01:00
#6440 fix gc will have 500 error when user try to put a new schedule
Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
parent
11f0e10d36
commit
5db765ea10
@ -100,26 +100,7 @@ export class GcComponent implements OnInit {
|
|||||||
this.disableGC = false;
|
this.disableGC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleGc(): void {
|
private resetSchedule(offTime) {
|
||||||
let offTime = this.gcUtility.getOffTime(this.dailyTime);
|
|
||||||
if (this.schedule) {
|
|
||||||
this.gcRepoService.putScheduleGc(this.scheduleType, offTime, this.weekDay.value).subscribe(response => {
|
|
||||||
this.translate.get('GC.MSG_SCHEDULE_RESET').subscribe((res: string) => {
|
|
||||||
this.errorHandler.info(res);
|
|
||||||
});
|
|
||||||
this.originScheduleType = this.scheduleType;
|
|
||||||
this.originWeekDay = this.weekDay;
|
|
||||||
this.originOffTime = { value: offTime, text: this.dailyTime };
|
|
||||||
this.isEditMode = false;
|
|
||||||
this.getJobs();
|
|
||||||
}, error => {
|
|
||||||
this.errorHandler.error(error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.gcRepoService.postScheduleGc(this.scheduleType, offTime, this.weekDay.value).subscribe(response => {
|
|
||||||
this.translate.get('GC.MSG_SCHEDULE_SET').subscribe((res: string) => {
|
|
||||||
this.errorHandler.info(res);
|
|
||||||
});
|
|
||||||
this.schedule = {
|
this.schedule = {
|
||||||
schedule: {
|
schedule: {
|
||||||
type: this.scheduleType,
|
type: this.scheduleType,
|
||||||
@ -132,6 +113,26 @@ export class GcComponent implements OnInit {
|
|||||||
this.originOffTime = { value: offTime, text: this.dailyTime };
|
this.originOffTime = { value: offTime, text: this.dailyTime };
|
||||||
this.isEditMode = false;
|
this.isEditMode = false;
|
||||||
this.getJobs();
|
this.getJobs();
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduleGc(): void {
|
||||||
|
let offTime = this.gcUtility.getOffTime(this.dailyTime);
|
||||||
|
let schedule = this.schedule;
|
||||||
|
if (schedule && schedule.schedule && schedule.schedule.type !== SCHEDULE_TYPE.NONE) {
|
||||||
|
this.gcRepoService.putScheduleGc(this.scheduleType, offTime, this.weekDay.value).subscribe(response => {
|
||||||
|
this.translate.get('GC.MSG_SCHEDULE_RESET').subscribe((res: string) => {
|
||||||
|
this.errorHandler.info(res);
|
||||||
|
});
|
||||||
|
this.resetSchedule(offTime);
|
||||||
|
}, error => {
|
||||||
|
this.errorHandler.error(error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.gcRepoService.postScheduleGc(this.scheduleType, offTime, this.weekDay.value).subscribe(response => {
|
||||||
|
this.translate.get('GC.MSG_SCHEDULE_SET').subscribe((res: string) => {
|
||||||
|
this.errorHandler.info(res);
|
||||||
|
});
|
||||||
|
this.resetSchedule(offTime);
|
||||||
}, error => {
|
}, error => {
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user