diff --git a/docs/8.0/ayanova/docs/form-ay-report-edit.md b/docs/8.0/ayanova/docs/form-ay-report-edit.md index aa302b75..07dd1912 100644 --- a/docs/8.0/ayanova/docs/form-ay-report-edit.md +++ b/docs/8.0/ayanova/docs/form-ay-report-edit.md @@ -125,3 +125,18 @@ Will render the small sized logo as an image tag set to the correct API Url. No When a report is rendered some settings from the Client browser are sent along with the report and are used as required to localize date, time and currency display formats as well as the current logged in User's API credential Bearer token and some other Client dependent settings. You can see what data is provided by using the ayJson helper as in the example above on the report. As of the time of this writing the current values provided are: +``` +ayClientMetaData: { "UserName": "AyaNova username", "Authorization": "Bearer eJhbGciO...token...data...hb9JyjcWl3Tib", "TimeZoneName": "America/Los_Angeles", "LanguageName": "en-US","Hour12": true, "CurrencyName": "USD", "DefaultLocale": "en" } +``` + +## ayServerMetaData + +When a report is rendered some settings from the local AyaNova Server are injected into the report data and are used as required to access local server relative settings. For example the URL path to the local AyaNova server's API so that API methods can be called directly in the report template relative to the server's local path. + +You can see what data is provided by using the ayJson helper as in the example above on the report. As of the time of this writing the current values provided are: + +``` +ayServerMetaData: { "ayApiUrl": "http://127.0.0.1:7575/api/v8/" } +``` + +The value is an example only, your server may report a different value for the api url \ No newline at end of file diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 5176f39a..4a9c819a 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -409,7 +409,7 @@ namespace AyaNova.Biz #endif //compile and run handlebars template - var compileScript = $"Handlebars.compile(`{report.Template}`)({{ ayReportData:ayPreRender({ReportData}), ayClientMetaData:{clientMeta}, ayApiUrl:`{apiUrl}` }});"; + var compileScript = $"Handlebars.compile(`{report.Template}`)({{ ayReportData:ayPreRender({ReportData}), ayClientMetaData:{clientMeta}, ayServerMetaData:{{ayApiUrl:`{apiUrl}`}} }});"; var resultHTML = await page.EvaluateExpressionAsync(compileScript); //render report as HTML diff --git a/server/AyaNova/resource/rpt/ay-report.js b/server/AyaNova/resource/rpt/ay-report.js index 08b8f3bd..426d9daa 100644 --- a/server/AyaNova/resource/rpt/ay-report.js +++ b/server/AyaNova/resource/rpt/ay-report.js @@ -19,7 +19,7 @@ function ayRegisterHelpers() { }); Handlebars.registerHelper("ayLogo", function (size) { - var url = `${Handlebars.escapeExpression(this.ayApiUrl)}logo/${size}`; + var url = `${Handlebars.escapeExpression(this.ayServerMetaData.ayApiUrl)}logo/${size}`; return new Handlebars.SafeString(""); });