max recent clients paginated
This commit is contained in:
parent
ffa8a46feb
commit
c51d28937b
@ -902,7 +902,7 @@ namespace SharedLibraryCore.Services
|
||||
/// gets the 10 most recently added clients to IW4MAdmin
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IList<PlayerInfo>> GetRecentClients()
|
||||
public async Task<IList<PlayerInfo>> 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)
|
||||
|
@ -315,12 +315,19 @@ namespace WebfrontCore.Controllers
|
||||
}));
|
||||
}
|
||||
|
||||
public async Task<IActionResult> RecentClientsForm()
|
||||
public async Task<IActionResult> 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 =>
|
||||
|
@ -0,0 +1,24 @@
|
||||
@model SharedLibraryCore.Dtos.PlayerInfo
|
||||
|
||||
<div class="bg-very-dark-dm bg-light-ex-lm p-15 rounded mb-10">
|
||||
<div class="d-flex flex-row">
|
||||
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.ClientId" class="h4 mr-auto">
|
||||
<color-code value="@Model.Name"></color-code>
|
||||
</a>
|
||||
@if (Model.GeoLocationInfo is not null)
|
||||
{
|
||||
@if (!string.IsNullOrEmpty(Model.GeoLocationInfo.CountryCode))
|
||||
{
|
||||
<div data-toggle="tooltip" data-title="@Model.GeoLocationInfo.Country">
|
||||
<div class="rounded" style="width: 40px; height: 25.66px; background-repeat: no-repeat; background-position: center center; background-image: url('https://flagcdn.com/w40/@(Model.GeoLocationInfo.CountryCode.ToLower()).png')"></div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="d-flex flex-row">
|
||||
<has-permission entity="ClientIPAddress" required-permission="Read">
|
||||
<div class="align-self-center mr-auto">@Model.IPAddress</div>
|
||||
</has-permission>
|
||||
<div class="align-self-center text-muted font-size-12">@Model.LastConnection.HumanizeForCurrentCulture()</div>
|
||||
</div>
|
||||
</div>
|
@ -3,31 +3,28 @@
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="mb-15 text-center font-weight-lighter">New clients connected in the last <span class="text-primary">24</span> hours</div>
|
||||
@if (ViewBag.First)
|
||||
{
|
||||
<div class="mb-15 text-center font-weight-lighter">New clients connected in the last <span class="text-primary">24</span> hours</div>
|
||||
}
|
||||
|
||||
@foreach (var client in Model)
|
||||
{
|
||||
<div class="bg-very-dark-dm bg-light-ex-lm p-15 rounded mb-10">
|
||||
<div class="d-flex flex-row">
|
||||
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="h4 mr-auto">
|
||||
<color-code value="@client.Name"></color-code>
|
||||
</a>
|
||||
@if (client.GeoLocationInfo is not null)
|
||||
{
|
||||
@if (!string.IsNullOrEmpty(client.GeoLocationInfo.CountryCode))
|
||||
{
|
||||
<div data-toggle="tooltip" data-title="@client.GeoLocationInfo.Country">
|
||||
<div class="rounded" style="width: 40px; height: 25.66px; background-repeat: no-repeat; background-position: center center; background-image: url('https://flagcdn.com/w40/@(client.GeoLocationInfo.CountryCode.ToLower()).png')"></div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@if (ViewBag.First)
|
||||
{
|
||||
<div id="recentClientsContainer">
|
||||
<partial name="~/Views/Shared/Components/Client/_RecentClient.cshtml" for="@client"/>
|
||||
</div>
|
||||
<div class="d-flex flex-row">
|
||||
<has-permission entity="ClientIPAddress" required-permission="Read">
|
||||
<div class="align-self-center mr-auto">@client.IPAddress</div>
|
||||
</has-permission>
|
||||
<div class="align-self-center text-muted font-size-12">@client.LastConnection.HumanizeForCurrentCulture()</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<partial name="~/Views/Shared/Components/Client/_RecentClient.cshtml" for="@client"/>
|
||||
}
|
||||
}
|
||||
|
||||
@if (ViewBag.First)
|
||||
{
|
||||
<i id="loaderLoad" class="loader-load-more oi oi-chevron-bottom text-center text-primary d-none d-lg-block mt-10"></i>
|
||||
|
||||
<script>initLoader('/Action/RecentClientsForm', '#recentClientsContainer', 30);</script>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user