JobList filter fix
This commit is contained in:
@@ -20,7 +20,7 @@ public partial class Index : ComponentBase, IDisposable
|
||||
private bool isLoading = false;
|
||||
private int currentPage = 1;
|
||||
private int pageSize = 50;
|
||||
private JobStatus? selectedStatus = null;
|
||||
private IEnumerable<JobStatus> selectedStatuses = new HashSet<JobStatus>();
|
||||
private JobType? selectedJobType = null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -60,7 +60,8 @@ public partial class Index : ComponentBase, IDisposable
|
||||
|
||||
try
|
||||
{
|
||||
jobs = await JobService.GetJobsAsync(currentPage, pageSize, selectedStatus, selectedJobType);
|
||||
var statusList = selectedStatuses?.ToList();
|
||||
jobs = await JobService.GetJobsAsync(currentPage, pageSize, statusList, selectedJobType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -81,15 +82,29 @@ public partial class Index : ComponentBase, IDisposable
|
||||
|
||||
private async Task ClearFilters()
|
||||
{
|
||||
selectedStatus = null;
|
||||
selectedStatuses = new HashSet<JobStatus>();
|
||||
selectedJobType = null;
|
||||
currentPage = 1;
|
||||
await LoadJobs();
|
||||
}
|
||||
|
||||
private async Task OnStatusFilterChanged(IEnumerable<JobStatus> values)
|
||||
{
|
||||
selectedStatuses = values;
|
||||
currentPage = 1;
|
||||
await LoadJobs();
|
||||
}
|
||||
|
||||
private async Task OnJobTypeFilterChanged(JobType? value)
|
||||
{
|
||||
selectedJobType = value;
|
||||
currentPage = 1;
|
||||
await LoadJobs();
|
||||
}
|
||||
|
||||
private async Task OnStatusClear()
|
||||
{
|
||||
selectedStatus = null;
|
||||
selectedStatuses = new HashSet<JobStatus>();
|
||||
currentPage = 1;
|
||||
await LoadJobs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user