IOB Deploy CI/CD:

- fix yaml
- fix conf appsettings.json + production
- global refresh
This commit is contained in:
Samuele Locatelli
2023-04-04 19:36:47 +02:00
parent 4f916ed863
commit 6355f1eaca
26 changed files with 172 additions and 132 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ namespace MP.Data.Controllers
public MpMongoController(IConfiguration configuration)
{
_configuration = configuration;
string mongoConf = _configuration.GetConnectionString("MongoConnect");
string mongoConf = _configuration.GetConnectionString("mdbConnString");
client = new MongoClient(mongoConf);
mongoDb = client.GetDatabase("MAPO");
Log.Info("Avviata classe MpMongoController");
+1 -1
View File
@@ -45,7 +45,7 @@ namespace MP.IOC.Controllers
string rawData = await GetRecipe(idxPODL);
if (!string.IsNullOrEmpty(rawData))
{
XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(rawData);
XmlDocument doc = (XmlDocument)(JsonConvert.DeserializeXmlNode(rawData) ?? new XmlDocument());
answ += doc.InnerXml;
}
return answ;
+31 -18
View File
@@ -45,7 +45,7 @@ namespace MP.IOC.Data
}
// conf mongo...
connStr = _configuration.GetConnectionString("MongoConnect");
connStr = _configuration.GetConnectionString("mdbConnString");
if (string.IsNullOrEmpty(connStr))
{
_logger.LogError("MongoController: ConnString empty!");
@@ -322,7 +322,7 @@ namespace MP.IOC.Data
// cerco in cache redis...
string redKeyArtUsed = $"{Utils.redKeyArtUsed}:{codArticolo}";
string redKeyTabCheckArt = Utils.redKeyTabCheckArt;
string rawData = redisDb.StringGet(redKeyArtUsed);
var rawData = redisDb.StringGet(redKeyArtUsed);
if (!string.IsNullOrEmpty(rawData))
{
bool.TryParse(rawData, out answ);
@@ -333,11 +333,11 @@ namespace MP.IOC.Data
try
{
// cerco in cache se ci sia la tabella con gli articoli impiegati...
string rawTable = redisDb.StringGet(redKeyTabCheckArt);
var rawTable = redisDb.StringGet(redKeyTabCheckArt);
List<string>? artList = new List<string>();
if (!string.IsNullOrEmpty(rawTable))
{
artList = JsonConvert.DeserializeObject<List<string>>(rawTable);
artList = JsonConvert.DeserializeObject<List<string>>($"{rawTable}");
}
// rileggo...
if (artList == null || artList.Count == 0)
@@ -926,7 +926,7 @@ namespace MP.IOC.Data
}
/// <summary>
/// Verifica se la macchina abbia un codice ricetta associato
/// Verifica se la macchina abbia un codice CONF ricetta associato
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
@@ -956,7 +956,7 @@ namespace MP.IOC.Data
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"MacchineRecipe | Read from {readType}: {ts.TotalMilliseconds}ms");
Log.Debug($"MacchineRecipeConf | Read from {readType}: {ts.TotalMilliseconds}ms");
return result ?? "";
}
@@ -1261,8 +1261,6 @@ namespace MP.IOC.Data
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"OdlListGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
//return await Task.FromResult(SpecDbController.OdlListGetFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate));
}
/// <summary>
@@ -1306,12 +1304,11 @@ namespace MP.IOC.Data
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> PODLDeleteRecord(PODLExpModel currRec)
public async Task<bool> POdlDeleteRecord(PODLExpModel currRec)
{
var dbResult = await SpecDbController.PODLDeleteRecord(currRec);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{Utils.redisXdlData}:*");
bool answ = await RedisFlushPatternAsync(pattern);
await POdlFlushCache();
await Task.Delay(1);
return dbResult;
}
@@ -1325,8 +1322,7 @@ namespace MP.IOC.Data
{
var dbResult = await SpecDbController.PODL_startSetup(currRec, 0, 1, 1, "");
// elimino cache redis...
RedisValue pattern = new RedisValue($"{Utils.redisXdlData}:*");
bool answ = await RedisFlushPatternAsync(pattern);
await POdlFlushCache();
await Task.Delay(1);
return dbResult;
}
@@ -1475,9 +1471,7 @@ namespace MP.IOC.Data
{
var dbResult = await SpecDbController.PODLUpdateRecord(currRec);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{Utils.redisXdlData}:*");
bool answ = await RedisFlushPatternAsync(pattern);
await Task.Delay(1);
await POdlFlushCache();
return dbResult;
}
@@ -1508,6 +1502,10 @@ namespace MP.IOC.Data
{
bool answ = false;
answ = await mongoController.RecipeSetByPODL(currRecord);
if (answ)
{
await POdlFlushCache();
}
return answ;
}
@@ -1615,14 +1613,14 @@ namespace MP.IOC.Data
public KeyValuePair<string, string>[] RedisGetHash(RedisKey redKey)
{
HashEntry[] rawData = redisDb.HashGetAll(redKey);
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>(x.Name, x.Value)).ToArray();
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>($"{x.Name}", $"{x.Value}")).ToArray();
return result;
}
public async Task<KeyValuePair<string, string>[]> RedisGetHashAsync(string redKey)
{
HashEntry[] rawData = await redisDb.HashGetAllAsync(redKey);
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>(x.Name, x.Value)).ToArray();
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>($"{x.Name}", $"{x.Value}")).ToArray();
return result;
}
@@ -2153,6 +2151,21 @@ namespace MP.IOC.Data
#region Private Methods
private async Task<bool> POdlFlushCache()
{
bool answ = false;
RedisValue pattern = new RedisValue($"{Utils.redisXdlData}:*");
answ = await RedisFlushPatternAsync(pattern);
pattern = new RedisValue($"{Utils.redisPOdlByOdl}:*");
answ = await RedisFlushPatternAsync(pattern);
pattern = new RedisValue($"{Utils.redisPOdlByPOdl}:*");
answ = await RedisFlushPatternAsync(pattern);
pattern = new RedisValue($"{Utils.redisPOdlList}:*");
answ = await RedisFlushPatternAsync(pattern);
return answ;
}
private async Task resetCacheArticoli()
{
RedisValue pattern = new RedisValue($"{Utils.redisArtByDossier}:*");
+2
View File
@@ -14,6 +14,8 @@
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS04.pubxml.user" />
<None Include="Properties\PublishProfiles\IISProfile.pubxml.user" />
<None Include="wwwroot\images\LogoBlu.svg" />
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2304.417</h4>
<h4>Versione: 6.16.2304.419</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.417
6.16.2304.419
+3 -3
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.417</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>
<version>6.16.2304.419</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>
</item>
+16
View File
@@ -0,0 +1,16 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"CodApp": "MP.IOC",
"ConnectionStrings": {
"Mp.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro;User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.IOC;",
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"mdbConnString": "mongodb://localhost:27017"
}
}
+2 -2
View File
@@ -8,9 +8,9 @@
"AllowedHosts": "*",
"CodApp": "MP.IOC",
"ConnectionStrings": {
"Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.IOC;",
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"MongoConnect": "mongodb://W2019-MONGODB:27017"
"mdbConnString": "mongodb://W2019-MONGODB:27017"
}
}
+2 -2
View File
@@ -21,9 +21,9 @@ Set-Content -Path $FileVers -Value $currRelNum
# replace x manifest
$manData = Get-Content $FileManIn
$manData = $manData -replace "1.0.0.0", $currRelNum
$manData = $manData -replace "{{DIRNAME}}", "MP-SPEC"
$manData = $manData -replace "{{DIRNAME}}", "MP-IOC"
$manData = $manData -replace "{{BRANCHNAME}}", "stable/LAST"
$manData = $manData -replace "{{PACKNAME}}", "MP.SPEC"
$manData = $manData -replace "{{PACKNAME}}", "MP.IOC"
Set-Content -Path $FileManOut -Value $manData
# replace x ChangeLog
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2304.417</Version>
<Version>6.16.2304.419</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MON MAPO</i>
<h4>Versione: 6.16.2304.417</h4>
<h4>Versione: 6.16.2304.419</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.417
6.16.2304.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.417</version>
<version>6.16.2304.419</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
-60
View File
@@ -22,63 +22,3 @@
</div>
</div>
@code {
//[CascadingParameter]
//private Task<AuthenticationState> 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()
{
userName = "N.A.";
await Task.Delay(1);
#if false
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
}
else
{
userName = "N.A.";
}
#endif
}
}
@* // 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*@
+68
View File
@@ -0,0 +1,68 @@
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks;
namespace MP.Prog.Components
{
public partial class CmpTop
{
#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 forceReload();
}
#endregion Protected Methods
#region Private Fields
private string userName = "";
#endregion Private Fields
#region Private Properties
private string PageIcon { get; set; }
private string PageName { get; set; }
[CascadingParameter(Name = "ShowSearch")]
private bool ShowSearch { get; set; }
#endregion Private Properties
#region Private Methods
private async Task forceReload()
{
userName = "N.A.";
await Task.Delay(1);
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>6.16.2304.0417</Version>
<Version>6.16.2304.0419</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.16.2304.0417</h4>
<h4>Versione: 6.16.2304.0419</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.0417
6.16.2304.0419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.0417</version>
<version>6.16.2304.0419</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+31 -30
View File
@@ -6,6 +6,7 @@ using MP.Data.MgModels;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
using System.Data;
using System.Diagnostics;
namespace MP.SPEC.Data
@@ -43,7 +44,7 @@ namespace MP.SPEC.Data
}
// conf mongo...
connStr = _configuration.GetConnectionString("MongoConnect");
connStr = _configuration.GetConnectionString("mdbConnString");
if (string.IsNullOrEmpty(connStr))
{
_logger.LogError("MongoController: ConnString empty!");
@@ -695,32 +696,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco setup dei tag conf correnti
/// </summary>
/// <returns></returns>
public Task<Dictionary<string, List<TagData>>> getAllTags()
{
return Task.FromResult(currTagConf);
}
/// <summary>
/// restituisce il valore da REDIS associato al tag richeisto
/// </summary>
/// <param name="redKey">Chiave in cui cercare il valore</param>
/// <returns></returns>
public string getTagConf(string redKey)
{
string outVal = "";
// cerco in REDIS la conf x l'IOB
var rawData = redisDb.StringGet(redKey);
if (!string.IsNullOrEmpty(rawData))
{
outVal = $"{rawData}";
}
return outVal;
}
/// <summary>
/// Init ricetta
/// </summary>
@@ -1066,7 +1041,7 @@ namespace MP.SPEC.Data
result = dbController.OdlListAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListOdlAll | Read from {readType}: {ts.TotalMilliseconds}ms");
Log.Debug($"OdlListAll | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
@@ -1214,7 +1189,7 @@ namespace MP.SPEC.Data
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
Log.Trace($"POdlGetByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
}
else
{
@@ -1261,7 +1236,7 @@ namespace MP.SPEC.Data
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
Log.Trace($"POdlGetByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
}
else
{
@@ -1487,6 +1462,32 @@ namespace MP.SPEC.Data
return dbController.OdlStart(IdxOdl);
}
/// <summary>
/// restituisce il valore da REDIS associato al tag richeisto
/// </summary>
/// <param name="redKey">Chiave in cui cercare il valore</param>
/// <returns></returns>
public string TagConfGetKey(string redKey)
{
string outVal = "";
// cerco in REDIS la conf x l'IOB
var rawData = redisDb.StringGet(redKey);
if (!string.IsNullOrEmpty(rawData))
{
outVal = $"{rawData}";
}
return outVal;
}
/// <summary>
/// Elenco setup dei tag conf correnti
/// </summary>
/// <returns></returns>
public Task<Dictionary<string, List<TagData>>> TagsGetAll()
{
return Task.FromResult(currTagConf);
}
/// <summary>
/// Esegue traduzione dato vocabolario da Lingua + Lemma
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2304.417</Version>
<Version>6.16.2304.419</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2304.417</h4>
<h4>Versione: 6.16.2304.419</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2304.417
6.16.2304.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2304.417</version>
<version>6.16.2304.419</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>
+1 -1
View File
@@ -12,7 +12,7 @@
"Mp.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"MongoConnect": "mongodb://W2019-MONGODB:27017"
"mdbConnString": "mongodb://W2019-MONGODB:27017"
},
"ServerConf": {
"maxAge": "2000",