| 1 | using AgentForge.Data.Entities; |
| 2 | |
| 3 | namespace AgentForge.Plugin.View.Components.Iop; |
| 4 | |
| 5 | internal static class ForgeViewIopChecksTab |
| 6 | { |
| 7 | internal static string Render(ForgeCiRunEntity? ciRun) |
| 8 | { |
| 9 | if (ciRun is null) |
| 10 | { |
| 11 | return ForgeHtml.Div("iop-checks-panel", |
| 12 | ForgeHtml.P("iop-empty", ForgeHtml.Text("No CI runs yet.")), |
| 13 | ForgeHtml.P("iop-meta", |
| 14 | ForgeHtml.Text("Report via "), |
| 15 | ForgeHtml.Code("/api/v1/ci/callback"), |
| 16 | ForgeHtml.Text("."))); |
| 17 | } |
| 18 | |
| 19 | var parts = new List<string> |
| 20 | { |
| 21 | ForgeHtml.Div("iop-check-row", |
| 22 | ForgeHtml.Span(null, ForgeHtml.Strong("CI")), |
| 23 | ForgeHtml.Text(" "), |
| 24 | ForgeViewIopCiBadge.Render(ciRun)), |
| 25 | }; |
| 26 | |
| 27 | if (!string.IsNullOrWhiteSpace(ciRun.Commit)) |
| 28 | { |
| 29 | parts.Add(ForgeHtml.P("iop-meta", |
| 30 | ForgeHtml.Text("commit "), |
| 31 | ForgeHtml.Code(ciRun.Commit))); |
| 32 | } |
| 33 | |
| 34 | if (!string.IsNullOrWhiteSpace(ciRun.Url)) |
| 35 | { |
| 36 | parts.Add(ForgeHtml.P("iop-meta", ForgeHtml.A(ciRun.Url, "View run log"))); |
| 37 | } |
| 38 | |
| 39 | return ForgeHtml.Div("iop-checks-panel", [.. parts]); |
| 40 | } |
| 41 | } |
| 42 | |