Files
tbd-station-14/Content.Shared/Administration/AdminLogsEuiState.cs
Javier Guardia Fernández 319aec109d Admin logs (#5419)
* Add admin logging, models, migrations

* Add logging damage changes

* Add Log admin flag, LogFilter, Logs admin menu tab, message
Refactor admin logging API

* Change admin log get method names

* Fix the name again

* Minute amount of reorganization

* Reset Postgres db snapshot

* Reset Sqlite db snapshot

* Make AdminLog have a composite primary key of round, id

* Minute cleanup

* Change admin system to do a type check instead of index check

* Make admin logs use C# 10 interpolated string handlers

* Implement UI on its own window
Custom controls
Searching
Add admin log converters

* Implement limits into the query

* Change logs to be put into an OutputPanel instead for text wrapping

* Add log <-> player m2m relationship back

* UI improvements, make text wrap, add separators

* Remove entity prefix from damaged log

* Add explicit m2m model, fix any players filter

* Add debug command to test bulk adding logs

* Admin logs now just kinda go

* Add histogram for database update time

* Make admin log system update run every 5 seconds

* Add a cap to the log queue and a metric for how many times it has been reached

* Add metric for logs sent in a round

* Make cvars out of admin logs queue send delay and cap

* Merge fixes

* Reset some changes

* Add test for adding and getting a single log

* Add tests for bulk adding logs

* Add test for querying logs

* Add CallerArgumentExpression to LogStringHandler methods and test

* Improve UI, fix SQLite, add searching by round

* Add entities to admin logs

* Move distinct after orderby

* Add migrations

* ef core eat my ass

* Add cvar for client logs batch size

* Sort logs from newest to oldest by default

* Merge fixes

* Reorganize tests and add one for date ordering

* Add note to log types to not change their numeric values

* Add impacts to logs, better UI filtering

* Make log add callable from shared for convenience

* Get current round id directly from game ticker

* Revert namespace change for DamageableSystem
2021-11-22 18:49:26 +01:00

86 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using Content.Shared.Administration.Logs;
using Content.Shared.Eui;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration;
[Serializable, NetSerializable]
public class AdminLogsEuiState : EuiStateBase
{
public AdminLogsEuiState(int roundId, Dictionary<Guid, string> players)
{
RoundId = roundId;
Players = players;
}
public bool IsLoading { get; set; }
public int RoundId { get; }
public Dictionary<Guid, string> Players { get; }
}
public static class AdminLogsEuiMsg
{
[Serializable, NetSerializable]
public sealed class Close : EuiMessageBase
{
}
[Serializable, NetSerializable]
public sealed class NewLogs : EuiMessageBase
{
public NewLogs(SharedAdminLog[] logs, bool replace)
{
Logs = logs;
Replace = replace;
}
public SharedAdminLog[] Logs { get; set; }
public bool Replace { get; set; }
}
[Serializable, NetSerializable]
public sealed class LogsRequest : EuiMessageBase
{
public LogsRequest(
int? roundId,
List<LogType>? types,
List<LogImpact>? impacts,
DateTime? before,
DateTime? after,
Guid[]? anyPlayers,
Guid[]? allPlayers,
int? lastLogId,
DateOrder dateOrder)
{
RoundId = roundId;
Types = types;
Impacts = impacts;
Before = before;
After = after;
AnyPlayers = anyPlayers is { Length: > 0 } ? anyPlayers : null;
AllPlayers = allPlayers is { Length: > 0 } ? allPlayers : null;
LastLogId = lastLogId;
DateOrder = dateOrder;
}
public int? RoundId { get; set; }
public List<LogType>? Types { get; set; }
public List<LogImpact>? Impacts { get; set; }
public DateTime? Before { get; set; }
public DateTime? After { get; set; }
public Guid[]? AnyPlayers { get; set; }
public Guid[]? AllPlayers { get; set; }
public int? LastLogId { get; set; }
public DateOrder DateOrder { get; set; }
}
[Serializable, NetSerializable]
public sealed class NextLogsRequest : EuiMessageBase
{
}
}