[CHANGE] Library service, db migrations, ui blazor
This commit is contained in:
6
Manager.App/Components/Pages/Accounts.razor
Normal file
6
Manager.App/Components/Pages/Accounts.razor
Normal file
@@ -0,0 +1,6 @@
|
||||
@page "/Accounts"
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
7
Manager.App/Components/Pages/Accounts.razor.cs
Normal file
7
Manager.App/Components/Pages/Accounts.razor.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Manager.App.Components.Pages;
|
||||
|
||||
public partial class Accounts : ComponentBase
|
||||
{
|
||||
}
|
40
Manager.App/Components/Pages/Library.razor
Normal file
40
Manager.App/Components/Pages/Library.razor
Normal file
@@ -0,0 +1,40 @@
|
||||
@page "/Library"
|
||||
|
||||
@inject ISnackbar Snackbar
|
||||
@inject ILibraryService LibraryService
|
||||
|
||||
<PageTitle>Library information</PageTitle>
|
||||
<ForcedLoadingOverlay Visible="_loading" CancellationTokenSource="@_cancellationTokenSource"/>
|
||||
|
||||
@if (_libraryInformation != null)
|
||||
{
|
||||
<MudSimpleTable Bordered Dense Elevation="0" Outlined Square Hover>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Library path:</td>
|
||||
<td>@_libraryInformation.LibraryPath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Created at (UTC):</td>
|
||||
<td>@_libraryInformation.CreatedAtUtc</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Last modified (UTC):</td>
|
||||
<td>@_libraryInformation.LastModifiedUtc</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Library size:</td>
|
||||
<td>@Suffix.BytesToSizeSuffix(_libraryInformation.TotalSizeBytes)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Total media:</td>
|
||||
<td>@_libraryInformation.TotalMedia</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total channels:</td>
|
||||
<td>@_libraryInformation.TotalChannels</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</MudSimpleTable>
|
||||
}
|
36
Manager.App/Components/Pages/Library.razor.cs
Normal file
36
Manager.App/Components/Pages/Library.razor.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Manager.App.Models.Library;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Manager.App.Components.Pages;
|
||||
|
||||
public partial class Library
|
||||
{
|
||||
private LibraryInformation? _libraryInformation;
|
||||
private bool _loading;
|
||||
private CancellationTokenSource _cancellationTokenSource = new();
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (_cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
}
|
||||
|
||||
_loading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
var result = await LibraryService.GetLibraryInfoAsync(_cancellationTokenSource.Token);
|
||||
if (result is { IsSuccess: true, Value: not null })
|
||||
{
|
||||
_libraryInformation = result.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Add($"Failed to get library info. Error: {result.Error?.Description}", Severity.Error);
|
||||
}
|
||||
_loading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user