diff --git a/src/Web/AdminPanel/Pages/Accounts.razor b/src/Web/AdminPanel/Pages/Accounts.razor
index 81ab10a..c41ba94 100644
--- a/src/Web/AdminPanel/Pages/Accounts.razor
+++ b/src/Web/AdminPanel/Pages/Accounts.razor
@@ -22,13 +22,12 @@
@Resources.Action |
-
+ |
-
+
|
- |
@item.LoginName |
diff --git a/src/Web/Shared/Services/AccountService.cs b/src/Web/Shared/Services/AccountService.cs
index a4e5be9..9df8db1 100644
--- a/src/Web/Shared/Services/AccountService.cs
+++ b/src/Web/Shared/Services/AccountService.cs
@@ -6,19 +6,23 @@ namespace MUnique.OpenMU.Web.Shared.Services;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
-using MUnique.OpenMU.Web.Shared.Components.Modal;
using MUnique.OpenMU.DataModel.Entities;
using MUnique.OpenMU.Persistence;
+using MUnique.OpenMU.Web.Shared.Components;
using MUnique.OpenMU.Web.Shared.Components.Form.Modal;
+using MUnique.OpenMU.Web.Shared.Components.Modal;
using MUnique.OpenMU.Web.Shared.Properties;
///
/// Service for s.
///
-public class AccountService : IDataService, ISupportDataChangedNotification
+public class AccountService : IDataService, ISupportDataChangedNotification, IDisposable
{
private readonly IDataSource _dataSource;
private readonly IModalService _modalService;
+ private readonly Debouncer _debouncer = new(300);
+
+ private string _searchFilter = string.Empty;
///
/// Initializes a new instance of the class.
@@ -31,7 +35,8 @@ public class AccountService : IDataService, ISupportDataChangedNotifica
this._modalService = modalService;
}
- private string _searchFilter = string.Empty;
+ ///
+ public event EventHandler? DataChanged;
///
/// Gets or sets the search filter query.
@@ -45,14 +50,19 @@ public class AccountService : IDataService, ISupportDataChangedNotifica
if (this._searchFilter != newValue)
{
this._searchFilter = newValue;
- this.RaiseDataChanged();
+ if (string.IsNullOrEmpty(newValue))
+ {
+ this._debouncer.Cancel();
+ this.DataChanged?.Invoke(this, EventArgs.Empty);
+ }
+ else
+ {
+ _ = this._debouncer.DebounceAsync(this.RaiseDataChangedAsync);
+ }
}
}
}
- ///
- public event EventHandler? DataChanged;
-
///
/// Returns a slice of the account list, defined by an offset and a count.
///
@@ -138,11 +148,21 @@ public class AccountService : IDataService, ISupportDataChangedNotifica
item.SecurityCode = accountParameters.SecurityCode;
item.RegistrationDate = DateTime.UtcNow;
await context.SaveChangesAsync().ConfigureAwait(false);
- this.RaiseDataChanged();
+ this.DataChanged?.Invoke(this, EventArgs.Empty);
}
}
- private void RaiseDataChanged() => this.DataChanged?.Invoke(this, EventArgs.Empty);
+ ///
+ public void Dispose()
+ {
+ this._debouncer.Dispose();
+ }
+
+ private Task RaiseDataChangedAsync()
+ {
+ this.DataChanged?.Invoke(this, EventArgs.Empty);
+ return Task.CompletedTask;
+ }
///
/// Parameters for the account creation which is used for the user interface.