Skip to content

Commit

Permalink
🚦 color container if pod is pending
Browse files Browse the repository at this point in the history
🚦 color container if pod is pending
  • Loading branch information
petar-cvit committed Apr 12, 2024
2 parents 3f38689 + 17ff489 commit 8f73fdc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cyclops-ui/src/components/k8s-resources/Deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,15 @@ const Deployment = ({ name, namespace }: Props) => {
dataIndex="containers"
key="containers"
width="15%"
render={(containers) => (
render={(containers, record: any) => (
<>
{containers.map((container: any) => {
let color = container.status.running ? "green" : "red";

if (record.podPhase === "Pending") {
color = "yellow"
}

return (
<Tag
color={color}
Expand Down
6 changes: 5 additions & 1 deletion cyclops-ui/src/components/k8s-resources/StatefulSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,13 @@ const StatefulSet = ({ name, namespace }: Props) => {
width="15%"
render={(containers) => (
<>
{containers.map((container: any) => {
{containers.map((container: any, record: any) => {
let color = container.status.running ? "green" : "red";

if (record.podPhase === "Pending") {
color = "yellow"
}

return (
<Tag
color={color}
Expand Down
2 changes: 1 addition & 1 deletion cyclops-ui/src/utils/pods.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { formatDistanceToNow } from "date-fns";

export function formatPodAge(podAge: string): string {
if (podAge === "") {
if (podAge === null || podAge === "") {
return "";
}

Expand Down

0 comments on commit 8f73fdc

Please sign in to comment.