Some checks failed
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m18s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m18s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m38s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m37s
93 lines
2.4 KiB
C#
93 lines
2.4 KiB
C#
using DiunaBI.UI.Shared.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using DiunaBI.Application.DTOModels;
|
|
using DiunaBI.Application.DTOModels.Common;
|
|
using MudBlazor;
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace DiunaBI.UI.Shared.Pages.Layers;
|
|
|
|
public partial class Index : ComponentBase
|
|
{
|
|
[Inject] private LayerService LayerService { get; set; } = default!;
|
|
[Inject] private ISnackbar Snackbar { get; set; } = default!;
|
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
|
[Inject] private LayerFilterStateService FilterStateService { get; set; } = default!;
|
|
[Inject] private IJSRuntime JSRuntime { get; set; } = default!;
|
|
|
|
|
|
private PagedResult<LayerDto> layers = new();
|
|
private LayerFilterRequest filterRequest = new();
|
|
private bool isLoading = false;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
filterRequest = FilterStateService.FilterRequest;
|
|
await LoadLayers();
|
|
}
|
|
|
|
private async Task LoadLayers()
|
|
{
|
|
isLoading = true;
|
|
|
|
try
|
|
{
|
|
FilterStateService.UpdateFilter(filterRequest);
|
|
layers = await LayerService.GetLayersAsync(filterRequest);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"Loading layers failed: {ex.Message}");
|
|
}
|
|
finally
|
|
{
|
|
isLoading = false;
|
|
}
|
|
}
|
|
|
|
private async Task SearchLayers()
|
|
{
|
|
filterRequest.Page = 1;
|
|
await LoadLayers();
|
|
}
|
|
|
|
private async Task OnPageChanged(int page)
|
|
{
|
|
filterRequest.Page = page;
|
|
await LoadLayers();
|
|
}
|
|
|
|
private async Task ClearFilters()
|
|
{
|
|
filterRequest = new LayerFilterRequest();
|
|
FilterStateService.ClearFilter();
|
|
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}");
|
|
}
|
|
|
|
private async Task OnRowRightClick(MouseEventArgs e, LayerDto layer)
|
|
{
|
|
var url = NavigationManager.ToAbsoluteUri($"/layers/{layer.Id}").ToString();
|
|
await JSRuntime.InvokeVoidAsync("open", url, "_blank");
|
|
}
|
|
}
|