diff --git a/Content.Client/Administration/UI/Logs/AdminLogsEui.cs b/Content.Client/Administration/UI/Logs/AdminLogsEui.cs index a40a248f3c..cd0d182898 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsEui.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsEui.cs @@ -1,4 +1,5 @@ -using Content.Client.Eui; +using System.Linq; +using Content.Client.Eui; using Content.Shared.Administration; using Content.Shared.Administration.Logs; using Content.Shared.Eui; @@ -25,17 +26,13 @@ public class AdminLogsEui : BaseEui private void RequestLogs() { - var round = Window.GetSelectedRoundId(); - var types = Window.GetSelectedLogTypes(); - var players = Window.GetSelectedPlayerIds(); - var request = new LogsRequest( - round, - types, + Window.SelectedRoundId, + Window.SelectedTypes.ToList(), null, null, null, - players, + Window.SelectedPlayers.ToArray(), null, null, DateOrder.Descending); diff --git a/Content.Client/Administration/UI/Logs/AdminLogsWindow.xaml.cs b/Content.Client/Administration/UI/Logs/AdminLogsWindow.xaml.cs index 35cf7f1bc1..ddf1549fa7 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsWindow.xaml.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsWindow.xaml.cs @@ -33,8 +33,8 @@ public partial class AdminLogsWindow : SS14Window LogSearch.OnTextChanged += LogSearchChanged; SelectAllTypesButton.OnPressed += SelectAllTypes; - SelectNoTypesButton.OnPressed += SelectNoTypes; + SelectNoPlayersButton.OnPressed += SelectNoPlayers; RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound; @@ -49,11 +49,13 @@ public partial class AdminLogsWindow : SS14Window private int CurrentRound { get; set; } - private HashSet SelectedTypes { get; } = new(); + public int SelectedRoundId => RoundSpinBox.Value; - private HashSet SelectedPlayers { get; } = new(); + public HashSet SelectedTypes { get; } = new(); - private HashSet SelectedImpacts { get; } = new(); + public HashSet SelectedPlayers { get; } = new(); + + public HashSet SelectedImpacts { get; } = new(); public void SetCurrentRound(int round) { @@ -100,6 +102,8 @@ public partial class AdminLogsWindow : SS14Window private void SelectAllTypes(ButtonEventArgs obj) { + SelectedTypes.Clear(); + foreach (var control in TypesContainer.Children) { if (control is not AdminLogTypeButton type) @@ -108,6 +112,7 @@ public partial class AdminLogsWindow : SS14Window } type.Pressed = true; + SelectedTypes.Add(type.Type); } UpdateLogs(); @@ -115,6 +120,8 @@ public partial class AdminLogsWindow : SS14Window private void SelectNoTypes(ButtonEventArgs obj) { + SelectedTypes.Clear(); + foreach (var control in TypesContainer.Children) { if (control is not AdminLogTypeButton type) @@ -131,6 +138,8 @@ public partial class AdminLogsWindow : SS14Window private void SelectNoPlayers(ButtonEventArgs obj) { + SelectedPlayers.Clear(); + foreach (var control in PlayersContainer.Children) { if (control is not AdminLogPlayerButton player) @@ -379,45 +388,6 @@ public partial class AdminLogsWindow : SS14Window AddLogs(logs); } - public int GetSelectedRoundId() - { - return RoundSpinBox.Value; - } - - public List GetSelectedLogTypes() - { - var types = new List(); - - foreach (var control in TypesContainer.Children) - { - if (control is not AdminLogTypeButton {Text: { }, Pressed: true} type) - { - continue; - } - - types.Add(Enum.Parse(type.Text)); - } - - return types; - } - - public Guid[] GetSelectedPlayerIds() - { - var players = new List(); - - foreach (var control in PlayersContainer.Children) - { - if (control is not AdminLogPlayerButton {Pressed: true} player) - { - continue; - } - - players.Add(player.Id); - } - - return players.ToArray(); - } - protected override void Dispose(bool disposing) { base.Dispose(disposing);