From dfb633f6a769bb95d5704dc8b3f21a2f77fff009 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Thu, 30 May 2024 13:34:24 +0200 Subject: [PATCH] Updated mooncore usage to work with the newer version --- .../Core/Models/Forms/Users/UpdateUserForm.cs | 3 + .../Core/UI/Views/Admin/Users/Index.razor | 20 +++--- .../Core/UI/Views/Admin/Users/Sessions.razor | 26 ++++--- .../Servers/Services/ServerService.cs | 56 +++++++++++---- .../Servers/UI/UserViews/Network.razor | 2 +- .../Servers/UI/Views/Admin/Images/Index.razor | 68 +++++++++---------- .../Servers/UI/Views/Admin/Nodes/Index.razor | 8 +-- .../Servers/UI/Views/Servers/Networks.razor | 9 ++- 8 files changed, 110 insertions(+), 82 deletions(-) diff --git a/Moonlight/Core/Models/Forms/Users/UpdateUserForm.cs b/Moonlight/Core/Models/Forms/Users/UpdateUserForm.cs index 67da5d86..2db50fec 100644 --- a/Moonlight/Core/Models/Forms/Users/UpdateUserForm.cs +++ b/Moonlight/Core/Models/Forms/Users/UpdateUserForm.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; +using MoonCoreUI.Attributes; namespace Moonlight.Core.Models.Forms.Users; @@ -16,5 +17,7 @@ public class UpdateUserForm public string Email { get; set; } [Description("This toggles the use of the two factor authentication")] + [RadioButtonBool("Enabled", "Disabled", TrueIcon = "bx-lock-alt", FalseIcon = "bx-lock-open-alt")] + [DisplayName("Two factor authentication")] public bool Totp { get; set; } = false; } \ No newline at end of file diff --git a/Moonlight/Core/UI/Views/Admin/Users/Index.razor b/Moonlight/Core/UI/Views/Admin/Users/Index.razor index 0568ffed..106923bd 100644 --- a/Moonlight/Core/UI/Views/Admin/Users/Index.razor +++ b/Moonlight/Core/UI/Views/Admin/Users/Index.razor @@ -17,30 +17,30 @@ + TCreateForm="CreateUserForm" + TUpdateForm="UpdateUserForm" + Loader="Load" + CustomAdd="Add" + ValidateUpdate="ValidateUpdate"> - + - + + Change password @code { - private User[] Load(Repository repository) + private IEnumerable Load(Repository repository) { - return repository.Get().ToArray(); + return repository.Get(); } private async Task ChangePassword(User user) diff --git a/Moonlight/Core/UI/Views/Admin/Users/Sessions.razor b/Moonlight/Core/UI/Views/Admin/Users/Sessions.razor index 641eef1c..9d626380 100644 --- a/Moonlight/Core/UI/Views/Admin/Users/Sessions.razor +++ b/Moonlight/Core/UI/Views/Admin/Users/Sessions.razor @@ -22,11 +22,11 @@
-
+