using System.Data.Common; using System.IdentityModel.Tokens.Jwt; using System.Web; using HandlebarsDotNet; using InnovEnergy.App.RemoteSupportConsole; using InnovEnergy.App.VrmGrabber.Database; using Microsoft.AspNetCore.Mvc; using FILE=System.IO.File; using VrmInstallation = InnovEnergy.Lib.Victron.VictronVRM.Installation; namespace InnovEnergy.App.VrmGrabber; public record Install( String Name, String Ip, Int64 Vrm, String Identifier, String Serial, String EscapedName, String Online, String LastSeen, Int64 NumBatteries, String BatteryVersion ); [Controller] public class Controller : ControllerBase { [HttpGet] [Route("/")] [Produces("text/html")] public ActionResult Index() { String source = @"
Name | Gui | VRM | Grafana | Identifier | Last Seen | Serial | #Batteries | Firmware-Version |
---|
Please wait page is still loading
" }; Handlebars.RegisterTemplate("installations", partialSource); var template = Handlebars.Compile(source); var insts = instList.Select(i => new Install( i.Name, i.Ip, i.Vrm, i.Identifier, i.Serial, i.EscapedName, i.Online, DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64(i.LastSeen)).ToString(), i.NumberOfBatteries, i.BatteryFirmwareVersion)); var data = new { inst = insts }; var result = template(data); return new ContentResult { ContentType = "text/html", Content = result }; } // [HttpGet(nameof(GetInstallation))] // [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "