-
");
-
- // Append emojis separately (not in verbatim string)
- sb.AppendLine();
- sb.Append("
🏠 Home");
- sb.AppendLine();
- sb.Append("
🔧 Hangfire Dashboard");
- sb.AppendLine();
- sb.Append("
📋 Logs (Serilog.UI)");
- sb.AppendLine();
- sb.Append("
📊 Health API");
- sb.AppendLine();
- sb.AppendLine("
");
-
- // Overall Status Header
- var statusClass = report.Status switch
- {
- HealthStatus.Healthy => "status-healthy",
- HealthStatus.Degraded => "status-degraded",
- HealthStatus.Unhealthy => "status-unhealthy",
- _ => ""
- };
-
- var badgeClass = report.Status switch
- {
- HealthStatus.Healthy => "badge-healthy",
- HealthStatus.Degraded => "badge-degraded",
- HealthStatus.Unhealthy => "badge-unhealthy",
- _ => "badge-secondary"
- };
-
- var icon = report.Status switch
- {
- HealthStatus.Healthy => "✅",
- HealthStatus.Degraded => "⚠️",
- HealthStatus.Unhealthy => "❌",
- _ => "❓"
- };
-
- sb.Append($@"
-
-
-
-
");
- sb.Append(icon);
- sb.Append($@" Health Check Status
-
Last checked: {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC
-
-
-
{report.Status}
-
-
-
-
-
-
-
-
");
- sb.AppendLine();
- sb.Append(" 📊 Summary");
- sb.AppendLine();
- sb.Append($@"
-
-
- Overall Status:
- {report.Status}
-
-
- Total Duration:
- {report.TotalDuration.TotalMilliseconds:F0} ms
-
-
- Checks:
- {report.Entries.Count}
-
-
-
-
-
-
");
-
- // Individual Checks
- foreach (var entry in report.Entries)
- {
- var checkStatusClass = entry.Value.Status switch
- {
- HealthStatus.Healthy => "status-healthy",
- HealthStatus.Degraded => "status-degraded",
- HealthStatus.Unhealthy => "status-unhealthy",
- _ => ""
- };
-
- var checkBadgeClass = entry.Value.Status switch
- {
- HealthStatus.Healthy => "badge-healthy",
- HealthStatus.Degraded => "badge-degraded",
- HealthStatus.Unhealthy => "badge-unhealthy",
- _ => "badge-secondary"
- };
-
- var checkIcon = entry.Value.Status switch
- {
- HealthStatus.Healthy => "✅",
- HealthStatus.Degraded => "⚠️",
- HealthStatus.Unhealthy => "❌",
- _ => "❓"
- };
-
- sb.Append($@"
-
-
-
- ");
- sb.Append(checkIcon);
- sb.Append($@" {entry.Key}
- {entry.Value.Status}
-
-
-
-
- Description:
- {entry.Value.Description ?? "N/A"}
-
-
- Duration:
- {entry.Value.Duration.TotalMilliseconds:F0} ms
-
");
-
- if (entry.Value.Exception != null)
- {
- sb.AppendLine($@"
-
- Exception:
- {System.Net.WebUtility.HtmlEncode(entry.Value.Exception.Message)}
-
");
- }
-
- if (entry.Value.Data.Any())
- {
- sb.AppendLine(@"
-
-
Details:
-
");
-
- foreach (var data in entry.Value.Data)
- {
- var value = data.Value?.ToString() ?? "N/A";
-
- // Format DateTime values
- if (data.Value is DateTime dt)
- {
- value = dt.ToString("yyyy-MM-dd HH:mm:ss");
- }
- else if (data.Value is TimeSpan ts)
- {
- value = $"{ts.TotalSeconds:F1}s";
- }
-
- sb.AppendLine($@"
-
- | {data.Key} |
- {value} |
-
");
- }
-
- sb.AppendLine(@"
-
-
");
- }
-
- sb.AppendLine(@"
-
-
");
- }
-
- sb.AppendLine(@"
-
-
-
-
-