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:
parent
9db9d4f977
commit
e3cdcdc826
@ -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";
|
||||
};
|
||||
@ -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";
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user