diff --git a/server/AyaNova/Controllers/ReportController.cs b/server/AyaNova/Controllers/ReportController.cs index 2e24fdc1..0d17dfc2 100644 --- a/server/AyaNova/Controllers/ReportController.cs +++ b/server/AyaNova/Controllers/ReportController.cs @@ -83,19 +83,14 @@ namespace AyaNova.Api.Controllers return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); var httpConnectionFeature = HttpContext.Features.Get(); - var API_URL=$"http://127.0.0.1:{httpConnectionFeature.LocalPort}/api/v8/"; + var API_URL = $"http://127.0.0.1:{httpConnectionFeature.LocalPort}/api/v8/"; //var localIpAddress = httpConnectionFeature?.LocalIpAddress; + //todo: validate files are present somehow? var ReportJSFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "reportjs"); if (!Directory.Exists(ReportJSFolderPath)) throw new System.Exception($"E1012: \"reportjs\" folder not found where expected: \"{ReportJSFolderPath}\", installation damaged?"); - - var hbspath = Path.Combine(ReportJSFolderPath, "ayhandlebars.js"); - if (!System.IO.File.Exists(hbspath)) - throw new System.Exception($"E1012: \"ayhandlebars.js\" file not found where expected: \"{hbspath}\", installation damaged?"); - - await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); //sample CSS @@ -118,13 +113,13 @@ namespace AyaNova.Api.Controllers //sample template //var reportTemplate = "'
{{#with person}}{{firstname}} {{aycaps lastname}}{{/with}}
'"; - var reportTemplate = "'test title " + + var reportTemplate = "'test title " + "

Test page top

A blue paragraph

{{#with person}}{{firstname}} {{aycaps lastname}}{{/with}}
" + "

Some markdown

{{{aymarkdown mdtest}}}
'"; //data object - + var aylogo = $"{{small:'{API_URL}logo/small',medium:'{API_URL}logo/medium',large:'{API_URL}logo/large'}}"; var reportData = "{ person: { firstname: 'Tyler', lastname: 'Mott' },aylogo:[AYLOGO], mdtest:'| CODE | MEANING |\\n| ----- | ------------------------------ |\\n| E1000 | Could not connect to the database specified in the [connection string](ops-config-db.md). |\\n| E1050 | XXXXXXXX |\\n| E1012 | Missing resource folder. AyaNova was started from the wrong location or was not installed properly. |\\n' }"; reportData = reportData.Replace("[AYLOGO]", aylogo); @@ -133,7 +128,7 @@ namespace AyaNova.Api.Controllers { //Add handlebars JS for compiling and presenting - await page.AddScriptTagAsync(new AddTagOptions() { Path = hbspath }); + await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ayhandlebars.js") }); //add marked for markdown processing await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "marked.js") });