DataInbox list
This commit is contained in:
60
DiunaBI.UI.Shared/Components/DataInboxListComponent.razor.cs
Normal file
60
DiunaBI.UI.Shared/Components/DataInboxListComponent.razor.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using DiunaBI.UI.Shared.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using DiunaBI.Application.DTOModels;
|
||||
using DiunaBI.Application.DTOModels.Common;
|
||||
using MudBlazor;
|
||||
|
||||
namespace DiunaBI.UI.Shared.Components;
|
||||
|
||||
public partial class DataInboxListComponent : ComponentBase
|
||||
{
|
||||
[Inject] private DataInboxService DataInboxService { get; set; } = default!;
|
||||
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
||||
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
||||
|
||||
|
||||
private PagedResult<DataInboxDto> dataInbox = new();
|
||||
private DataInboxFilterRequest filterRequest = new();
|
||||
private bool isLoading = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadDataInbox();
|
||||
}
|
||||
|
||||
private async Task LoadDataInbox()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
try
|
||||
{
|
||||
dataInbox = await DataInboxService.GetDataInboxAsync(filterRequest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Loading data inbox failed: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SearchDataInbox()
|
||||
{
|
||||
filterRequest.Page = 1;
|
||||
await LoadDataInbox();
|
||||
}
|
||||
|
||||
private async Task OnPageChanged(int page)
|
||||
{
|
||||
filterRequest.Page = page;
|
||||
await LoadDataInbox();
|
||||
}
|
||||
|
||||
private async Task ClearFilters()
|
||||
{
|
||||
filterRequest = new DataInboxFilterRequest();
|
||||
await LoadDataInbox();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user