Skip to content

Commit 01fa531

Browse files
fix
1 parent d290c0e commit 01fa531

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed
+33-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
using System;
2-
using Windows.UI;
3-
using Coder.Desktop.App.ViewModels;
4-
using Microsoft.UI.Xaml.Data;
5-
using Microsoft.UI.Xaml.Media;
6-
7-
namespace Coder.Desktop.App.Converters;
8-
9-
public class AgentStatusToColorConverter : IValueConverter
10-
{
11-
private static readonly SolidColorBrush Green = new(Color.FromArgb(255, 52, 199, 89));
12-
private static readonly SolidColorBrush Red = new(Color.FromArgb(255, 255, 59, 48));
13-
private static readonly SolidColorBrush Gray = new(Color.FromArgb(255, 142, 142, 147));
14-
15-
public object Convert(object value, Type targetType, object parameter, string language)
16-
{
17-
if (value is not AgentConnectionStatus status) return Gray;
18-
19-
return status switch
20-
{
21-
AgentConnectionStatus.Green => Green,
22-
AgentConnectionStatus.Red => Red,
23-
_ => Gray,
24-
};
25-
}
26-
27-
public object ConvertBack(object value, Type targetType, object parameter, string language)
28-
{
29-
throw new NotImplementedException();
30-
}
31-
}
1+
using System;
2+
using Windows.UI;
3+
using Coder.Desktop.App.ViewModels;
4+
using Microsoft.UI.Xaml.Data;
5+
using Microsoft.UI.Xaml.Media;
6+
7+
namespace Coder.Desktop.App.Converters;
8+
9+
public class AgentStatusToColorConverter : IValueConverter
10+
{
11+
private static readonly SolidColorBrush Green = new(Color.FromArgb(255, 52, 199, 89));
12+
private static readonly SolidColorBrush Red = new(Color.FromArgb(255, 255, 59, 48));
13+
private static readonly SolidColorBrush Gray = new(Color.FromArgb(255, 142, 142, 147));
14+
private static readonly SolidColorBrush Yellow = new(Color.FromArgb(255, 204, 1, 0));
15+
16+
public object Convert(object value, Type targetType, object parameter, string language)
17+
{
18+
if (value is not AgentConnectionStatus status) return Gray;
19+
20+
return status switch
21+
{
22+
AgentConnectionStatus.Green => Green,
23+
AgentConnectionStatus.Red => Red,
24+
AgentConnectionStatus.Yellow => Yellow,
25+
_ => Gray,
26+
};
27+
}
28+
29+
public object ConvertBack(object value, Type targetType, object parameter, string language)
30+
{
31+
throw new NotImplementedException();
32+
}
33+
}

App/ViewModels/AgentViewModel.cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum AgentConnectionStatus
1010
{
1111
Green,
1212
Red,
13+
Yellow,
1314
Gray,
1415
}
1516

App/ViewModels/TrayWindowViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private void UpdateFromRpcModel(RpcModel rpcModel)
137137
HostnameSuffix = fqdnSuffix,
138138
ConnectionStatus = lastHandshakeAgo < TimeSpan.FromMinutes(5)
139139
? AgentConnectionStatus.Green
140-
: AgentConnectionStatus.Red,
140+
: AgentConnectionStatus.Yellow,
141141
DashboardUrl = WorkspaceUri(coderUri, workspace?.Name),
142142
});
143143
}

0 commit comments

Comments
 (0)