1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add getStatus to CronJob

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-03-09 14:58:30 -05:00
parent 01164ed732
commit 87cbfd1e39

View File

@ -66,6 +66,11 @@ export interface CronJobStatus {
active?: ObjectReference[];
}
export enum CronJobStatusPhase {
SUSPENDED = "Suspended",
SCHEDULED = "Scheduled",
}
export class CronJob extends KubeObject<
NamespaceScopedMetadata,
CronJobStatus,
@ -90,6 +95,14 @@ export class CronJob extends KubeObject<
return this.spec.schedule;
}
getStatus() {
if (this.isSuspend()) {
return CronJobStatusPhase.SUSPENDED;
}
return CronJobStatusPhase.SCHEDULED;
}
isNeverRun() {
const schedule = this.getSchedule();
const daysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];