finish implementation of per server top stats page

This commit is contained in:
RaidMax 2019-02-27 20:13:15 -06:00
parent c21bf2ebf1
commit b3e5f468a1
8 changed files with 38 additions and 20 deletions

View File

@ -18,7 +18,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
{ {
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_TITLE"]; ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_TITLE"];
ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_DESC"]; ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_DESC"];
ViewBag.Servers = Manager.GetServers().Select(_server => new ServerInfo() { Name = _server.Hostname, ID = _server.GetHashCode() }); ViewBag.Servers = Manager.GetServers().Select(_server => new ServerInfo() { Name = _server.Hostname, ID = _server.EndPoint });
return View("Index"); return View("Index");
} }

View File

@ -155,6 +155,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
var finished = topPlayers.Select(s => new TopStatsInfo() var finished = topPlayers.Select(s => new TopStatsInfo()
{ {
ClientId = s.ClientId, ClientId = s.ClientId,
Id = (int?)serverId ?? 0,
Deaths = s.Deaths, Deaths = s.Deaths,
Kills = s.Kills, Kills = s.Kills,
KDR = Math.Round(s.KDR, 2), KDR = Math.Round(s.KDR, 2),

View File

@ -61,7 +61,7 @@
<span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span><span class="text-primary"> @stat.LastSeen </span><span class="text-muted">@loc["WEBFRONT_PENALTY_TEMPLATE_AGO"]</span> <span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span><span class="text-primary"> @stat.LastSeen </span><span class="text-muted">@loc["WEBFRONT_PENALTY_TEMPLATE_AGO"]</span>
</div> </div>
<div class="col-md-6 client-rating-graph" id="rating_history_@stat.ClientId" data-history="@Html.Raw(Json.Serialize(stat.PerformanceHistory))"> <div class="col-md-6 client-rating-graph" id="rating_history_@(stat.ClientId + "_" + stat.Id)" data-history="@Html.Raw(Json.Serialize(stat.PerformanceHistory))">
</div> </div>

View File

@ -1,4 +1,4 @@
<ul class="nav nav-tabs" role="tablist" id="stats_top_players"> <ul class="nav nav-tabs border-top" role="tablist" id="stats_top_players">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active top-players-link" href="#server_0" role="tab" data-toggle="tab" aria-selected="true" data-serverid="0">All Servers</a> <a class="nav-link active top-players-link" href="#server_0" role="tab" data-toggle="tab" aria-selected="true" data-serverid="0">All Servers</a>
</li> </li>
@ -11,15 +11,14 @@
} }
</ul> </ul>
<div class="tab-content striped border-bottom"> <div class="tab-content border-bottom">
<div role="tabpanel" class="tab-pane active" id="server_0"> <div role="tabpanel" class="tab-pane active" id="server_0">
@await Component.InvokeAsync("TopPlayers", new { count = 50, offset = 0 }) @await Component.InvokeAsync("TopPlayers", new { count = 10, offset = 0 })
</div> </div>
@foreach (var server in ViewBag.Servers) @foreach (var server in ViewBag.Servers)
{ {
<div role="tabpanel" class="tab-pane" id="server_@server.ID"> <div role="tabpanel" class="tab-pane" id="server_@server.ID">
@await Component.InvokeAsync("TopPlayers", new { count = 50, offset = 0, serverId = server.ID })
</div> </div>
} }
</div> </div>
@ -30,5 +29,5 @@
<script type="text/javascript" src="~/js/loader.js"></script> <script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/stats.js"></script> <script type="text/javascript" src="~/js/stats.js"></script>
</environment> </environment>
<script>initLoader('/Stats/GetTopPlayersAsync', '#server_0', 50);</script> <script>initLoader('/Stats/GetTopPlayersAsync', '#server_0', 10);</script>
} }

View File

@ -6418,20 +6418,27 @@ form *, select {
right: 1em; } right: 1em; }
.nav-tabs, .nav-tabs .nav-link.active { .nav-tabs, .nav-tabs .nav-link.active {
border-color: #007ACC; border-width: 0;
color: #007ACC;
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
color: #fff !important; } color: #fff !important; }
.nav-tabs .nav-link.active {
border-bottom-width: 1px;
border-bottom-color: #007ACC !important; }
.nav-tabs .nav-link:hover { .nav-tabs .nav-link:hover {
border-color: #007ACC; background-color: #222222;
background-color: rgba(0, 0, 0, 0.2); color: #007ACC;
border-width: 2px; } border-width: 0 0 1px 0;
border-bottom-color: #007ACC; }
.nav-tabs .nav-link { .nav-tabs .nav-link {
border-radius: 0; border-radius: 0;
padding: 1rem; padding: 1rem;
color: #6c757d; color: #6c757d;
border-width: 2px; } border-width: 0 0 1px 0;
border-bottom-color: transparent; }
.nav-tabs .nav-link.active { .nav-tabs .nav-link.active {
border-bottom-color: transparent; } border-bottom-color: transparent; }

View File

@ -221,22 +221,31 @@ form *, select {
} }
.nav-tabs, .nav-tabs .nav-link.active { .nav-tabs, .nav-tabs .nav-link.active {
border-color: $blue; border-width: 0;
color: $blue;
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
color: $white !important; color: $white !important;
} }
.nav-tabs .nav-link.active
{
border-bottom-width: 1px;
border-bottom-color: $blue !important;
}
.nav-tabs .nav-link:hover { .nav-tabs .nav-link:hover {
border-color: $blue; background-color: #222222;
background-color: rgba(0, 0, 0, 0.2); color: $blue;
border-width: 2px; border-width: 0 0 1px 0;
border-bottom-color: $blue;
} }
.nav-tabs .nav-link { .nav-tabs .nav-link {
border-radius: 0; border-radius: 0;
padding: 1rem; padding: 1rem;
color: #6c757d; color: #6c757d;
border-width: 2px; border-width: 0 0 1px 0;
border-bottom-color: transparent;
} }
.nav-tabs .nav-link.active { .nav-tabs .nav-link.active {

View File

@ -4,11 +4,11 @@ let isLoaderLoading = false;
let loadUri = ''; let loadUri = '';
let loaderResponseId = ''; let loaderResponseId = '';
function initLoader(location, loaderId, count = 10) { function initLoader(location, loaderId, count = 10, start = count) {
loadUri = location; loadUri = location;
loaderResponseId = loaderId; loaderResponseId = loaderId;
loadCount = count; loadCount = count;
loaderOffset = count; loaderOffset = start;
setupListeners(); setupListeners();
} }

View File

@ -74,7 +74,9 @@ $(document).ready(function () {
}); });
$('.top-players-link').click(function (event) { $('.top-players-link').click(function (event) {
initLoader('/Stats/GetTopPlayersAsync?serverId=' + $(this).data('serverid'), $(this).attr('href'), 50); $($(this).attr('href')).html('');
initLoader('/Stats/GetTopPlayersAsync?serverId=' + $(this).data('serverid'), $(this).attr('href'), 10, 0);
loadMoreItems();
}); });
}); });