Add access logs (IC ones) (#17810)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using Content.Shared.CartridgeLoader.Cartridges;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.CartridgeLoader.Cartridges;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class LogProbeUiFragment : BoxContainer
|
||||
{
|
||||
public LogProbeUiFragment()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public void UpdateState(List<PulledAccessLog> logs)
|
||||
{
|
||||
ProbedDeviceContainer.RemoveAllChildren();
|
||||
|
||||
//Reverse the list so the oldest entries appear at the bottom
|
||||
logs.Reverse();
|
||||
|
||||
var count = 1;
|
||||
foreach (var log in logs)
|
||||
{
|
||||
AddAccessLog(log, count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAccessLog(PulledAccessLog log, int numberLabelText)
|
||||
{
|
||||
var timeLabelText = TimeSpan.FromSeconds(Math.Truncate(log.Time.TotalSeconds)).ToString();
|
||||
var accessorLabelText = log.Accessor;
|
||||
var entry = new LogProbeUiEntry(numberLabelText, timeLabelText, accessorLabelText);
|
||||
|
||||
ProbedDeviceContainer.AddChild(entry);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user