33 lines
No EOL
1 KiB
Text
33 lines
No EOL
1 KiB
Text
@using LANCommander.SDK.Enums
|
|
@inject StorageLocationService StorageLocationService
|
|
|
|
@if (StorageLocations.Any())
|
|
{
|
|
<Select
|
|
DataSource="StorageLocations"
|
|
ItemValue="l => l"
|
|
ItemLabel="l => l.Path"
|
|
@bind-Value="Value"
|
|
OnSelectedItemChanged="ValueChanged" />
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public StorageLocation Value { get; set; } = new();
|
|
[Parameter] public EventCallback<StorageLocation> ValueChanged { get; set; }
|
|
[Parameter] public StorageLocationType Type { get; set; } = StorageLocationType.Archive;
|
|
|
|
IEnumerable<StorageLocation> StorageLocations = new List<StorageLocation>();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
StorageLocations = await StorageLocationService
|
|
.AsNoTracking()
|
|
.SortBy(l => l.Path)
|
|
.GetAsync(l => l.Type == Type);
|
|
|
|
Value = StorageLocations.First();
|
|
|
|
if (ValueChanged.HasDelegate)
|
|
await ValueChanged.InvokeAsync(Value);
|
|
}
|
|
} |