@using EntKube.Web.Data @using EntKube.Web.Services @inject PrometheusService PrometheusService
Cluster Health — Prometheus
@if (loading) { }
@if (!string.IsNullOrEmpty(errorMessage)) {
@errorMessage
} else if (health is null && loading) {

Querying Prometheus...

} else if (health is not null) { @* ── Overview cards ── *@
@health.ReadyNodes / @health.TotalNodes
Nodes Ready
@health.RunningPods
Running Pods @if (health.PendingPods > 0 || health.FailedPods > 0) {
@if (health.PendingPods > 0) { @health.PendingPods pending } @if (health.FailedPods > 0) { @health.FailedPods failed }
}
@health.CpuUsagePercent%
CPU Usage
@health.MemoryUsagePercent%
Memory Usage
@* ── Per-node table ── *@ @if (health.Nodes.Count > 0) {
Nodes
@foreach (NodeHealthInfo node in health.Nodes) { }
Node Status CPU Memory
@node.Name @if (node.Ready) { Ready } else { NotReady }
@node.CpuUsagePercent%
@node.MemoryUsagePercent%
}
Last queried: @health.QueriedAt.ToString("HH:mm:ss UTC")
} else {

No health data available. Click Refresh to query Prometheus.

}
@code { [Parameter] public Guid ClusterId { get; set; } [Parameter] public EventCallback OnClose { get; set; } private ClusterHealthSummary? health; private bool loading; private string? errorMessage; protected override async Task OnInitializedAsync() { await RefreshHealth(); } private async Task RefreshHealth() { loading = true; errorMessage = null; StateHasChanged(); KubernetesOperationResult result = await PrometheusService.GetClusterHealthAsync(ClusterId); if (result.IsSuccess) { health = result.Data; } else { errorMessage = result.Error; } loading = false; } private static string GetUsageBorderClass(double percent) => percent switch { >= 90 => "border-danger", >= 70 => "border-warning", _ => "border-success" }; private static string GetUsageTextClass(double percent) => percent switch { >= 90 => "text-danger", >= 70 => "text-warning", _ => "text-success" }; private static string GetProgressBarClass(double percent) => percent switch { >= 90 => "bg-danger", >= 70 => "bg-warning", _ => "bg-success" }; }