diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-03-29 05:57:43 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-03-29 05:57:43 +1100 |
| commit | 9f4033649a53222b0543343fc02b0c74a72235b4 (patch) | |
| tree | afa81b1c7926fae3fcc549fdfb2aed31c1de248c /Pages/Component/AboutDialog.razor | |
| parent | 4a2491b24b58027a693b1a69f3b94bb23fb96f20 (diff) | |
v0.4av0.4a
Diffstat (limited to 'Pages/Component/AboutDialog.razor')
| -rw-r--r-- | Pages/Component/AboutDialog.razor | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Pages/Component/AboutDialog.razor b/Pages/Component/AboutDialog.razor index 9ffbad4..1229dc7 100644 --- a/Pages/Component/AboutDialog.razor +++ b/Pages/Component/AboutDialog.razor @@ -1,5 +1,6 @@ @using System.Reflection @using Microsoft.AspNetCore.Hosting +@inject IDbContextFactory<HBContext> dbFactory @inject IHostingEnvironment hostingEnvironment @implements IDialog @@ -672,6 +673,15 @@ <<a href="https://www.gnu.org/licenses/" target="_blank">https://www.gnu.org/licenses/</a>>. </div> <a href="https://gitlab.com/plasmicplexus/HyperBooru-Server" target="_blank">Source</a> + <div id="progressContainer"> + @if(progress.HasValue) { + var untagged = progress.Value.Untagged.ToString("N0"); + var total = progress.Value.Total.ToString("N0"); + var percent = (progress.Value.Untagged * 100f / progress.Value.Total).ToString("f1"); + <p id="progress">Untagged: @($"{untagged}/{total} ({percent}%)")</p> + } + <ProgressBar @ref=progressBar /> + </div> <ButtonContainer> <button @onclick=Hide>Close</button> </ButtonContainer> @@ -680,9 +690,26 @@ @code { private Dialog dialog; + private ProgressBar progressBar; + + private (long Untagged, long Total)? progress; + public bool Visible { get => dialog.Visible; - set => dialog.Visible = value; + set { + dialog.Visible = value; + if(value) { + using var db = dbFactory.CreateDbContext(); + progress = ( + Untagged: db.Media + .Where(m => m.Tags.Any(t => t.TagDefinition.ObjectId == (int) HBObjectId.IngestTag)) + .Count(), + Total: db.Media.Count() + ); + progressBar.Progress = (float) progress.Value!.Untagged / (float) progress.Value!.Total; + InvokeAsync(() => StateHasChanged()); + } + } } public void Show() => Visible = true; |
