66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
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();
|
|
}
|
|
|
|
private void OnRowClick(DataInboxDto dataInboxItem)
|
|
{
|
|
NavigationManager.NavigateTo($"/datainbox/{dataInboxItem.Id}");
|
|
}
|
|
}
|