From 8aabc0f4fef84447e48ba3840bb6bdf510dbac3f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 14 Sep 2020 17:38:30 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 2 +- ayanova/src/api/gzapi.js | 23 ++++++++++++++++++- .../components/report-selector-control.vue | 3 ++- ayanova/src/views/login.vue | 4 +++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 16db4fda..b2e57f3d 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -14,7 +14,7 @@ todo: Need client to accept an open object url which directly opens a report So they would click on a link in an email and be taken to login and then directly to previewing the report URL: 404 - Object not found: "/viewreport/2/100/1" /viewreport/objecttype/:objectid/:reportid - http://localhost:8080//viewreport/2/100/1 + http://localhost:8080/viewreport/1/1 todo: export from grid to xls, csv etc. I'm thinking perhaps also a secondary ability to make report templates that are actually intended for export to xls or whatever as an additional feature diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index 4e6bc00d..6581647c 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -610,7 +610,7 @@ export default { async uploadLogo(fileData, size) { let that = this; try { - var data = new FormData(); + let data = new FormData(); data.append(fileData.name, fileData); //----------------- @@ -649,6 +649,27 @@ export default { .getBrowserFirstLanguage() .split("-", 1)[0] }; + }, + /////////////////////////////////// + // RENDER REPORT DIRECTLY + // + // + async renderReport(objectid, reportid) { + let reportDataOptions = { + ReportId: reportid, + SelectedRowIds: [objectid], + ClientMeta: this.reportClientMetaData() + }; + + let res = await window.$gz.api.upsert("report/render", reportDataOptions); + if (res.error) { + throw res.error; + } else { + let reportUrl = window.$gz.api.reportDownloadUrl(res.data); + if (window.open(reportUrl, "Report") == null) { + throw "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"; + } + } } //--------------- diff --git a/ayanova/src/components/report-selector-control.vue b/ayanova/src/components/report-selector-control.vue index 1687516c..f46ee6a9 100644 --- a/ayanova/src/components/report-selector-control.vue +++ b/ayanova/src/components/report-selector-control.vue @@ -90,10 +90,11 @@ export default { /* public class RenderReportParameter { - public long ReportId { get; set; } + public long ReportId { get; set; } public long[] SelectedRowIds { get; set; } public string DataListKey { get; set; } public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList + public JToken ClientMeta {get;set;}//meta JSON data passed from client, not part of biz object data } */ let reportDataOptions = vm.reportDataOptions; diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index f3b660fb..862f270d 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -335,7 +335,9 @@ export default { //check if it's an open report link and if so //trigger that to open in a new window and continue on to normal home page if (toPath.startsWith("/viewreport")) { - alert("stub: open report"); + (async function() { + await window.$gz.api.renderReport(1, 1); //objectid,reportid + })(); vm.$router.push(vm.$store.state.homePage); } else { //otherwise open the url indicated