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