Remember list filters
This commit is contained in:
@@ -11,6 +11,7 @@ public partial class DataInboxListComponent : ComponentBase
|
|||||||
[Inject] private DataInboxService DataInboxService { get; set; } = default!;
|
[Inject] private DataInboxService DataInboxService { get; set; } = default!;
|
||||||
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
||||||
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
[Inject] private DataInboxFilterStateService FilterStateService { get; set; } = default!;
|
||||||
|
|
||||||
|
|
||||||
private PagedResult<DataInboxDto> dataInbox = new();
|
private PagedResult<DataInboxDto> dataInbox = new();
|
||||||
@@ -19,6 +20,7 @@ public partial class DataInboxListComponent : ComponentBase
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
filterRequest = FilterStateService.FilterRequest;
|
||||||
await LoadDataInbox();
|
await LoadDataInbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +30,7 @@ public partial class DataInboxListComponent : ComponentBase
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
FilterStateService.UpdateFilter(filterRequest);
|
||||||
dataInbox = await DataInboxService.GetDataInboxAsync(filterRequest);
|
dataInbox = await DataInboxService.GetDataInboxAsync(filterRequest);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -55,6 +58,7 @@ public partial class DataInboxListComponent : ComponentBase
|
|||||||
private async Task ClearFilters()
|
private async Task ClearFilters()
|
||||||
{
|
{
|
||||||
filterRequest = new DataInboxFilterRequest();
|
filterRequest = new DataInboxFilterRequest();
|
||||||
|
FilterStateService.ClearFilter();
|
||||||
await LoadDataInbox();
|
await LoadDataInbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,16 @@ public partial class LayerListComponent : ComponentBase
|
|||||||
[Inject] private LayerService LayerService { get; set; } = default!;
|
[Inject] private LayerService LayerService { get; set; } = default!;
|
||||||
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
||||||
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
[Inject] private LayerFilterStateService FilterStateService { get; set; } = default!;
|
||||||
|
|
||||||
|
|
||||||
private PagedResult<LayerDto> layers = new();
|
private PagedResult<LayerDto> layers = new();
|
||||||
private LayerFilterRequest filterRequest = new();
|
private LayerFilterRequest filterRequest = new();
|
||||||
private bool isLoading = false;
|
private bool isLoading = false;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
filterRequest = FilterStateService.FilterRequest;
|
||||||
await LoadLayers();
|
await LoadLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +30,7 @@ public partial class LayerListComponent : ComponentBase
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
FilterStateService.UpdateFilter(filterRequest);
|
||||||
layers = await LayerService.GetLayersAsync(filterRequest);
|
layers = await LayerService.GetLayersAsync(filterRequest);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -55,6 +58,7 @@ public partial class LayerListComponent : ComponentBase
|
|||||||
private async Task ClearFilters()
|
private async Task ClearFilters()
|
||||||
{
|
{
|
||||||
filterRequest = new LayerFilterRequest();
|
filterRequest = new LayerFilterRequest();
|
||||||
|
FilterStateService.ClearFilter();
|
||||||
await LoadLayers();
|
await LoadLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ public static class ServiceCollectionExtensions
|
|||||||
services.AddScoped<LayerService>();
|
services.AddScoped<LayerService>();
|
||||||
services.AddScoped<DataInboxService>();
|
services.AddScoped<DataInboxService>();
|
||||||
|
|
||||||
|
// Filter state services (scoped to maintain state during user session)
|
||||||
|
services.AddScoped<LayerFilterStateService>();
|
||||||
|
services.AddScoped<DataInboxFilterStateService>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Text" OnClick="ProcessLayer">Process Layer</MudButton>
|
<MudButton Variant="Variant.Text" OnClick="ProcessLayer">Process Layer</MudButton>
|
||||||
}
|
}
|
||||||
|
<MudButton Variant="Variant.Text" OnClick="GoBack" StartIcon="@Icons.Material.Filled.ArrowBack">Back to List</MudButton>
|
||||||
</CardHeaderActions>
|
</CardHeaderActions>
|
||||||
</MudCardHeader>
|
</MudCardHeader>
|
||||||
<MudCardContent>
|
<MudCardContent>
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ public partial class LayerDetailPage : ComponentBase
|
|||||||
Snackbar.Add("Process layer functionality coming soon", Severity.Error);
|
Snackbar.Add("Process layer functionality coming soon", Severity.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GoBack()
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/layers");
|
||||||
|
}
|
||||||
|
|
||||||
// Record editing methods
|
// Record editing methods
|
||||||
private void StartEdit(RecordDto record)
|
private void StartEdit(RecordDto record)
|
||||||
{
|
{
|
||||||
|
|||||||
18
DiunaBI.UI.Shared/Services/DataInboxFilterStateService.cs
Normal file
18
DiunaBI.UI.Shared/Services/DataInboxFilterStateService.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using DiunaBI.Application.DTOModels;
|
||||||
|
|
||||||
|
namespace DiunaBI.UI.Shared.Services;
|
||||||
|
|
||||||
|
public class DataInboxFilterStateService
|
||||||
|
{
|
||||||
|
public DataInboxFilterRequest FilterRequest { get; set; } = new();
|
||||||
|
|
||||||
|
public void UpdateFilter(DataInboxFilterRequest request)
|
||||||
|
{
|
||||||
|
FilterRequest = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearFilter()
|
||||||
|
{
|
||||||
|
FilterRequest = new DataInboxFilterRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
18
DiunaBI.UI.Shared/Services/LayerFilterStateService.cs
Normal file
18
DiunaBI.UI.Shared/Services/LayerFilterStateService.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using DiunaBI.Application.DTOModels;
|
||||||
|
|
||||||
|
namespace DiunaBI.UI.Shared.Services;
|
||||||
|
|
||||||
|
public class LayerFilterStateService
|
||||||
|
{
|
||||||
|
public LayerFilterRequest FilterRequest { get; set; } = new();
|
||||||
|
|
||||||
|
public void UpdateFilter(LayerFilterRequest request)
|
||||||
|
{
|
||||||
|
FilterRequest = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearFilter()
|
||||||
|
{
|
||||||
|
FilterRequest = new LayerFilterRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user