Move console editor to cards and put it under a sub menu item
parent
f1c1b517c0
commit
d13d7129f3
|
@ -2,13 +2,23 @@
|
|||
@using LANCommander.Data.Models
|
||||
@using LANCommander.Extensions;
|
||||
|
||||
|
||||
|
||||
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
||||
@if (Value == null || Value.Count == 0)
|
||||
{
|
||||
<Empty />
|
||||
}
|
||||
|
||||
@foreach (var console in Value)
|
||||
{
|
||||
<SpaceItem>
|
||||
@if (console.Type == ServerConsoleType.RCON)
|
||||
{
|
||||
<Card Size="small">
|
||||
<Card Size="small" Title="@console.Name">
|
||||
<Extra>
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger OnClick="() => Remove(console)" />
|
||||
</Extra>
|
||||
<Body>
|
||||
<Form Layout="@FormLayout.Vertical" Model="@console">
|
||||
<GridRow Gutter="16">
|
||||
|
@ -20,7 +30,7 @@
|
|||
</Select>
|
||||
</FormItem>
|
||||
<FormItem Label="Name">
|
||||
<Input @bind-Value="context.Name" />
|
||||
<Input @bind-Value="context.Name" BindOnInput />
|
||||
</FormItem>
|
||||
</GridCol>
|
||||
|
||||
|
@ -42,7 +52,10 @@
|
|||
}
|
||||
else if (console.Type == ServerConsoleType.LogFile)
|
||||
{
|
||||
<Card Size="small">
|
||||
<Card Size="small" Title="@console.Name">
|
||||
<Extra>
|
||||
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger OnClick="() => Remove(console)" />
|
||||
</Extra>
|
||||
<Body>
|
||||
<Form Layout="@FormLayout.Vertical" Model="@console">
|
||||
<GridRow Gutter="16">
|
||||
|
@ -73,7 +86,7 @@
|
|||
<SpaceItem>
|
||||
<GridRow Justify="end">
|
||||
<GridCol>
|
||||
<Button OnClick="AddConsole" Type="@ButtonType.Primary">Add Console</Button>
|
||||
<Button OnClick="Add" Type="@ButtonType.Primary">Add Console</Button>
|
||||
</GridCol>
|
||||
</GridRow>
|
||||
</SpaceItem>
|
||||
|
@ -95,7 +108,7 @@
|
|||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task AddConsole()
|
||||
private async Task Add()
|
||||
{
|
||||
if (Value == null)
|
||||
Value = new List<ServerConsole>();
|
||||
|
@ -111,7 +124,7 @@
|
|||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task RemoveConsole(ServerConsole console)
|
||||
private async Task Remove(ServerConsole console)
|
||||
{
|
||||
Value.Remove(console);
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
|
||||
@if (Server != null && Server.Id != Guid.Empty)
|
||||
{
|
||||
<SubMenu Key="sub1" Title="Console">
|
||||
<SubMenu Key="sub1" Title="Consoles">
|
||||
<MenuItem Key="Edit" RouterLink="@($"/Servers/{Server.Id}/Consoles")">Edit</MenuItem>
|
||||
@foreach (var log in Server.ServerConsoles)
|
||||
{
|
||||
<MenuItem Key="@log.Id.ToString()" RouterLink="@($"/Servers/{Server.Id}/Console/{log.Id}")">@log.Name</MenuItem>
|
||||
<MenuItem Key="@log.Id.ToString()" RouterLink="@($"/Servers/{Server.Id}/Consoles/{log.Id}")">@log.Name</MenuItem>
|
||||
}
|
||||
</SubMenu>
|
||||
<MenuItem RouterLink="@($"/Servers/{Server.Id}/Files")">Files</MenuItem>
|
||||
|
@ -82,17 +83,23 @@
|
|||
<Switch @bind-Checked="context.UseShellExecute" />
|
||||
</ChildContent>
|
||||
</FormItem>
|
||||
<FormItem Label="Autostart">
|
||||
<Switch @bind-Checked="context.Autostart" />
|
||||
</FormItem>
|
||||
@if (context.Autostart)
|
||||
{
|
||||
<FormItem Label="Autostart Delay">
|
||||
<AntDesign.Input @bind-Value="context.AutostartDelay" Placeholder="0">
|
||||
<Suffix>Seconds</Suffix>
|
||||
</AntDesign.Input>
|
||||
</FormItem>
|
||||
}
|
||||
<GridRow Wrap="false" Gutter="16">
|
||||
<GridCol Flex="@("none")">
|
||||
<FormItem Label="Autostart">
|
||||
<Switch @bind-Checked="context.Autostart" />
|
||||
</FormItem>
|
||||
</GridCol>
|
||||
<GridCol Flex="@("auto")">
|
||||
@if (context.Autostart)
|
||||
{
|
||||
<FormItem Label="Delay">
|
||||
<AntDesign.Input @bind-Value="context.AutostartDelay" Placeholder="0">
|
||||
<Suffix>Seconds</Suffix>
|
||||
</AntDesign.Input>
|
||||
</FormItem>
|
||||
}
|
||||
</GridCol>
|
||||
</GridRow>
|
||||
|
||||
<FormItem>
|
||||
<ServerConsoleEditor @bind-Value="Server.ServerConsoles" ServerId="Id" />
|
||||
|
@ -104,9 +111,16 @@
|
|||
</Form>
|
||||
}
|
||||
|
||||
@if (Panel == "Console")
|
||||
@if (Panel == "Consoles")
|
||||
{
|
||||
<Console ServerId="@Server.Id" ServerConsoleId="@LogId" />
|
||||
@if (LogId != null && LogId != Guid.Empty)
|
||||
{
|
||||
<Console ServerId="@Server.Id" ServerConsoleId="@LogId" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<ServerConsoleEditor @bind-Value="Server.ServerConsoles" ServerId="Id" />
|
||||
}
|
||||
}
|
||||
|
||||
@if (Panel == "Files")
|
||||
|
|
Loading…
Reference in New Issue