This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -48,8 +48,8 @@
|
|||||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||||
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"19",
|
"AYANOVA_REPORT_RENDERING_TIMEOUT":"60",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "large",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
||||||
},
|
},
|
||||||
"sourceFileMap": {
|
"sourceFileMap": {
|
||||||
|
|||||||
@@ -856,6 +856,8 @@ namespace AyaNova.Biz
|
|||||||
ReportData.Add(jo);
|
ReportData.Add(jo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vc.Clear();
|
||||||
|
oc.Clear();
|
||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -832,6 +832,8 @@ namespace AyaNova.Biz
|
|||||||
ReportData.Add(jo);
|
ReportData.Add(jo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vc.Clear();
|
||||||
|
oc.Clear();
|
||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
||||||
|
|
||||||
|
|
||||||
if (!RequestIsCustomerWorkOrderReport && !AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.AType))
|
if (!RequestIsCustomerWorkOrderReport && !AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.AType))
|
||||||
{
|
{
|
||||||
log.LogDebug($"bail: user unauthorized");
|
log.LogDebug($"bail: user unauthorized");
|
||||||
@@ -490,7 +490,12 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
var ReportJSFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "rpt");
|
var ReportJSFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "rpt");
|
||||||
|
|
||||||
|
|
||||||
|
//Keep for debugging headfully
|
||||||
|
//var lo = new LaunchOptions { Headless = false };
|
||||||
var lo = new LaunchOptions { Headless = true };
|
var lo = new LaunchOptions { Headless = true };
|
||||||
|
|
||||||
|
|
||||||
if (!AutoDownloadChromium)
|
if (!AutoDownloadChromium)
|
||||||
{
|
{
|
||||||
lo.ExecutablePath = ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PATH;
|
lo.ExecutablePath = ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PATH;
|
||||||
@@ -511,10 +516,7 @@ namespace AyaNova.Biz
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// #if (DEBUG)
|
|
||||||
// log.LogInformation($"DBG: ReportBiz::calling browserfetcher");
|
|
||||||
// #endif
|
|
||||||
log.LogDebug($"Windows: Calling browserFetcher download async now:");
|
log.LogDebug($"Windows: Calling browserFetcher download async now:");
|
||||||
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
|
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
|
||||||
}
|
}
|
||||||
@@ -524,7 +526,13 @@ namespace AyaNova.Biz
|
|||||||
//*** DANGER: --disable-dev-shm-usage will crash linux ayanova when it runs out of memory ****
|
//*** DANGER: --disable-dev-shm-usage will crash linux ayanova when it runs out of memory ****
|
||||||
//that was only suitable for dockerized scenario as it had an alt swap system
|
//that was only suitable for dockerized scenario as it had an alt swap system
|
||||||
//var OriginalDefaultArgs = "--disable-dev-shm-usage --single-process --no-sandbox --disable-gpu --no-zygote ";
|
//var OriginalDefaultArgs = "--disable-dev-shm-usage --single-process --no-sandbox --disable-gpu --no-zygote ";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Keep for debugging headfully
|
||||||
|
// var DefaultArgs = "--no-sandbox";
|
||||||
var DefaultArgs = "--headless --no-sandbox";
|
var DefaultArgs = "--headless --no-sandbox";
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PARAMS))
|
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PARAMS))
|
||||||
{
|
{
|
||||||
log.LogDebug($"AYANOVA_REPORT_RENDER_BROWSER_PARAMS will be used: {ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PARAMS}");
|
log.LogDebug($"AYANOVA_REPORT_RENDER_BROWSER_PARAMS will be used: {ServerBootConfig.AYANOVA_REPORT_RENDER_BROWSER_PARAMS}");
|
||||||
@@ -615,8 +623,8 @@ namespace AyaNova.Biz
|
|||||||
if (!string.IsNullOrWhiteSpace(report.JsHelpers))
|
if (!string.IsNullOrWhiteSpace(report.JsHelpers))
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Content = report.JsHelpers });
|
await page.AddScriptTagAsync(new AddTagOptions() { Content = report.JsHelpers });
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(report.Style))
|
// if (!string.IsNullOrWhiteSpace(report.Style))
|
||||||
await page.AddStyleTagAsync(new AddTagOptions() { Content = report.Style });
|
// await page.AddStyleTagAsync(new AddTagOptions() { Content = report.Style });
|
||||||
|
|
||||||
log.LogDebug($"Preparing page: adding Client meta data");
|
log.LogDebug($"Preparing page: adding Client meta data");
|
||||||
|
|
||||||
@@ -682,17 +690,20 @@ namespace AyaNova.Biz
|
|||||||
var compiledHTML = await page.EvaluateExpressionAsync<string>(compileScript);
|
var compiledHTML = await page.EvaluateExpressionAsync<string>(compileScript);
|
||||||
if (!ReportRenderManager.KeepGoing(job.GId))
|
if (!ReportRenderManager.KeepGoing(job.GId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//render report as HTML
|
//render report as HTML
|
||||||
log.LogDebug($"Setting page content to compiled HTML");
|
|
||||||
|
|
||||||
await page.SetContentAsync(compiledHTML);
|
//add style
|
||||||
|
// if (!string.IsNullOrWhiteSpace(report.Style))
|
||||||
|
// {
|
||||||
|
// log.LogDebug($"Adding report template Style CSS");
|
||||||
|
// await page.AddStyleTagAsync(new AddTagOptions { Content = report.Style });
|
||||||
|
// }
|
||||||
|
// log.LogInformation(report.Style);
|
||||||
|
// log.LogInformation(compiledHTML);
|
||||||
|
log.LogDebug($"Setting page content to style and compiled HTML");
|
||||||
|
await page.SetContentAsync($"<style>{report.Style}</style>{compiledHTML}");
|
||||||
|
|
||||||
//add style (after page or it won't work)
|
|
||||||
if (!string.IsNullOrWhiteSpace(report.Style))
|
|
||||||
{
|
|
||||||
log.LogDebug($"Adding report template Style CSS");
|
|
||||||
await page.AddStyleTagAsync(new AddTagOptions { Content = report.Style });
|
|
||||||
}
|
|
||||||
|
|
||||||
string outputFileName = StringUtil.ReplaceLastOccurrence(FileUtil.NewRandomFileName, ".", "") + ".pdf";
|
string outputFileName = StringUtil.ReplaceLastOccurrence(FileUtil.NewRandomFileName, ".", "") + ".pdf";
|
||||||
string outputFullPath = System.IO.Path.Combine(FileUtil.TemporaryFilesFolder, outputFileName);
|
string outputFullPath = System.IO.Path.Combine(FileUtil.TemporaryFilesFolder, outputFileName);
|
||||||
@@ -779,7 +790,7 @@ namespace AyaNova.Biz
|
|||||||
return;
|
return;
|
||||||
//render to pdf and return
|
//render to pdf and return
|
||||||
log.LogDebug($"Calling render page contents to PDF");
|
log.LogDebug($"Calling render page contents to PDF");
|
||||||
await page.PdfAsync(outputFullPath, PdfOptions);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE SUPPORTED, open bug: https://github.com/hardkoded/puppeteer-sharp/issues/1710
|
await page.PdfAsync(outputFullPath, PdfOptions);
|
||||||
|
|
||||||
log.LogDebug($"Closing Page");
|
log.LogDebug($"Closing Page");
|
||||||
await page.CloseAsync();
|
await page.CloseAsync();
|
||||||
|
|||||||
@@ -986,11 +986,11 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
ReportData.Add(jo);
|
ReportData.Add(jo);
|
||||||
}
|
}
|
||||||
|
batchResults.Clear();
|
||||||
}
|
}
|
||||||
// #if (DEBUG)
|
|
||||||
// watch.Stop();
|
vc.Clear();
|
||||||
// System.Diagnostics.Debug.WriteLine($"Workorderbiz::GetReportData took ms: {watch.ElapsedMilliseconds}");
|
oc.Clear();
|
||||||
// #endif
|
|
||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace AyaNova.Util
|
|||||||
// {
|
// {
|
||||||
// System.Diagnostics.Debug.WriteLine("constructing objectcache");
|
// System.Diagnostics.Debug.WriteLine("constructing objectcache");
|
||||||
// }
|
// }
|
||||||
|
internal void Clear()
|
||||||
|
{
|
||||||
|
_cache.Clear();
|
||||||
|
}
|
||||||
internal void Add(object value, string key, long? id = 0)
|
internal void Add(object value, string key, long? id = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace AyaNova.Util
|
|||||||
// {
|
// {
|
||||||
// System.Diagnostics.Debug.WriteLine("constructing vizcache");
|
// System.Diagnostics.Debug.WriteLine("constructing vizcache");
|
||||||
// }
|
// }
|
||||||
|
internal void Clear()
|
||||||
|
{
|
||||||
|
_vizCache.Clear();
|
||||||
|
}
|
||||||
internal void Add(string value, string key, long? id = 0)
|
internal void Add(string value, string key, long? id = 0)
|
||||||
{
|
{
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
|
|||||||
Reference in New Issue
Block a user