-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a diagnostics page that lists all system wiki pages needed by the…
… site code and flag any that do not exist
- Loading branch information
adelikat
committed
Jul 8, 2023
1 parent
48e8072
commit 17ebbd6
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@page | ||
@{ ViewData.SetTitle("System Wiki Pages Used By the Site Code"); } | ||
@model SystemPagesModel | ||
<ul> | ||
<li><a asp-page="Index">Diagnostics</a></li> | ||
</ul> | ||
<label class="float-end">Total: @Model.SystemPages.Count</label> | ||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Page Name</th> | ||
<th>Exists</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var p in Model.SystemPages.OrderBy(p => p.Exists).ThenBy(p => p.Name)) | ||
{ | ||
<tr> | ||
<td> | ||
<wiki-link page-name="@p.Name"></wiki-link> | ||
<td> | ||
<td> | ||
<i condition="p.Exists" class="text-success fa fa-check"></i> | ||
<i condition="!p.Exists" class="text-danger fa fa-exclamation"></i> | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using TASVideos.Core.Services.Wiki; | ||
using TASVideos.Data.Entity; | ||
|
||
namespace TASVideos.Pages.Diagnostics; | ||
|
||
[RequirePermission(PermissionTo.SeeDiagnostics)] | ||
public class SystemPagesModel : BasePageModel | ||
{ | ||
private readonly IWikiPages _wikiPages; | ||
|
||
public SystemPagesModel(IWikiPages wikiPages) | ||
{ | ||
_wikiPages = wikiPages; | ||
} | ||
|
||
public record SystemPage(string Name, bool Exists); | ||
public List<SystemPage> SystemPages { get; set; } = new List<SystemPage>(); | ||
|
||
public async Task<IActionResult> OnGet() | ||
{ | ||
foreach (var page in SystemWiki.Pages) | ||
{ | ||
var exists = await _wikiPages.Exists(page); | ||
SystemPages.Add(new SystemPage(page, exists)); | ||
} | ||
|
||
return Page(); | ||
} | ||
} |