Merge branch 'Release/UploadLiman02'
This commit is contained in:
@@ -114,8 +114,9 @@ namespace MP.FileData.Controllers
|
||||
/// <param name="searchPattern">pattern di ricerca (*.*)</param>
|
||||
/// <param name="forceTag">Forza il controllo dei Tags</param>
|
||||
/// <param name="currRule">Regole di ricerca applicate</param>
|
||||
/// <param name="UserName">Utente connesso x approvazione</param>
|
||||
/// <returns></returns>
|
||||
public int CheckFileArchived(string idxMacchina, string path, int numDayPre, string searchPattern, bool forceTag, SearchRules currRule)
|
||||
public int CheckFileArchived(string idxMacchina, string path, int numDayPre, string searchPattern, bool forceTag, SearchRules currRule, string UserName)
|
||||
{
|
||||
Log.Info($"CheckFileArchived S00 | macchina: {idxMacchina} | path: {path} | pattern: {searchPattern} | # ExcludedFileExt: {currRule.ExcludedFileExt.Count()}");
|
||||
int checkDone = 0;
|
||||
@@ -138,13 +139,27 @@ namespace MP.FileData.Controllers
|
||||
{
|
||||
fileList = fileListRaw.ToList();
|
||||
}
|
||||
Log.Trace($"CheckFileArchived S01 | file trovati: {fileList.Count()}");
|
||||
Log.Debug($"CheckFileArchived S01 | file trovati: {fileList.Count()}");
|
||||
List<FileInfo> fileNew = new List<FileInfo>();
|
||||
List<FileModel> fileChecked = new List<FileModel>();
|
||||
List<FileModel> fileMod = new List<FileModel>();
|
||||
|
||||
// recupera elenco file nel DB
|
||||
var archivedFile = FileGetByPath(path, true);
|
||||
List<FileModel> archivedFile = new List<FileModel>();
|
||||
List<FileModel> foundFile = FileGetByPath(path, true);
|
||||
// rimuovo eventuali file con estensioni escluse...
|
||||
foreach (var fRec in foundFile)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(fRec.Extension) && currRule.ExcludedFileExt.Contains(fRec.Extension))
|
||||
{
|
||||
Log.Trace($"CheckFileArchived S01.B: escluso {fRec.Name} | estensione {fRec.Extension}");
|
||||
}
|
||||
else
|
||||
{
|
||||
archivedFile.Add(fRec);
|
||||
}
|
||||
}
|
||||
Log.Debug($"CheckFileArchived S01.C | Recuperati {archivedFile.Count()} da DB per confronto");
|
||||
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
|
||||
{
|
||||
// verifica i file
|
||||
@@ -159,9 +174,9 @@ namespace MP.FileData.Controllers
|
||||
{
|
||||
// cerca nel DB...
|
||||
FileModel currRecord = archivedFile
|
||||
.Where(x => x.Active && x.Path == file.FullName)
|
||||
.OrderByDescending(y => y.Rev)
|
||||
.FirstOrDefault();
|
||||
.Where(x => x.Active && x.Path == file.FullName)
|
||||
.OrderByDescending(y => y.Rev)
|
||||
.FirstOrDefault();
|
||||
// se NON trova lo crea
|
||||
if (currRecord == null)
|
||||
{
|
||||
@@ -198,7 +213,7 @@ namespace MP.FileData.Controllers
|
||||
if (fileNew != null && fileNew.Count > 0)
|
||||
{
|
||||
checkDone += fileNew.Count;
|
||||
FileInsert(idxMacchina, path, fileNew, 0, currRule);
|
||||
FileInsert(idxMacchina, path, fileNew, UserName, 0, currRule);
|
||||
Log.Trace($"CheckFileArchived S03 | insert {fileNew.Count} files");
|
||||
}
|
||||
// aggiorno i file modificati
|
||||
@@ -374,10 +389,11 @@ namespace MP.FileData.Controllers
|
||||
/// <param name="idxMacchina">Macchina</param>
|
||||
/// <param name="basePath">Path base macchina</param>
|
||||
/// <param name="newFiles">Elenco files</param>
|
||||
/// <param name="UserName">Utente che ha approvato la modifica, "" = NON confermata/eliminabile</param>
|
||||
/// <param name="rev">rev da usare x creazione</param>
|
||||
/// <param name="currRule">Configuraizone ricerca</param>
|
||||
/// <returns></returns>
|
||||
public bool FileInsert(string idxMacchina, string basePath, List<FileInfo> newFiles, int rev, SearchRules currRule)
|
||||
public bool FileInsert(string idxMacchina, string basePath, List<FileInfo> newFiles, string UserName, int rev, SearchRules currRule)
|
||||
{
|
||||
// fare: lettura conf x macchina
|
||||
Log.Info($"FileInsert S01 per macchina {idxMacchina}: {newFiles.Count} files da valutare");
|
||||
@@ -389,13 +405,14 @@ namespace MP.FileData.Controllers
|
||||
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
|
||||
{
|
||||
// converto
|
||||
List<DatabaseModels.FileModel> newRec = newFiles.Select(o => new DatabaseModels.FileModel()
|
||||
List<FileModel> newRec = newFiles.Select(o => new FileModel()
|
||||
{
|
||||
Active = true,
|
||||
DiskStatus = FileState.Ok,
|
||||
IdxMacchina = idxMacchina,
|
||||
LastCheck = adesso,
|
||||
LastMod = o.LastWriteTime,
|
||||
UserAppr = UserName,
|
||||
MimeType = o.Extension,
|
||||
Name = o.Name,
|
||||
Path = o.FullName,
|
||||
@@ -427,15 +444,15 @@ namespace MP.FileData.Controllers
|
||||
// cerco codice tag da configurazione
|
||||
if (currRule.Mode == SearchMode.StringOnFile)
|
||||
{
|
||||
Tags = TagsUtils.searchProgComment(fileName, item.FileStringContent, currRule);
|
||||
Tags = TagsUtils.SearchProgComment(fileName, item.FileStringContent, currRule);
|
||||
}
|
||||
else if (currRule.Mode == SearchMode.TagListed)
|
||||
{
|
||||
Tags = TagsUtils.searchTagListed(fileName, item.FileStringContent, currRule);
|
||||
Tags = TagsUtils.SearchTagListed(fileName, item.FileStringContent, currRule);
|
||||
}
|
||||
else
|
||||
{
|
||||
Tags = TagsUtils.searchPathName(item.Path, basePath, currRule);
|
||||
Tags = TagsUtils.SearchPathName(item.Path, basePath, currRule);
|
||||
}
|
||||
|
||||
foreach (var tag in Tags)
|
||||
@@ -479,7 +496,13 @@ namespace MP.FileData.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool FileModApprove(FileModel currFile)
|
||||
/// <summary>
|
||||
/// Approvazione modifica File
|
||||
/// </summary>
|
||||
/// <param name="currFile"></param>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
public bool FileModApprove(FileModel currFile, string UserName)
|
||||
{
|
||||
bool done = false;
|
||||
// recupero file regole json da macchina..
|
||||
@@ -512,7 +535,7 @@ namespace MP.FileData.Controllers
|
||||
if (currRule.Name != "ND")
|
||||
{
|
||||
// inserisco come REVISIONE
|
||||
FileInsert(currFile.IdxMacchina, currMacchina.BasePath, listUpdate, currFile.Rev + 1, currRule);
|
||||
FileInsert(currFile.IdxMacchina, currMacchina.BasePath, listUpdate, UserName, currFile.Rev + 1, currRule);
|
||||
|
||||
// archivio vecchio file
|
||||
currFile.Active = false;
|
||||
@@ -594,15 +617,15 @@ namespace MP.FileData.Controllers
|
||||
// cerco codice tag da configurazione
|
||||
if (currRule.Mode == SearchMode.StringOnFile)
|
||||
{
|
||||
Tags = TagsUtils.searchProgComment(fileName, item.FileStringContent, currRule);
|
||||
Tags = TagsUtils.SearchProgComment(fileName, item.FileStringContent, currRule);
|
||||
}
|
||||
else if (currRule.Mode == SearchMode.TagListed)
|
||||
{
|
||||
Tags = TagsUtils.searchTagListed(fileName, item.FileStringContent, currRule);
|
||||
Tags = TagsUtils.SearchTagListed(fileName, item.FileStringContent, currRule);
|
||||
}
|
||||
else
|
||||
{
|
||||
Tags = TagsUtils.searchPathName(item.Path, basePath, currRule);
|
||||
Tags = TagsUtils.SearchPathName(item.Path, basePath, currRule);
|
||||
}
|
||||
|
||||
foreach (var tag in Tags)
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace MP.FileData.DatabaseModels
|
||||
public string Name { get; set; } = "";
|
||||
public int Rev { get; set; } = 0;
|
||||
public DateTime LastMod { get; set; }
|
||||
public string UserAppr { get; set; } = "";
|
||||
public long Size { get; set; } = 0;
|
||||
public string Path { get; set; } = "";
|
||||
public string MimeType { get; set; } = "";
|
||||
@@ -48,7 +49,22 @@ namespace MP.FileData.DatabaseModels
|
||||
set
|
||||
{
|
||||
// serializzo a byte
|
||||
FileContent = Encoding.ASCII.GetBytes(value);
|
||||
//FileContent = Encoding.ASCII.GetBytes(value);
|
||||
FileContent = Encoding.UTF8.GetBytes(value);
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string Extension
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if(!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
int sPos = Name.LastIndexOf('.');
|
||||
answ = Name.Substring(sPos);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
public class MeasureUtils
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static readonly string[] SizeSuffixes = { "b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb" };
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calcola dimensione file automaticamwente secondo dimensione
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="decimalPlaces"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static string SizeSuffix(Int64 value, int decimalPlaces = 1)
|
||||
{
|
||||
if (decimalPlaces < 0) { throw new ArgumentOutOfRangeException("decimalPlaces"); }
|
||||
if (value < 0) { return "-" + SizeSuffix(-value, decimalPlaces); }
|
||||
if (value == 0) { return string.Format("{0:n" + decimalPlaces + "} bytes", 0); }
|
||||
|
||||
// mag is 0 for bytes, 1 for KB, 2, for MB, etc.
|
||||
int mag = (int)Math.Log(value, 1024);
|
||||
|
||||
// 1L << (mag * 10) == 2 ^ (10 * mag) [i.e. the number of bytes in the unit
|
||||
// corresponding to mag]
|
||||
decimal adjustedSize = (decimal)value / (1L << (mag * 10));
|
||||
|
||||
// make adjustment when the value is large enough that it would round up to 1000 or more
|
||||
if (Math.Round(adjustedSize, decimalPlaces) >= 1000)
|
||||
{
|
||||
mag += 1;
|
||||
adjustedSize /= 1024;
|
||||
}
|
||||
|
||||
return string.Format("{0:n" + decimalPlaces + "} {1}",
|
||||
adjustedSize,
|
||||
SizeSuffixes[mag]);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MP.FileData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_ProgContext))]
|
||||
[Migration("20241022090211_AddUserAppr")]
|
||||
partial class AddUserAppr
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("ProductVersion", "6.0.33")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.Property<int>("FilesFileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TagsTagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("FilesFileId", "TagsTagId");
|
||||
|
||||
b.HasIndex("TagsTagId");
|
||||
|
||||
b.ToTable("FileModelTagModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.ArchMaccModel", b =>
|
||||
{
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("BasePath")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImgUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Nome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RuleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ShowOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdxMacchina");
|
||||
|
||||
b.ToTable("Macchine");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
IdxMacchina = "0",
|
||||
BasePath = "",
|
||||
Descrizione = "--- Tutte ---",
|
||||
ImgUrl = "",
|
||||
Nome = "--- Tutte ---",
|
||||
Note = "",
|
||||
RuleName = "0",
|
||||
ShowOrder = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.Property<int>("FileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("FileId"), 1L, 1);
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("DiskStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("FileContent")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("LastCheck")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("LastMod")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("MD5")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Rev")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("UserAppr")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
b.HasKey("FileId");
|
||||
|
||||
b.HasIndex("IdxMacchina", "Active", "DiskStatus");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.TagModel", b =>
|
||||
{
|
||||
b.Property<string>("TagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("TagId");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.FileModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("FilesFileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MP.FileData.DatabaseModels.TagModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsTagId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.ArchMaccModel", "Macchina")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdxMacchina");
|
||||
|
||||
b.Navigation("Macchina");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
public partial class AddUserAppr : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UserAppr",
|
||||
table: "Files",
|
||||
type: "nvarchar(250)",
|
||||
maxLength: 250,
|
||||
nullable: false,
|
||||
defaultValueSql: "('')");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserAppr",
|
||||
table: "Files");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_ProgContext))]
|
||||
@@ -15,10 +17,11 @@ namespace MP.FileData.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.9")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("ProductVersion", "6.0.33")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
@@ -35,57 +38,7 @@ namespace MP.FileData.Migrations
|
||||
b.ToTable("FileModelTagModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.Property<int>("FileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("DiskStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("FileContent")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("LastCheck")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("LastMod")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("MD5")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Rev")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("FileId");
|
||||
|
||||
b.HasIndex("IdxMacchina", "Active", "DiskStatus");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.MacchinaModel", b =>
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.ArchMaccModel", b =>
|
||||
{
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
@@ -129,6 +82,64 @@ namespace MP.FileData.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.Property<int>("FileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("FileId"), 1L, 1);
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("DiskStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("FileContent")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("LastCheck")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("LastMod")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("MD5")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Rev")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("UserAppr")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
b.HasKey("FileId");
|
||||
|
||||
b.HasIndex("IdxMacchina", "Active", "DiskStatus");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.TagModel", b =>
|
||||
{
|
||||
b.Property<string>("TagId")
|
||||
@@ -156,7 +167,7 @@ namespace MP.FileData.Migrations
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.MacchinaModel", "Macchina")
|
||||
b.HasOne("MP.FileData.DatabaseModels.ArchMaccModel", "Macchina")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdxMacchina");
|
||||
|
||||
|
||||
@@ -93,7 +93,16 @@ namespace MP.FileData
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
//
|
||||
// fix valori default
|
||||
modelBuilder.Entity<FileModel>(entity =>
|
||||
{
|
||||
entity.Property(e => e.UserAppr)
|
||||
.HasMaxLength(250)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Seed();
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace MP.FileData
|
||||
/// <param name="filePath">Nome del file (path completo)</param>
|
||||
/// <param name="currRule">Parametri analisi</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> searchPathName(string filePath, string basePath, SearchRules currRule)
|
||||
public static List<string> SearchPathName(string filePath, string basePath, SearchRules currRule)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
@@ -74,7 +74,7 @@ namespace MP.FileData
|
||||
// se nullo --> segnalo!
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
Log.Warn($"searchPathName Attenzione Tag non trovati | {filePath} | basePath: {basePath}");
|
||||
Log.Warn($"SearchPathName Attenzione Tag non trovati | {filePath} | basePath: {basePath}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace MP.FileData
|
||||
/// <param name="fileContent">Contenuto del file da analizzare</param>
|
||||
/// <param name="currRule">Parametri analisi</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> searchProgComment(string fileName, string fileContent, SearchRules currRule)
|
||||
public static List<string> SearchProgComment(string fileName, string fileContent, SearchRules currRule)
|
||||
{
|
||||
// verifico se trimmare contenuto file
|
||||
if (fileContent.Length > currRule.MaxChar2Search && currRule.MaxChar2Search > 0)
|
||||
@@ -148,7 +148,7 @@ namespace MP.FileData
|
||||
// se nullo --> segnalo!
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
Log.Warn($"searchProgComment Attenzione Tag non trovati | {fileName} | pattern: {pattern}");
|
||||
Log.Warn($"SearchProgComment Attenzione Tag non trovati | {fileName} | pattern: {pattern}");
|
||||
//Log.Trace($"{fileName}:{Environment.NewLine}{fileContent}");
|
||||
}
|
||||
return answ;
|
||||
@@ -164,7 +164,7 @@ namespace MP.FileData
|
||||
/// <param name="fileContent">Contenuto del file da analizzare</param>
|
||||
/// <param name="currRule">Parametri analisi</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> searchTagListed(string fileName, string fileContent, SearchRules currRule)
|
||||
public static List<string> SearchTagListed(string fileName, string fileContent, SearchRules currRule)
|
||||
{
|
||||
// verifico se trimmare contenuto file
|
||||
if (fileContent.Length > currRule.MaxChar2Search && currRule.MaxChar2Search > 0)
|
||||
@@ -183,7 +183,7 @@ namespace MP.FileData
|
||||
{
|
||||
foreach (var row in fileRows)
|
||||
{
|
||||
if (row.StartsWith(tag2check))
|
||||
if (row.StartsWith(tag2check) || row.Contains(tag2check))
|
||||
{
|
||||
answ.Add(row.Trim());
|
||||
break;
|
||||
@@ -195,8 +195,7 @@ namespace MP.FileData
|
||||
// se nullo --> segnalo!
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
Log.Warn($"searchTagListed Attenzione Tag non trovati | {fileName} | tags cercati: {currRule.Tag2Collect.Count}");
|
||||
//Log.Trace($"{Environment.NewLine}{fileContent}");
|
||||
Log.Warn($"SearchTagListed Attenzione Tag non trovati | {fileName} | tags cercati: {currRule.Tag2Collect.Count}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
+14
-10
@@ -1,10 +1,14 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
@* <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> *@
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<LoadingData></LoadingData>
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -26,11 +26,14 @@ namespace MP.Prog.Components
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; }
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
protected bool showProgress { get; set; } = false;
|
||||
@@ -39,42 +42,6 @@ namespace MP.Prog.Components
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ArchiveCheck(int maxHour)
|
||||
{
|
||||
showProgress = true;
|
||||
percLoading = 0;
|
||||
await verificaTutte(maxHour);
|
||||
|
||||
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
|
||||
}
|
||||
|
||||
protected async Task ArchiveSingleCheck(string idxMacchina, int maxHour)
|
||||
{
|
||||
showProgress = true;
|
||||
percLoading = 0;
|
||||
await verificaSingola(idxMacchina, maxHour, 2);
|
||||
|
||||
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
|
||||
}
|
||||
|
||||
protected async Task ClearMessage()
|
||||
{
|
||||
await Task.Delay(10);
|
||||
setupMessages = new List<string>();
|
||||
}
|
||||
|
||||
protected async Task SelEdit(string idxMacc)
|
||||
{
|
||||
// recupero macchina e mando a edit!
|
||||
SelRecord = await FDService.ArchMaccGetByKey(idxMacc);
|
||||
}
|
||||
|
||||
protected async void ResetSel()
|
||||
{
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void AddNew()
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
@@ -89,25 +56,51 @@ namespace MP.Prog.Components
|
||||
Note = ""
|
||||
};
|
||||
}
|
||||
|
||||
protected async Task ArchiveCheck(int maxHour)
|
||||
{
|
||||
showProgress = true;
|
||||
percLoading = 0;
|
||||
await VerificaTutte(maxHour);
|
||||
|
||||
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
|
||||
}
|
||||
|
||||
protected async Task ArchiveSingleCheck(string idxMacchina, int maxHour)
|
||||
{
|
||||
showProgress = true;
|
||||
percLoading = 0;
|
||||
await VerificaSingola(idxMacchina, maxHour, 2);
|
||||
|
||||
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
|
||||
}
|
||||
|
||||
protected void ClearMessage()
|
||||
{
|
||||
setupMessages = new List<string>();
|
||||
}
|
||||
|
||||
protected async Task ForceCheck(int maxHour)
|
||||
{
|
||||
ListRecords = null;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
setupMessages.Add("Inizio Analisi Archivio...");
|
||||
await InvokeAsync(StateHasChanged);
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
await ArchiveCheck(maxHour);
|
||||
await ClearMessage();
|
||||
await Task.Delay(400);
|
||||
ClearMessage();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ForceCheckMacchina(string idxMacchina)
|
||||
{
|
||||
ListRecords = null;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
setupMessages.Add($"Inizio Analisi Archivio | Archivio {idxMacchina}");
|
||||
await InvokeAsync(StateHasChanged);
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
await ArchiveSingleCheck(idxMacchina, 0);
|
||||
await ClearMessage();
|
||||
await Task.Delay(400);
|
||||
ClearMessage();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -131,16 +124,25 @@ namespace MP.Prog.Components
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected async void ResetSel()
|
||||
{
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SelEdit(string idxMacc)
|
||||
{
|
||||
// recupero macchina e mando a edit!
|
||||
SelRecord = await FDService.ArchMaccGetByKey(idxMacc);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private List<ArchiveStatusDTO> ListRecords;
|
||||
private ArchMaccModel? SelRecord { get; set; } = null;
|
||||
|
||||
private int numChecks = 0;
|
||||
|
||||
private Stopwatch sw = new Stopwatch();
|
||||
private int totalCount = 0;
|
||||
|
||||
@@ -148,35 +150,35 @@ namespace MP.Prog.Components
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private ArchMaccModel? SelRecord { get; set; } = null;
|
||||
private List<string> setupMessages { get; set; } = new List<string>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task verificaSingola(string idxMacchina, int numDays, int numMacchine)
|
||||
private async Task VerificaSingola(string idxMacchina, int numDays, int numMacchine)
|
||||
{
|
||||
sw.Restart();
|
||||
// recupero elenco macchine
|
||||
percLoading += 100 / numMacchine;
|
||||
numChecks = await FDService.updateMachineArchive(idxMacchina, numDays, true, false);
|
||||
numChecks = await FDService.UpdateMachineArchive(idxMacchina, numDays, true, false, MServ.UserName);
|
||||
await Task.Delay(1);
|
||||
setupMessages.Add($"{idxMacchina}: {numChecks} files");
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(1);
|
||||
sw.Stop();
|
||||
var elapsTime = sw.Elapsed;
|
||||
Log.Trace($"verificaSingola | idxMacchina: {idxMacchina} | {elapsTime.TotalMilliseconds}ms");
|
||||
Log.Info($"VerificaSingola | idxMacchina: {idxMacchina} | {sw.ElapsedMilliseconds:N0}ms");
|
||||
}
|
||||
|
||||
private async Task verificaTutte(int numDays)
|
||||
private async Task VerificaTutte(int numDays)
|
||||
{
|
||||
// recupero elenco macchine
|
||||
var listaMacchine = await FDService.ArchMaccGetAll();
|
||||
int numMacchine = listaMacchine.Count();
|
||||
foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList())
|
||||
{
|
||||
await verificaSingola(item.IdxMacchina, numDays, numMacchine);
|
||||
await VerificaSingola(item.IdxMacchina, numDays, numMacchine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between pt-3">
|
||||
<div class="px-2">
|
||||
<i class="fas fa-user-alt"></i> <b>@UserName</b>
|
||||
</div>
|
||||
<div class="px-2 d-none d-lg-block text-center h4 text-truncate">
|
||||
<span class="@PageIcon" aria-hidden="true"></span> @PageName
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//using MP.Prog.Components;
|
||||
//using System.Security.Claims;
|
||||
|
||||
//using Microsoft.AspNetCore.Components.Authorization;
|
||||
using MP.Prog.Data;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
|
||||
namespace MP.Prog.Components
|
||||
{
|
||||
@@ -14,15 +17,13 @@ namespace MP.Prog.Components
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMessages.EA_PageUpdated -= OnPageUpdate;
|
||||
MServ.EA_PageUpdated -= OnPageUpdate;
|
||||
}
|
||||
|
||||
//[Inject]
|
||||
//protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
public void OnPageUpdate()
|
||||
{
|
||||
PageName = AppMessages.PageName;
|
||||
PageIcon = AppMessages.PageIcon;
|
||||
PageName = MServ.PageName;
|
||||
PageIcon = MServ.PageIcon;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
@@ -34,30 +35,23 @@ namespace MP.Prog.Components
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMessages { get; set; }
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMessages.EA_PageUpdated += OnPageUpdate;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MServ.EA_PageUpdated += OnPageUpdate;
|
||||
await forceReload();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string userName = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string PageIcon { get; set; }
|
||||
@@ -67,14 +61,28 @@ namespace MP.Prog.Components
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; }
|
||||
|
||||
private string UserName
|
||||
{
|
||||
get => MServ.UserName;
|
||||
set => MServ.UserName = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
userName = "N.A.";
|
||||
await Task.Delay(1);
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
UserName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
UserName = "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -31,119 +31,13 @@
|
||||
<div class="row" style=" height: @(pHeight)em; overflow-y: scroll;">
|
||||
<div class="col-6 table-primary">
|
||||
<div class="border border-primary p-2 bg-light">
|
||||
<p style="max-width: 70em;">@((MarkupString)oldResult)</p>
|
||||
<p style="max-width: 70em;">@StrFix(oldResult)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 table-warning">
|
||||
<div class="border border-warning p-2 bg-light">
|
||||
<p style="max-width: 70em;">@((MarkupString)newResult)</p>
|
||||
<p style="max-width: 70em;">@StrFix(newResult)</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
string sepDest = "<br />";
|
||||
|
||||
protected int pHeight = 25;
|
||||
|
||||
protected string oldResult = "";
|
||||
protected string newResult = "";
|
||||
|
||||
protected string _oldText = "";
|
||||
protected string _newText = "";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> diffDone { get; set; }
|
||||
|
||||
protected int numChanges { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string oldText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _oldText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_oldText = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected string oldTextFix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _oldText.Replace(Environment.NewLine, sepDest).Replace("\n", sepDest).Replace("\r", sepDest);
|
||||
}
|
||||
}
|
||||
|
||||
protected string newTextFix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _newText.Replace(Environment.NewLine, sepDest).Replace("\n", sepDest).Replace("\r", sepDest);
|
||||
}
|
||||
}
|
||||
[Parameter]
|
||||
public string newText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _newText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_newText = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
protected void ReloadData()
|
||||
{
|
||||
numChanges = 0;
|
||||
// calcolo diff
|
||||
diff_match_patch dmp = new diff_match_patch();
|
||||
List<Diff> diff = dmp.diff_main(oldTextFix, newTextFix);
|
||||
dmp.diff_cleanupSemantic(diff);
|
||||
|
||||
// predispongo la stringa secondo l'elenco dei diff....
|
||||
StringBuilder sbNew = new StringBuilder();
|
||||
StringBuilder sbOld = new StringBuilder();
|
||||
foreach (var item in diff)
|
||||
{
|
||||
switch (item.operation)
|
||||
{
|
||||
case Operation.DELETE:
|
||||
sbOld.Append($"<span class=\"border border-success table-success\">{item.text}</span>");
|
||||
numChanges++;
|
||||
break;
|
||||
case Operation.INSERT:
|
||||
sbNew.Append($"<span class=\"border border-danger table-danger\">{item.text}</span>");
|
||||
numChanges++;
|
||||
break;
|
||||
case Operation.EQUAL:
|
||||
sbNew.Append($"<span class=\"text-dark\">{item.text}</span>");
|
||||
sbOld.Append($"<span class=\"text-dark\">{item.text}</span>");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newResult = sbNew.ToString().Trim();
|
||||
oldResult = sbOld.ToString().Trim();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await diffDone.InvokeAsync(numChanges);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
ReloadData();
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using DiffMatchPatch;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace MP.Prog.Components
|
||||
{
|
||||
public partial class DiffView
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> diffDone { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string newText
|
||||
{
|
||||
get => _newText;
|
||||
set => _newText = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string oldText
|
||||
{
|
||||
get => _oldText;
|
||||
set => _oldText = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _newText = "";
|
||||
|
||||
protected string _oldText = "";
|
||||
|
||||
protected string newResult = "";
|
||||
|
||||
protected string oldResult = "";
|
||||
|
||||
protected int pHeight = 25;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int numChanges { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
ReloadData();
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected void ReloadData()
|
||||
{
|
||||
numChanges = 0;
|
||||
// calcolo diff
|
||||
diff_match_patch dmp = new diff_match_patch();
|
||||
List<Diff> diff = dmp.diff_main(oldText, newText);
|
||||
//List<Diff> diff = dmp.diff_main(oldTextFix, newTextFix);
|
||||
dmp.diff_cleanupSemantic(diff);
|
||||
|
||||
// predispongo la stringa secondo l'elenco dei diff....
|
||||
StringBuilder sbNew = new StringBuilder();
|
||||
StringBuilder sbOld = new StringBuilder();
|
||||
foreach (var item in diff)
|
||||
{
|
||||
// se fosse testo vuoto --> metto spazio!
|
||||
if (string.IsNullOrEmpty(item.text))
|
||||
{
|
||||
item.text = " ";
|
||||
}
|
||||
switch (item.operation)
|
||||
{
|
||||
case Operation.DELETE:
|
||||
sbOld.Append($"<span class=\"border border-success table-success\">{HttpUtility.HtmlEncode(item.text)}</span>");
|
||||
numChanges++;
|
||||
break;
|
||||
|
||||
case Operation.INSERT:
|
||||
sbNew.Append($"<span class=\"border border-danger table-danger\">{HttpUtility.HtmlEncode(item.text)}</span>");
|
||||
numChanges++;
|
||||
break;
|
||||
|
||||
case Operation.EQUAL:
|
||||
sbNew.Append($"<span class=\"text-dark\">{HttpUtility.HtmlEncode(item.text)}</span>");
|
||||
sbOld.Append($"<span class=\"text-dark\">{HttpUtility.HtmlEncode(item.text)}</span>");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newResult = sbNew.ToString();
|
||||
oldResult = sbOld.ToString();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await diffDone.InvokeAsync(numChanges);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string sepDest = "<br />";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private MarkupString StrFix(string origVal)
|
||||
{
|
||||
string fixVal = origVal.Trim()
|
||||
.Replace(" ", " ")
|
||||
.Replace(Environment.NewLine, sepDest);
|
||||
//.Replace("\r", sepDest)
|
||||
//.Replace("\n", sepDest);
|
||||
return new MarkupString(fixVal);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-primary btn-lg w-100" value="Cancel" @onclick="RejectChange">Mantieni Archivio <i class="fas fa-arrow-right"></i></button>
|
||||
<button type="button" class="btn btn-primary w-100" value="Cancel" @onclick="RejectChange">Mantieni Archivio <i class="fas fa-arrow-right"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-warning btn-lg w-100" value="Cancel" @onclick="ApproveChange"><i class="fas fa-arrow-left"></i> Accetta Modifiche</button>
|
||||
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="ApproveChange"><i class="fas fa-arrow-left"></i> Accetta Modifiche</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success btn-lg w-100" value="" @onclick="ExportArchive">Sostituisci da Archivio <i class="fas fa-file-download"></i></button>
|
||||
<button type="button" class="btn btn-success w-100" value="" @onclick="ExportArchive">Sostituisci da Archivio <i class="fas fa-file-download"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
@@ -33,11 +33,11 @@
|
||||
<div class="col-2">
|
||||
</div>
|
||||
<div class="col-2 text-end">
|
||||
<button type="button" class="btn btn-light btn-lg w-100" value="Cancel" @onclick="cancelUpdate" title="Chiudi">Chiudi <i class="fas fa-window-close"></i></button>
|
||||
<button type="button" class="btn btn-light w-100" value="Cancel" @onclick="cancelUpdate" title="Chiudi">Chiudi <i class="fas fa-xmark"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body small py-1">
|
||||
<MP.Prog.Components.DiffView oldText="@_currItem.FileStringContent" newText="@(CurrFileContent(_currItem.Path))"></MP.Prog.Components.DiffView>
|
||||
<DiffView oldText="@_currItem.FileStringContent" newText="@(CurrFileContent(_currItem.Path))"></DiffView>
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,28 +12,12 @@ namespace MP.Prog.Components
|
||||
{
|
||||
public partial class FileEditor : ComponentBase
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int numDiff = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public FileModel _currItem = new FileModel();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
@@ -63,6 +47,56 @@ namespace MP.Prog.Components
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CurrFileContent(string fullPath)
|
||||
{
|
||||
string answ = "";
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
answ = File.ReadAllText(fullPath);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int numDiff = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void diffDoneHandler(int numChanges)
|
||||
{
|
||||
#if false
|
||||
numDiff = numChanges;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
//private string userName = "";
|
||||
//protected override void OnInitialized()
|
||||
//{
|
||||
// userName = MServ.UserName;
|
||||
//}
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ApproveChange()
|
||||
@@ -72,7 +106,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileApprove(_currItem);
|
||||
await FDService.FileApprove(_currItem, MServ.UserName);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -93,7 +127,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileDelete(_currItem);
|
||||
await FDService.FileDelete(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -114,9 +148,9 @@ namespace MP.Prog.Components
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.FileExport(_currItem);
|
||||
await FDService.FileExport(_currItem);
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.updateMachineArchive(_currItem.IdxMacchina, 1, false, false);
|
||||
await FDService.UpdateMachineArchive(_currItem.IdxMacchina, 1, false, false,MServ.UserName);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -132,7 +166,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileReject(_currItem);
|
||||
await FDService.FileReject(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -145,7 +179,7 @@ namespace MP.Prog.Components
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileUpdate(_currItem);
|
||||
await FDService.FileUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -155,30 +189,5 @@ namespace MP.Prog.Components
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void diffDoneHandler(int numChanges)
|
||||
{
|
||||
#if false
|
||||
numDiff = numChanges;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CurrFileContent(string fullPath)
|
||||
{
|
||||
string answ = "";
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
answ = File.ReadAllText(fullPath);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@*<h1 class="alert alert-info">Working</h1>*@
|
||||
<div class="row">
|
||||
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-5x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,7 +2,8 @@
|
||||
"ExcludedTags": [ ],
|
||||
"ExcludedFileExt": [
|
||||
".bak",
|
||||
".bck"
|
||||
".bck",
|
||||
".file"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
},
|
||||
|
||||
@@ -69,8 +69,7 @@ namespace MP.Prog.Data
|
||||
public async Task<bool> ArchivioMaccUpsert(ArchMaccModel currRec)
|
||||
{
|
||||
bool fatto = await dbController.ArchMaccUpsert(currRec);
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
|
||||
await ResetArchiveCache();
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -259,17 +258,17 @@ namespace MP.Prog.Data
|
||||
/// <summary>
|
||||
/// Aggiorna intero archivio scansionando dati x tutte le macchine che hanno un path valido
|
||||
/// </summary>
|
||||
/// <param name="numDayPre">
|
||||
/// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
|
||||
/// </param>
|
||||
/// <param name="numDayPre">Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite</param>
|
||||
/// <param name="forceTag">Indica se forzare il tag</param>
|
||||
/// <param name="UserName">Utente attivo</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> updateAllArchive(int numDayPre, bool forceTag)
|
||||
public async Task<int> UpdateAllArchive(int numDayPre, bool forceTag, string UserName)
|
||||
{
|
||||
int checkDone = 0;
|
||||
var listaMacchine = await ArchMaccGetAll();
|
||||
foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList())
|
||||
{
|
||||
checkDone += await updateMachineArchive(item.IdxMacchina, numDayPre, forceTag, false);
|
||||
checkDone += await UpdateMachineArchive(item.IdxMacchina, numDayPre, forceTag, false, UserName);
|
||||
}
|
||||
|
||||
return await Task.FromResult(checkDone);
|
||||
@@ -284,8 +283,9 @@ namespace MP.Prog.Data
|
||||
/// </param>
|
||||
/// <param name="forceTag">Forza la riverifica dei tags (x update da setup)</param>
|
||||
/// <param name="fullLog">Scrittura log verboso macchina</param>
|
||||
/// <param name="UserName">Utente attivo</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> updateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog)
|
||||
public async Task<int> UpdateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog, string UserName)
|
||||
{
|
||||
int checkDone = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
@@ -293,7 +293,7 @@ namespace MP.Prog.Data
|
||||
string ruleName = "Rule00.json";
|
||||
try
|
||||
{
|
||||
var macchina = ArchMaccGetByKey(idxMacchina).Result;
|
||||
ArchMaccModel macchina = await ArchMaccGetByKey(idxMacchina);
|
||||
if (macchina != null && !string.IsNullOrEmpty(macchina.BasePath))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(macchina.RuleName))
|
||||
@@ -345,48 +345,77 @@ namespace MP.Prog.Data
|
||||
Log.Trace($"Conf rule generato:{Environment.NewLine}{rawRule}");
|
||||
}
|
||||
}
|
||||
checkDone = dbController.CheckFileArchived(macchina.IdxMacchina, macchina.BasePath, numDayPre, "*.*", forceTag, currRule);
|
||||
checkDone = dbController.CheckFileArchived(macchina.IdxMacchina, macchina.BasePath, numDayPre, "*.*", forceTag, currRule, UserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in updateMachineArchive{Environment.NewLine}{exc}{Environment.NewLine}{exc.InnerException}");
|
||||
Log.Error($"Eccezione in UpdateMachineArchive{Environment.NewLine}{exc}{Environment.NewLine}{exc.InnerException}");
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Info($"Effettuato update archivio file MACCHINA | last {numDayPre} days | {checkDone} checked | {ts.TotalMilliseconds} ms");
|
||||
|
||||
return await Task.FromResult(checkDone);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
// restituisco conteggio
|
||||
return checkDone;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal Task FileApprove(FileModel currItem)
|
||||
/// <summary>
|
||||
/// Approvazione modifica file
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> FileApprove(FileModel currItem, string UserName)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModApprove(currItem));
|
||||
bool answ = dbController.FileModApprove(currItem, UserName);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileDelete(FileModel currItem)
|
||||
/// <summary>
|
||||
/// Eliminazione file (x rifiuto modifica)
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> FileDelete(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileDelete(currItem));
|
||||
bool answ = dbController.FileDelete(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileExport(FileModel currItem)
|
||||
internal async Task<bool> FileExport(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileExport(currItem));
|
||||
bool answ = dbController.FileExport(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileReject(FileModel currItem)
|
||||
internal async Task<bool> FileReject(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModReject(currItem));
|
||||
bool answ = dbController.FileModReject(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileUpdate(FileModel updItem)
|
||||
internal async Task<bool> FileUpdate(FileModel updItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileUpdate(updItem));
|
||||
bool answ = dbController.FileUpdate(updItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal void ResetController()
|
||||
@@ -399,6 +428,7 @@ namespace MP.Prog.Data
|
||||
#region Protected Fields
|
||||
|
||||
protected static string connStringBBM = "";
|
||||
|
||||
protected static string connStringFatt = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
@@ -411,9 +441,13 @@ namespace MP.Prog.Data
|
||||
private const string redisBaseAddr = "MP:PROG";
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<FileArchDataService> _logger;
|
||||
|
||||
private static List<ArchMaccModel> ElencoMacchine = new List<ArchMaccModel>();
|
||||
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
@@ -497,6 +531,16 @@ namespace MP.Prog.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset della cache dati ArchivioMacchine in redis
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ResetArchiveCache()
|
||||
{
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,6 @@ namespace MP.Prog.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private SelectData _fileFilter = SelectData.Init(5, 15);
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal = "";
|
||||
private bool showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated;
|
||||
@@ -30,6 +20,8 @@ namespace MP.Prog.Data
|
||||
|
||||
public event Action EA_ShowSearch;
|
||||
|
||||
public event Action EA_UserUpdated;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
@@ -106,8 +98,32 @@ namespace MP.Prog.Data
|
||||
}
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get => _userName;
|
||||
set
|
||||
{
|
||||
if (_userName != value)
|
||||
{
|
||||
_userName = value;
|
||||
ReportUserUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private SelectData _fileFilter = SelectData.Init(5, 15);
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal = "";
|
||||
private string _userName = "";
|
||||
private bool showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReportFilter()
|
||||
@@ -150,6 +166,14 @@ namespace MP.Prog.Data
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportUserUpd()
|
||||
{
|
||||
if (EA_UserUpdated != null)
|
||||
{
|
||||
EA_UserUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>6.16.2410.2116</Version>
|
||||
<Version>6.16.2410.2211</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -20,6 +20,8 @@
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2409.2607" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" />
|
||||
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.35" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.35" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.17" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
|
||||
+18
-13
@@ -1,7 +1,5 @@
|
||||
@page "/Archive"
|
||||
|
||||
@using MP.Prog.Components
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
@@ -83,7 +81,7 @@
|
||||
</div>
|
||||
@if (DeleteDialogOpen)
|
||||
{
|
||||
<MP.Prog.Components.TagSearch Title="Ricerca Tag" OnClose="@OnDialogClose"></MP.Prog.Components.TagSearch>
|
||||
<TagSearch Title="Ricerca Tag" OnClose="@OnDialogClose"></TagSearch>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -97,7 +95,7 @@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
@@ -112,9 +110,7 @@
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>File</th>
|
||||
<th>Rev</th>
|
||||
<th>Size</th>
|
||||
<th class="text-center">State</th>
|
||||
<th>Rev / State / Size</th>
|
||||
<th>Macchina</th>
|
||||
<th>Tags</th>
|
||||
<th class="text-end">Modificato</th>
|
||||
@@ -149,17 +145,26 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Rev</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@((((double)record.Size) / 1024).ToString("N2")) k</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="d-flex justify-content-xl-between">
|
||||
<div class="px-0">
|
||||
@record.Rev
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<span title="@record.DiskStatus | Ultimo controllo: @record.LastCheck.ToString("yyyy.MM.dd HH:mm:ss")">
|
||||
<span class="@(cssStatusByCod(record.DiskStatus))">
|
||||
@record.DiskStatus
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@CalcSize(record.Size)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-xl-between small">
|
||||
<div class="px-0"><i class="fas fa-user-alt"></i></div>
|
||||
<div class="px-0">@record.UserAppr</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Macchina.Nome</div>
|
||||
|
||||
+319
-313
@@ -1,254 +1,78 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.FileData;
|
||||
using MP.FileData.DatabaseModels;
|
||||
using MP.Prog.Data;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Prog.Pages
|
||||
{
|
||||
public partial class Archive : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
#region Public Properties
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private FileModel currRecord = null;
|
||||
private List<FileModel> ListRecords;
|
||||
private List<ArchMaccModel> MacList;
|
||||
private List<TagModel> TagList;
|
||||
public bool DeleteDialogOpen { get; set; }
|
||||
|
||||
#endregion Private Fields
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int FileId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.FileId == FileId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MServ.EA_SearchUpdated -= OnSeachUpdated;
|
||||
MServ.EA_FilterUpdated -= OnFilterUpdated;
|
||||
}
|
||||
|
||||
public async void OnFilterUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
SearchVal = MServ.SearchVal;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _SearchTag;
|
||||
|
||||
protected string defTag = "";
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.File_Filter.PageNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.File_Filter.PageNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.File_Filter.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.File_Filter.PageSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyActive;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyActive.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyActive = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyMod
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyMod;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyMod.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyMod = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyNoTag
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyNoTag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyNoTag.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyNoTag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.SearchVal;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.SearchVal.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.SearchVal = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.FileName;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.FileName.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.FileName = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelIdxMacc
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.IdxMacchina;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.IdxMacchina.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.IdxMacchina = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelTag
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.Tag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.Tag.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.Tag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService DataService { get; set; }
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
@@ -270,7 +94,7 @@ namespace MP.Prog.Pages
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
TagList = await DataService.TagGetFilt(SearchTag);
|
||||
TagList = await FDService.TagGetFilt(SearchTag);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -280,61 +104,6 @@ namespace MP.Prog.Pages
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool DeleteDialogOpen { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string cssActive(bool active)
|
||||
{
|
||||
string answ = active ? "text-dark" : "text-secondary textStriked";
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string cssStatusByCod(FileData.FileState currStatus)
|
||||
{
|
||||
string answ = "badge";
|
||||
switch (currStatus)
|
||||
{
|
||||
case FileData.FileState.Changed:
|
||||
answ += " badge-warning";
|
||||
break;
|
||||
|
||||
case FileData.FileState.Deleted:
|
||||
answ += " badge-danger";
|
||||
break;
|
||||
|
||||
case FileData.FileState.Ok:
|
||||
answ += " badge-success";
|
||||
break;
|
||||
|
||||
case FileData.FileState.ND:
|
||||
default:
|
||||
answ += " badge-light";
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task OnDialogClose(bool accepted)
|
||||
{
|
||||
DeleteDialogOpen = false;
|
||||
currPage = 1;
|
||||
await AsyncReload();
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
private void OpenDialog()
|
||||
{
|
||||
DeleteDialogOpen = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task AsyncReload()
|
||||
@@ -346,6 +115,16 @@ namespace MP.Prog.Pages
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce size calcolata
|
||||
/// </summary>
|
||||
/// <param name="origSize"></param>
|
||||
/// <returns></returns>
|
||||
protected string CalcSize(long origSize)
|
||||
{
|
||||
return MeasureUtils.SizeSuffix(origSize, 1);
|
||||
}
|
||||
|
||||
protected async Task Edit(FileModel selRecord)
|
||||
{
|
||||
if (!selRecord.Active)
|
||||
@@ -355,7 +134,7 @@ namespace MP.Prog.Pages
|
||||
}
|
||||
|
||||
// rileggo dal DB il record corrente...
|
||||
currRecord = await DataService.FileGetByKey(selRecord.FileId);
|
||||
currRecord = await FDService.FileGetByKey(selRecord.FileId);
|
||||
}
|
||||
|
||||
protected async Task FilterPath(string searchVal)
|
||||
@@ -371,7 +150,7 @@ namespace MP.Prog.Pages
|
||||
{
|
||||
SelTag = searchVal;
|
||||
currPage = 1;
|
||||
await ReloadAllData();
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
@@ -381,8 +160,8 @@ namespace MP.Prog.Pages
|
||||
ListRecords = null;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
//AppMService.File_Filter = SelectData.Init(5, 10);
|
||||
var numCheck = await DataService.updateAllArchive(numDays, false);
|
||||
//MServ.File_Filter = SelectData.Init(5, 10);
|
||||
var numCheck = await FDService.UpdateAllArchive(numDays, false, MServ.UserName);
|
||||
await ReloadAllData();
|
||||
await Task.Delay(1);
|
||||
await RefreshDisplayLoading();
|
||||
@@ -391,11 +170,11 @@ namespace MP.Prog.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SearchTag = defTag;
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Archivio File Programmi";
|
||||
AppMService.PageIcon = "fas fa-folder pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
AppMService.EA_FilterUpdated += OnFilterUpdated;
|
||||
MServ.ShowSearch = true;
|
||||
MServ.PageName = "Archivio File Programmi";
|
||||
MServ.PageIcon = "fas fa-folder pr-2";
|
||||
MServ.EA_SearchUpdated += OnSeachUpdated;
|
||||
MServ.EA_FilterUpdated += OnFilterUpdated;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -423,10 +202,10 @@ namespace MP.Prog.Pages
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
MacList = await DataService.ArchMaccGetAll();
|
||||
MacList = await FDService.ArchMaccGetAll();
|
||||
SelIdxMacc = "0";
|
||||
SearchTag = defTag;
|
||||
TagList = await DataService.TagGetFilt(SearchTag);
|
||||
TagList = await FDService.TagGetFilt(SearchTag);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -435,18 +214,18 @@ namespace MP.Prog.Pages
|
||||
isLoading = true;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
totalCount = await DataService.FileCountFilt(AppMService.File_Filter);
|
||||
//SearchRecords = await FDService.FileGetFilt(AppMService.File_Filter);
|
||||
totalCount = await FDService.FileCountFilt(MServ.File_Filter);
|
||||
//SearchRecords = await FDService.FileGetFilt(MServ.File_Filter);
|
||||
//// faccio paginazione SOLO NELLA DECINA attuale... (quindi non tutte le pagine ma solo subset)
|
||||
//ListRecords = SearchRecords.Skip(numRecord * (currPage % 10 - 1)).Take(numRecord).ToList();
|
||||
|
||||
ListRecords = await DataService.FileGetFilt(AppMService.File_Filter);
|
||||
ListRecords = await FDService.FileGetFilt(MServ.File_Filter);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
FDService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
@@ -455,8 +234,8 @@ namespace MP.Prog.Pages
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
currPage = 1;
|
||||
AppMService.File_Filter = SelectData.Init(5, 10);
|
||||
AppMService.SearchVal = "";
|
||||
MServ.File_Filter = SelectData.Init(5, 10);
|
||||
MServ.SearchVal = "";
|
||||
SearchTag = defTag;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
@@ -493,7 +272,7 @@ namespace MP.Prog.Pages
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
DataService.ResetController();
|
||||
FDService.ResetController();
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
@@ -501,41 +280,268 @@ namespace MP.Prog.Pages
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
#region Private Fields
|
||||
|
||||
public string checkSelect(int FileId)
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private FileModel currRecord = null;
|
||||
private List<FileModel> ListRecords;
|
||||
private List<ArchMaccModel> MacList;
|
||||
private List<TagModel> TagList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
get
|
||||
{
|
||||
try
|
||||
return MServ.File_Filter.PageNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
MServ.File_Filter.PageNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return MServ.File_Filter.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
MServ.File_Filter.PageSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = (currRecord.FileId == FileId) ? "table-info" : "";
|
||||
answ = MServ.File_Filter.OnlyActive;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyActive.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyActive = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyMod
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.OnlyMod;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyMod.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyMod = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyNoTag
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.OnlyNoTag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyNoTag.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyNoTag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.SearchVal;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.SearchVal.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.SearchVal = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.FileName;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.FileName.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.FileName = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelIdxMacc
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.IdxMacchina;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.IdxMacchina.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.IdxMacchina = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelTag
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.Tag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.Tag.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.Tag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string cssActive(bool active)
|
||||
{
|
||||
string answ = active ? "text-dark" : "text-secondary textStriked";
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string cssStatusByCod(FileState currStatus)
|
||||
{
|
||||
string answ = "badge";
|
||||
switch (currStatus)
|
||||
{
|
||||
case FileState.Changed:
|
||||
answ += " text-bg-warning";
|
||||
break;
|
||||
|
||||
case FileState.Deleted:
|
||||
answ += " text-bg-danger";
|
||||
break;
|
||||
|
||||
case FileState.Ok:
|
||||
answ += " text-bg-success";
|
||||
break;
|
||||
|
||||
case FileState.ND:
|
||||
default:
|
||||
answ += " text-bg-light";
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
private async Task OnDialogClose(bool accepted)
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
AppMService.EA_FilterUpdated -= OnFilterUpdated;
|
||||
}
|
||||
|
||||
public async void OnFilterUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
DeleteDialogOpen = false;
|
||||
currPage = 1;
|
||||
await AsyncReload();
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
private void OpenDialog()
|
||||
{
|
||||
SearchVal = AppMService.SearchVal;
|
||||
DeleteDialogOpen = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -23,10 +23,13 @@ namespace MP.Prog
|
||||
})
|
||||
.ConfigureLogging(logging =>
|
||||
{
|
||||
// impostante per non perdere le regole di log
|
||||
logging.ClearProviders();
|
||||
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Error);
|
||||
})
|
||||
.UseNLog();
|
||||
// importante per eseguire la conf regike logging
|
||||
.UseNLog(new NLogAspNetCoreOptions() { RemoveLoggerFactoryFilter = false });
|
||||
//.UseNLog();
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:7312",
|
||||
"sslPort": 44309
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.16.2410.2116</h4>
|
||||
<h4>Versione: 6.16.2410.2211</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.2116
|
||||
6.16.2410.2211
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.2116</version>
|
||||
<version>6.16.2410.2211</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>
|
||||
|
||||
+14
-2
@@ -1,3 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authentication.Negotiate;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@@ -8,6 +9,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MP.Prog.Data;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -84,8 +86,8 @@ namespace MP.Prog
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
//app.UseAuthentication();
|
||||
//app.UseAuthorization();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
@@ -105,6 +107,16 @@ namespace MP.Prog
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Aggiunta auth windows
|
||||
services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
|
||||
.AddNegotiate();
|
||||
|
||||
services.AddAuthorization(options =>
|
||||
{
|
||||
// By default, all incoming requests will be authorized according to the default policy.
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
|
||||
// cookie applicazione da 14 gg (defaul) a 30
|
||||
services.ConfigureApplicationCookie(o =>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user