This commit is contained in:
@@ -300,6 +300,9 @@ TESTING INFO:
|
|||||||
- MUST: Must test a timeout to ensure the error displays correctly in the report-control because only developed against manual cancel so far with new system
|
- MUST: Must test a timeout to ensure the error displays correctly in the report-control because only developed against manual cancel so far with new system
|
||||||
set to 1m timeout and then run a ginormous report or temp set server to always timeout is probably better for testing purposes
|
set to 1m timeout and then run a ginormous report or temp set server to always timeout is probably better for testing purposes
|
||||||
- report designer print needs to be fixed to use new system
|
- report designer print needs to be fixed to use new system
|
||||||
|
- Must test error condition due to report template fucked up
|
||||||
|
- must test timeout error
|
||||||
|
- must test exception not due to report template bug (i.e. server exception of some kind)
|
||||||
- direct print report from url must be tested and fixed up
|
- direct print report from url must be tested and fixed up
|
||||||
- upload and test on devops
|
- upload and test on devops
|
||||||
- give to Joyce to mangle
|
- give to Joyce to mangle
|
||||||
|
|||||||
@@ -161,29 +161,79 @@ export default {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
jobStatus = jobStatus.data;
|
jobStatus = jobStatus.data;
|
||||||
if (jobStatus == 4 || jobStatus == 0) {
|
|
||||||
throw new Error("Job failed");
|
/*
|
||||||
}
|
Absent = 0,
|
||||||
if (jobStatus == 3) {
|
Sleeping = 1,
|
||||||
|
Running = 2,
|
||||||
|
Completed = 3,
|
||||||
|
Failed = 4
|
||||||
|
*/
|
||||||
|
//check for any terminal status
|
||||||
|
if (jobStatus != 1 && jobStatus != 2) {
|
||||||
this.jobActive = false;
|
this.jobActive = false;
|
||||||
//success, get the report url name
|
|
||||||
const jobLogRes = await window.$gz.api.get(
|
const jobLogRes = await window.$gz.api.get(
|
||||||
`job-operations/logs/${jobId}`
|
`job-operations/logs/${jobId}`
|
||||||
);
|
);
|
||||||
if (Array.isArray(jobLogRes.data)) {
|
//get final entry is error or success
|
||||||
//walk the array backwards as it's probably the final entry in the log
|
var finalEntry = jobLogRes.data[jobLogRes.data.length - 1];
|
||||||
for (var i = jobLogRes.data.length - 1; i >= 0; i--) {
|
console.log("final entry:", finalEntry);
|
||||||
var v = jobLogRes.data[i].statusText;
|
|
||||||
if (v.includes("reportfilename")) {
|
// if (Array.isArray(jobLogRes.data)) {
|
||||||
const o = JSON.parse(v);
|
// //walk the array backwards as it's probably the final entry in the log
|
||||||
reportUrl = window.$gz.api.reportDownloadUrl(
|
// for (var i = jobLogRes.data.length - 1; i >= 0; i--) {
|
||||||
o.reportfilename
|
// var v = jobLogRes.data[i].statusText;
|
||||||
);
|
// if (v.includes("reportfilename")) {
|
||||||
|
// const o = JSON.parse(v);
|
||||||
|
// reportUrl = window.$gz.api.reportDownloadUrl(
|
||||||
|
// o.reportfilename
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (jobStatus == 4 || jobStatus == 0) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
report template processing error example
|
||||||
|
{
|
||||||
|
"created": "2021-12-28T16:13:01.13624Z",
|
||||||
|
"statusText": "rendererror:exception,\"PuppeteerSharp -> Evaluation failed: TypeError: Assignment to constant variable.\n at ayPrepareData (<anonymous>:7:2)\n at ayPreRender (C:\\data\\code\\raven\\server\\AyaNova\\resource\\rpt\\ay-report.js:8:38)\n at eval (eval at waitForPredicatePageFunction (:3:23), <anonymous>:3:9)\n at onRaf (__puppeteer_evaluation_script__:50:35)\n at pollRaf (__puppeteer_evaluation_script__:43:15)\n at waitForPredicatePageFunction (__puppeteer_evaluation_script__:8:22)\r\n\"",
|
||||||
|
"jobId": "3deeac20-b49d-46d8-a5f6-891b7d1049f8"
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
throw new Error("Job failed");
|
||||||
|
}
|
||||||
|
if (jobStatus == 3) {
|
||||||
|
/*
|
||||||
|
example success
|
||||||
|
{
|
||||||
|
"created": "2021-12-28T16:14:32.184925Z",
|
||||||
|
"statusText": "{\"reportfilename\":\"tixcxh25aop.pdf\"}",
|
||||||
|
"jobId": "c251aa88-6763-4065-a1d4-13fdeb947a72"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
this.jobActive = false;
|
||||||
|
//success, get the report url name
|
||||||
|
// const jobLogRes = await window.$gz.api.get(
|
||||||
|
// `job-operations/logs/${jobId}`
|
||||||
|
// );
|
||||||
|
if (Array.isArray(jobLogRes.data)) {
|
||||||
|
//walk the array backwards as it's probably the final entry in the log
|
||||||
|
for (var i = jobLogRes.data.length - 1; i >= 0; i--) {
|
||||||
|
var v = jobLogRes.data[i].statusText;
|
||||||
|
if (v.includes("reportfilename")) {
|
||||||
|
const o = JSON.parse(v);
|
||||||
|
reportUrl = window.$gz.api.reportDownloadUrl(
|
||||||
|
o.reportfilename
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.jobActive = false;
|
this.jobActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//job ran to completion, get the report file name and fetch it
|
//job ran to completion, get the report file name and fetch it
|
||||||
|
|||||||
@@ -867,10 +867,12 @@ export default {
|
|||||||
reportDataOptions.ReportId = vm.obj.id;
|
reportDataOptions.ReportId = vm.obj.id;
|
||||||
//Meta data from client for use by report script
|
//Meta data from client for use by report script
|
||||||
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
|
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
|
||||||
const res = await vm.$refs.reportSelector.open(
|
try {
|
||||||
reportDataOptions,
|
await vm.$refs.reportSelector.open(reportDataOptions, vm.obj.id);
|
||||||
vm.obj.id
|
} catch (ex) {
|
||||||
);
|
vm.rendering = false;
|
||||||
|
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async xxrender() {
|
async xxrender() {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user