diff --git a/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor b/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor index c0436ce6..16ae635f 100644 --- a/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor +++ b/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor @@ -38,89 +38,176 @@ @if(!_initialized) { -
-

Loading...

+
+
+
+ Loading... +
+

Loading CD offsets...

+
return; } -
-

Compact Disc Offsets

- - - - - - - - - - - - - - - @foreach(CompactDiscOffset item in _items) - { - - - - - - - - - - - } - -
- @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.Manufacturer)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.Model)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.Offset)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.Submissions)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.Agreement)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.AddedWhen)) - - @DisplayNameHelper.GetDisplayName(typeof(CompactDiscOffset), nameof(CompactDiscOffset.ModifiedWhen)) - - Actions -
- @item.Manufacturer - - @item.Model - - @item.Offset - - @item.Submissions - - @item.Agreement - - @item.AddedWhen - - @item.ModifiedWhen - - - Edit - - -
-
+
+ +
+
+

+ Compact Disc Offsets +

+

Manage CD drive read offset database for accurate audio extraction

+
+
- + +
+
+
+
+
+ + + + +
+
+
+ + Total: @FilteredItems.Count() / @_items.Count + +
+
+
+
+ + +
+
+
+ CD Drive Offset Database +
+
+
+ @if(FilteredItems.Any()) + { +
+ + + + + + + + + + + + + + + + @foreach(CompactDiscOffset item in FilteredItems) + { + + + + + + + + + + + + } + +
+ ID + + Manufacturer + + Model + + Offset + + Submissions + + Agreement + + Added + + Modified + + Actions +
+ @item.Id + + @item.Manufacturer + + @item.Model + + @item.Offset + + @item.Submissions + + @(item.Agreement*100)% + + @item.AddedWhen.ToString("yyyy-MM-dd") + + @item.ModifiedWhen.ToString("yyyy-MM-dd") + + + + + +
+
+ } + else + { +
+ +

No CD offsets found

+

@(string.IsNullOrWhiteSpace(_searchTerm) ? "No data available" : "Try adjusting your search criteria")

+
+ } +
+
+
+ + -
Are you sure you want to delete this offset?
+
+ + Are you sure you want to delete this CD offset? +
- - + + -
\ No newline at end of file + + diff --git a/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor.cs b/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor.cs index 068e2103..6b30435d 100644 --- a/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor.cs +++ b/Aaru.Server/Components/Admin/Pages/CompactDiscOffsets/View.razor.cs @@ -35,10 +35,28 @@ namespace Aaru.Server.Components.Admin.Pages.CompactDiscOffsets; public partial class View { - private int _deleteId; - private Modal? _deleteModal; - bool _initialized; - List _items; + private int _deleteId; + private Modal? _deleteModal; + private bool _initialized; + private List _items = new(); + private string _searchTerm = string.Empty; + + private IEnumerable FilteredItems + { + get + { + if(string.IsNullOrWhiteSpace(_searchTerm)) return _items; + + return _items.Where(item => + (item.Manufacturer?.Contains(_searchTerm, StringComparison.OrdinalIgnoreCase) ?? + false) || + (item.Model?.Contains(_searchTerm, StringComparison.OrdinalIgnoreCase) ?? false) || + item.Offset.ToString().Contains(_searchTerm, StringComparison.OrdinalIgnoreCase) || + item.Submissions.ToString() + .Contains(_searchTerm, StringComparison.OrdinalIgnoreCase) || + item.Id.ToString().Contains(_searchTerm, StringComparison.OrdinalIgnoreCase)); + } + } /// protected override async Task OnInitializedAsync()