From c071489eec25588a43420ad37fc86c05d8ba20c8 Mon Sep 17 00:00:00 2001 From: Rhywden Date: Mon, 24 Aug 2026 13:11:28 +0200 Subject: [PATCH] MudTable is now sortable --- .../Components/Pages/Admin/AdminHome.razor | 50 +++++++++++++++---- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/Wollmilchsau/Components/Pages/Admin/AdminHome.razor b/Wollmilchsau/Components/Pages/Admin/AdminHome.razor index 5f95d6c..e1e3a63 100644 --- a/Wollmilchsau/Components/Pages/Admin/AdminHome.razor +++ b/Wollmilchsau/Components/Pages/Admin/AdminHome.razor @@ -8,13 +8,15 @@ User Comparison - +Export CSV -

User Comparison

+User Comparison @if (!AdminState.Value.LdapUsersLoaded || !AdminState.Value.MoodleUsersLoaded) { -

Loading users...

+ + Loading @string.Join(" and ", PendingUserImports, " users")... + } else { @@ -27,19 +29,21 @@ else @if (!CombinedUsers.Any()) { -

No users found.

+ + No users found. + } else { - Username - Classroom - Surname - Given name - Role - Exists in LDAP - Exists in Moodle + Username + Classroom + Surname + Given name + Role + Exists in LDAP + Exists in Moodle @context.Username @@ -58,8 +62,32 @@ else } @code { + private static readonly Func SortByUsername = user => user.Username; + private static readonly Func SortByClassroom = user => user.Classroom ?? string.Empty; + private static readonly Func SortBySurname = user => user.Surname ?? string.Empty; + private static readonly Func SortByGivenName = user => user.GivenName ?? string.Empty; + private static readonly Func SortByRole = user => user.Role?.ToString() ?? string.Empty; + private static readonly Func SortByLdapExistence = user => user.ExistsInLdap; + private static readonly Func SortByMoodleExistence = user => user.ExistsInMoodle; + private IEnumerable LdapUsers => AdminState.Value.LdapUsers.Values; + private IEnumerable PendingUserImports + { + get + { + if (!AdminState.Value.LdapUsersLoaded) + { + yield return "LDAP"; + } + + if (!AdminState.Value.MoodleUsersLoaded) + { + yield return "Moodle"; + } + } + } + private IEnumerable CombinedUsers { get