From d020cfaaaa52aeed42a239e638fd7d3decab6124 Mon Sep 17 00:00:00 2001 From: A-Guldborg Date: Tue, 23 Apr 2024 23:16:13 +0200 Subject: [PATCH] First attempt at loading indicator to UserTable component --- Shifty.App/Components/UserTable.razor | 120 ++++++++++++++------------ 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/Shifty.App/Components/UserTable.razor b/Shifty.App/Components/UserTable.razor index d757983..73be8f6 100644 --- a/Shifty.App/Components/UserTable.razor +++ b/Shifty.App/Components/UserTable.razor @@ -5,63 +5,73 @@ @using Shifty.Api.Generated.AnalogCoreV2 @using Shared @using LanguageExt.UnsafeValueAccess +@using MudExtensions @inject IUserService _userService @inject ISnackbar Snackbar - - - Users - - - - - Id - Name - Email - UserGroup - - - @context.Id - @context.Name - @context.Email - @context.UserGroup - - - @context.Id - @context.Name - @context.Email - - - @foreach (var group in Enum.GetValues()) { - @group - } - - - - No matching records found - - - - - + + Users + + + + + + + + + + + + Id + Name + Email + UserGroup + + + @context.Id + @context.Name + @context.Email + @context.UserGroup + + + @context.Id + @context.Name + @context.Email + + + @foreach (var group in Enum.GetValues()) { + @group + } + + + + No matching records found + + + + + + + + @code @@ -69,11 +79,13 @@ private MudTable _table; private string searchString = ""; UserGroup UserGroupBeforeEdit; + private bool _loading = false; private async Task> LoadUsers(TableState state) { + _loading = true; var result = await _userService.SearchUsers(searchString, state.Page, state.PageSize); - + _loading = false; return result.Match( Succ: res => { return new TableData(){ Items = res.Users.AsEnumerable(), TotalItems = res.TotalUsers};