Skip to content

Commit 21602d5

Browse files
feat(Pod): improve status (#1044)
1 parent a915bff commit 21602d5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/KubeUI/Controls/PodStatusCell.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@ protected override void OnDataContextChanged(EventArgs e)
1515
}
1616
else
1717
{
18-
PrettyString = ViewModel.Status.Phase;
18+
PrettyString = ViewModel.Status?.Conditions?.FirstOrDefault(x => x.Type == "Ready")?.Status == "True" ? "Running" : ViewModel.Status?.Conditions?.FirstOrDefault(x => x.Type == "Ready")?.Reason ?? "Unknown";
1919
}
2020

21-
if (PrettyString == "Failed")
21+
if (PrettyString == "Pending" || PrettyString == "Terminating")
2222
{
2323
_styles = [
2424
new Style<TextBlock>()
25-
.Setter(TextBlock.ForegroundProperty, Brushes.Orange),
25+
.Setter(TextBlock.ForegroundProperty, Brushes.Yellow),
2626
];
2727
}
28-
else if (PrettyString == "Pending" || PrettyString == "Terminating")
28+
else if (PrettyString == "Running" || PrettyString == "PodCompleted")
2929
{
3030
_styles = [
3131
new Style<TextBlock>()
32-
.Setter(TextBlock.ForegroundProperty, Brushes.Yellow),
32+
.Setter(TextBlock.ForegroundProperty, Brushes.LimeGreen),
3333
];
3434
}
35-
else if (PrettyString == "Running" || PrettyString == "Succeeded")
35+
else
3636
{
3737
_styles = [
3838
new Style<TextBlock>()
39-
.Setter(TextBlock.ForegroundProperty, Brushes.LimeGreen),
39+
.Setter(TextBlock.ForegroundProperty, Brushes.Orange),
4040
];
4141
}
4242
}

src/KubeUI/Resources/Workloads/V1PodConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public override IList<IResourceListColumn> Columns()
5858
new ResourceListColumn<V1Pod, string>()
5959
{
6060
Name = "Status",
61-
Field = x => x.Status.Phase ?? "",
61+
Field = x => x.Status?.Conditions?.FirstOrDefault(x => x.Type == "Ready")?.Status == "True" ? "Running" : x.Status?.Conditions?.FirstOrDefault(x => x.Type == "Ready")?.Reason ?? "Unknown",
6262
CustomControl = typeof(PodStatusCell),
6363
Width = nameof(DataGridLengthUnitType.SizeToHeader)
6464
},

0 commit comments

Comments
 (0)