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

Expand folding of workload status phases

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-03-09 15:00:42 -05:00
parent 9db9d4f977
commit e3cdcdc826
2 changed files with 43 additions and 18 deletions

View File

@ -1,18 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { PodStatusPhase } from "../../common/k8s-api/endpoints";
export const foldPodStatusPhase = (previous: "failed" | "pending" | "running", current: PodStatusPhase): "failed" | "pending" | "running" => {
if (previous === "failed" || current === PodStatusPhase.FAILED) {
return "failed";
}
if (previous === "pending" || current === PodStatusPhase.PENDING) {
return "pending";
}
return "running";
};

View File

@ -0,0 +1,43 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { WorkloadStatus } from "../components/+workloads-overview/overview-workload-status";
import type { WorkloadStatusPhase } from "../components/+workloads-overview/workloads/workload-injection-token";
export const foldWorkloadStatusPhase = (previous: WorkloadStatus, current: WorkloadStatusPhase): WorkloadStatus => {
if (previous === "failed" || current === "Failed") {
return "failed";
}
if (previous === "evicted" || current === "Evicted") {
return "evicted";
}
if (previous === "pending" || current === "Pending") {
return "pending";
}
if (previous === "suspended" || current === "Suspended") {
return "suspended";
}
if (previous === "running" || current === "Running") {
return "running";
}
if (previous === "scheduled" || current === "Scheduled") {
return "scheduled";
}
if (previous === "succeeded" || current === "Succeeded") {
return "succeeded";
}
if (previous === "terminated" || current === "Terminated") {
return "terminated";
}
return "unknown";
};