inizio pag rep-stop
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
@page "/repa-stop"
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<span class="fs-3 mb-0">Fermi Reparto</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 align-content-center d-flex justify-content-end">
|
||||
<small class="fs-5">Edit Massivo Fermi</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
@if (ListRecords != null)
|
||||
{
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (AllSelected)
|
||||
{
|
||||
<button class="btn btn-outline-dark border-0 py-0" @onclick="() => ToggleAllSel()"><i class="fa-solid fa-toggle-on"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-outline-secondary border-0 py-0" @onclick="() => ToggleAllSel()"><i class="fa-solid fa-toggle-off"></i></button>
|
||||
}
|
||||
@if (numSel > 0)
|
||||
{
|
||||
<span class="fw-bold">(@numSel)</span>
|
||||
}
|
||||
</th>
|
||||
<th><i class="fa-solid fa-thumbtack"></i> Cod</th>
|
||||
<th><i class="fa-solid fa-industry"></i> Macchina</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@CheckSelect(record)">
|
||||
<td>
|
||||
@if (CurrList.Contains(record.CodMacchina))
|
||||
{
|
||||
<button class="btn btn-outline-primary border-0 py-0" @onclick="() => ToggleSel(record.CodMacchina)"><i class="fa-solid fa-toggle-on"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-outline-dark border-0 py-0" @onclick="() => ToggleSel(record.CodMacchina)"><i class="fa-solid fa-toggle-off"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>@record.CodMacchina</td>
|
||||
<td>@record.Descrizione</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
<div class="col-6">Elenco Fermate</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Components.Reparti;
|
||||
using MP.SPEC.Data;
|
||||
using NLog.LayoutRenderers;
|
||||
using static MP.Core.Objects.Enums;
|
||||
using static MP.Data.Services.ExecStatsCollector;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class RepStop
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
protected List<string> CurrList { get; set; } = new List<string>();
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected int numSel
|
||||
{
|
||||
get => CurrList.Count();
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSelect(MacchineModel currRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrList.Contains(currRec.CodMacchina))
|
||||
{
|
||||
answ = "table-info";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var rawList = MDService.MacchineGetFilt("*");
|
||||
// prendo solo macchine VALIDE
|
||||
SearchRecords = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList();
|
||||
totalCount = SearchRecords.Count;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue toggle selezione fino a numMax in aggiunta e rimuovendo tutti se era true
|
||||
/// </summary>
|
||||
protected async Task ToggleAllSel()
|
||||
{
|
||||
AllSelected = !AllSelected;
|
||||
if (AllSelected)
|
||||
{
|
||||
if (ListRecords != null)
|
||||
{
|
||||
foreach (var record in ListRecords)
|
||||
{
|
||||
if (!CurrList.Contains(record.CodMacchina))
|
||||
{
|
||||
CurrList.Add(record.CodMacchina);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrList.Clear();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
#if false
|
||||
await EC_ListUpdated.InvokeAsync(CurrList);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected void ToggleSel(string newVal)
|
||||
{
|
||||
if (!CurrList.Contains(newVal))
|
||||
{
|
||||
CurrList.Add(newVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrList.Remove(newVal);
|
||||
}
|
||||
// riordino
|
||||
CurrList = CurrList.OrderBy(x => x).ToList();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool AllSelected = false;
|
||||
private int currPage = 1;
|
||||
private bool isLoading = false;
|
||||
|
||||
private List<MacchineModel> ListRecords = new();
|
||||
private int numRecord = 10;
|
||||
private List<MacchineModel> SearchRecords = new();
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
+92
-4
@@ -1,4 +1,4 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.AspNetCore.Authentication.Negotiate;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -12,9 +12,14 @@ using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
using MP.SPEC.Services;
|
||||
using NLog;
|
||||
using NLog.Targets;
|
||||
using NLog.Targets.OpenTelemetryProtocol;
|
||||
using NLog.Web;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
using StackExchange.Redis;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
/*--------------------
|
||||
@@ -25,18 +30,55 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
*
|
||||
* */
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
|
||||
|
||||
string uptraceEndpoint = configuration["UptraceDev:Endpoint"] ?? "";
|
||||
string uptraceDsn = configuration["UptraceDev:Dsn"] ?? "";
|
||||
// NLog Uptrace setup
|
||||
if (builder.Environment.IsDevelopment())
|
||||
{
|
||||
// Recupera i parametri dal file appsettings.Development.json
|
||||
|
||||
if (!string.IsNullOrEmpty(uptraceEndpoint) && !string.IsNullOrEmpty(uptraceDsn))
|
||||
{
|
||||
// Crea il target OTLP di NLog
|
||||
var otlpTarget = new OtlpTarget
|
||||
{
|
||||
Name = "UptraceRealtime",
|
||||
Endpoint = uptraceEndpoint,
|
||||
// Impostiamo il layout per far capire a Uptrace il nome del servizio
|
||||
ServiceName = "MP.DATA.Tracer",
|
||||
Headers = $"uptrace-dsn={uptraceDsn}"
|
||||
};
|
||||
|
||||
// Recupera la configurazione attuale di NLog (quella caricata da nlog.config)
|
||||
var config = LogManager.Configuration ?? new NLog.Config.LoggingConfiguration();
|
||||
|
||||
// Aggiunge il nuovo target
|
||||
config.AddTarget(otlpTarget);
|
||||
|
||||
// Crea una regola per inviare tutto (da Info in su) al target OTLP
|
||||
config.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, otlpTarget);
|
||||
|
||||
// Applica le modifiche a NLog
|
||||
LogManager.Configuration = config;
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
|
||||
Console.WriteLine("🚀 NLog OTLP Target attivato per Uptrace in Development!");
|
||||
}
|
||||
}
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis") ?? "localhost:6379";
|
||||
//string connStringRedis = ConfMan.GetConnectionString("RedisAdmin");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
@@ -54,9 +96,54 @@ builder.Services.AddAuthorization(options =>
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
// redis replliminare
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
|
||||
// Estrae la versione compilata (es. 1.0.0.0) dell'applicazione corrente
|
||||
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0";
|
||||
|
||||
//opentelemetry services
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.WithTracing(tracerProviderBuilder =>
|
||||
{
|
||||
tracerProviderBuilder
|
||||
// Definiamo il nome del servizio CORRENTE su Uptrace
|
||||
//.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName: "MAPO.SPEC"))
|
||||
.SetResourceBuilder(ResourceBuilder.CreateDefault()
|
||||
.AddService(serviceName: "MAPO.SPEC", serviceVersion: appVersion))
|
||||
// Diciamo a OTel di ascoltare gli Span generati dalla tua classe
|
||||
.AddSource("MP.DATA.Tracer")
|
||||
// aggiunta altre instrumentation
|
||||
// 1. Strumentazione ASP.NET Core
|
||||
.AddAspNetCoreInstrumentation(options =>
|
||||
{
|
||||
// Opzionale: puoi evitare di tracciare le rotte "noiose" come gli health check o i file statici
|
||||
options.Filter = (httpContext) => !httpContext.Request.Path.StartsWithSegments("/health");
|
||||
})
|
||||
|
||||
// 2. Strumentazione SQL Client
|
||||
.AddSqlClientInstrumentation(options =>
|
||||
{
|
||||
options.RecordException = true;
|
||||
})
|
||||
// 3. Strumentazione Redis
|
||||
// ATTENZIONE: A differenza degli altri, a Redis devi passare l'oggetto di connessione (IConnectionMultiplexer)
|
||||
.AddRedisInstrumentation(redisMultiplexer)
|
||||
//.AddRedisInstrumentation(sp => sp.GetRequiredService<IConnectionMultiplexer>())
|
||||
|
||||
// Esporta i dati verso Uptrace
|
||||
.AddOtlpExporter(options =>
|
||||
{
|
||||
options.Endpoint = new Uri(uptraceEndpoint);
|
||||
options.Headers = $"uptrace-dsn={uptraceDsn}";
|
||||
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
|
||||
});
|
||||
// da abilitare per verificare SE genera davvero le activity traces
|
||||
//.AddConsoleExporter();
|
||||
});
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
builder.Services.AddSingleton<MpDataService>();
|
||||
builder.Services.AddSingleton<ListSelectDataSrv>();
|
||||
builder.Services.AddSingleton<IOApiService>();
|
||||
@@ -69,6 +156,7 @@ builder.Services.AddHttpClient();
|
||||
|
||||
logger.Info("Aggiunti services");
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
logger.Info("Build App");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2509.1211</h4>
|
||||
<h4>Versione: 6.16.2602.2412</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2509.1211
|
||||
6.16.2602.2412
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2509.1211</version>
|
||||
<version>6.16.2602.2412</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"UptraceDev": {
|
||||
"Endpoint": "https://uptrace.egalware.com:14317",
|
||||
"Dsn": "https://DC_iX71mEzg7KA7atQEBdQ@uptrace.egalware.com?grpc=14317"
|
||||
//"Endpoint": "http://upt.ovh:14317",
|
||||
//"Dsn": "http://DC_iX71mEzg7KA7atQEBdQ@upt.ovh?grpc=14317"
|
||||
},
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": 2,
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2510.1508</Version>
|
||||
<Version>6.16.2510.1508</Version>
|
||||
<Version>6.16.2601.1310</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2510.1508</h4>
|
||||
<h4>Versione: 6.16.2601.1310</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2510.1508
|
||||
6.16.2601.1310
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2510.1508</version>
|
||||
<version>6.16.2601.1310</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user