mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use new getStatus in CronJobStore's getStatuses
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f17acccda1
commit
9db9d4f977
@ -6,6 +6,7 @@
|
||||
import type { KubeObjectStoreDependencies, KubeObjectStoreOptions } from "../../../common/k8s-api/kube-object.store";
|
||||
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||
import type { CronJob, CronJobApi } from "../../../common/k8s-api/endpoints/cron-job.api";
|
||||
import { CronJobStatusPhase } from "../../../common/k8s-api/endpoints/cron-job.api";
|
||||
import type { GetJobsByOwner } from "../+workloads-jobs/get-jobs-by-owner.injectable";
|
||||
|
||||
interface Dependencies extends KubeObjectStoreDependencies {
|
||||
@ -18,18 +19,19 @@ export class CronJobStore extends KubeObjectStore<CronJob, CronJobApi> {
|
||||
}
|
||||
|
||||
getStatuses(cronJobs?: CronJob[]) {
|
||||
const status = { scheduled: 0, suspended: 0 };
|
||||
const statuses = { scheduled: 0, suspended: 0 };
|
||||
|
||||
cronJobs?.forEach(cronJob => {
|
||||
if (cronJob.spec.suspend) {
|
||||
status.suspended++;
|
||||
}
|
||||
else {
|
||||
status.scheduled++;
|
||||
const status = cronJob.getStatus();
|
||||
|
||||
if (status === CronJobStatusPhase.SUSPENDED) {
|
||||
statuses.suspended++;
|
||||
} else {
|
||||
statuses.scheduled++;
|
||||
}
|
||||
});
|
||||
|
||||
return status;
|
||||
return statuses;
|
||||
}
|
||||
|
||||
getActiveJobsNum(cronJob: CronJob) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user