mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
Merge pull request #6468 from zhoumeina/fix_500_gc
#6440 fix gc will have 500 error when user try to put a new schedule
This commit is contained in:
commit
9100dfdb5f
@ -100,18 +100,30 @@ export class GcComponent implements OnInit {
|
|||||||
this.disableGC = false;
|
this.disableGC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private resetSchedule(offTime) {
|
||||||
|
this.schedule = {
|
||||||
|
schedule: {
|
||||||
|
type: this.scheduleType,
|
||||||
|
offTime: offTime,
|
||||||
|
weekDay: this.weekDay.value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.originScheduleType = this.scheduleType;
|
||||||
|
this.originWeekDay = this.weekDay;
|
||||||
|
this.originOffTime = { value: offTime, text: this.dailyTime };
|
||||||
|
this.isEditMode = false;
|
||||||
|
this.getJobs();
|
||||||
|
}
|
||||||
|
|
||||||
scheduleGc(): void {
|
scheduleGc(): void {
|
||||||
let offTime = this.gcUtility.getOffTime(this.dailyTime);
|
let offTime = this.gcUtility.getOffTime(this.dailyTime);
|
||||||
if (this.schedule) {
|
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.gcRepoService.putScheduleGc(this.scheduleType, offTime, this.weekDay.value).subscribe(response => {
|
||||||
this.translate.get('GC.MSG_SCHEDULE_RESET').subscribe((res: string) => {
|
this.translate.get('GC.MSG_SCHEDULE_RESET').subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.originScheduleType = this.scheduleType;
|
this.resetSchedule(offTime);
|
||||||
this.originWeekDay = this.weekDay;
|
|
||||||
this.originOffTime = { value: offTime, text: this.dailyTime };
|
|
||||||
this.isEditMode = false;
|
|
||||||
this.getJobs();
|
|
||||||
}, error => {
|
}, error => {
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -120,18 +132,7 @@ export class GcComponent implements OnInit {
|
|||||||
this.translate.get('GC.MSG_SCHEDULE_SET').subscribe((res: string) => {
|
this.translate.get('GC.MSG_SCHEDULE_SET').subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.schedule = {
|
this.resetSchedule(offTime);
|
||||||
schedule: {
|
|
||||||
type: this.scheduleType,
|
|
||||||
offTime: offTime,
|
|
||||||
weekDay: this.weekDay.value
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.originScheduleType = this.scheduleType;
|
|
||||||
this.originWeekDay = this.weekDay;
|
|
||||||
this.originOffTime = { value: offTime, text: this.dailyTime };
|
|
||||||
this.isEditMode = false;
|
|
||||||
this.getJobs();
|
|
||||||
}, error => {
|
}, error => {
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user