start implementation for per server top stats

issue #39
This commit is contained in:
RaidMax 2019-02-25 19:36:10 -06:00
parent 61f1436faf
commit d318a57830
11 changed files with 106 additions and 13 deletions

2
.gitignore vendored
View File

@ -223,7 +223,7 @@ global.min.js
bootstrap-custom.min.css
**/Master/static
**/Master/dev_env
/WebfrontCore/Views/Plugins/Stats
/WebfrontCore/Views/Plugins/*
/WebfrontCore/wwwroot/**/dds
/DiscordWebhook/env

View File

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
<Version>2.2.5.5</Version>
<Version>2.2.5.6</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Product>IW4MAdmin</Product>
@ -31,8 +31,8 @@
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TieredCompilation>true</TieredCompilation>
<AssemblyVersion>2.2.5.5</AssemblyVersion>
<FileVersion>2.2.5.5</FileVersion>
<AssemblyVersion>2.2.5.6</AssemblyVersion>
<FileVersion>2.2.5.6</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using System;
using System.Linq;
using System.Threading.Tasks;
@ -16,6 +17,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
{
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_TITLE"];
ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_DESC"];
ViewBag.Servers = Manager.GetServers().Select(_server => new ServerInfo() { Name = _server.Hostname, ID = _server.GetHashCode() });
return View("Index", await Plugin.Manager.GetTopStats(0, 50));
}

View File

@ -18,5 +18,6 @@ namespace IW4MAdmin.Plugins.Stats.Web.Dtos
public int Deaths { get; set; }
public int RatingChange { get; set; }
public List<double> PerformanceHistory { get; set; }
public List<ServerInfo> Servers { get; set; }
}
}

View File

@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompiledOnPublish>true</RazorCompiledOnPublish>
<ResolvedRazorCompileToolset>RazorSdk</ResolvedRazorCompileToolset>
<Configurations>Debug;Release;Prerelease</Configurations>
</PropertyGroup>

View File

@ -1,14 +1,53 @@
@model List<IW4MAdmin.Plugins.Stats.Web.Dtos.TopStatsInfo>
<h4 class="pb-2 text-center ">@ViewBag.Title</h4>
<div id="stats_top_players" class="striped border-top border-bottom">
@await Html.PartialAsync("_List", Model)
<ul class="nav nav-tabs" role="tablist" id="stats_top_players">
<li class="nav-item">
<a class="nav-link active" href="#server_0" role="tab" data-toggle="tab" aria-selected="true">All Servers</a>
</li>
@foreach (var server in ViewBag.Servers)
{
<li class="nav-item">
<a class="nav-link" href="#server_@server.ID" role="tab" data-toggle="tab" aria-selected="false">@server.Name</a>
</li>
}
</ul>
<div class="tab-content striped border-bottom">
<div role="tabpanel" class="tab-pane active" id="server_0">
@{
if (Model.Count > 0)
{
await Html.PartialAsync("_List", Model);
}
else
{
<div class="p-2 text-center">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex.Set["PLUGINS_STATS_TEXT_NOQUALIFY"]</div>
}
}
</div>
@foreach (var server in ViewBag.Servers)
{
<div role="tabpanel" class="tab-pane" id="server_@server.ID">
@{
if (Model.Count > 0)
{
await Html.PartialAsync("_List", Model);
}
else
{
<div class="p-2 text-center">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex.Set["PLUGINS_STATS_TEXT_NOQUALIFY"]</div>
}
}
</div>
}
</div>
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/stats.js"></script>
@*<script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/stats.js"></script>*@
</environment>
<script>initLoader('/Stats/GetTopPlayersAsync', '#stats_top_players', 50);</script>
@*<script>initLoader('/Stats/GetTopPlayersAsync', '#stats_top_players', 50);</script>*@
}

View File

@ -47,6 +47,14 @@ namespace WebfrontCore
}
});
#if DEBUG
mvcBuilder = mvcBuilder.AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);
services.Configure<RazorViewEngineOptions>(_options =>
{
_options.ViewLocationFormats.Add(@"/Views/Plugins/{1}/{0}" + RazorViewEngine.ViewExtension);
});
#endif
foreach (var asm in Program.Manager.GetPluginAssemblies())
{
mvcBuilder.AddApplicationPart(asm);

View File

@ -82,7 +82,7 @@
}
</div>
<div id="profile_level" class="text-muted mb-2">
<h5><span class="level-color-@Model.LevelInt @(isTempBanned ? "penalties-color-tempban" : "")"><strong>@Model.Level @(isTempBanned ? $"&emdash; {loc["WEBFRONT_PROFILE_TEMPBAN"]}" : "")</strong></span></h5>
<h5><span class="level-color-@Model.LevelInt @(isTempBanned ? "penalties-color-tempban" : "")"><strong>@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")</strong></span></h5>
</div>
<div id="profile_time_played" class="text-muted">
@loc["WEBFRONT_PROFILE_PLAYER"] <span class="text-primary">@Model.TimePlayed</span> @loc["GLOBAL_TIME_HOURS"]

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>true</RazorCompileOnPublish>
<PreserveCompilationContext>true</PreserveCompilationContext>
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>

View File

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

View File

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