mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-11 18:38:14 +01:00
Fix_cron schedule bug when call api ' get/schedule ' error
Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
parent
7576800eb2
commit
131683b4ef
@ -18,7 +18,7 @@ import {
|
||||
import { ErrorHandler } from "../../error-handler/index";
|
||||
import { CronScheduleComponent } from "../../cron-schedule/cron-schedule.component";
|
||||
import { OriginCron } from '../../service/interface';
|
||||
|
||||
import { finalize } from "rxjs/operators";
|
||||
@Component({
|
||||
selector: "gc-config",
|
||||
templateUrl: "./gc.component.html",
|
||||
@ -50,12 +50,14 @@ export class GcComponent implements OnInit {
|
||||
|
||||
getCurrentSchedule() {
|
||||
this.loadingGcStatus.emit(true);
|
||||
this.gcRepoService.getSchedule().subscribe(schedule => {
|
||||
this.initSchedule(schedule);
|
||||
this.gcRepoService.getSchedule()
|
||||
.pipe(finalize(() => {
|
||||
this.loadingGcStatus.emit(false);
|
||||
}))
|
||||
.subscribe(schedule => {
|
||||
this.initSchedule(schedule);
|
||||
}, error => {
|
||||
this.errorHandler.error(error);
|
||||
this.loadingGcStatus.emit(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Component, Input, Output, EventEmitter, ViewChild, OnInit } from '@angular/core';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { map, catchError } from "rxjs/operators";
|
||||
import { map, catchError, finalize } from "rxjs/operators";
|
||||
import { Observable, throwError as observableThrowError, of } from "rxjs";
|
||||
import { Configuration } from '../config';
|
||||
import {
|
||||
@ -85,16 +85,18 @@ export class VulnerabilityConfigComponent implements OnInit {
|
||||
}
|
||||
|
||||
getSchedule() {
|
||||
this.onGoing = true;
|
||||
this.scanningService.getSchedule().subscribe(schedule => {
|
||||
this.initSchedule(schedule);
|
||||
this.onGoing = false;
|
||||
this.loadingStatus.emit(this.onGoing);
|
||||
}, error => {
|
||||
this.errorHandler.error(error);
|
||||
this.loadingStatus.emit(this.onGoing);
|
||||
});
|
||||
}
|
||||
this.onGoing = true;
|
||||
this.scanningService.getSchedule()
|
||||
.pipe(finalize(() => {
|
||||
this.onGoing = false;
|
||||
this.loadingStatus.emit(this.onGoing);
|
||||
}))
|
||||
.subscribe(schedule => {
|
||||
this.initSchedule(schedule);
|
||||
}, error => {
|
||||
this.errorHandler.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
public initSchedule(schedule: any) {
|
||||
if (schedule && schedule.schedule !== null) {
|
||||
|
@ -9,6 +9,8 @@ import {
|
||||
} from "@angular/core";
|
||||
import { OriginCron } from "../service/interface";
|
||||
import { cronRegex } from "../utils";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { ErrorHandler } from "../error-handler/error-handler";
|
||||
const SCHEDULE_TYPE = {
|
||||
NONE: "None",
|
||||
DAILY: "Daily",
|
||||
@ -33,6 +35,10 @@ export class CronScheduleComponent implements OnChanges {
|
||||
SCHEDULE_TYPE = SCHEDULE_TYPE;
|
||||
scheduleType: string;
|
||||
@Output() inputvalue = new EventEmitter<string>();
|
||||
constructor(
|
||||
private translate: TranslateService,
|
||||
private errorHandler: ErrorHandler,
|
||||
) { }
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
let cronChange: SimpleChange = changes["originCron"];
|
||||
@ -43,6 +49,7 @@ export class CronScheduleComponent implements OnChanges {
|
||||
}
|
||||
editSchedule() {
|
||||
if (!this.originScheduleType) {
|
||||
this.translate.get('SCHEDULE.NOSCHEDULE').subscribe(res => this.errorHandler.error(res));
|
||||
return;
|
||||
}
|
||||
this.isEditMode = true;
|
||||
|
@ -991,7 +991,9 @@
|
||||
"MANUAL": "Manual",
|
||||
"CRON": "cron",
|
||||
"ON": "on",
|
||||
"AT": "at"
|
||||
"AT": "at",
|
||||
"NOSCHEDULE": "An error occurred in Get schedule"
|
||||
|
||||
},
|
||||
"GC": {
|
||||
"CURRENT_SCHEDULE": "Current Schedule",
|
||||
|
@ -989,7 +989,9 @@
|
||||
"MANUAL": "Manual",
|
||||
"CRON": "cron",
|
||||
"ON": "on",
|
||||
"AT": "at"
|
||||
"AT": "at",
|
||||
"NOSCHEDULE": "An error occurred in Get schedule"
|
||||
|
||||
},
|
||||
"GC": {
|
||||
"CURRENT_SCHEDULE": "Current Schedule",
|
||||
|
@ -960,7 +960,9 @@
|
||||
"MANUAL": "Manual",
|
||||
"CRON": "cron",
|
||||
"ON": "on",
|
||||
"AT": "at"
|
||||
"AT": "at",
|
||||
"NOSCHEDULE": "An error occurred in Get schedule"
|
||||
|
||||
},
|
||||
"GC": {
|
||||
"CURRENT_SCHEDULE": "Current Schedule",
|
||||
|
@ -981,7 +981,9 @@
|
||||
"MANUAL": "Manual",
|
||||
"CRON": "cron",
|
||||
"ON": "on",
|
||||
"AT": "at"
|
||||
"AT": "at",
|
||||
"NOSCHEDULE": "An error occurred in Get schedule"
|
||||
|
||||
},
|
||||
"GC": {
|
||||
"CURRENT_SCHEDULE": "Agendamento atual",
|
||||
|
@ -987,7 +987,9 @@
|
||||
"CRON": "cron",
|
||||
"MANUAL": "手动",
|
||||
"ON": " ",
|
||||
"AT": " "
|
||||
"AT": " ",
|
||||
"NOSCHEDULE": "获取schedule时出现错误"
|
||||
|
||||
},
|
||||
"GC": {
|
||||
"CURRENT_SCHEDULE": "当前定时任务",
|
||||
|
Loading…
Reference in New Issue
Block a user