diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 391688d9..a20e9863 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index 1c59c2f5..0c4d87c5 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -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 // diff --git a/ayanova/src/router.js b/ayanova/src/router.js index d5fd55e8..6b893cda 100644 --- a/ayanova/src/router.js +++ b/ayanova/src/router.js @@ -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", diff --git a/ayanova/src/views/ay-report-edit.vue b/ayanova/src/views/ay-report-edit.vue index a94fd36c..7cfb1ce4 100644 --- a/ayanova/src/views/ay-report-edit.vue +++ b/ayanova/src/views/ay-report-edit.vue @@ -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 - }); - } } } }; diff --git a/ayanova/src/views/ay-report-view.vue b/ayanova/src/views/ay-report-view.vue new file mode 100644 index 00000000..9e59bcd6 --- /dev/null +++ b/ayanova/src/views/ay-report-view.vue @@ -0,0 +1,43 @@ + + + diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index 16f69896..67de6d64 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -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 {