Fix returning internal error when setting cron for gc

Signed-off-by: FangyuanCheng <fangyuanc@vmware.com>
This commit is contained in:
FangyuanCheng 2019-03-11 12:47:32 +08:00
parent a618a2c2ac
commit e32a34048a
7 changed files with 44 additions and 20 deletions

View File

@ -1,5 +1,5 @@
<div class="cron-selection">
<cron-selection [labelCurrent]="getLabelCurrent" [labelEdit]='getText' [originCron]='originCron' (inputvalue)="getcron($event)"></cron-selection>
<cron-selection [labelCurrent]="getLabelCurrent" [labelEdit]='getText' [originCron]='originCron' (inputvalue)="scheduleGc($event)"></cron-selection>
</div>
<button class="btn btn-primary btn-sm gc-start-btn" (click)="gcNow()" [disabled]="disableGC">{{'GC.GC_NOW' | translate}}</button>
<div class="job-header font-style">{{'GC.JOB_HISTORY' | translate}}</div>

View File

@ -97,7 +97,17 @@ export class GcComponent implements OnInit {
this.disableGC = false;
}
getcron(cron: string) {
private resetSchedule(cron) {
this.schedule = {
schedule: {
type: this.CronScheduleComponent.scheduleType,
cron: cron
}
};
this.getJobs();
}
scheduleGc(cron: string) {
let schedule = this.schedule;
if (schedule && schedule.schedule && schedule.schedule.type !== SCHEDULE_TYPE_NONE) {
this.gcRepoService.putScheduleGc(this.CronScheduleComponent.scheduleType, cron).subscribe(
@ -107,7 +117,7 @@ export class GcComponent implements OnInit {
.subscribe((res) => {
this.errorHandler.info(res);
});
this.getJobs();
this.resetSchedule(cron);
},
error => {
this.errorHandler.error(error);
@ -119,7 +129,7 @@ export class GcComponent implements OnInit {
this.translate.get("GC.MSG_SCHEDULE_SET").subscribe((res) => {
this.errorHandler.info(res);
});
this.getJobs();
this.resetSchedule(cron);
},
error => {
this.errorHandler.error(error);

View File

@ -646,9 +646,9 @@
"VERIFY_CERT": "Verify Cert from LDAP Server",
"READONLY_TOOLTIP": "In read-only mode, you can not delete repositories or tags or push images. ",
"REPO_TOOLTIP": "Users can not do any operations to the images in this mode.",
"HOURLY_CRON":"Run once an hour, beginning of hour",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun",
"DAILY_CRON":"Run once a day, midnight"
"HOURLY_CRON":"Run once an hour, beginning of hour. Equivalent to 0 0 * * * *.",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun. Equivalent to 0 0 0 * * 0.",
"DAILY_CRON":"Run once a day, midnight. Equivalent to 0 0 0 * * *."
},
"LDAP": {
"URL": "LDAP URL",

View File

@ -645,9 +645,9 @@
"VERIFY_CERT": "Verify Cert from LDAP Server",
"READONLY_TOOLTIP": "In read-only mode, you can not delete repositories or tags or push images. ",
"GC_POLICY": "",
"HOURLY_CRON":"Run once an hour, beginning of hour",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun",
"DAILY_CRON":"Run once a day, midnight"
"HOURLY_CRON":"Run once an hour, beginning of hour. Equivalente a 0 0 * * * *.",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun. Equivalente a 0 0 0 * * 0.",
"DAILY_CRON":"Run once a day, midnight. Equivalente a 0 0 0 * * *."
},
"LDAP": {
@ -885,7 +885,10 @@
"NONE": "None",
"DAILY": "Daily",
"WEEKLY": "Weekly",
"HOURLY": "Hourly",
"CUSTOM": "Custom",
"MANUAL": "Manual",
"CRON": "cron",
"ON": "on",
"AT": "at"
},

View File

@ -617,9 +617,9 @@
"SCANNING_POLICY": "Définissez la politique d'analyse des images en fonction des différentes exigences. 'Aucune' : pas de politique active; 'Tousles jours à' : déclenchement du balayage à l'heure spécifiée tous les jours.",
"READONLY_TOOLTIP": "In read-only mode, you can not delete repositories or tags or push images. ",
"GC_POLICY": "",
"HOURLY_CRON":"Run once an hour, beginning of hour",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun",
"DAILY_CRON":"Run once a day, midnight"
"HOURLY_CRON":"Run once an hour, beginning of hour. Équivalent à 0 0 * * * *.",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun. Équivalent à 0 0 0 * * 0.",
"DAILY_CRON":"Run once a day, midnight. Équivalent à 0 0 0 * * *."
},
"LDAP": {
"URL": "URL LDAP",
@ -848,7 +848,10 @@
"NONE": "None",
"DAILY": "Daily",
"WEEKLY": "Weekly",
"HOURLY": "Hourly",
"CUSTOM": "Custom",
"MANUAL": "Manual",
"CRON": "cron",
"ON": "on",
"AT": "at"
},

View File

@ -639,9 +639,9 @@
"VERIFY_CERT": "Verificar o Certificado do Servidor LDAP",
"READONLY_TOOLTIP": "Em modo somente leitura, você não pode remover repositórios ou tags ou enviar imagens. ",
"REPO_TOOLTIP": "Usuários não podem efetuar qualquer operação nas imagens nesse modo.",
"HOURLY_CRON":"Run once an hour, beginning of hour",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun",
"DAILY_CRON":"Run once a day, midnight"
"HOURLY_CRON":"Run once an hour, beginning of hour. Equivalente a 0 0 * * * *.",
"WEEKLY_CRON":"Run once a week, midnight between Sat/Sun. Equivalente a 0 0 0 * * 0.",
"DAILY_CRON":"Run once a day, midnight. Equivalente a 0 0 0 * * *."
},
"LDAP": {
"URL": "URL LDAP",
@ -877,7 +877,12 @@
"NONE": "Nenhum",
"DAILY": "Diário",
"WEEKLY": "Semanal",
"MANUAL": "Manual"
"HOURLY": "Hourly",
"CUSTOM": "Custom",
"MANUAL": "Manual",
"CRON": "cron",
"ON": "on",
"AT": "at"
},
"GC": {
"CURRENT_SCHEDULE": "Agendamento atual",

View File

@ -645,9 +645,9 @@
"VERIFY_CERT": "检查来自LDAP服务端的证书",
"READONLY_TOOLTIP": "选中,表示正在维护状态,不可删除仓库及标签,也不可以推送镜像。",
"REPO_TOOLTIP": "用户在此模式下无法对图像执行任何操作。",
"HOURLY_CRON":"每小时运行一次",
"WEEKLY_CRON":"每周一次,周六/周日午夜之间开始",
"DAILY_CRON":"每天午夜运行一次"
"HOURLY_CRON":"每小时运行一次。相当于 0 0 * * * *",
"WEEKLY_CRON":"每周一次,周六/周日午夜之间开始。相当于 0 0 * * * *",
"DAILY_CRON":"每天午夜运行一次。相当于 0 0 * * * *"
},
"LDAP": {
"URL": "LDAP URL",
@ -883,6 +883,9 @@
"NONE": "无",
"DAILY": "每天",
"WEEKLY": "每周",
"HOURLY": "每小时",
"CUSTOM": "自定义",
"CRON": "cron",
"MANUAL": "手动",
"ON": " ",
"AT": " "