update componenti layout pagina (da fixare)

This commit is contained in:
Samuele E. Locatelli
2023-12-28 12:19:09 +01:00
parent 88a4b0188e
commit 009aba0cec
19 changed files with 677 additions and 123 deletions
-11
View File
@@ -46,17 +46,6 @@ namespace MagMan.Data
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
#if false
// se samuele --> admin!
if (username.StartsWith("samuele"))
{
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
}
else
{
sqlCommand = $"GRANT ALL ON {dbName}.* TO '{username}'@'localhost';";
}
#endif
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;";
+2 -2
View File
@@ -5,9 +5,9 @@ VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagMan.UI", "MagMan.UI\MagMan.UI.csproj", "{F10B1580-27FE-4F0D-BA47-7DC9D7B63F73}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagMan.Core", "MagMan.Core\MagMan.Core.csproj", "{328950E0-CCFB-40EF-AC68-A26912135588}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagMan.Core", "MagMan.Core\MagMan.Core.csproj", "{328950E0-CCFB-40EF-AC68-A26912135588}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagMan.Data", "MagMan.Data\MagMan.Data.csproj", "{4F26EF07-74E7-4A8F-B24B-19AACDD718B3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagMan.Data", "MagMan.Data\MagMan.Data.csproj", "{4F26EF07-74E7-4A8F-B24B-19AACDD718B3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+16
View File
@@ -0,0 +1,16 @@
<div class="form-row text-light">
<div class="col-5 pr-0 text-left">
MagMan <span class="small">v.@version</span>
</div>
<div class="col-7 pl-0 text-right">
<span class="small">@adesso</span>
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware<img class="img-fluid" width="16" src="img/EgalwareLogo.svg" /></a>
</div>
</div>
@code {
protected DateTime adesso = DateTime.Now;
Version version = typeof(Program).Assembly.GetName().Version;
}
+21
View File
@@ -0,0 +1,21 @@
@using MagMan.UI.Components
@using MagMan.UI.Data
@using System.Security.Claims
@using Microsoft.AspNetCore.Components.Authorization
@inject MessageService AppMessages
<div class="form-row pt-3">
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
<LoginDisplay></LoginDisplay>
</div>
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
<span><i class="@PageIcon" aria-hidden="true"></i> @PageName</span>
</div>
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
@if (ShowSearch)
{
<SearchMod></SearchMod>
}
</div>
</div>
+53
View File
@@ -0,0 +1,53 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Components;
namespace MagMan.UI.Components
{
public partial class CmpTop
{
#region Private Properties
private string PageIcon { get; set; } = "";
private string PageName { get; set; } = "";
[CascadingParameter(Name = "ShowSearch")]
private bool ShowSearch { get; set; } = false;
#endregion Private Properties
#region Public Methods
public void Dispose()
{
AppMessages.EA_PageUpdated -= OnPageUpdate;
}
public void OnPageUpdate()
{
PageName = AppMessages.PageName;
PageIcon = AppMessages.PageIcon;
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Public Methods
#region Protected Methods
protected override void OnInitialized()
{
AppMessages.EA_PageUpdated += OnPageUpdate;
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(0);
}
#endregion Protected Methods
}
}
+33
View File
@@ -0,0 +1,33 @@
@using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider
<CascadingAuthenticationState>
<AuthorizeView>
<Authorized>
<div class="input-group text-truncate">
<div class="input-group-prepend">
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger"><i class="fas fa-sign-out-alt"></i></a>
</div>
<a title="Gestione account @userName" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
<div class="d-none d-sm-block">
<i class="fas fa-user-alt"></i> @StringLim(userName, 30)
</div>
<div class="d-block d-sm-none">
<i class="fas fa-user-alt"></i> @StringLim(userName, 15)
</div>
</a>
</div>
</Authorized>
<NotAuthorized>
<div class="input-group">
<div class="input-group-prepend">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success"><i class="fas fa-sign-in-alt"></i></a>
</div>
<div class="form-control form-control-sm">
<i class="fas fa-user-alt"></i>&nbsp;@userName
</div>
</div>
</NotAuthorized>
</AuthorizeView>
</CascadingAuthenticationState>
@@ -0,0 +1,48 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Components.Authorization;
namespace MagMan.UI.Components
{
public partial class LoginDisplay
{
#region Private Fields
private string userName = "";
#endregion Private Fields
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await forceReload();
}
protected string StringLim(string original, int maxLen)
{
return original.Length <= maxLen ? original : $"{original.Substring(0, maxLen - 3)}...";
}
#endregion Protected Methods
#region Private Methods
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity != null && user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
}
else
{
userName = "Non Autenticato";
}
}
#endregion Private Methods
}
}
+11
View File
@@ -0,0 +1,11 @@
@using MagMan.UI.Components
@using MagMan.UI.Data
@inject MessageService MessageService
<div class="input-group input-group-sm">
<input @bind-value="searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
<div class="input-group-append">
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
</div>
</div>
+45
View File
@@ -0,0 +1,45 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using MagMan.Data.Services;
using Microsoft.AspNetCore.Components;
namespace MagMan.UI.Components
{
public partial class SearchMod
{
#region Public Properties
[Parameter]
public EventCallback<string> searchUpdated { get; set; }
[Parameter]
public string searchVal
{
get
{
return MessageService.SearchVal;
}
set
{
MessageService.SearchVal = value;
reportChange();
}
}
#endregion Public Properties
#region Private Methods
private void reportChange()
{
searchUpdated.InvokeAsync(searchVal);
}
private void reset()
{
searchVal = "";
}
#endregion Private Methods
}
}
+14
View File
@@ -6,11 +6,25 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Identity\Data\" />
<Folder Include="Controllers\" />
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
<None Include="wwwroot\fonts\lato-v17-latin-regular.svg" />
<None Include="wwwroot\fonts\lato-v17-latin-regular.woff2" />
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.svg" />
<None Include="wwwroot\fonts\roboto-condensed-v19-latin-regular.woff2" />
<None Include="wwwroot\fonts\roboto-v27-latin-regular.svg" />
<None Include="wwwroot\fonts\roboto-v27-latin-regular.woff2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.4" />
+71 -1
View File
@@ -1,8 +1,14 @@
@inherits LayoutComponentBase
@using MagMan.UI.Data
@using MagMan.UI.Components
@inject MessageService MessageService
@implements IDisposable
<PageTitle>MagMan.UI</PageTitle>
<div class="page">
@* <div class="page">
<div class="sidebar">
<NavMenu />
</div>
@@ -16,4 +22,68 @@
@Body
</article>
</main>
</div> *@
<div class="page">
<div class="@sideClass">
@* <NavMenu EC_compressUpdated="@UpdateNavDisplay" /> *@
<NavMenu />
</div>
<CascadingValue Name="ShowSearch" Value=@ShowSearch>
<div class="main mr-1">
<div class="top-row">
<CmpTop></CmpTop>
</div>
<div class="content pt-1 pt-lg-2 mb-5 px-0 px-lg-2">
@Body
</div>
<div class="fixed-bottom bottom-row">
<CmpFooter></CmpFooter>
</div>
</div>
</CascadingValue>
</div>
@code {
bool ShowSearch { get; set; } = false;
protected override void OnInitialized()
{
MessageService.EA_ShowSearch += OnShowSearch;
MessageService.EA_HideSearch += OnHideSearch;
}
public void OnShowSearch()
{
ShowSearch = true;
InvokeAsync(() =>
{
StateHasChanged();
});
}
public void OnHideSearch()
{
ShowSearch = false;
InvokeAsync(() =>
{
StateHasChanged();
});
}
public void Dispose()
{
MessageService.EA_ShowSearch -= OnShowSearch;
MessageService.EA_ShowSearch -= OnHideSearch;
}
protected bool navLarge { get; set; } = true;
protected string sideClass { get; set; } = "sidebar";
protected void UpdateNavDisplay()
{
navLarge = !navLarge;
sideClass = navLarge ? "sidebar" : "sidebarSmall";
}
}
+76 -61
View File
@@ -1,70 +1,85 @@
.page {
position: relative;
display: flex;
flex-direction: column;
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
.sidebar,
.sidebarSmall {
background-image: linear-gradient(180deg, #052767 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;
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
height: 3.5rem;
align-items: center;
/*justify-content: space-evenly;
display: flex;*/
}
.top-row ::deep a,
.top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.top-row a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.top-row ::deep a, .top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.top-row a:first-child {
overflow: hidden;
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;
}
.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) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
.page {
flex-direction: row;
}
.sidebar {
width: 230px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebarSmall {
width: 80px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row,
article {
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;*/
}
}
+97
View File
@@ -0,0 +1,97 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
.sidebar, .sidebarSmall {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
height: 3.5rem;
align-items: center;
/*justify-content: space-evenly;
display: flex;*/
}
.top-row ::deep a, .top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.top-row a:first-child {
overflow: hidden;
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) {
.page {
flex-direction: row;
}
.sidebar {
width: 230px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebarSmall {
width: 80px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row, article {
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;*/
}
}
+1
View File
@@ -0,0 +1 @@
.page{position:relative;display:flex;flex-direction:column;}main{flex:1;}.sidebar,.sidebarSmall{background-image:linear-gradient(180deg,#052767 20%,#3aa6ff 90%);}.top-row{background-color:#f7f7f7;border-bottom:1px solid #d6d5d5;height:3.5rem;align-items:center;}.top-row ::deep a,.top-row .btn-link{white-space:nowrap;margin-left:1.5rem;}.top-row a:first-child{overflow:hidden;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:#000;height:2rem;align-items:center;}@media(min-width:641px){.page{flex-direction:row;}.sidebar{width:230px;height:100vh;position:sticky;top:0;}.sidebarSmall{width:80px;height:100vh;position:sticky;top:0;}.top-row{position:sticky;top:0;z-index:1;}.top-row,article{padding-left:2rem!important;padding-right:1.5rem!important;}.bottom-row{position:fixed;bottom:0;z-index:1;}.main>div{padding-left:.5rem!important;padding-right:.5rem!important;}}
+37 -48
View File
@@ -1,62 +1,51 @@
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
height: 3.5rem;
background-color: rgba(0, 0, 0, 0.4);
}
.navbar-brand {
font-size: 1.1rem;
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.25);
color: white;
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;
background-color: rgba(255, 255, 255, 0.1);
color: white;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
}
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
}
+62
View File
@@ -0,0 +1,62 @@
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
}
.navbar-brand {
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.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;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
}
+1
View File
@@ -0,0 +1 @@
.navbar-toggler{background-color:rgba(255,255,255,.1);}.top-row{height:3.5rem;background-color:rgba(0,0,0,.4);}.navbar-brand{font-size:1.1rem;}.oi{width:2rem;font-size:1.1rem;vertical-align:text-top;top:-2px;}.nav-item{font-size:.9rem;padding-bottom:.5rem;}.nav-item:first-of-type{padding-top:1rem;}.nav-item:last-of-type{padding-bottom:1rem;}.nav-item ::deep a{color:#d7d7d7;border-radius:4px;height:3rem;display:flex;align-items:center;line-height:3rem;}.nav-item ::deep a.active{background-color:rgba(255,255,255,.25);color:#fff;}.nav-item ::deep a:hover{background-color:rgba(255,255,255,.1);color:#fff;}@media(min-width:641px){.navbar-toggler{display:none;}.collapse{display:block;}}
+18
View File
@@ -0,0 +1,18 @@
[
{
"outputFile": "Shared/MainLayout.razor.css",
"inputFile": "Shared/MainLayout.razor.less"
},
{
"outputFile": "Shared/NavMenu.razor.css",
"inputFile": "Shared/NavMenu.razor.less"
},
{
"outputFile": "wwwroot/css/site.css",
"inputFile": "wwwroot/css/site.less"
},
{
"outputFile": "wwwroot/css/font.css",
"inputFile": "wwwroot/css/font.less"
}
]
+71
View File
@@ -0,0 +1,71 @@
{
"compilers": {
"less": {
"autoPrefix": "",
"cssComb": "none",
"ieCompat": true,
"math": null,
"strictMath": false,
"strictUnits": false,
"relativeUrls": true,
"rootPath": "",
"sourceMapRoot": "",
"sourceMapBasePath": "",
"sourceMap": false
},
"sass": {
"autoPrefix": "",
"loadPaths": "",
"style": "expanded",
"relativeUrls": true,
"sourceMap": false
},
"nodesass": {
"autoPrefix": "",
"includePath": "",
"indentType": "space",
"indentWidth": 2,
"outputStyle": "nested",
"precision": 5,
"relativeUrls": true,
"sourceMapRoot": "",
"lineFeed": "",
"sourceMap": false
},
"stylus": {
"sourceMap": false
},
"babel": {
"sourceMap": false
},
"coffeescript": {
"bare": false,
"runtimeMode": "node",
"sourceMap": false
},
"handlebars": {
"root": "",
"noBOM": false,
"name": "",
"namespace": "",
"knownHelpersOnly": false,
"forcePartial": false,
"knownHelpers": [],
"commonjs": "",
"amd": false,
"sourceMap": false
}
},
"minifiers": {
"css": {
"enabled": true,
"termSemicolons": true,
"gzip": false
},
"javascript": {
"enabled": true,
"termSemicolons": true,
"gzip": false
}
}
}