Fix filtering mismatch when using the None players button
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Client.Eui;
|
using System.Linq;
|
||||||
|
using Content.Client.Eui;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Eui;
|
using Content.Shared.Eui;
|
||||||
@@ -25,17 +26,13 @@ public class AdminLogsEui : BaseEui
|
|||||||
|
|
||||||
private void RequestLogs()
|
private void RequestLogs()
|
||||||
{
|
{
|
||||||
var round = Window.GetSelectedRoundId();
|
|
||||||
var types = Window.GetSelectedLogTypes();
|
|
||||||
var players = Window.GetSelectedPlayerIds();
|
|
||||||
|
|
||||||
var request = new LogsRequest(
|
var request = new LogsRequest(
|
||||||
round,
|
Window.SelectedRoundId,
|
||||||
types,
|
Window.SelectedTypes.ToList(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
players,
|
Window.SelectedPlayers.ToArray(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
DateOrder.Descending);
|
DateOrder.Descending);
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
LogSearch.OnTextChanged += LogSearchChanged;
|
LogSearch.OnTextChanged += LogSearchChanged;
|
||||||
|
|
||||||
SelectAllTypesButton.OnPressed += SelectAllTypes;
|
SelectAllTypesButton.OnPressed += SelectAllTypes;
|
||||||
|
|
||||||
SelectNoTypesButton.OnPressed += SelectNoTypes;
|
SelectNoTypesButton.OnPressed += SelectNoTypes;
|
||||||
|
|
||||||
SelectNoPlayersButton.OnPressed += SelectNoPlayers;
|
SelectNoPlayersButton.OnPressed += SelectNoPlayers;
|
||||||
|
|
||||||
RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound;
|
RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound;
|
||||||
@@ -49,11 +49,13 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
|
|
||||||
private int CurrentRound { get; set; }
|
private int CurrentRound { get; set; }
|
||||||
|
|
||||||
private HashSet<LogType> SelectedTypes { get; } = new();
|
public int SelectedRoundId => RoundSpinBox.Value;
|
||||||
|
|
||||||
private HashSet<Guid> SelectedPlayers { get; } = new();
|
public HashSet<LogType> SelectedTypes { get; } = new();
|
||||||
|
|
||||||
private HashSet<LogImpact> SelectedImpacts { get; } = new();
|
public HashSet<Guid> SelectedPlayers { get; } = new();
|
||||||
|
|
||||||
|
public HashSet<LogImpact> SelectedImpacts { get; } = new();
|
||||||
|
|
||||||
public void SetCurrentRound(int round)
|
public void SetCurrentRound(int round)
|
||||||
{
|
{
|
||||||
@@ -100,6 +102,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
|
|
||||||
private void SelectAllTypes(ButtonEventArgs obj)
|
private void SelectAllTypes(ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
|
SelectedTypes.Clear();
|
||||||
|
|
||||||
foreach (var control in TypesContainer.Children)
|
foreach (var control in TypesContainer.Children)
|
||||||
{
|
{
|
||||||
if (control is not AdminLogTypeButton type)
|
if (control is not AdminLogTypeButton type)
|
||||||
@@ -108,6 +112,7 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
type.Pressed = true;
|
type.Pressed = true;
|
||||||
|
SelectedTypes.Add(type.Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateLogs();
|
UpdateLogs();
|
||||||
@@ -115,6 +120,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
|
|
||||||
private void SelectNoTypes(ButtonEventArgs obj)
|
private void SelectNoTypes(ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
|
SelectedTypes.Clear();
|
||||||
|
|
||||||
foreach (var control in TypesContainer.Children)
|
foreach (var control in TypesContainer.Children)
|
||||||
{
|
{
|
||||||
if (control is not AdminLogTypeButton type)
|
if (control is not AdminLogTypeButton type)
|
||||||
@@ -131,6 +138,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
|
|
||||||
private void SelectNoPlayers(ButtonEventArgs obj)
|
private void SelectNoPlayers(ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
|
SelectedPlayers.Clear();
|
||||||
|
|
||||||
foreach (var control in PlayersContainer.Children)
|
foreach (var control in PlayersContainer.Children)
|
||||||
{
|
{
|
||||||
if (control is not AdminLogPlayerButton player)
|
if (control is not AdminLogPlayerButton player)
|
||||||
@@ -379,45 +388,6 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
AddLogs(logs);
|
AddLogs(logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetSelectedRoundId()
|
|
||||||
{
|
|
||||||
return RoundSpinBox.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LogType> GetSelectedLogTypes()
|
|
||||||
{
|
|
||||||
var types = new List<LogType>();
|
|
||||||
|
|
||||||
foreach (var control in TypesContainer.Children)
|
|
||||||
{
|
|
||||||
if (control is not AdminLogTypeButton {Text: { }, Pressed: true} type)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
types.Add(Enum.Parse<LogType>(type.Text));
|
|
||||||
}
|
|
||||||
|
|
||||||
return types;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Guid[] GetSelectedPlayerIds()
|
|
||||||
{
|
|
||||||
var players = new List<Guid>();
|
|
||||||
|
|
||||||
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)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
|||||||
Reference in New Issue
Block a user