Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,17 @@ public void SetPlayer(Guid playerId, string playerUsername)
UpdateLogs();
}

/// <summary>
/// Creates new player-filter buttons for the UI
/// </summary>
/// <param name="players">The dictionary of players</param>
public void SetPlayers(Dictionary<Guid, string> players)
{
var buttons = new SortedSet<AdminLogPlayerButton>(_adminLogPlayerButtonComparer);
var allSelected = true;

// Go through player-filter buttons that already exist on this instance of the UI, and remove their respective players from the dictionary
// When the window first opens, no player-filter buttons exist on it, and so this loop is skipped
foreach (var control in PlayersContainer.Children.ToArray())
{
if (control is not AdminLogPlayerButton player)
Expand All @@ -455,6 +461,7 @@ public void SetPlayers(Dictionary<Guid, string> players)
buttons.Add(player);
}

// Create player-filter buttons for players that remain in the dictionary
foreach (var (id, name) in players)
{
var button = new AdminLogPlayerButton(id)
Expand All @@ -471,6 +478,7 @@ public void SetPlayers(Dictionary<Guid, string> players)
buttons.Add(button);
}

// Refresh the container's children. Add any new buttons that were added since the last refresh
PlayersContainer.RemoveAllChildren();

foreach (var player in buttons)
Expand Down
5 changes: 4 additions & 1 deletion Content.Server/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ private void AddAdminVerbs(GetVerbsEvent<Verb> args)
{
var ui = new AdminLogsEui();
_euiManager.OpenEui(ui, player);
ui.SetLogFilter(player: (targetPlayerSession.UserId.UserId, targetPlayerSession.Name));

// TODO Remove search input once player filter actually works
var search = MetaData(targetPlayer).EntityName;
ui.SetLogFilter(search: search, player: (targetPlayerSession.UserId.UserId, targetPlayerSession.Name));
},
Impact = LogImpact.Low
};
Expand Down
Loading