| 1 |
@page "/git" |
| 2 |
@inherits GitPage |
| 3 |
|
| 4 |
<PageTitle>git — mb.bes.is</PageTitle> |
| 5 |
|
| 6 |
<GitBar/> |
| 7 |
|
| 8 |
<main class="git-main"> |
| 9 |
<section class="block"> |
| 10 |
<h2 class="block-head"> |
| 11 |
<span>repositories</span> |
| 12 |
<span class="block-note">@Repositories.Count</span> |
| 13 |
</h2> |
| 14 |
|
| 15 |
@if (Index.Error is { } error) |
| 16 |
{ |
| 17 |
<p class="empty">@error</p> |
| 18 |
} |
| 19 |
else if (Repositories.Count == 0) |
| 20 |
{ |
| 21 |
<p class="empty">Nothing to browse: there are no repositories under @Service.Root.</p> |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
<div class="scroll"> |
| 26 |
<table> |
| 27 |
<thead> |
| 28 |
<tr> |
| 29 |
<th>name</th> |
| 30 |
<th class="wide">description</th> |
| 31 |
<th class="when-wide">branch</th> |
| 32 |
@if (Owned) |
| 33 |
{ |
| 34 |
<th class="when-wide">owner</th> |
| 35 |
} |
| 36 |
<th class="num">idle</th> |
| 37 |
</tr> |
| 38 |
</thead> |
| 39 |
<tbody> |
| 40 |
@foreach (var repository in Repositories) |
| 41 |
{ |
| 42 |
<tr> |
| 43 |
<td><a href="/git/@Uri.EscapeDataString(repository.Name)">@repository.DisplayName</a></td> |
| 44 |
<td class="wide dim">@(repository.Description ?? "")</td> |
| 45 |
<td class="dim when-wide">@(repository.Head ?? "")</td> |
| 46 |
@if (Owned) |
| 47 |
{ |
| 48 |
<td class="dim when-wide">@(repository.Owner ?? "")</td> |
| 49 |
} |
| 50 |
<td class="num dim" title="@Exact(repository.Tip?.Committer.When)"> |
| 51 |
@Age(repository.Tip?.Committer.When) |
| 52 |
</td> |
| 53 |
</tr> |
| 54 |
} |
| 55 |
</tbody> |
| 56 |
</table> |
| 57 |
</div> |
| 58 |
} |
| 59 |
</section> |
| 60 |
</main> |
| 61 |
|
| 62 |
@code { |
| 63 |
private GitIndexView Index { get; set; } = new([], null); |
| 64 |
|
| 65 |
private IReadOnlyList<GitRepoSummary> Repositories => Index.Repositories; |
| 66 |
|
| 67 |
/// <summary> |
| 68 |
/// Owner comes from each repository's <c>gitweb.owner</c>, and most never set it. A column of |
| 69 |
/// nothing is the opposite of what this page is for, so it only appears once it says something. |
| 70 |
/// </summary> |
| 71 |
private bool Owned => Repositories.Any(repository => repository.Owner is { Length: > 0 }); |
| 72 |
|
| 73 |
protected override void OnParametersSet() => Index = Service.ListRepositories(); |
| 74 |
} |