tweak: add confirm to server restart button (#37849)

This commit is contained in:
Perry Fraser
2025-05-27 19:44:15 -04:00
committed by GitHub
parent d6356fd8a9
commit d2add64897
2 changed files with 6 additions and 1 deletions

View File

@@ -1,11 +1,12 @@
<Control <Control
xmlns="https://spacestation14.io" xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Margin="4" Margin="4"
MinSize="50 50"> MinSize="50 50">
<GridContainer <GridContainer
Columns="4" > Columns="4" >
<cc:CommandButton Command="shutdown" Text="{Loc server-shutdown}" /> <controls:ConfirmButton Name="ServerShutdownButton" Text="{Loc server-shutdown}" />
<cc:CommandButton Name="SetOocButton" Command="setooc" Text="{Loc server-ooc-toggle}" ToggleMode="True" /> <cc:CommandButton Name="SetOocButton" Command="setooc" Text="{Loc server-ooc-toggle}" ToggleMode="True" />
<cc:CommandButton Name="SetLoocButton" Command="setlooc" Text="{Loc server-looc-toggle}" ToggleMode="True" /> <cc:CommandButton Name="SetLoocButton" Command="setlooc" Text="{Loc server-looc-toggle}" ToggleMode="True" />
</GridContainer> </GridContainer>

View File

@@ -1,5 +1,6 @@
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
@@ -10,6 +11,7 @@ namespace Content.Client.Administration.UI.Tabs
public sealed partial class ServerTab : Control public sealed partial class ServerTab : Control
{ {
[Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly IClientConsoleHost _console = default!;
public ServerTab() public ServerTab()
{ {
@@ -18,6 +20,8 @@ namespace Content.Client.Administration.UI.Tabs
_config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true); _config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
_config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true); _config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
ServerShutdownButton.OnPressed += _ => _console.ExecuteCommand("shutdown");
} }
private void OocEnabledChanged(bool value) private void OocEnabledChanged(bool value)