Merge branch 'v2_ChangeArchitecture' of https://github.com/Moonlight-Panel/Moonlight into v2_ChangeArchitecture
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
From: "transform opacity-100 scale-100"
|
||||
To: "transform opacity-0 scale-95"
|
||||
-->
|
||||
<div class="@(ShowProfileNav ? "opacity-100" : "opacity-0") transition ease-out duration-100 absolute right-0 z-10 mt-2.5 w-44 origin-top-right rounded-md bg-gray-750 py-2 shadow-lg ring-1 ring-gray-100/5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1">
|
||||
<div class="@(ShowProfileNav ? "opacity-100" : "opacity-0 hidden") transition ease-out duration-100 absolute right-0 z-10 mt-2.5 w-44 origin-top-right rounded-md bg-gray-750 py-2 shadow-lg ring-1 ring-gray-100/5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1">
|
||||
<!-- Active: "bg-gray-50", Not Active: "" -->
|
||||
<a href="/admin" class="block px-3 py-1 text-sm leading-6 text-gray-100 hover:text-primary-500" role="menuitem" tabindex="-1" id="user-menu-item-0">Your profile</a>
|
||||
<a @onclick="Logout" @onclick:preventDefault href="#" class="block px-3 py-1 text-sm leading-6 text-gray-100 hover:text-primary-500" role="menuitem" tabindex="-1" id="user-menu-item-1">Sign out</a>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
var url = new Uri(Navigation.Uri);
|
||||
}
|
||||
|
||||
<div class="relative z-40 lg:hidden transition-opacity @(Layout.ShowMobileNavigation ? "opacity-100" : "opacity-0")" role="dialog" aria-modal="true">
|
||||
<div class="relative z-40 lg:hidden transition-opacity @(Layout.ShowMobileNavigation ? "opacity-100" : "opacity-0 hidden")" role="dialog" aria-modal="true">
|
||||
<div class="fixed inset-0 bg-gray-800/80"></div>
|
||||
|
||||
<div class="fixed inset-0 flex justify-center bg-gray-900">
|
||||
|
||||
65
Moonlight.Client/UI/Views/Admin/Users/Index.razor
Normal file
65
Moonlight.Client/UI/Views/Admin/Users/Index.razor
Normal file
@@ -0,0 +1,65 @@
|
||||
@page "/admin/users"
|
||||
|
||||
@using MoonCore.Blazor.Tailwind.Forms.Components
|
||||
@using MoonCore.Helpers
|
||||
@using MoonCore.Models
|
||||
@using Moonlight.Shared.Http.Requests.Admin.Users
|
||||
@using Moonlight.Shared.Http.Responses.Admin.Users
|
||||
|
||||
@inject HttpApiClient HttpApiClient
|
||||
|
||||
<Crud TItem="UserDetailResponse"
|
||||
TCreateForm="CreateUserRequest"
|
||||
TUpdateForm="UpdateUserRequest"
|
||||
OnConfigure="OnConfigure">
|
||||
<View>
|
||||
<Column TItem="UserDetailResponse" Field="@(x => x.Id)" Title="Id" />
|
||||
<Column TItem="UserDetailResponse" Field="@(x => x.Username)" Title="Username" />
|
||||
<Column TItem="UserDetailResponse" Field="@(x => x.Email)" Title="Email" />
|
||||
</View>
|
||||
</Crud>
|
||||
|
||||
@code
|
||||
{
|
||||
private void OnConfigure(CrudOptions<UserDetailResponse, CreateUserRequest, UpdateUserRequest> crudOptions)
|
||||
{
|
||||
crudOptions.ItemName = "User";
|
||||
|
||||
crudOptions.ItemLoader = async (page, pageSize)
|
||||
=> await HttpApiClient.GetJson<PagedData<UserDetailResponse>>($"api/admin/users?page={page}&pageSize={pageSize}");
|
||||
|
||||
crudOptions.SingleItemLoader = async id
|
||||
=> await HttpApiClient.GetJson<UserDetailResponse>($"api/admin/users/{id}");
|
||||
|
||||
crudOptions.QueryIdentifier = item => item.Id.ToString(); //TODO: Make this default
|
||||
|
||||
crudOptions.OnCreate = async request
|
||||
=> await HttpApiClient.Post("api/admin/users", request);
|
||||
|
||||
crudOptions.OnUpdate = async (item, request)
|
||||
=> await HttpApiClient.Patch($"api/admin/users/{item.Id}", request);
|
||||
|
||||
crudOptions.OnDelete = async item
|
||||
=> await HttpApiClient.Delete($"api/admin/users/{item.Id}");
|
||||
|
||||
crudOptions.OnConfigureCreate = configuration =>
|
||||
{
|
||||
configuration.WithField(x => x.Username);
|
||||
configuration.WithField(x => x.Email);
|
||||
configuration.WithField(x => x.Password)
|
||||
.WithComponent<StringComponent>(component => component.Type = "password");
|
||||
};
|
||||
|
||||
crudOptions.OnConfigureUpdate = (_, configuration) =>
|
||||
{
|
||||
configuration.WithField(x => x.Username);
|
||||
configuration.WithField(x => x.Email);
|
||||
|
||||
configuration.WithField(x => x.Password, fieldConfiguration =>
|
||||
{
|
||||
fieldConfiguration.Description = "Optional. Specify if you want to change this accounts password";
|
||||
})
|
||||
.WithComponent<StringComponent>(component => component.Type = "password");
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user