add game badge to server overview

This commit is contained in:
RaidMax 2022-06-04 09:58:30 -05:00
parent ee56a5db1f
commit c493fbe13d
4 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Data.Models;
using SharedLibraryCore.Helpers;
namespace SharedLibraryCore.Dtos
@ -40,5 +41,6 @@ namespace SharedLibraryCore.Dtos
return Math.Round(valid.Select(player => player.ZScore.Value).Average(), 2);
}
}
public Reference.Game Game { get; set; }
}
}

View File

@ -5,6 +5,7 @@ using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Linq;
using Data.Models;
using Data.Models.Client.Stats;
using IW4MAdmin.Plugins.Stats.Helpers;
using WebfrontCore.ViewModels;
@ -34,6 +35,7 @@ namespace WebfrontCore.Controllers
ID = s.EndPoint,
Port = s.Port,
Map = s.CurrentMap.Alias,
Game = (Reference.Game)s.GameName,
ClientCount = s.Clients.Count(client => client != null),
MaxClients = s.MaxClients,
GameType = s.GametypeName,

View File

@ -4,11 +4,9 @@ using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Data.Models;
using Data.Models.Client.Stats;
using Microsoft.AspNetCore.Hosting.Server;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Interfaces;
using static SharedLibraryCore.Server;
@ -72,6 +70,7 @@ namespace WebfrontCore.ViewComponents
ID = server.EndPoint,
Port = server.Port,
Map = server.CurrentMap.Alias,
Game = (Reference.Game)server.GameName,
ClientCount = server.Clients.Count(client => client != null),
MaxClients = server.MaxClients,
GameType = server.GametypeName,

View File

@ -15,7 +15,9 @@
foreach (var snapshot in Model.ClientHistory.ClientCounts)
{
snapshot.MapAlias = GetMapName(snapshot.Map);
}
};
string MakeAbbreviation(string gameName) => string.Join("", gameName.Split(' ').Select(word => char.ToUpper(word.First())).ToArray());
}
<div class="card mt-20 mb-20 ml-0 mr-0 p-0">
@ -42,6 +44,7 @@
class="text-light align-self-center">
<i class="oi oi-spreadsheet ml-5 mr-5"></i>
</a>
<span class="ml-5 mr-5 text-light badge font-weight-light" data-toggle="tooltip" data-title="@ViewBag.Localization[$"GAME_{Model.Game}"]">@MakeAbbreviation(ViewBag.Localization[$"GAME_{Model.Game}"])</span>
</div>
</div>
<!-- second column -->
@ -52,6 +55,7 @@
<span>&ndash;</span>
<span>@Model.GameType</span>
}
</div>
<!-- third column -->
<div class="align-self-center d-flex flex-column flex-lg-row col-12 col-lg-2 justify-content-end">