2024-08-12 00:15:16 -05:00
|
|
|
@using LANCommander.Server.Data.Models
|
2024-08-04 18:44:33 -05:00
|
|
|
@using LANCommander.Server.Extensions;
|
2023-11-04 20:02:09 -05:00
|
|
|
@inject NavigationManager NavigationManager
|
2023-11-04 19:43:38 -05:00
|
|
|
|
2025-01-22 18:31:56 -06:00
|
|
|
<Flex Vertical Gap="FlexGap.Large">
|
|
|
|
|
<Table TItem="ServerHttpPath" DataSource="@Values" HidePagination="true" Responsive>
|
|
|
|
|
<PropertyColumn Property="p => p.LocalPath" Title="Local Path">
|
|
|
|
|
<FilePicker @bind-Value="context.LocalPath" AllowDirectories Title="Select Local Path" Root="@WorkingDirectory" />
|
|
|
|
|
</PropertyColumn>
|
|
|
|
|
<PropertyColumn Property="p => p.Path">
|
|
|
|
|
<Input Type="InputType.Text" @bind-Value="context.Path" />
|
|
|
|
|
</PropertyColumn>
|
|
|
|
|
<ActionColumn>
|
|
|
|
|
<Space Style="display: flex; justify-content: end">
|
|
|
|
|
@if (context != null && context.Id != Guid.Empty)
|
|
|
|
|
{
|
2023-11-04 20:12:11 -05:00
|
|
|
<SpaceItem>
|
2025-01-22 18:31:56 -06:00
|
|
|
<a class="ant-btn ant-btn-text ant-btn-icon-only" href="@NavigationManager.ToAbsoluteUri($"Server/{ServerId}/{context.Path.TrimStart('/')}")" target="_blank">
|
|
|
|
|
<Icon Type="@IconType.Outline.Eye" />
|
|
|
|
|
</a>
|
2023-11-04 20:12:11 -05:00
|
|
|
</SpaceItem>
|
2025-01-22 18:31:56 -06:00
|
|
|
}
|
|
|
|
|
<SpaceItem>
|
|
|
|
|
<Button OnClick="() => Remove(context)" Type="@ButtonType.Text" Danger Icon="@IconType.Outline.Close" />
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
</Space>
|
|
|
|
|
</ActionColumn>
|
|
|
|
|
</Table>
|
|
|
|
|
<Flex Justify="FlexJustify.End">
|
|
|
|
|
<Button OnClick="Add" Type="@ButtonType.Primary">Add Path</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
2023-11-04 19:43:38 -05:00
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[Parameter] public ICollection<ServerHttpPath> Values { get; set; }
|
|
|
|
|
[Parameter] public EventCallback<ICollection<ServerHttpPath>> ValuesChanged { get; set; }
|
|
|
|
|
[Parameter] public Guid ServerId { get; set; }
|
|
|
|
|
[Parameter] public string WorkingDirectory { get; set; }
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
if (Values == null)
|
|
|
|
|
Values = new List<ServerHttpPath>();
|
|
|
|
|
|
|
|
|
|
if (ValuesChanged.HasDelegate)
|
|
|
|
|
await ValuesChanged.InvokeAsync(Values);
|
|
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task Add()
|
|
|
|
|
{
|
|
|
|
|
if (Values == null)
|
|
|
|
|
Values = new List<ServerHttpPath>();
|
|
|
|
|
|
|
|
|
|
Values.Add(new ServerHttpPath
|
|
|
|
|
{
|
|
|
|
|
ServerId = ServerId
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (ValuesChanged.HasDelegate)
|
|
|
|
|
await ValuesChanged.InvokeAsync(Values);
|
|
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task Remove(ServerHttpPath httpPath)
|
|
|
|
|
{
|
|
|
|
|
Values.Remove(httpPath);
|
|
|
|
|
|
|
|
|
|
if (ValuesChanged.HasDelegate)
|
|
|
|
|
await ValuesChanged.InvokeAsync(Values);
|
|
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|