diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index f0ff5ce09..0f5d5ce99 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -902,7 +902,7 @@ namespace SharedLibraryCore.Services /// gets the 10 most recently added clients to IW4MAdmin /// /// - public async Task> GetRecentClients() + public async Task> GetRecentClients(PaginationRequest request) { var startOfPeriod = DateTime.UtcNow.AddHours(-24); @@ -917,7 +917,9 @@ namespace SharedLibraryCore.Services Name = client.CurrentAlias.Name, IPAddress = client.CurrentAlias.IPAddress.ConvertIPtoString(), LastConnection = client.FirstConnection - }); + }) + .Skip(request.Offset) + .Take(request.Count); var clientList = await iqClients.ToListAsync(); foreach (var client in clientList) diff --git a/WebfrontCore/Controllers/ActionController.cs b/WebfrontCore/Controllers/ActionController.cs index b9f482705..5c91d6e7c 100644 --- a/WebfrontCore/Controllers/ActionController.cs +++ b/WebfrontCore/Controllers/ActionController.cs @@ -315,12 +315,19 @@ namespace WebfrontCore.Controllers })); } - public async Task RecentClientsForm() + public async Task RecentClientsForm(PaginationRequest request) { - var clients = await Manager.GetClientService().GetRecentClients(); + ViewBag.First = request.Offset == 0; + + if (request.Count > 30) + { + request.Count = 30; + } + + var clients = await Manager.GetClientService().GetRecentClients(request); return View("~/Views/Shared/Components/Client/_RecentClients.cshtml", clients); } - + public IActionResult RecentReportsForm() { var serverInfo = Manager.GetServers().Select(server => diff --git a/WebfrontCore/Views/Shared/Components/Client/_RecentClient.cshtml b/WebfrontCore/Views/Shared/Components/Client/_RecentClient.cshtml new file mode 100644 index 000000000..66399a7c8 --- /dev/null +++ b/WebfrontCore/Views/Shared/Components/Client/_RecentClient.cshtml @@ -0,0 +1,24 @@ +@model SharedLibraryCore.Dtos.PlayerInfo + +
+
+ + + + @if (Model.GeoLocationInfo is not null) + { + @if (!string.IsNullOrEmpty(Model.GeoLocationInfo.CountryCode)) + { +
+
+
+ } + } +
+
+ +
@Model.IPAddress
+
+
@Model.LastConnection.HumanizeForCurrentCulture()
+
+
diff --git a/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml b/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml index 99a76c25d..e17250a51 100644 --- a/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml +++ b/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml @@ -3,31 +3,28 @@ Layout = null; } -
New clients connected in the last 24 hours
+@if (ViewBag.First) +{ +
New clients connected in the last 24 hours
+} @foreach (var client in Model) { -
-
- - - - @if (client.GeoLocationInfo is not null) - { - @if (!string.IsNullOrEmpty(client.GeoLocationInfo.CountryCode)) - { -
-
-
- } - } + @if (ViewBag.First) + { +
+
-
- -
@client.IPAddress
-
-
@client.LastConnection.HumanizeForCurrentCulture()
-
- -
+ } + else + { + + } +} + +@if (ViewBag.First) +{ + + + }