From e3c8bfecf0b64b01b46b023354cacb9be8f26079 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:53:10 -0700 Subject: [PATCH 1/4] feat(Events): highlight Warnings --- src/KubeUI/App.axaml | 5 +++- .../ViewModels/ResourceListViewModel.cs | 25 +++++++++++++++++++ src/KubeUI/Views/ResourceListView.cs | 7 +++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/KubeUI/App.axaml b/src/KubeUI/App.axaml index 7ad445cb..4838ce83 100644 --- a/src/KubeUI/App.axaml +++ b/src/KubeUI/App.axaml @@ -12,7 +12,10 @@ - + [ + new Style() + .Setter(DataGridRow.ForegroundProperty, new Binding("Value.Type") + { + Converter = new FuncValueConverter(x => + { + if (string.Equals(x, "Warning", StringComparison.Ordinal)) + { + return Brushes.Red; + } + + if (Application.Current.ActualThemeVariant == ThemeVariant.Light) + { + return Brushes.Black; //todo reference style + } + + return Brushes.White; //todo reference style + }), + }), + ]; } else if (resourceType == typeof(V1Pod)) { @@ -1161,4 +1184,6 @@ public class ResourceListViewMenuItem public bool ShowNamespaces { get; set; } = true; public bool ShowNewResource { get; set; } = true; + + public Func? SetStyle { get; set; } = () => []; } diff --git a/src/KubeUI/Views/ResourceListView.cs b/src/KubeUI/Views/ResourceListView.cs index b83cdada..2e594ab7 100644 --- a/src/KubeUI/Views/ResourceListView.cs +++ b/src/KubeUI/Views/ResourceListView.cs @@ -29,7 +29,7 @@ private void GenerateGrid() { try { - var columnDisplay = (Func)columnDefinition.GetType().GetProperty(nameof(ResourceListViewDefinitionColumn.Display)).GetValue(columnDefinition); + var columnDisplay = (Func)columnDefinition.GetType().GetProperty(nameof(ResourceListViewDefinitionColumn.Display)).GetValue(columnDefinition); var columnField = columnDefinition.GetType().GetProperty(nameof(ResourceListViewDefinitionColumn.Field)).GetValue(columnDefinition); @@ -216,6 +216,11 @@ private List