Switch server file inputs to new file picker, default root to app's path root

dhcp-server
Pat Hartl 2023-09-11 19:17:49 -05:00
parent 9e0768a96d
commit f80e88a9a2
1 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@
@page "/Servers/{id:guid}/{panel}" @page "/Servers/{id:guid}/{panel}"
@page "/Servers/{id:guid}/{panel}/{logId}" @page "/Servers/{id:guid}/{panel}/{logId}"
@page "/Servers/Add" @page "/Servers/Add"
@using LANCommander.Components.FileManagerComponents;
@using LANCommander.Pages.Servers.Components @using LANCommander.Pages.Servers.Components
@inject GameService GameService @inject GameService GameService
@inject ServerService ServerService @inject ServerService ServerService
@ -72,13 +73,13 @@
</Select> </Select>
</FormItem> </FormItem>
<FormItem Label="Path"> <FormItem Label="Path">
<Input @bind-Value="@context.Path" /> <FilePicker Root="@RootPath" EntrySelectable="x => x is FileManagerFile" @bind-Value="@context.Path" />
</FormItem> </FormItem>
<FormItem Label="Arguments"> <FormItem Label="Arguments">
<Input @bind-Value="@context.Arguments" /> <Input @bind-Value="@context.Arguments" />
</FormItem> </FormItem>
<FormItem Label="Working Directory"> <FormItem Label="Working Directory">
<Input @bind-Value="@context.WorkingDirectory" /> <FilePicker Root="@RootPath" Title="Choose Working Directory" OkText="Select Directory" EntrySelectable="x => x is FileManagerDirectory" @bind-Value="@context.WorkingDirectory" />
</FormItem> </FormItem>
<FormItem> <FormItem>
<LabelTemplate> <LabelTemplate>
@ -147,6 +148,8 @@
IEnumerable<Game> Games = new List<Game>(); IEnumerable<Game> Games = new List<Game>();
string RootPath;
Server Server; Server Server;
Guid GameId; Guid GameId;
@ -157,8 +160,7 @@
else else
Server = await ServerService.Get(Id); Server = await ServerService.Get(Id);
if (String.IsNullOrWhiteSpace(Server.WorkingDirectory)) RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory());
Server.WorkingDirectory = "C:\\";
if (Server.GameId.HasValue) if (Server.GameId.HasValue)
GameId = Server.GameId.Value; GameId = Server.GameId.Value;