Aggiunta pagine status x MP-IOC (preliminare)

This commit is contained in:
Samuele Locatelli
2026-04-09 15:48:56 +02:00
parent 7ad6468969
commit e47b2df5d2
21 changed files with 86 additions and 211 deletions
+8 -2
View File
@@ -431,8 +431,14 @@ namespace MP.AppAuth.Services
public void Dispose()
{
// Clear database controller
dbController.Dispose();
MpDbController.Dispose();
if (dbController != null)
{
dbController.Dispose();
}
if (MpDbController != null)
{
MpDbController.Dispose();
}
}
public async Task FlushRedisCache()
+4 -5
View File
@@ -1,8 +1,4 @@
#if false
using Blazored.LocalStorage;
using Blazored.SessionStorage;
#endif
using EgwCoreLib.Utils;
using EgwCoreLib.Utils;
using Microsoft.Extensions.Configuration;
using MP.Data.DbModels;
using MP.Data.DTO;
@@ -186,6 +182,9 @@ namespace MP.Data.Services
}
}
public string PageName;
public string PageIcon;
/// <summary>
/// Diritti utente (solo Funzione/Ruolo)
/// </summary>
+2 -2
View File
@@ -1,10 +1,10 @@
<div class="d-flex justify-content-between text-light w-100">
<div class="px-1 text-start">
MP.Land <span class="small">v.@version</span>
MP-IOC <span class="small">v.@version</span>
</div>
<div class="px-1 text-end">
<span class="small">@adesso</span>
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware &nbsp;<img class="img-fluid" width="16" src="img/LogoEgalware.svg" /></a>
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware &nbsp;<img class="img-fluid" width="16" src="images/LogoEgw.png" /></a>
</div>
</div>
+2 -5
View File
@@ -1,10 +1,7 @@
@using MP.Land.Components
@using System.Security.Claims
<div class="row pt-2">
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
@*<LoginDisplay></LoginDisplay>*@
<i class="fas fa-user-alt"></i> <b>@userName</b>
</div>
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
@@ -13,7 +10,7 @@
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-end">
@if (ShowSearch)
{
<SearchMod></SearchMod>
@* <SearchMod></SearchMod> *@
}
</div>
</div>
+2 -21
View File
@@ -1,10 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using MP.Land.Data;
using System;
using System.Threading.Tasks;
namespace MP.Land.Components
namespace MP.IOC.Components.Compo
{
public partial class CmpTop : IDisposable
{
@@ -12,36 +9,20 @@ namespace MP.Land.Components
public void Dispose()
{
AppMessages.EA_PageUpdated -= OnPageUpdate;
GC.Collect();
}
public void OnPageUpdate()
{
PageName = AppMessages.PageName;
PageIcon = AppMessages.PageIcon;
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected LMessageService AppMessages { get; set; } = null!;
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
AppMessages.EA_PageUpdated += OnPageUpdate;
}
protected override async Task OnInitializedAsync()
{
await forceReload();
+3 -12
View File
@@ -1,20 +1,12 @@
@inherits LayoutComponentBase
@using MP.Land.Data
@using MP.Land.Components
@inject LMessageService AppMService
@inject LicenseService LicServ
@implements IDisposable
<PageTitle>MP-LAND</PageTitle>
<PageTitle>MP-IOC</PageTitle>
<div class="page">
<div class="@sideClass d-print-none">
<NavMenu EC_compressUpdated="@UpdateNavDisplay" />
<NavMenu EC_compressUpdated="UpdateNavDisplay" />
</div>
<CascadingValue Name="ShowSearch" Value=@ShowSearch>
<div class="main pe-1">
<div class="top-row d-print-none">
<CmpTop></CmpTop>
@@ -22,10 +14,9 @@
<div class="content pt-1 pt-lg-2 mb-5 px-3">
@Body
</div>
<div class="fixed-bottom @cssRow">
<div class="fixed-bottom bottom-row">
<CmpFooter></CmpFooter>
</div>
</div>
</CascadingValue>
</div>
+2 -40
View File
@@ -1,39 +1,22 @@
using Microsoft.AspNetCore.Components;
using MP.AppAuth.Services;
using MP.Land.Data;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MP.Land.Shared
namespace MP.IOC.Components.Layout
{
public partial class MainLayout
public partial class MainLayout : IDisposable
{
#region Public Methods
public void Dispose()
{
AppMService.EA_ShowSearch -= OnShowSearch;
AppMService.EA_ShowSearch -= OnHideSearch;
GC.Collect();
}
public void OnHideSearch()
{
ShowSearch = false;
InvokeAsync(() =>
{
StateHasChanged();
});
}
public void OnShowSearch()
{
ShowSearch = true;
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Public Methods
@@ -44,9 +27,6 @@ namespace MP.Land.Shared
protected string cssRow { get; set; } = "bottom-row bg-primary";
[Inject]
protected AppAuthService DataService { get; set; }
protected bool navLarge { get; set; } = true;
protected string sideClass { get; set; } = "sidebar";
@@ -55,24 +35,6 @@ namespace MP.Land.Shared
#region Protected Methods
protected override async Task OnInitializedAsync()
{
AppMService.EA_ShowSearch += OnShowSearch;
AppMService.EA_HideSearch += OnHideSearch;
AppMService.EA_UpdateLic += SetYrAuth;
await Task.Delay(1);
}
protected void SetYrAuth()
{
annualAuthOk = AppMService.YearAuth;
cssRow = annualAuthOk ? "bottom-row" : "bottom-row bg-danger";
InvokeAsync(() =>
{
StateHasChanged();
});
}
protected void UpdateNavDisplay()
{
navLarge = !navLarge;
+8 -50
View File
@@ -2,11 +2,11 @@
<div class="container-fluid">
@if (!showText)
{
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">MP.L <i class="fas fa-caret-square-right"></i></a>
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">MP <i class="fas fa-caret-square-right"></i></a>
}
else
{
<a class="navbar-brand" @onclick="() => ToggleCompress()">MP.Land <i class="fas fa-caret-square-left"></i></a>
<a class="navbar-brand" @onclick="() => ToggleCompress()">MP.IOC <i class="fas fa-caret-square-left"></i></a>
}
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
@@ -23,7 +23,7 @@
else
{
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="" Match="NavLinkMatch.All">
<NavLink class="nav-link py-0 px-2 mb-0" href="Index" Match="NavLinkMatch.All">
<span class="fas fa-home fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
@@ -32,15 +32,15 @@
</NavLink>
</div>
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="UserQr">
<span class="fas fa-qrcode fs-4 pe-2" aria-hidden="true"></span>
<NavLink class="nav-link py-0 px-2 mb-0" href="callstats">
<span class="fas fa-chart-pie fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
<span class="@hideText">QR Card User</span>
<span class="@hideText">Call Stats</span>
}
</NavLink>
</div>
<div class="nav-item px-2">
@* <div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="IobList">
<span class="fas fa-computer fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
@@ -57,19 +57,7 @@
<span class="@hideText">Update Manager</span>
}
</NavLink>
</div>
@if (IsSuperAdmin)
{
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="ConfSync">
<span class="fas fa-file-import fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
<span class="@hideText">Config Sync</span>
}
</NavLink>
</div>
}
</div> *@
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="About">
<span class="fas fa-info-circle fs-4 pe-2" aria-hidden="true"></span>
@@ -88,36 +76,6 @@
}
</NavLink>
</div>
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="SysInfo">
<span class="fas fa-wrench fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
<span class="@hideText">System Info</span>
}
</NavLink>
</div>
@if (IsSuperAdmin)
{
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="DbInfo">
<span class="fas fa-database fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
<span class="@hideText">DBs Info</span>
}
</NavLink>
</div>
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="TaskScheduler">
<span class="fas fa-stopwatch fs-4 pe-2" aria-hidden="true"></span>
@if (showText)
{
<span class="@hideText">Task Scheduler</span>
}
</NavLink>
</div>
}
<div class="nav-item px-2">
<NavLink class="nav-link py-0 px-2 mb-0" href="RefreshData">
<span class="fas fa-sync-alt fs-4 pe-2" aria-hidden="true"></span>
+2 -57
View File
@@ -1,13 +1,8 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Configuration;
using MP.AppAuth.Models;
using MP.AppAuth.Services;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.Shared
namespace MP.IOC.Components.Layout
{
public partial class NavMenu
{
@@ -23,16 +18,8 @@ namespace MP.Land.Shared
[Inject]
protected AuthenticationStateProvider AuthStateProvider { get; set; } = null!;
[Inject]
protected AppAuthService DataService { get; set; }
protected string hideText { get => showText ? "" : "invisible"; }
protected bool IsSuperAdmin
{
get => HasRight(AppAuthService.RoleSuperAdmin);
}
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
@@ -59,18 +46,6 @@ namespace MP.Land.Shared
#region Protected Methods
protected bool HasRight(string codFunz)
{
bool answ = false;
if (UserRight != null && UserRight.Count > 0)
{
answ = UserRight
.Where(x => x.Funzione.Equals(codFunz, System.StringComparison.InvariantCultureIgnoreCase))
.Count() > 0;
}
return answ;
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
@@ -108,30 +83,11 @@ namespace MP.Land.Shared
#region Private Methods
private void checkAuth()
{
// verifico pagina tra i permessi, se manca --> rimando a pagina unauth... se contiene
// index --> salto
if (!pageName.Contains("index"))
{
bool isAuth = false;
if (UserPerm != null)
{
isAuth = UserPerm.Where(x => x.Url.ToLower() == pageName).Count() > 0;
bool pageIsSafe = SafePages.ToLower().Contains($"|{pageName.ToLower()}|");
if (!pageIsSafe && !isAuth)
{
NavManager.NavigateTo("Unauthorized", true);
}
}
}
}
private async Task ReloadData()
{
isLoading = true;
// sistemo elenco pagine safe...
SafePages = ConfMan.GetValue<string>("Application:SafePages").ToLower();
SafePages = ConfMan.GetValue<string>("ServerConf:SafePages").ToLower() ?? "";
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity != null && user.Identity.IsAuthenticated)
@@ -142,17 +98,6 @@ namespace MP.Land.Shared
{
userName = "N.A.";
}
// carico diritti...
var domUser = userName.Split("\\");
if (domUser.Length > 0)
{
string dominio = domUser[0];
string uName = domUser[1];
UserRight = await DataService.DirittiGetByUser(uName);
UserPerm = await DataService.PermessiGetByUser(uName);
}
checkAuth();
await Task.Delay(1);
isLoading = false;
await Task.Delay(1);
}
+6
View File
@@ -0,0 +1,6 @@
@page "/about"
<h3>About</h3>
@code {
}
+6
View File
@@ -0,0 +1,6 @@
@page "/callstats"
<h3>CallStats</h3>
@code {
}
+7
View File
@@ -0,0 +1,7 @@
@page "/contacts"
<h3>Contacts</h3>
@code {
}
@@ -0,0 +1,7 @@
@page "/RefreshData"
<h3>RefreshData</h3>
@code {
}
+5 -3
View File
@@ -1,5 +1,5 @@
@using System.Net.Http
@using System.Net.Http.Json
@using EgwCoreLib.Razor
@using EgwCoreLib.Utils
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@@ -10,4 +10,6 @@
@using MP.Data.Repository
@using MP.Data.Services
@using MP.IOC.Components
@* @using MP.IOC.Components.Compo *@
@using MP.IOC.Components.Compo
@using System.Net.Http
@using System.Net.Http.Json
+4 -7
View File
@@ -1,18 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2604.915</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Components\Compo\CmpTop.razor.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
<Content Remove="Components\Compo\CmpTop.razor" />
</ItemGroup>
<ItemGroup>
@@ -32,6 +28,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2511.312" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2511.312" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.25" />
<PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" />
@@ -53,7 +51,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Components\Compo\" />
<Folder Include="Components\Layout\" />
</ItemGroup>
+11 -1
View File
@@ -4,6 +4,7 @@ using Microsoft.OpenApi.Models;
using MP.Data;
using MP.Data.Repository.Utils;
using MP.Data.Services.Utils;
using MP.IOC.Components;
using MP.IOC.Data;
using MP.IOC.Services;
using NLog;
@@ -76,6 +77,14 @@ string utilsConnString = builder.Configuration.GetConnectionString("MP.Utils") ?
builder.Services.AddDbContextFactory<MoonPro_UtilsContext>(options =>
options.UseSqlServer(utilsConnString));
#if false
// gestione generica MP
// aggiunta helper local/session storage service
builder.Services.AddScoped<ISessionStorageService, SessionStorageService>();
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
builder.Services.AddScoped<MessageService>();
#endif
// MP.Data Services Utils - Statistiche DB
builder.Services.AddScoped<IStatsAggrRepository, StatsAggrRepository>();
builder.Services.AddScoped<IStatsDetailRepository, StatsDetailRepository>();
@@ -181,6 +190,7 @@ app.UseAuthorization();
// aggiunta x index.html
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseAntiforgery();
// Mappatura delle API
app.MapControllers();
@@ -189,7 +199,7 @@ app.MapControllers();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.MapHealthChecks("/health");
//app.MapHealthChecks("/health");
logger.Info("Run App");
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2604.907</h4>
<h4>Versione: 6.16.2604.915</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2604.907
6.16.2604.915
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2604.907</version>
<version>6.16.2604.915</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -1
View File
@@ -80,7 +80,8 @@
"BaseUrl": "/MP/IOC/",
"RedisBaseKey": "MP-IOC",
"RedisWeight": true,
"RoutePath": "/api/RIOB"
"RoutePath": "/api/RIOB",
"SafePages": "Index"
},
"ConnectionStrings": {
"MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.IOC;",
+2 -2
View File
@@ -1,6 +1,6 @@
html, body {
/*html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
}*/
a, .btn-link {
color: #006bb7;