@@ -193,20 +193,23 @@
_model.KeepOldCidPinned = InitialKeepOldCidPinned;
}
- private IEnumerable
Validate()
+ private string? ValidateName(string? value)
{
- _error = null;
+ if (string.IsNullOrWhiteSpace(value))
+ return "Name is required.";
- if (string.IsNullOrWhiteSpace(_model.Name))
- yield return "Name is required.";
- if (string.IsNullOrWhiteSpace(_model.Key))
- yield return "IPNS key is required.";
+ return IpfsGateway.ToSafeLeaf(value) is null ? "Invalid name." : null;
+ }
- var leaf = IpfsGateway.ToSafeLeaf(_model.Name);
- if (leaf is null)
- yield return "Invalid name.";
- if (!_model.Key.StartsWith("k51") && !_model.Key.StartsWith("/ipns/"))
- yield return "IPNS Key should look like k51… or /ipns/k51…";
+ private static string? ValidateKey(string? value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ return "IPNS key is required.";
+
+ return value.StartsWith("k51", StringComparison.OrdinalIgnoreCase) ||
+ value.StartsWith("/ipns/k51", StringComparison.OrdinalIgnoreCase)
+ ? null
+ : "IPNS Key should look like k51… or /ipns/k51…";
}
private void Cancel() => MudDialog.Cancel();
@@ -293,9 +296,9 @@
return null;
}
- private async void Submit()
+ private async Task Submit()
{
- await _form.Validate();
+ await _form.ValidateAsync();
if (!_form.IsValid) return;
// Name leaf (immutable on edit)
diff --git a/TruthGate-Web/TruthGate-Web/Components/Shared/AddPinnedItemDialog.razor b/TruthGate-Web/TruthGate-Web/Components/Shared/AddPinnedItemDialog.razor
index b473c89..76207eb 100644
--- a/TruthGate-Web/TruthGate-Web/Components/Shared/AddPinnedItemDialog.razor
+++ b/TruthGate-Web/TruthGate-Web/Components/Shared/AddPinnedItemDialog.razor
@@ -1,9 +1,9 @@
-@using MudBlazor
+@using MudBlazor
@using TruthGate_Web.Utils
-
+
Add Pinned Item
CPU % (System vs Process)
@@ -91,10 +90,9 @@
System Memory Used (GB)
@@ -105,10 +103,9 @@
Process Memory (MB) · Working Set & GC Heap
@@ -119,11 +116,10 @@
ThreadPool · Threads & Queue
+ ChartOptions="@_chartOptions" />
@@ -156,38 +152,34 @@
private int _detailedWindowSeconds = 30; // Detailed: last 30s
private bool _rotateXLabels = true;
- // ===== Axis cosmetics =====
- private readonly AxisChartOptions _axisOptions = new()
- {
- MatchBoundsToSize = true,
- XAxisLabelRotation = 45
- };
- private readonly ChartOptions _chartOptions = new()
- {
- YAxisTicks = 8
- };
+ // ===== Chart cosmetics =====
+ private readonly LineChartOptions _chartOptions = new()
+ {
+ XAxisLabelRotation = 45,
+ YAxisTicks = 8
+ };
// ===== Series & labels =====
private string[] _xLabels = Array.Empty();
- private readonly List _cpuSeries = new()
+ private readonly List> _cpuSeries = new()
{
- new ChartSeries { Name = "System CPU %", Data = Array.Empty() },
- new ChartSeries { Name = "Process CPU %", Data = Array.Empty() }
+ new ChartSeries { Name = "System CPU %", Data = Array.Empty() },
+ new ChartSeries { Name = "Process CPU %", Data = Array.Empty() }
};
- private readonly List _sysMemSeries = new()
+ private readonly List> _sysMemSeries = new()
{
- new ChartSeries { Name = "System Used (GB)", Data = Array.Empty() }
+ new ChartSeries { Name = "System Used (GB)", Data = Array.Empty() }
};
- private readonly List _procMemSeries = new()
+ private readonly List> _procMemSeries = new()
{
- new ChartSeries { Name = "Working Set (MB)", Data = Array.Empty() },
- new ChartSeries { Name = "GC Heap (MB)", Data = Array.Empty() }
+ new ChartSeries { Name = "Working Set (MB)", Data = Array.Empty() },
+ new ChartSeries { Name = "GC Heap (MB)", Data = Array.Empty() }
};
- private readonly List _tpSeries = new()
+ private readonly List> _tpSeries = new()
{
- new ChartSeries { Name = "Threads", Data = Array.Empty() },
- new ChartSeries { Name = "Queue Length", Data = Array.Empty() }
+ new ChartSeries { Name = "Threads", Data = Array.Empty() },
+ new ChartSeries { Name = "Queue Length", Data = Array.Empty() }
};
// ===== Now-cards =====
@@ -214,7 +206,7 @@
{
while (await _timer!.WaitForNextTickAsync(_cts.Token))
{
- _axisOptions.XAxisLabelRotation = _rotateXLabels ? 45 : 0;
+ _chartOptions.XAxisLabelRotation = _rotateXLabels ? 45 : 0;
RebuildSeries();
await InvokeAsync(StateHasChanged);
}
diff --git a/TruthGate-Web/TruthGate-Web/Components/Shared/SimplePromptDialog.razor b/TruthGate-Web/TruthGate-Web/Components/Shared/SimplePromptDialog.razor
index 8416526..5052f11 100644
--- a/TruthGate-Web/TruthGate-Web/Components/Shared/SimplePromptDialog.razor
+++ b/TruthGate-Web/TruthGate-Web/Components/Shared/SimplePromptDialog.razor
@@ -1,4 +1,4 @@
-@using MudBlazor
+@using MudBlazor
@@ -7,7 +7,7 @@
@Message
}
-
+
Validate()
+ private string? ValidateValue(string? value)
{
_error = null;
- if (Required && string.IsNullOrWhiteSpace(_value))
- {
- _error = "Please enter a value.";
- yield return _error;
- }
+ if (Required && string.IsNullOrWhiteSpace(value))
+ return _error = "Please enter a value.";
+
+ return null;
}
private async Task Submit()
{
- await _form.Validate();
+ await _form.ValidateAsync();
if (!_form.IsValid) return;
MudDialog.Close(DialogResult.Ok(_value));
}
diff --git a/TruthGate-Web/TruthGate-Web/TruthGate-Web.csproj b/TruthGate-Web/TruthGate-Web/TruthGate-Web.csproj
index 624c429..d18a0fb 100644
--- a/TruthGate-Web/TruthGate-Web/TruthGate-Web.csproj
+++ b/TruthGate-Web/TruthGate-Web/TruthGate-Web.csproj
@@ -1,7 +1,7 @@
- net9.0
+ net10.0
enable
enable
TruthGate_Web
@@ -9,20 +9,21 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+