diff --git a/DiunaBI.API/Controllers/DataInboxController.cs b/DiunaBI.API/Controllers/DataInboxController.cs index 2660a13..441556d 100644 --- a/DiunaBI.API/Controllers/DataInboxController.cs +++ b/DiunaBI.API/Controllers/DataInboxController.cs @@ -92,20 +92,15 @@ public class DataInboxController : Controller [HttpGet] [Route("GetAll")] - public IActionResult GetAll([FromQuery] int start, [FromQuery] int limit, [FromQuery] string? name, [FromQuery] string? source) + public IActionResult GetAll([FromQuery] int start, [FromQuery] int limit, [FromQuery] string? search) { try { var query = _db.DataInbox.AsQueryable(); - if (name != null) + if (!string.IsNullOrEmpty(search)) { - query = query.Where(x => x.Name.Contains(name)); - } - - if (source != null) - { - query = query.Where(x => x.Source.Contains(source)); + query = query.Where(x => x.Name.Contains(search) || x.Source.Contains(search)); } var totalCount = query.Count(); @@ -133,8 +128,8 @@ public class DataInboxController : Controller PageSize = limit }; - _logger.LogDebug("GetAll: Retrieved {Count} of {TotalCount} data inbox items (page {Page}) with filter name={Name}, source={Source}", - items.Count, totalCount, pagedResult.Page, name, source); + _logger.LogDebug("GetAll: Retrieved {Count} of {TotalCount} data inbox items (page {Page}) with filter search={Search}", + items.Count, totalCount, pagedResult.Page, search); return Ok(pagedResult); } diff --git a/DiunaBI.UI.Shared/Components/DataInboxListComponent.razor b/DiunaBI.UI.Shared/Components/DataInboxListComponent.razor index 943ab3a..185b2b2 100644 --- a/DiunaBI.UI.Shared/Components/DataInboxListComponent.razor +++ b/DiunaBI.UI.Shared/Components/DataInboxListComponent.razor @@ -3,7 +3,7 @@ - + - - - Clear filters - + + + + diff --git a/DiunaBI.UI.Shared/Components/LayerListComponent.razor b/DiunaBI.UI.Shared/Components/LayerListComponent.razor index 891a894..51d7bcf 100644 --- a/DiunaBI.UI.Shared/Components/LayerListComponent.razor +++ b/DiunaBI.UI.Shared/Components/LayerListComponent.razor @@ -1,9 +1,10 @@ @using MudBlazor.Internal +@using DiunaBI.Application.DTOModels - + - - - Clear filters - + + @foreach (LayerType type in Enum.GetValues(typeof(LayerType))) + { + @type.ToString() + } + + + + + diff --git a/DiunaBI.UI.Shared/Components/LayerListComponent.razor.cs b/DiunaBI.UI.Shared/Components/LayerListComponent.razor.cs index 28ac7dd..8e923a5 100644 --- a/DiunaBI.UI.Shared/Components/LayerListComponent.razor.cs +++ b/DiunaBI.UI.Shared/Components/LayerListComponent.razor.cs @@ -58,6 +58,20 @@ public partial class LayerListComponent : ComponentBase await LoadLayers(); } + private async Task OnTypeClear() + { + filterRequest.Type = null; + filterRequest.Page = 1; + await LoadLayers(); + } + + private async Task OnTypeChanged(LayerType? type) + { + filterRequest.Type = type; + filterRequest.Page = 1; + await LoadLayers(); + } + private void OnRowClick(LayerDto layer) { NavigationManager.NavigateTo($"/layers/{layer.Id}"); diff --git a/DiunaBI.UI.Shared/MainLayout.razor b/DiunaBI.UI.Shared/MainLayout.razor index 4200735..e2d1649 100644 --- a/DiunaBI.UI.Shared/MainLayout.razor +++ b/DiunaBI.UI.Shared/MainLayout.razor @@ -5,6 +5,7 @@ + diff --git a/DiunaBI.UI.Shared/Services/DataInboxService.cs b/DiunaBI.UI.Shared/Services/DataInboxService.cs index a04ac84..1db5435 100644 --- a/DiunaBI.UI.Shared/Services/DataInboxService.cs +++ b/DiunaBI.UI.Shared/Services/DataInboxService.cs @@ -26,7 +26,9 @@ public class DataInboxService var query = $"DataInbox/GetAll?start={start}&limit={filterRequest.PageSize}"; if (!string.IsNullOrEmpty(filterRequest.Search)) - query += $"&name={Uri.EscapeDataString(filterRequest.Search)}"; + { + query += $"&search={Uri.EscapeDataString(filterRequest.Search)}"; + } var response = await _httpClient.GetAsync(query); response.EnsureSuccessStatusCode(); diff --git a/DiunaBI.UI.Shared/Services/LayerService.cs b/DiunaBI.UI.Shared/Services/LayerService.cs index 98c8624..3e56b68 100644 --- a/DiunaBI.UI.Shared/Services/LayerService.cs +++ b/DiunaBI.UI.Shared/Services/LayerService.cs @@ -28,10 +28,8 @@ public class LayerService if (!string.IsNullOrEmpty(filterRequest.Search)) query += $"&name={Uri.EscapeDataString(filterRequest.Search)}"; - /* - if (type.HasValue) - query += $"&type={type.Value}"; - */ + if (filterRequest.Type.HasValue) + query += $"&type={(int)filterRequest.Type.Value}"; var response = await _httpClient.GetAsync(query); response.EnsureSuccessStatusCode();