This commit is contained in:
@@ -86,13 +86,55 @@ async function ayPrepareData(reportData) {
|
||||
//before the report is rendered
|
||||
//modify data as required here and return it to change the data before the report renders
|
||||
|
||||
//Example of using API method to fetch data from API server and make it available to the report template
|
||||
let route=`${reportData.ayServerMetaData.ayApiUrl}enum-list/list/AyaType`;
|
||||
//Example of using API GET method to fetch data from API server and make it available to the report template
|
||||
let route=`${reportData.ayServerMetaData.ayApiUrl}server-info`;
|
||||
|
||||
//Put the data into the main report data object so it's available to the template
|
||||
reportData.myData={AyaTypeList:await ayGetFromAPI(route, reportData.ayClientMetaData.Authorization)};
|
||||
reportData.myData={ServerInfo:await ayGetFromAPI(route, reportData.ayClientMetaData.Authorization)};
|
||||
|
||||
//Example API POST method to fetch data from api server
|
||||
route=`${reportData.ayServerMetaData.ayApiUrl}search`;
|
||||
let searchPostData={phrase: "Fish"};
|
||||
reportData.myData.SearchResults=await ayPostToAPI(route, reportData.ayClientMetaData.Authorization,searchPostData);
|
||||
|
||||
return reportData;
|
||||
}
|
||||
|
||||
<html>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<h4>ayServerMetaData</h4>
|
||||
{{ ayJSON ayServerMetaData }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>ayClientMetaData</h4>
|
||||
{{ ayJSON ayClientMetaData }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>ayReportMetaData</h4>
|
||||
{{ ayJSON ayReportMetaData }}
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<h4>myData</h4>
|
||||
<h5>(Fetched dynamically from API route <strong>enum-list/list/AyaType</strong>)</h5>
|
||||
{{ ayJSON myData }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>ayReportData</h4>
|
||||
{{#each ayReportData}}
|
||||
<h2>{{ Name }}</h2>
|
||||
<div>Notes: <span class="example">{{ Notes }}</span></div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user