huge commit for webfront facelift

This commit is contained in:
RaidMax
2022-04-19 18:43:58 -05:00
parent 4023ca37d4
commit 4fbe0ee0ed
105 changed files with 2981 additions and 2545 deletions

View File

@ -7,11 +7,9 @@ namespace WebfrontCore.ViewComponents
{
public class PenaltyListViewComponent : ViewComponent
{
private const int PENALTY_COUNT = 15;
public async Task<IViewComponentResult> InvokeAsync(int offset, EFPenalty.PenaltyType showOnly, bool ignoreAutomated)
public async Task<IViewComponentResult> InvokeAsync(int offset, int count, EFPenalty.PenaltyType showOnly, bool ignoreAutomated)
{
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(PENALTY_COUNT, offset, showOnly, ignoreAutomated);
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(count, offset, showOnly, ignoreAutomated);
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
return View("~/Views/Penalty/PenaltyInfoList.cshtml", penalties);

View File

@ -94,8 +94,8 @@ namespace WebfrontCore.ViewComponents
}).ToList(),
ChatHistory = server.ChatHistory.ToList(),
Online = !server.Throttled,
IPAddress =
$"{(server.ResolvedIpEndPoint.Address.IsInternal() ? Program.Manager.ExternalIPAddress : server.IP)}:{server.Port}",
IPAddress = server.IP,
ExternalIPAddress = server.ResolvedIpEndPoint.Address.IsInternal() ? Program.Manager.ExternalIPAddress : server.IP,
ConnectProtocolUrl = server.EventParser.URLProtocolFormat.FormatExt(
server.ResolvedIpEndPoint.Address.IsInternal() ? Program.Manager.ExternalIPAddress : server.IP,
server.Port)

View File

@ -16,22 +16,16 @@ namespace WebfrontCore.ViewComponents
_config = config;
}
public async Task<IViewComponentResult> InvokeAsync(int count, int offset, long? serverId = null)
public async Task<IViewComponentResult> InvokeAsync(int count, int offset, string serverEndpoint = null)
{
if (serverId == 0)
{
serverId = null;
}
var server = Plugin.ServerManager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId);
if (server != null)
{
serverId = StatManager.GetIdForServer(server);
}
var server = Plugin.ServerManager.GetServers()
.FirstOrDefault(server => server.ToString() == serverEndpoint);
var serverId = server is null ? (long?)null : StatManager.GetIdForServer(server);
ViewBag.UseNewStats = _config?.EnableAdvancedMetrics ?? true;
ViewBag.SelectedServerName = server?.Hostname;
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml",
ViewBag.UseNewStats
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)