summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pages/Component/AboutDialog.razor29
-rw-r--r--Pages/Component/AboutDialog.razor.css11
-rw-r--r--Pages/Component/ProgressBar.razor17
-rw-r--r--Pages/Component/ProgressBar.razor.css17
-rw-r--r--Server.csproj4
-rw-r--r--wwwroot/styles/global.css2
6 files changed, 77 insertions, 3 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 @@
&lt<a href="https://www.gnu.org/licenses/" target="_blank">https://www.gnu.org/licenses/</a>&gt.
</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;
diff --git a/Pages/Component/AboutDialog.razor.css b/Pages/Component/AboutDialog.razor.css
index 0a523a4..cbc4b59 100644
--- a/Pages/Component/AboutDialog.razor.css
+++ b/Pages/Component/AboutDialog.razor.css
@@ -6,6 +6,12 @@ p#author {
font-size: 8pt;
}
+p#progress {
+ flex: 1 0 auto;
+ font-size: 8pt;
+ margin-right: 10px;
+}
+
div#license {
background: #222;
border-radius: 10px;
@@ -16,3 +22,8 @@ div#license {
overflow-y: auto;
padding: 20px;
}
+
+div#progressContainer {
+ align-items: center;
+ display: flex;
+}
diff --git a/Pages/Component/ProgressBar.razor b/Pages/Component/ProgressBar.razor
new file mode 100644
index 0000000..aa22194
--- /dev/null
+++ b/Pages/Component/ProgressBar.razor
@@ -0,0 +1,17 @@
+<div id="outer">
+ <div id="inner" style="width:@(Progress * 100)%">
+ </div>
+</div>
+
+@code {
+ private float progress = 0;
+
+ [Parameter]
+ public float Progress {
+ get => progress;
+ set {
+ progress = value;
+ InvokeAsync(() => StateHasChanged());
+ }
+ }
+}
diff --git a/Pages/Component/ProgressBar.razor.css b/Pages/Component/ProgressBar.razor.css
new file mode 100644
index 0000000..f49c982
--- /dev/null
+++ b/Pages/Component/ProgressBar.razor.css
@@ -0,0 +1,17 @@
+div#outer {
+ background: var(--col-progbar-bg);
+ border-radius: 15px;
+ height: 15px;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+
+div#inner {
+ background: var(--col-progbar-fg);
+ border-radius: 15px;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ transition: width 0.5s ease;
+}
diff --git a/Server.csproj b/Server.csproj
index 8396e3d..8e85fd2 100644
--- a/Server.csproj
+++ b/Server.csproj
@@ -6,9 +6,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>HyperBooru</AssemblyName>
<RootNamespace>HyperBooru</RootNamespace>
- <AssemblyVersion>0.3.0.0</AssemblyVersion>
+ <AssemblyVersion>0.4.0.0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
- <Version>0.3-alpha</Version>
+ <Version>0.4-alpha</Version>
<UserSecretsId>2907567f-4640-4581-8f4d-0977952d26bd</UserSecretsId>
</PropertyGroup>
diff --git a/wwwroot/styles/global.css b/wwwroot/styles/global.css
index ebcda47..b635eb1 100644
--- a/wwwroot/styles/global.css
+++ b/wwwroot/styles/global.css
@@ -23,6 +23,8 @@
--col-switch-bg: var(--col-bg);
--col-switch-fg: #fff;
--col-switch-bg-hl: var(--col-accent-pri);
+ --col-progbar-fg: var(--col-accent-pri);
+ --col-progbar-bg: #777;
--size-default-gap: 30px;
}