This commit is contained in:
@@ -299,6 +299,8 @@ TESTING INFO:
|
||||
- 1 todo: cancellable reporting?? Jobify it just like any other long running job, it's necessary unfortunately and then put a cancel button
|
||||
|
||||
- direct print report from url must be tested and fixed up
|
||||
http://localhost:8080/viewreport/103/57
|
||||
redocument as the format has changed and also update the notify code as the format has changed no longer a query string but a full path as in above
|
||||
- upload and test on devops
|
||||
- give to Joyce to mangle
|
||||
|
||||
|
||||
@@ -639,38 +639,38 @@ export default {
|
||||
PDFTime: window.$gz.locale.utcDateToShortTimeLocalized(nowUtc)
|
||||
};
|
||||
},
|
||||
///////////////////////////////////
|
||||
// RENDER REPORT DIRECTLY
|
||||
//
|
||||
//
|
||||
async renderReport(objectid, reportid, redirectNotPopup) {
|
||||
const reportDataOptions = {
|
||||
ReportId: reportid,
|
||||
SelectedRowIds: [objectid],
|
||||
ClientMeta: this.reportClientMetaData()
|
||||
};
|
||||
// ///////////////////////////////////
|
||||
// // RENDER REPORT DIRECTLY
|
||||
// //
|
||||
// //
|
||||
// async renderReport(objectid, reportid, redirectNotPopup) {
|
||||
// const reportDataOptions = {
|
||||
// ReportId: reportid,
|
||||
// SelectedRowIds: [objectid],
|
||||
// ClientMeta: this.reportClientMetaData()
|
||||
// };
|
||||
|
||||
const res = await window.$gz.api.upsert("report/render", reportDataOptions);
|
||||
if (res.error) {
|
||||
if (redirectNotPopup) {
|
||||
return res;
|
||||
} else {
|
||||
throw new Error(window.$gz.errorHandler.errorToString(res));
|
||||
}
|
||||
} else {
|
||||
const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
|
||||
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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// const res = await window.$gz.api.upsert("report/render", reportDataOptions);
|
||||
// if (res.error) {
|
||||
// if (redirectNotPopup) {
|
||||
// return res;
|
||||
// } else {
|
||||
// throw new Error(window.$gz.errorHandler.errorToString(res));
|
||||
// }
|
||||
// } else {
|
||||
// const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
|
||||
// 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"
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
///////////////////////////////////
|
||||
// FETCH BIZ OBJECT NAME
|
||||
//
|
||||
|
||||
@@ -71,6 +71,12 @@ export default new Router({
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "ay-common" */ "./views/ay-open.vue")
|
||||
},
|
||||
{
|
||||
path: "/viewreport/:oid/:rid",
|
||||
name: "ay-report-view",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "ay-common" */ "./views/ay-report-view.vue")
|
||||
},
|
||||
{
|
||||
path: "/about",
|
||||
name: "ay-about",
|
||||
@@ -1064,27 +1070,27 @@ export default new Router({
|
||||
},
|
||||
|
||||
//############################## SPECIAL ROUTES ###############################
|
||||
{
|
||||
//REPORT VIEW FROM URL
|
||||
path: "/viewreport",
|
||||
beforeEnter: async (to, from, next) => {
|
||||
//open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
|
||||
const objectId = parseInt(to.query.oid);
|
||||
const reportId = parseInt(to.query.rid);
|
||||
// {
|
||||
// //REPORT VIEW FROM URL
|
||||
// path: "/viewreport",
|
||||
// beforeEnter: async (to, from, next) => {
|
||||
// //open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
|
||||
// const objectId = parseInt(to.query.oid);
|
||||
// const reportId = parseInt(to.query.rid);
|
||||
|
||||
const res = await window.$gz.api.renderReport(objectId, reportId, true);
|
||||
if (res.error) {
|
||||
//log the error and do a popup for it
|
||||
const msg = `/viewReport, query ${JSON.stringify(
|
||||
to.query
|
||||
)}, server error: ${JSON.stringify(res.error)}`;
|
||||
window.$gz.eventBus.$emit("notify-error", msg);
|
||||
next("/applog");
|
||||
}
|
||||
// const res = await window.$gz.api.renderReport(objectId, reportId, true);
|
||||
// if (res.error) {
|
||||
// //log the error and do a popup for it
|
||||
// const msg = `/viewReport, query ${JSON.stringify(
|
||||
// to.query
|
||||
// )}, server error: ${JSON.stringify(res.error)}`;
|
||||
// window.$gz.eventBus.$emit("notify-error", msg);
|
||||
// next("/applog");
|
||||
// }
|
||||
|
||||
next(false);
|
||||
}
|
||||
},
|
||||
// next(false);
|
||||
// }
|
||||
// },
|
||||
|
||||
{
|
||||
path: "/ay-evaluate",
|
||||
|
||||
@@ -873,54 +873,6 @@ export default {
|
||||
vm.rendering = false;
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
}
|
||||
},
|
||||
async xxrender() {
|
||||
const vm = this;
|
||||
if (vm.$route.params.recordid == 0) {
|
||||
return;
|
||||
}
|
||||
const reportDataOptions = vm.$route.params.reportDataOptions;
|
||||
if (!reportDataOptions) {
|
||||
throw new Error(
|
||||
"Missing report data: to view report must come here from an object edit form or list so data can be provided for viewing the report"
|
||||
);
|
||||
}
|
||||
reportDataOptions.ReportId = vm.obj.id;
|
||||
//Meta data from client for use by report script
|
||||
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: true
|
||||
});
|
||||
try {
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
vm.rendering = true;
|
||||
const res = await window.$gz.api.upsert(
|
||||
"report/render",
|
||||
reportDataOptions
|
||||
);
|
||||
vm.rendering = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
|
||||
if (window.open(reportUrl, "Report") == null) {
|
||||
vm.formState.serverError =
|
||||
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting";
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
vm.rendering = false;
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
} finally {
|
||||
vm.rendering = false;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
43
ayanova/src/views/ay-report-view.vue
Normal file
43
ayanova/src/views/ay-report-view.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div>
|
||||
<span>📖...</span>
|
||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//THIS FORM IS USED WHEN CLICKING ON A REPORT URL FROM A NOTIFICATION EMAIL ETC
|
||||
//it's only ever called from the router directly
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
async created() {
|
||||
const vm = this;
|
||||
//open report links have url format /viewreport/[objectid]/[reportid]
|
||||
//path: "/viewreport/:oid/:rid",
|
||||
|
||||
const objectId = parseInt(vm.$route.params.oid);
|
||||
const reportId = parseInt(vm.$route.params.rid);
|
||||
|
||||
if (!objectId || !reportId) {
|
||||
throw new Error(
|
||||
"Missing report data: oid or rid are not set, unable to render report"
|
||||
);
|
||||
}
|
||||
|
||||
const reportDataOptions = {
|
||||
ReportId: reportid,
|
||||
SelectedRowIds: [objectid],
|
||||
ClientMeta: window.$gz.api.reportClientMetaData()
|
||||
};
|
||||
|
||||
try {
|
||||
await vm.$refs.reportSelector.open(reportDataOptions, reportid);
|
||||
} catch (ex) {
|
||||
vm.rendering = false;
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -589,9 +589,20 @@ export default {
|
||||
(async function() {
|
||||
//open report links have a query string /viewreport?oid=[objectid]&rid=[reportid]
|
||||
const searchParams = new URLSearchParams(vm.$route.params.search);
|
||||
const objectId = parseInt(searchParams.get("oid"));
|
||||
//const objectId = parseInt(searchParams.get("oid"));
|
||||
const reportId = parseInt(searchParams.get("rid"));
|
||||
await window.$gz.api.renderReport(objectId, reportId); //objectid,reportid
|
||||
//await window.$gz.api.renderReport(objectId, reportId); //objectid,reportid
|
||||
|
||||
const reportDataOptions = {
|
||||
ReportId: reportId,
|
||||
SelectedRowIds: [parseInt(searchParams.get("oid"))],
|
||||
ClientMeta: window.$gz.api.reportClientMetaData()
|
||||
};
|
||||
try {
|
||||
await vm.$refs.reportSelector.open(reportDataOptions, reportId);
|
||||
} catch (ex) {
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
}
|
||||
})();
|
||||
vm.$router.push(vm.$store.state.homePage);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user