diff --git a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor index 15f1ead2..1778d4a5 100644 --- a/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor +++ b/src/Microsoft.Tye.Hosting/Dashboard/Pages/Index.razor @@ -20,7 +20,8 @@ { var logsPath = $"logs/{service.Description.Name}"; var servicePath = $"services/{service.Description.Name}"; - + var status = GetServiceStatusColor(service); + @if(service.ServiceType == ServiceType.External) { @@ -96,6 +97,33 @@ return $"{(b.Protocol ?? "tcp")}://{b.Host ?? "localhost"}:{b.Port}"; } + string GetServiceStatusColor(Service service) + { + foreach (var replica in service.Replicas) + { + switch (replica.Value.State) + { + // Replica was recently restarted + case ReplicaState.Removed: + case ReplicaState.Added: + case ReplicaState.Started: + case ReplicaState.Stopped: + return "table-danger"; + + // Replica has passed liveness, but not readiness + case ReplicaState.Healthy: + return "table-warning"; + + // Replica passed both liveness and readiness + case ReplicaState.Ready: + continue; + } + } + + // All replicas have passed liveness and readiness + return "table-success"; + } + protected override void OnInitialized() { foreach (var a in application.Services.Values)