Switched to database scheme seperation from MoonCores SingleDb. Updated mooncore versions. Updating to correct Async naming
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<label for="@Id" class="btn btn-square border-0 ring-0 outline-0" style="background-color: @Value">
|
||||
<i class="text-lg text-base-content @Icon"></i>
|
||||
</label>
|
||||
<input value="@Value" @oninput="Update" id="@Id" type="color" class="h-0 w-0 opacity-0"/>
|
||||
<input value="@Value" @oninput="UpdateAsync" id="@Id" type="color" class="h-0 w-0 opacity-0"/>
|
||||
|
||||
@code
|
||||
{
|
||||
@@ -37,7 +37,7 @@
|
||||
Id = $"color-selector-{GetHashCode()}";
|
||||
}
|
||||
|
||||
private async Task Update(ChangeEventArgs args)
|
||||
private async Task UpdateAsync(ChangeEventArgs args)
|
||||
{
|
||||
Value = args.Value?.ToString() ?? "#FFFFFF";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
for all SignalR Hubs to be synced.
|
||||
</p>
|
||||
<div class="mt-5">
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<WButton OnClick="OnClick" CssClasses="btn btn-primary">
|
||||
Send broadcast
|
||||
</WButton>
|
||||
@@ -30,9 +30,9 @@
|
||||
{
|
||||
private HubConnection? Connection;
|
||||
|
||||
private async Task Load(LazyLoader lazyLoader)
|
||||
private async Task LoadAsync(LazyLoader lazyLoader)
|
||||
{
|
||||
await lazyLoader.UpdateText("Connecting to SignalR endpoint");
|
||||
await lazyLoader.UpdateTextAsync("Connecting to SignalR endpoint");
|
||||
|
||||
Connection = new HubConnectionBuilder()
|
||||
.WithUrl(Navigation.ToAbsoluteUri("/api/admin/system/diagnose/ws"))
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
Connection.On(
|
||||
"Pong",
|
||||
async () => await ToastService.Success("Received broadcast")
|
||||
async () => await ToastService.SuccessAsync("Received broadcast")
|
||||
);
|
||||
|
||||
await Connection.StartAsync();
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="_ => UpdateRadiusBox(possibleValue)" type="radio" name="radius-box" class="radio hidden"/>
|
||||
<input @onclick="_ => UpdateRadiusBoxAsync(possibleValue)" type="radio" name="radius-box" class="radio hidden"/>
|
||||
}
|
||||
<span class="label-text w-full">
|
||||
<div class="pe-1.5 pt-1.5" aria-hidden="true">
|
||||
@@ -164,7 +164,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="_ => UpdateRadiusField(possibleValue)" type="radio" name="radius-field" class="radio hidden"/>
|
||||
<input @onclick="_ => UpdateRadiusFieldAsync(possibleValue)" type="radio" name="radius-field" class="radio hidden"/>
|
||||
}
|
||||
<span class="label-text w-full">
|
||||
<div class="pe-1.5 pt-1.5" aria-hidden="true">
|
||||
@@ -191,7 +191,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input @onclick="_ => UpdateRadiusSelector(possibleValue)" type="radio" name="radius-selector" class="radio hidden"/>
|
||||
<input @onclick="_ => UpdateRadiusSelectorAsync(possibleValue)" type="radio" name="radius-selector" class="radio hidden"/>
|
||||
}
|
||||
<span class="label-text w-full">
|
||||
<div class="pe-1.5 pt-1.5" aria-hidden="true">
|
||||
@@ -302,19 +302,19 @@
|
||||
set => Theme.Noise = value ? 1 : 0;
|
||||
}
|
||||
|
||||
private async Task UpdateRadiusBox(float value)
|
||||
private async Task UpdateRadiusBoxAsync(float value)
|
||||
{
|
||||
Theme.RadiusBox = value;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task UpdateRadiusField(float value)
|
||||
private async Task UpdateRadiusFieldAsync(float value)
|
||||
{
|
||||
Theme.RadiusField = value;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task UpdateRadiusSelector(float value)
|
||||
private async Task UpdateRadiusSelectorAsync(float value)
|
||||
{
|
||||
Theme.RadiusSelector = value;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
public event Func<Task> OnStateChanged;
|
||||
public bool ShowMobileNavigation { get; private set; } = false;
|
||||
|
||||
public async Task ToggleMobileNavigation()
|
||||
public async Task ToggleMobileNavigationAsync()
|
||||
{
|
||||
ShowMobileNavigation = !ShowMobileNavigation;
|
||||
await OnStateChanged();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<header class="flex items-center px-4 lg:hidden border-b border-base-content/5">
|
||||
<div class="py-2.5">
|
||||
<span class="relative">
|
||||
<button @onclick="Layout.ToggleMobileNavigation" aria-label="Open navigation"
|
||||
<button @onclick="Layout.ToggleMobileNavigationAsync" aria-label="Open navigation"
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 sm:text-sm/5 text-base-content"
|
||||
type="button">
|
||||
<i class="icon-menu text-xl"></i>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="#" @onclick:preventDefault @onclick="Logout" class="flex items-center">
|
||||
<a href="#" @onclick:preventDefault @onclick="LogoutAsync" class="flex items-center">
|
||||
<i class="icon-log-out text-lg"></i>
|
||||
</a>
|
||||
</div>
|
||||
@@ -121,7 +121,7 @@
|
||||
<div class="truncate">Moonlight v2.1</div>
|
||||
</div>
|
||||
|
||||
<button @onclick="Layout.ToggleMobileNavigation" aria-label="Close navigation" type="button"
|
||||
<button @onclick="Layout.ToggleMobileNavigationAsync" aria-label="Close navigation" type="button"
|
||||
class="relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 text-base-content">
|
||||
<i class="icon-x text-lg"></i>
|
||||
</button>
|
||||
@@ -180,7 +180,7 @@
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<div class="relative">
|
||||
<a class="flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 sm:py-2 sm:text-sm/5 text-base-content"
|
||||
href="#" @onclick:preventDefault @onclick="Logout">
|
||||
href="#" @onclick:preventDefault @onclick="LogoutAsync">
|
||||
<i class="icon-log-out"></i>
|
||||
<span class="truncate">Logout</span>
|
||||
</a>
|
||||
@@ -252,13 +252,13 @@
|
||||
if (!Layout.ShowMobileNavigation)
|
||||
return;
|
||||
|
||||
await Layout.ToggleMobileNavigation();
|
||||
await Layout.ToggleMobileNavigationAsync();
|
||||
};
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task Logout()
|
||||
private Task LogoutAsync()
|
||||
{
|
||||
Navigation.NavigateTo("/api/auth/logout", true);
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="flex h-screen justify-center items-center">
|
||||
<div class="sm:min-w-md">
|
||||
<div class="bg-base-100 shadow-base-300/20 z-1 w-full space-y-6 rounded-xl p-6 shadow-md lg:p-8">
|
||||
<LazyLoader EnableDefaultSpacing="false" Load="Load">
|
||||
<LazyLoader EnableDefaultSpacing="false" Load="LoadAsync">
|
||||
@if (ShowSelection)
|
||||
{
|
||||
<div class="flex justify-center items-center gap-3">
|
||||
@@ -34,7 +34,7 @@
|
||||
if (config == null) // Ignore all schemes which have no ui configured
|
||||
continue;
|
||||
|
||||
<button @onclick="() => Start(scheme)" class="btn btn-text w-full"
|
||||
<button @onclick="() => StartAsync(scheme)" class="btn btn-text w-full"
|
||||
style="background-color: @(config.Color)">
|
||||
<img src="@config.IconUrl"
|
||||
alt="scheme icon"
|
||||
@@ -71,7 +71,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
private async Task Load(LazyLoader arg)
|
||||
private async Task LoadAsync(LazyLoader arg)
|
||||
{
|
||||
AuthSchemes = await ApiClient.GetJson<AuthSchemeResponse[]>(
|
||||
"api/auth"
|
||||
@@ -82,12 +82,12 @@
|
||||
// showing the selection screen
|
||||
|
||||
if (AuthSchemes.Length == 1)
|
||||
await Start(AuthSchemes[0]);
|
||||
await StartAsync(AuthSchemes[0]);
|
||||
else
|
||||
ShowSelection = true;
|
||||
}
|
||||
|
||||
private Task Start(AuthSchemeResponse scheme)
|
||||
private Task StartAsync(AuthSchemeResponse scheme)
|
||||
{
|
||||
Navigation.NavigateTo($"/api/auth/{scheme.Identifier}", true);
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -66,17 +66,17 @@
|
||||
|
||||
var response = await ApiClient.PostJson<CreateApiKeyResponse>("api/admin/apikeys", Request);
|
||||
|
||||
await DownloadService.Download(
|
||||
await DownloadService.DownloadAsync(
|
||||
$"moonlight-key-{response.Id}.txt",
|
||||
response.Secret
|
||||
);
|
||||
|
||||
await AlertService.Success(
|
||||
await AlertService.SuccessAsync(
|
||||
"API Key successfully created",
|
||||
"The API Key has been downloaded. Dont lose it, you cant view it anymore"
|
||||
);
|
||||
|
||||
await ToastService.Success("Successfully created api key");
|
||||
await ToastService.SuccessAsync("Successfully created api key");
|
||||
Navigation.NavigateTo("/admin/api");
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="ApiKeyResponse"
|
||||
ItemsProvider="ItemsProvider"
|
||||
ItemsProvider="ItemsProviderAsync"
|
||||
EnableFiltering="true"
|
||||
EnablePagination="true">
|
||||
<PropertyColumn Field="x => x.Id" Sortable="true" />
|
||||
@@ -92,7 +92,7 @@
|
||||
{
|
||||
private DataGrid<ApiKeyResponse> Grid;
|
||||
|
||||
private async Task<DataGridItemResult<ApiKeyResponse>> ItemsProvider(DataGridItemRequest request)
|
||||
private async Task<DataGridItemResult<ApiKeyResponse>> ItemsProviderAsync(DataGridItemRequest request)
|
||||
{
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
@@ -116,13 +116,13 @@
|
||||
|
||||
private async Task DeleteAsync(ApiKeyResponse apiKeyResponse)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
"API Key deletion",
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"API Key Deletion",
|
||||
$"Do you really want to delete the api key '{apiKeyResponse.Description}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/apikeys/{apiKeyResponse.Id}");
|
||||
await ToastService.Success("Successfully deleted api key");
|
||||
await ToastService.SuccessAsync("Successfully deleted api key");
|
||||
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
@inject NavigationManager Navigation
|
||||
@inject ToastService ToastService
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="Update API Key">
|
||||
<a href="/admin/api" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -40,7 +40,7 @@
|
||||
private HandleForm Form;
|
||||
private UpdateApiKeyRequest Request;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
var detail = await ApiClient.GetJson<ApiKeyResponse>($"api/admin/apikeys/{Id}");
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
{
|
||||
await ApiClient.Patch($"api/admin/apikeys/{Id}", Request);
|
||||
|
||||
await ToastService.Success("Successfully updated api key");
|
||||
await ToastService.SuccessAsync("Successfully updated api key");
|
||||
Navigation.NavigateTo("/admin/api");
|
||||
}
|
||||
}
|
||||
@@ -26,17 +26,17 @@
|
||||
includes your installed theme and plugins. For more information, have a look at <a class="text-primary" href="https://help.moonlightpanel.xyz">our docs</a>
|
||||
</p>
|
||||
|
||||
<WButton OnClick="GenerateFrontend" CssClasses="btn btn-primary mt-5">Generate frontend.zip</WButton>
|
||||
<WButton OnClick="GenerateFrontendAsync" CssClasses="btn btn-primary mt-5">Generate frontend.zip</WButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
private async Task GenerateFrontend(WButton _)
|
||||
private async Task GenerateFrontendAsync(WButton _)
|
||||
{
|
||||
var stream = await ApiClient.GetStream("api/admin/system/advanced/frontend");
|
||||
|
||||
await DownloadService.Download("frontend.zip", stream);
|
||||
await DownloadService.DownloadAsync("frontend.zip", stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<div class="my-8">
|
||||
<DataGrid TGridItem="ThemeResponse"
|
||||
ItemsProvider="ItemsProvider"
|
||||
ItemsProvider="ItemsProviderAsync"
|
||||
EnableFiltering="true"
|
||||
EnablePagination="true">
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
{
|
||||
private DataGrid<ThemeResponse> Grid;
|
||||
|
||||
private async Task<DataGridItemResult<ThemeResponse>> ItemsProvider(DataGridItemRequest request)
|
||||
private async Task<DataGridItemResult<ThemeResponse>> ItemsProviderAsync(DataGridItemRequest request)
|
||||
{
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
{
|
||||
if (!file.Name.EndsWith(".json"))
|
||||
{
|
||||
await ToastService.Error($"Unable to import {file.Name}", "Only .json files are supported");
|
||||
await ToastService.ErrorAsync($"Unable to import {file.Name}", "Only .json files are supported");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file.Size > maxFileSize)
|
||||
{
|
||||
await ToastService.Error($"Unable to import {file.Name}", "Exceeded the maximum file limit of 1MB");
|
||||
await ToastService.ErrorAsync($"Unable to import {file.Name}", "Exceeded the maximum file limit of 1MB");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
if (themeTransfer == null)
|
||||
{
|
||||
await ToastService.Error($"Unable to import {file.Name}", "Failed to deserialize the content");
|
||||
await ToastService.ErrorAsync($"Unable to import {file.Name}", "Failed to deserialize the content");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
Version = themeTransfer.Version
|
||||
});
|
||||
|
||||
await ToastService.Success("Successfully imported theme", theme.Name);
|
||||
await ToastService.SuccessAsync("Successfully imported theme", theme.Name);
|
||||
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
@@ -203,19 +203,19 @@
|
||||
|
||||
var fileName = $"{transfer.Name.Replace(" ", string.Empty).Trim()}.json";
|
||||
|
||||
await DownloadService.Download(fileName, json);
|
||||
await DownloadService.DownloadAsync(fileName, json);
|
||||
}
|
||||
|
||||
private async Task DeleteAsync(ThemeResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"Theme deletion",
|
||||
$"Do you really want to delete the theme: {response.Name}",
|
||||
async () =>
|
||||
{
|
||||
await ThemeService.DeleteAsync(response.Id);
|
||||
|
||||
await ToastService.Success("Successfully deleted theme");
|
||||
await ToastService.SuccessAsync("Successfully deleted theme");
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -59,7 +59,7 @@
|
||||
private async Task OnValidSubmit()
|
||||
{
|
||||
await ThemeService.CreateAsync(Request);
|
||||
await ToastService.Success("Successfully created theme");
|
||||
await ToastService.SuccessAsync("Successfully created theme");
|
||||
|
||||
NavigationManager.NavigateTo("/admin/system/customisation");
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
@inject ToastService ToastService
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="@($"Update {Request.Name}")">
|
||||
<a href="/admin/system/customisation" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
private HandleForm Form;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Response = await ThemeService.GetAsync(Id);
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
{
|
||||
await ThemeService.UpdateAsync(Id, Request);
|
||||
|
||||
await ToastService.Success("Successfully updated theme");
|
||||
await ToastService.SuccessAsync("Successfully updated theme");
|
||||
Navigation.NavigateTo("/admin/system/customisation");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
If you only want to export specific parts of the diagnose report, click on "Advanced" and select the desired providers
|
||||
</p>
|
||||
|
||||
<WButton OnClick="GenerateDiagnose" CssClasses="btn btn-primary my-5">Generate report</WButton>
|
||||
<WButton OnClick="GenerateDiagnoseAsync" CssClasses="btn btn-primary my-5">Generate report</WButton>
|
||||
|
||||
<div class="text-sm">
|
||||
<a class="text-primary cursor-pointer flex items-center" @onclick:preventDefault
|
||||
@onclick="ToggleDropDown">
|
||||
@onclick="ToggleDropDownAsync">
|
||||
<span class="me-1.5">Advanced</span>
|
||||
@if (DropdownOpen)
|
||||
{
|
||||
@@ -45,7 +45,7 @@
|
||||
</a>
|
||||
|
||||
<div class="@(DropdownOpen ? "" : "hidden")">
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div class="mb-2 py-2 border-b border-base-content/70 flex items-center gap-3">
|
||||
<input id="selectall_checkbox" @bind="SelectAll" type="checkbox" class="checkbox checkbox-primary checkbox-xs">
|
||||
<label for="selectall_checkbox">Select all</label>
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Load(LazyLoader arg)
|
||||
private async Task LoadAsync(LazyLoader arg)
|
||||
{
|
||||
var providers = await ApiClient.GetJson<DiagnoseProvideResponse[]>(
|
||||
"api/admin/system/diagnose/providers"
|
||||
@@ -96,7 +96,7 @@
|
||||
.ToDictionary(x => x, _ => true);
|
||||
}
|
||||
|
||||
private async Task GenerateDiagnose(WButton button)
|
||||
private async Task GenerateDiagnoseAsync(WButton button)
|
||||
{
|
||||
var request = new GenerateDiagnoseRequest();
|
||||
|
||||
@@ -111,11 +111,11 @@
|
||||
|
||||
var stream = await ApiClient.PostStream("api/admin/system/diagnose", request);
|
||||
|
||||
await DownloadService.Download("diagnose.zip", stream);
|
||||
await DownloadService.DownloadAsync("diagnose.zip", stream);
|
||||
}
|
||||
|
||||
|
||||
private async Task ToggleDropDown()
|
||||
private async Task ToggleDropDownAsync()
|
||||
{
|
||||
DropdownOpen = !DropdownOpen;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</HelperMessage>
|
||||
</div>
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 gap-5">
|
||||
<StatCard Title="Servers" Text="@Stats.Servers.ToString()" Icon="icon-server"/>
|
||||
<StatCard Title="Recurring" Text="@Stats.Recurring.ToString()" Icon="icon-calendar-sync"/>
|
||||
@@ -39,7 +39,7 @@
|
||||
{
|
||||
private HangfireStatsResponse Stats;
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
Stats = await ApiClient.GetJson<HangfireStatsResponse>(
|
||||
"api/admin/system/hangfire/stats"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<NavTabs Index="0" Names="UiConstants.AdminNavNames" Links="UiConstants.AdminNavLinks" />
|
||||
</div>
|
||||
|
||||
<LazyLoader Load="LoadOverview">
|
||||
<LazyLoader Load="LoadOverviewAsync">
|
||||
<div class="gap-5 grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4">
|
||||
<StatCard Title="CPU Usage" Text="@(OverviewData.CpuUsage + "%")" Icon="icon-cpu"/>
|
||||
<StatCard Title="Memory Usage" Text="@(Formatter.FormatSize(OverviewData.MemoryUsage))" Icon="icon-memory-stick"/>
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="flex">
|
||||
<div class="card card-body">
|
||||
<div class="flex justify-center">
|
||||
<WButton OnClick="Restart" CssClasses="btn btn-error w-full">
|
||||
<WButton OnClick="RestartAsync" CssClasses="btn btn-error w-full">
|
||||
<i class="icon-repeat me-2"></i>
|
||||
Restart/Shutdown
|
||||
</WButton>
|
||||
@@ -41,12 +41,12 @@
|
||||
{
|
||||
private SystemOverviewResponse OverviewData;
|
||||
|
||||
private async Task LoadOverview(LazyLoader arg)
|
||||
private async Task LoadOverviewAsync(LazyLoader arg)
|
||||
{
|
||||
OverviewData = await ApiClient.GetJson<SystemOverviewResponse>("api/admin/system");
|
||||
}
|
||||
|
||||
private async Task Restart(WButton _)
|
||||
private async Task RestartAsync(WButton _)
|
||||
{
|
||||
await ApiClient.Post("api/admin/system/shutdown");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Create
|
||||
</WButton>
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
await ApiClient.Post("api/admin/users", Request);
|
||||
|
||||
await ToastService.Success("Successfully created user");
|
||||
await ToastService.SuccessAsync("Successfully created user");
|
||||
Navigation.NavigateTo("/admin/users");
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<DataGrid @ref="Grid"
|
||||
TGridItem="UserResponse"
|
||||
ItemsProvider="ItemsProvider"
|
||||
ItemsProvider="ItemsProviderAsync"
|
||||
EnableFiltering="true"
|
||||
EnablePagination="true">
|
||||
<PropertyColumn Field="x => x.Id" Sortable="true" />
|
||||
@@ -46,7 +46,7 @@
|
||||
{
|
||||
private DataGrid<UserResponse> Grid;
|
||||
|
||||
private async Task<DataGridItemResult<UserResponse>> ItemsProvider(DataGridItemRequest request)
|
||||
private async Task<DataGridItemResult<UserResponse>> ItemsProviderAsync(DataGridItemRequest request)
|
||||
{
|
||||
var query = $"?startIndex={request.StartIndex}&count={request.Count}";
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
|
||||
private async Task DeleteAsync(UserResponse response)
|
||||
{
|
||||
await AlertService.ConfirmDanger(
|
||||
await AlertService.ConfirmDangerAsync(
|
||||
"User deletion",
|
||||
$"Do you really want to delete the user '{response.Username}'",
|
||||
async () =>
|
||||
{
|
||||
await ApiClient.Delete($"api/admin/users/{response.Id}");
|
||||
await ToastService.Success("Successfully deleted user");
|
||||
await ToastService.SuccessAsync("Successfully deleted user");
|
||||
|
||||
await Grid.RefreshAsync();
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
@inject NavigationManager Navigation
|
||||
@inject ToastService ToastService
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<LazyLoader Load="LoadAsync">
|
||||
<PageHeader Title="Update User">
|
||||
<a href="/admin/users" class="btn btn-secondary">
|
||||
<i class="icon-chevron-left"></i>
|
||||
Back
|
||||
</a>
|
||||
<WButton OnClick="_ => Form.Submit()" CssClasses="btn btn-primary">
|
||||
<WButton OnClick="Form.SubmitAsync" CssClasses="btn btn-primary">
|
||||
<i class="icon-check"></i>
|
||||
Update
|
||||
</WButton>
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
private List<string> Permissions = [];
|
||||
|
||||
private async Task Load(LazyLoader _)
|
||||
private async Task LoadAsync(LazyLoader _)
|
||||
{
|
||||
var detail = await ApiClient.GetJson<UserResponse>($"api/admin/users/{Id}");
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
await ApiClient.Patch($"api/admin/users/{Id}", Request);
|
||||
|
||||
await ToastService.Success("Successfully updated user");
|
||||
await ToastService.SuccessAsync("Successfully updated user");
|
||||
Navigation.NavigateTo("/admin/users");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user