diff --git a/MP-PROG.sln b/MP-PROG.sln index 6ec09bf1..5f434b0f 100644 --- a/MP-PROG.sln +++ b/MP-PROG.sln @@ -7,10 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Sta EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.Prog.Data", "MP.Prog.Data\MP.Prog.Data.csproj", "{C24C479B-4668-42FA-8DC9-15633B896CDB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.Prog", "MP.Prog\MP.Prog.csproj", "{3223DDE4-564E-4D58-8A94-E368B9778C67}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.FileData", "MP.FileData\MP.FileData.csproj", "{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,14 +25,14 @@ Global {10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.Build.0 = Debug|Any CPU {10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.ActiveCfg = Release|Any CPU {10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.Build.0 = Release|Any CPU - {C24C479B-4668-42FA-8DC9-15633B896CDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C24C479B-4668-42FA-8DC9-15633B896CDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C24C479B-4668-42FA-8DC9-15633B896CDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C24C479B-4668-42FA-8DC9-15633B896CDB}.Release|Any CPU.Build.0 = Release|Any CPU {3223DDE4-564E-4D58-8A94-E368B9778C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3223DDE4-564E-4D58-8A94-E368B9778C67}.Debug|Any CPU.Build.0 = Debug|Any CPU {3223DDE4-564E-4D58-8A94-E368B9778C67}.Release|Any CPU.ActiveCfg = Release|Any CPU {3223DDE4-564E-4D58-8A94-E368B9778C67}.Release|Any CPU.Build.0 = Release|Any CPU + {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MP.Prog.Data/MP.Prog.Data.csproj b/MP.FileData/MP.FileData.csproj similarity index 100% rename from MP.Prog.Data/MP.Prog.Data.csproj rename to MP.FileData/MP.FileData.csproj diff --git a/MP.Prog/Components/CmpFooter.razor b/MP.Prog/Components/CmpFooter.razor new file mode 100644 index 00000000..e85aaf30 --- /dev/null +++ b/MP.Prog/Components/CmpFooter.razor @@ -0,0 +1,16 @@ +
+
+ GWMS v.@version +
+
+ @adesso + Egalware +
+
+ +@code { + protected DateTime adesso = DateTime.Now; + + Version version = typeof(Program).Assembly.GetName().Version; + +} \ No newline at end of file diff --git a/MP.Prog/Components/CmpTop.razor b/MP.Prog/Components/CmpTop.razor new file mode 100644 index 00000000..a6ac5aea --- /dev/null +++ b/MP.Prog/Components/CmpTop.razor @@ -0,0 +1,80 @@ +@using MP.Prog.Components +@using System.Security.Claims +@using Microsoft.AspNetCore.Components.Authorization +@using MP.Prog.Data + +@inject MessageService AppMessages +@inject AuthenticationStateProvider AuthenticationStateProvider + +
+
+ +
+
+ @PageName +
+
+ @if (ShowSearch) + { + + } +
+
+ +@code { + + [CascadingParameter] + private Task AuthenticationStateTask { get; set; } + + [CascadingParameter(Name = "ShowSearch")] + private bool ShowSearch { get; set; } + + private string userName = ""; + + private string PageName { get; set; } + private string PageIcon { get; set; } + + protected override async Task OnInitializedAsync() + { + await forceReload(); + } + + protected override void OnInitialized() + { + AppMessages.EA_PageUpdated += OnPageUpdate; + } + public void OnPageUpdate() + { + PageName = AppMessages.PageName; + PageIcon = AppMessages.PageIcon; + InvokeAsync(() => + { + StateHasChanged(); + }); + } + + public void Dispose() + { + AppMessages.EA_PageUpdated -= OnPageUpdate; + } + + private async Task forceReload() + { + + var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); + var user = authState.User; + + if (user.Identity.IsAuthenticated) + { + userName = $"{user.Identity.Name}"; + } + else + { + userName = "N.A."; + } + } +} + +@* // Vedere anche: + // https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0#:~:text=Blazor%20uses%20the%20existing%20ASP.NET%20Core%20authentication%20mechanisms,all%20client-side%20code%20can%20be%20modified%20by%20users + // https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0*@ \ No newline at end of file diff --git a/MP.Prog/Components/DataPager.razor b/MP.Prog/Components/DataPager.razor new file mode 100644 index 00000000..818627ba --- /dev/null +++ b/MP.Prog/Components/DataPager.razor @@ -0,0 +1,76 @@ +
+
+
+
+ @if (totalCount > 0) + { + + + + + + + + + + + + @for (int i = @startPage; i <= endPage; ++i) + { + var pageNum = i; + + + @pageNum + + + } + + + + + + + + + + + + } +
+
+
+
+ @if (showLoading) + { + + + + } +
+
+
+
+
+
+ @if (!showLoading) + { + @totalCount records + } +
+
+ @if (totalCount > 0) + { +
+ +
+ } +
+
+
+
\ No newline at end of file diff --git a/MP.Prog/Components/DataPager.razor.cs b/MP.Prog/Components/DataPager.razor.cs new file mode 100644 index 00000000..adc3e47e --- /dev/null +++ b/MP.Prog/Components/DataPager.razor.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using MP.Prog.Components; +using MP.Prog.Data; + +namespace MP.Prog.Components +{ + public partial class DataPager : ComponentBase + { + #region Protected Fields + + protected bool _showLoading = false; + + #endregion Protected Fields + + #region Private Properties + + private int endPage + { + get + { + int answ = (int)(currPage / numPages) * numPages + numPages; + answ = answ < LastPage ? answ : LastPage; + return answ; + } + } + + private int LastPage + { + get + { + return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1); + } + } + + private int nextBlock + { + get + { + int answ = currPage + numPages; + answ = answ < LastPage ? answ : LastPage; + return answ; + } + } + + private int numPages { get; set; } = 10; + + private int prevBlock + { + get + { + int answ = currPage - numPages; + answ = answ > 0 ? answ : 1; + return answ; + } + } + + // calcola un set 1 .. numPages centrato sulla pagina corrente... + private int startPage + { + get + { + int answ = (int)(currPage / numPages) * numPages; + answ = answ > 0 ? answ : 1; + return answ; + } + } + + #endregion Private Properties + + #region Protected Properties + + protected int _numPage { get; set; } = 1; + + protected int _numRecord { get; set; } = 10; + + protected int percLoading { get; set; } = 0; + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public int currPage + { + get + { + return _numPage; + } + set + { + bool doReport = !_numPage.Equals(value); + if (doReport) + { + _numPage = value; + reportChangePage(); + } + } + } + + [Parameter] + public EventCallback numPageChanged { get; set; } + + [Parameter] + public EventCallback numRecordChanged { get; set; } + + [Parameter] + public int PageSize + { + get + { + return _numRecord; + } + set + { + bool doReport = !_numRecord.Equals(value); + if (doReport) + { + _numRecord = value; + reportChange(); + } + } + } + + [Parameter] + public bool showLoading + { + get + { + return _showLoading; + } + set + { + if (value) + { + Random random = new Random(); + percLoading = random.Next(30, 90); + } + else + { + percLoading = 5; + } + _showLoading = value; + } + } + + [Parameter] + public int totalCount { get; set; } = 0; + + #endregion Public Properties + + #region Private Methods + + private void reportChange() + { + numRecordChanged.InvokeAsync(PageSize); + } + + private void reportChangePage() + { + numPageChanged.InvokeAsync(currPage); + } + + #endregion Private Methods + + #region Protected Methods + + protected void HandlePaginationItemClick(string page) + { + currPage = int.Parse(page); + } + + protected override async Task OnInitializedAsync() + { + await Task.Run(() => showLoading = false); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Prog/Components/LoadingData.razor b/MP.Prog/Components/LoadingData.razor new file mode 100644 index 00000000..d3228baf --- /dev/null +++ b/MP.Prog/Components/LoadingData.razor @@ -0,0 +1,6 @@ +
+
+

loading data

+ +
+
\ No newline at end of file diff --git a/MP.Prog/Components/LoginDisplay.razor b/MP.Prog/Components/LoginDisplay.razor new file mode 100644 index 00000000..c840f5c4 --- /dev/null +++ b/MP.Prog/Components/LoginDisplay.razor @@ -0,0 +1,61 @@ +@using Microsoft.AspNetCore.Components.Authorization + +@inject AuthenticationStateProvider AuthenticationStateProvider + + + + + + +
+
+ +
+
+  @userName +
+
+
+
+ +@code{ + + private string userName = ""; + protected override async Task OnInitializedAsync() + { + await forceReload(); + } + private async Task forceReload() + { + + var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); + var user = authState.User; + + if (user.Identity.IsAuthenticated) + { + userName = $"{user.Identity.Name}"; + } + else + { + userName = "Non Autenticato"; + } + } + + protected string StringLim(string original, int maxLen) + { + return original.Length <= maxLen ? original : $"{original.Substring(0, maxLen - 3)}..."; + } + +} \ No newline at end of file diff --git a/MP.Prog/Components/SearchMod.razor b/MP.Prog/Components/SearchMod.razor new file mode 100644 index 00000000..2d4f63ef --- /dev/null +++ b/MP.Prog/Components/SearchMod.razor @@ -0,0 +1,41 @@ +@using MP.Prog.Components +@using MP.Prog.Data +@inject MessageService MessageService + +
+ +
+ +
+
+ +@code { + + [Parameter] + public EventCallback searchUpdated { get; set; } + + [Parameter] + public string searchVal + { + get + { + return MessageService.SearchVal; + } + set + { + MessageService.SearchVal = value; + reportChange(); + } + } + + private void reportChange() + { + searchUpdated.InvokeAsync(searchVal); + } + + private void reset() + { + searchVal = ""; + } + +} \ No newline at end of file diff --git a/MP.Prog/Data/MessageService.cs b/MP.Prog/Data/MessageService.cs new file mode 100644 index 00000000..57585ff0 --- /dev/null +++ b/MP.Prog/Data/MessageService.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Prog.Data +{ + public class MessageService + { + #region Private Fields + + private SelectData _detailFilter = SelectData.Init(5, 15); + private string _pageIcon; + private string _pageName; + private string _searchVal; + private bool showSearch; + + #endregion Private Fields + + #region Public Events + + public event Action EA_FilterUpdated; + + public event Action EA_HideSearch; + + public event Action EA_PageUpdated; + + public event Action EA_SearchUpdated; + + public event Action EA_ShowSearch; + + #endregion Public Events + + #region Public Properties + + public SelectData DetailFilter + { + get => _detailFilter; + set + { + if (_detailFilter != value) + { + _detailFilter = value; + + if (EA_FilterUpdated != null) + { + EA_FilterUpdated?.Invoke(); + } + } + } + } + + public SelectData File_Filter { get; set; } = SelectData.Init(5, 30); + + public string PageIcon + { + get => _pageIcon; + set + { + if (_pageIcon != value) + { + _pageIcon = value; + ReportPageUpd(); + } + } + } + + public string PageName + { + get => _pageName; + set + { + if (_pageName != value) + { + _pageName = value; + ReportPageUpd(); + } + } + } + + public string SearchVal + { + get => _searchVal; + set + { + if (_searchVal != value) + { + _searchVal = value; + + if (EA_SearchUpdated != null) + { + EA_SearchUpdated?.Invoke(); + } + } + } + } + + public bool ShowSearch + { + get => showSearch; + set + { + if (showSearch != value) + { + showSearch = value; + if (showSearch) + { + if (EA_ShowSearch != null) + { + EA_ShowSearch?.Invoke(); + } + } + else + { + if (EA_HideSearch != null) + { + EA_HideSearch?.Invoke(); + } + } + } + } + } + + #endregion Public Properties + + #region Private Methods + + private void ReportPageUpd() + { + if (EA_PageUpdated != null) + { + EA_PageUpdated?.Invoke(); + } + } + + private void ReportSearch() + { + if (EA_SearchUpdated != null) + { + EA_SearchUpdated?.Invoke(); + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.Prog/Data/SelectData.cs b/MP.Prog/Data/SelectData.cs new file mode 100644 index 00000000..2d176677 --- /dev/null +++ b/MP.Prog/Data/SelectData.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Prog.Data +{ + public class SelectData + { + #region Public Properties + + public DateTime DateEnd { get; set; } = DateTime.Now.AddMinutes(1); + public DateTime DateStart { get; set; } = DateTime.Now.AddDays(-7); + + #endregion Public Properties + + #region Public Methods + + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + /// + public static SelectData Init(int minRound, int numDayPrev) + { + TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); + int minDay = (int)((DayElapsed.TotalMinutes / minRound) + 1) * minRound; + DateTime endRounded = DateTime.Today.AddMinutes(minDay); + SelectData answ = new SelectData() + { + DateEnd = endRounded, + DateStart = endRounded.AddDays(-numDayPrev) + }; + return answ; + } + + public override bool Equals(object obj) + { + if (!(obj is SelectData item)) + return false; + + if (DateEnd != item.DateEnd) + return false; + if (DateStart != item.DateStart) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Prog/Extensions/NavigationManagerExtension.cs b/MP.Prog/Extensions/NavigationManagerExtension.cs new file mode 100644 index 00000000..c949659b --- /dev/null +++ b/MP.Prog/Extensions/NavigationManagerExtension.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.WebUtilities; + +namespace MP.Prog.Extensions +{ + public static class NavigationManagerExtension + { + #region Public Methods + + /// + /// Estensione metodo NavigationManager + /// + /// https://code-maze.com/query-strings-blazor-webassembly/ + /// + /// + /// + /// + /// + public static T ExtractQueryStringByKey(this NavigationManager navManager, string key) + { + var uri = navManager.ToAbsoluteUri(navManager.Uri); + QueryHelpers.ParseQuery(uri.Query) + .TryGetValue(key, out var queryValue); + + if (typeof(T).Equals(typeof(int))) + { + int.TryParse(queryValue, out int result); + return (T)(object)result; + } + + if (typeof(T).Equals(typeof(string))) + return (T)(object)queryValue.ToString(); + + return default; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index 1cfa28da..6825308c 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -5,7 +5,15 @@ - + + + + + + + + + diff --git a/MP.Prog/Shared/MainLayout.razor.css b/MP.Prog/Shared/MainLayout.razor.css index 43c355a4..333ac907 100644 --- a/MP.Prog/Shared/MainLayout.razor.css +++ b/MP.Prog/Shared/MainLayout.razor.css @@ -8,17 +8,17 @@ flex: 1; } -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); +.sidebar, .sidebarSmall { + background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%); } .top-row { background-color: #f7f7f7; border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; height: 3.5rem; - display: flex; align-items: center; + /*justify-content: space-evenly; + display: flex;*/ } .top-row ::deep a, .top-row .btn-link { @@ -31,18 +31,11 @@ text-overflow: ellipsis; } -@media (max-width: 640.98px) { - .top-row:not(.auth) { - display: none; - } - - .top-row.auth { - justify-content: space-between; - } - - .top-row a, .top-row .btn-link { - margin-left: 0; - } +.bottom-row { + color: #dedede; + background-color: #000000; + height: 2rem; + align-items: center; } @media (min-width: 641px) { @@ -57,14 +50,29 @@ top: 0; } + .sidebarSmall { + width: 80px; + height: 100vh; + position: sticky; + top: 0; + } + .top-row { position: sticky; top: 0; z-index: 1; } - .main > div { - padding-left: 2rem !important; - padding-right: 1.5rem !important; + .bottom-row { + position: fixed; + bottom: 0; + z-index: 1; } -} + + .main > div { + padding-left: 0.5rem !important; + padding-right: 0.5rem !important; + /*padding-left: 2rem !important; + padding-right: 1.5rem !important;*/ + } +} \ No newline at end of file diff --git a/MP.Prog/Shared/NavMenu.razor.css b/MP.Prog/Shared/NavMenu.razor.css index acc5f9f8..e132378a 100644 --- a/MP.Prog/Shared/NavMenu.razor.css +++ b/MP.Prog/Shared/NavMenu.razor.css @@ -40,15 +40,15 @@ line-height: 3rem; } -.nav-item ::deep a.active { - background-color: rgba(255,255,255,0.25); - color: white; -} + .nav-item ::deep a.active { + background-color: rgba(255,255,255,0.25); + color: white; + } -.nav-item ::deep a:hover { - background-color: rgba(255,255,255,0.1); - color: white; -} + .nav-item ::deep a:hover { + background-color: rgba(255,255,255,0.1); + color: white; + } @media (min-width: 641px) { .navbar-toggler { @@ -59,4 +59,4 @@ /* Never collapse the sidebar for wide screens */ display: block; } -} +} \ No newline at end of file diff --git a/MP.Prog/logs/.placeholder b/MP.Prog/logs/.placeholder new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/MP.Prog/logs/.placeholder @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index ff0f7ef3..2dbfe396 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net5.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 1.0.2109.0217 + 1.0.2109.0218 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index fab69b6b..e7ebcf95 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

Versione: 1.0.2109.0217

+

Versione: 1.0.2109.0218


Note di rilascio:
    diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index d509a18d..42817866 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2109.0217 +1.0.2109.0218 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index cbffa6ab..53b173ec 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2109.0217 + 1.0.2109.0218 http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/MP.Stats.zip http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/ChangeLog.html false