- fix componenti UI
- lasciati invariati in area wwwroot
This commit is contained in:
Samuele Locatelli
2022-09-21 14:49:45 +02:00
parent 3a5b77314a
commit 2a41e8070b
14 changed files with 183 additions and 179 deletions
+4 -4
View File
@@ -33,15 +33,15 @@ namespace MP.SPEC.Components
aTimer.Start();
}
#endregion Public Methods
#region Protected Methods
protected override void OnInitialized()
{
version = typeof(Program).Assembly.GetName().Version;
}
#endregion Public Methods
#region Protected Methods
#endregion Protected Methods
#region Private Fields
+10 -6
View File
@@ -23,12 +23,6 @@ namespace MP.SPEC.Components
}
}
}
public async Task resetCurrPage()
{
await Task.Delay(1);
currPage = 1;
}
[Parameter]
public EventCallback<int> numPageChanged { get; set; }
@@ -82,6 +76,16 @@ namespace MP.SPEC.Components
#endregion Public Properties
#region Public Methods
public async Task resetCurrPage()
{
await Task.Delay(1);
currPage = 1;
}
#endregion Public Methods
#region Protected Fields
protected bool _showLoading = false;
+17 -38
View File
@@ -1,21 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.SPEC;
using MP.SPEC.Shared;
using MP.SPEC.Components;
using MP.SPEC.Data;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
namespace MP.SPEC.Components
{
@@ -31,15 +16,27 @@ namespace MP.SPEC.Components
#endregion Public Properties
#region Protected Fields
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MpDataService MDService { get; set; } = null!;
protected DateTime selDtRef
{
get
{
return SelFilterDossier.DtRef;
}
set
{
if (!SelFilterDossier.DtRef.Equals(value))
{
SelFilterDossier.DtRef = value;
reportChange();
}
}
}
protected string selMacchina
{
@@ -60,7 +57,6 @@ namespace MP.SPEC.Components
}
}
protected int selMaxRecord
{
get
@@ -78,23 +74,6 @@ namespace MP.SPEC.Components
}
}
protected DateTime selDtRef
{
get
{
return SelFilterDossier.DtRef;
}
set
{
if (!SelFilterDossier.DtRef.Equals(value))
{
SelFilterDossier.DtRef = value;
reportChange();
}
}
}
#endregion Protected Properties
#region Protected Methods
+2 -1
View File
@@ -111,10 +111,11 @@ namespace MP.SPEC.Components
{
get => SelFilter.TempoAgg;
}
//protected int RefreshPeriod { get; set; } = 5000;
#endregion Protected Properties
//protected int RefreshPeriod { get; set; } = 5000;
#region Protected Methods
protected override async Task OnInitializedAsync()
+43 -47
View File
@@ -12,7 +12,6 @@ namespace MP.SPEC.Components
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public EventCallback<PODLModel> RecordSel { get; set; }
@@ -35,38 +34,6 @@ namespace MP.SPEC.Components
return answ;
}
protected async Task resetSel()
{
await RecordSel.InvokeAsync(null);
}
protected bool POdlDelEnabled(int idxOdl)
{
return idxOdl == 0;
}
protected async Task selRecord(PODLModel selRec)
{
await RecordSel.InvokeAsync(selRec);
}
/// <summary>
/// Eliminazione record selezioanto (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.PODLDeleteRecord(selRec);
currRecord = null;
await reloadData();
await Task.Delay(1);
}
#endregion Public Methods
#region Protected Properties
@@ -84,6 +51,22 @@ namespace MP.SPEC.Components
#region Protected Methods
/// <summary>
/// Eliminazione record selezioanto (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(PODLModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.PODLDeleteRecord(selRec);
currRecord = null;
await reloadData();
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
{
MsgService.EA_PageUpdated += MessageService_EA_PageUpdated;
@@ -104,6 +87,21 @@ namespace MP.SPEC.Components
});
}
protected bool POdlDelEnabled(int idxOdl)
{
return idxOdl == 0;
}
protected async Task resetSel()
{
await RecordSel.InvokeAsync(null);
}
protected async Task selRecord(PODLModel selRec)
{
await RecordSel.InvokeAsync(selRec);
}
protected async Task UpdateData()
{
currRecord = null;
@@ -118,6 +116,7 @@ namespace MP.SPEC.Components
private List<PODLModel>? ListRecords;
private List<ListValues>? ListStati;
private List<PODLModel>? SearchRecords;
#endregion Private Fields
@@ -175,6 +174,17 @@ namespace MP.SPEC.Components
});
}
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
private string tradFase(string codFase)
{
string answ = codFase;
@@ -189,20 +199,6 @@ namespace MP.SPEC.Components
return answ;
}
private List<ListValues>? ListStati;
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
}
#endregion Private Methods
}
}
+9 -13
View File
@@ -15,7 +15,7 @@ namespace MP.SPEC.Components
#endregion Public Properties
#region Protected Fields
#region Protected Properties
protected string lastUpdate
{
@@ -23,10 +23,6 @@ namespace MP.SPEC.Components
set => SelFilter.lastUpdate = value;
}
#endregion Protected Fields
#region Protected Properties
protected bool liveUpdate
{
get => SelFilter.LiveUpdate;
@@ -134,6 +130,14 @@ namespace MP.SPEC.Components
await FilterChanged.InvokeAsync(SelFilter);
}
protected async Task takeSnapshot()
{
// fermo udpate
liveUpdate = false;
await MDService.DossiersTakeParamsSnapshot(selMacchina, 10);
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
protected void toggleParams()
{
showEditPar = !showEditPar;
@@ -149,14 +153,6 @@ namespace MP.SPEC.Components
}
}
protected async Task takeSnapshot()
{
// fermo udpate
liveUpdate = false;
await MDService.DossiersTakeParamsSnapshot(selMacchina, 10);
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
#endregion Protected Methods
#region Private Fields
+18 -16
View File
@@ -11,13 +11,25 @@
#region Public Properties
public int CurrPage { get; set; } = 1;
public DateTime DtRef { get; set; } = Init(5);
public string IdxMacchina { get; set; } = "*";
public int MaxRecord { get; set; } = 100;
#endregion Public Properties
#region Public Methods
/// <summary>
        /// Inizializzazione con periodo e arrotondamento
        /// </summary>
        /// <param name="minRound"></param>
        /// <param name="numDayPrev"></param>
        /// <returns></returns>
        public static DateTime Init(int minRound)
        /// Inizializzazione con periodo e arrotondamento
        /// </summary>
        /// <param name="minRound"></param>
        /// <param name="numDayPrev"></param>
        /// <returns></returns>
public static DateTime Init(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
@@ -25,16 +37,6 @@
return endRounded;
}
public string IdxMacchina { get; set; } = "*";
public int MaxRecord { get; set; } = 100;
public DateTime DtRef { get; set; } = Init(5);
public int CurrPage { get; set; } = 1;
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is SelectDossierParams item))
+2 -2
View File
@@ -12,13 +12,13 @@
#region Public Properties
public string CodFlux { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true;
public int MaxRecord { get; set; } = 100;
public int TempoAgg { get; set; } = 2000;
public int CurrPage { get; set; } = 1;
public string lastUpdate { get; set; } = "-";
#endregion Public Properties
+21 -5
View File
@@ -8,20 +8,36 @@ namespace MP.SPEC.Pages
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
#region Public Constructors
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
#endregion Public Constructors
#region Public Properties
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
#endregion Public Properties
#region Public Methods
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
#endregion Public Methods
#region Private Fields
private readonly ILogger<ErrorModel> _logger;
#endregion Private Fields
}
}
+2 -7
View File
@@ -29,7 +29,7 @@ namespace MP.SPEC.Pages
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
currFilter.lastUpdate= $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilter.lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilter.LiveUpdate = (currPage == 1);
StateHasChanged();
}
@@ -66,11 +66,6 @@ namespace MP.SPEC.Pages
#endregion Protected Methods
#region Private Fields
#endregion Private Fields
#region Private Properties
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
@@ -81,8 +76,8 @@ namespace MP.SPEC.Pages
set => MsgService.currPage = value;
}
private bool isLoading { get; set; } = true;
private bool isFiltering { get; set; } = false;
private bool isLoading { get; set; } = true;
private int numRecord
{
+11 -4
View File
@@ -1,18 +1,25 @@
using Microsoft.AspNetCore.Components;
using MP.SPEC.Data;
using System.Reflection;
namespace MP.SPEC.Pages
{
public partial class Utils
{
[Inject]
protected MpDataService MDService { get; set; }
#region Public Methods
public async Task flushCache()
{
await Task.Delay(1);
await MDService.FlushRedisCache();
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected MpDataService MDService { get; set; }
#endregion Protected Properties
}
}
}
+25 -25
View File
@@ -1,28 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:46815",
"sslPort": 44370
}
},
"profiles": {
"MP.SPEC": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7212;http://localhost:5212",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:46815",
"sslPort": 44370
}
},
"profiles": {
"MP.SPEC": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7212;http://localhost:5212",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
+18 -10
View File
@@ -24,16 +24,16 @@ main {
display: flex;*/
}
.top-row ::deep a,
.top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.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 a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.bottom-row {
color: #dedede;
@@ -46,9 +46,11 @@ main {
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row a,
.top-row .btn-link {
margin-left: 0;
@@ -59,34 +61,40 @@ main {
.page {
flex-direction: row;
}
.sidebar {
width: 15rem;
height: 100vh;
position: sticky;
top: 0;
}
.sidebarSmall {
width: 5rem;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row,
article {
padding-left: 0.5rem !important;
padding-right: 0.5rem !important;
}
.bottom-row {
position: fixed;
bottom: 0;
z-index: 1;
}
.main>div {
.main > div {
padding-left: 0.5rem !important;
padding-right: 0.5rem !important;
/*padding-left: 2rem !important;
+1 -1
View File
@@ -59,4 +59,4 @@
/* Never collapse the sidebar for wide screens */
display: block;
}
}
}