This commit is contained in:
2020-10-09 14:35:14 +00:00
parent cbf0ee6516
commit b6ec4078c5
4 changed files with 30 additions and 40 deletions

View File

@@ -656,7 +656,7 @@ export default {
// RENDER REPORT DIRECTLY
//
//
async renderReport(objectid, reportid) {
async renderReport(objectid, reportid, redirectNotPopup) {
let reportDataOptions = {
ReportId: reportid,
SelectedRowIds: [objectid],
@@ -668,10 +668,15 @@ export default {
throw new Error(res.error);
} else {
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (window.open(reportUrl, "Report") == null) {
throw new Error(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
);
if (redirectNotPopup) {
//used for direct report open from direct report view url
window.location.replace(reportUrl);
} else {
if (window.open(reportUrl, "Report") == null) {
throw new Error(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
);
}
}
}
}

View File

@@ -522,9 +522,23 @@ export default new Router({
component: () =>
import(/* webpackChunkName: "ay-common" */ "./views/ay-history.vue")
},
//SPECIAL ROUTES
{
//REPORT VIEW FROM URL
path: "/viewreport",
beforeEnter: (to, from, next) => {
(async function() {
//open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
let objectId = parseInt(to.query.oid);
let reportId = parseInt(to.query.rid);
await window.$gz.api.renderReport(objectId, reportId, true);
})();
next(false);
}
},
//TEST TEST TEST TEST TEST
{
//NEW TEST GZ DATA TABLE
path: "/widgets",