1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

add most recent players dropdown option to webfront

remove unneeded compiled bootstrap file
This commit is contained in:
RaidMax
2019-07-16 15:27:19 -05:00
parent d4598d6687
commit 1705db63ff
13 changed files with 137 additions and 6474 deletions

View File

@ -241,5 +241,11 @@ namespace WebfrontCore.Controllers
command = $"!say {message}"
}));
}
public async Task<IActionResult> RecentClientsForm()
{
var clients = await Manager.GetClientService().GetRecentClients();
return View("~/Views/Shared/Components/Client/_RecentClients.cshtml", clients);
}
}
}

View File

@ -0,0 +1,50 @@
@model IEnumerable<SharedLibraryCore.Dtos.PlayerInfo>
@{
Layout = null;
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
}
@*<table class="table table-striped">
<thead>
<tr class="bg-primary pt-2 pb-2">
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<th scope="col">@loc["WEBFRONT_CONFIGURATION_SERVER_IP"]</th>
<th scope="col">@loc["WEBFRONT_PROFILE_LOOKUP_LOCATION"]</th>
<th scope="col" class="text-right">@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]</th>
</tr>
</thead>
@foreach (var client in Model)
{
<tr>
<td class="w-25">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="link-inverse">@client.Name</a>
</td>
<td class="w-25">
@client.IPAddress
</td>
<td>
<div class="client-location-flag" data-ip="@client.IPAddress" />
</td>
<td class="text-right">
@client.LastConnectionText
</td>
</tr>
}
</table>*@
@foreach (var client in Model)
{
<div class="p-2 mb-3 border-bottom" style="background-color: #222;">
<div class="d-flex flex-row">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="h4 mr-auto">@client.Name</a>
<div class="client-location-flag align-self-center" data-ip="@client.IPAddress"></div>
</div>
<div class="d-flex flex-row">
<div class="align-self-center mr-auto">@client.IPAddress</div>
<div class="align-self-center">@client.LastConnectionText</div>
</div>
</div>
}

View File

@ -61,6 +61,7 @@
{
<a asp-controller="Configuration" asp-action="Edit" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_EDIT_CONFIGURATION"]</a>
}
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="RecentClients" title="@loc["WEBFRONT_ACTION_RECENT_CLIENTS"]">@loc["WEBFRONT_ACTION_RECENT_CLIENTS"]</a>
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
<a asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
</div>

View File

@ -39,6 +39,8 @@
<Content Remove="Views\Plugins\Stats\_MessageContext.cshtml" />
<Content Remove="Views\Plugins\Stats\_PenaltyInfo.cshtml" />
<Content Remove="Views\Plugins\_ViewImports.cshtml" />
<Content Remove="wwwroot\css\bootstrap-custom.css" />
<Content Remove="wwwroot\css\bootstrap-custom.min.css" />
</ItemGroup>
<ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@ -289,3 +289,11 @@ form *, select {
.hide {
display: none;
}
.client-location-flag {
width: 3rem;
height: 1.5rem;
background-image: url('/images/radar/hud_weapons/hud_neutral.png');
background-size: contain;
background-repeat: no-repeat
}

View File

@ -39,6 +39,7 @@ $(document).ready(function () {
$('#actionModal .modal-message').fadeOut('fast');
$('#actionModal .modal-body-content').html(response);
$('#actionModal').modal();
$('#actionModal').trigger('action_form_received', actionType);
})
.fail(function (jqxhr, textStatus, error) {
$('#actionModal .modal-message').text('Error — ' + error);
@ -83,4 +84,20 @@ $(document).ready(function () {
$('#actionModal .modal-message').fadeIn('fast');
});
});
/*
* handle loading of recent clients
*/
$('#actionModal').off('action_form_received');
$('#actionModal').on('action_form_received', function (e, actionType) {
if (actionType == 'RecentClients') {
const ipAddresses = $('.client-location-flag');
$.each(ipAddresses, function (index, address) {
$.get('https://ip2c.org/' + $(address).data('ip'), function (result) {
const countryCode = result.split(';')[1].toLowerCase();
$(address).css('background-image', `url(https://www.countryflags.io/${countryCode}/flat/64.png)`);
});
});
}
});
});