This commit is contained in:
2021-12-27 23:39:56 +00:00
parent cd5176a22c
commit 5deaa88a76

View File

@@ -58,21 +58,20 @@
</v-dialog>
</v-row>
<!-- ################################################################################-->
<!-- ########################## RENDERING FORM ####################################-->
<!-- ########################## JOB FORM ####################################-->
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="rendering">
<v-dialog persistent max-width="600px" v-model="jobActive">
<v-card>
<v-card-title>{{ $ay.t("RenderingReport") }}</v-card-title>
<v-card-text>
soemthing here
soemthing here
</v-card-text>
<v-card-actions>
<v-btn text @click="cancelJob" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
@@ -94,9 +93,9 @@ export default {
},
reportList: [],
selectedReport: null,
rendering: false,
jobActive: false,
preSelectReportId: null
preSelectReportId: null,
jobId: null
}),
methods: {
editReport(reportid) {
@@ -110,56 +109,12 @@ export default {
}
});
},
async immediateRenderReport(reportId, reportName) {
if (this.$route.params.recordid == 0) {
return;
}
const reportDataOptions = this.reportDataOptions;
if (!reportDataOptions) {
this.reject("Missing report data unable to render report");
}
reportDataOptions.ReportId = reportId;
//Meta data from client for use by report script
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
this.rendering = true;
const res = await window.$gz.api.upsert(
"report/render",
reportDataOptions
);
this.rendering = false;
if (res.error) {
this.reject(res);
} else {
//special handling for timeout response at the server
if (res.data && res.data.timeout) {
await window.$gz.dialog.displayNoTranslationModalNotificationMessage(
window.$gz.translation
.get("ReportRenderTimeOut")
.replace("{0}", res.data.timeoutconfigminutes),
null,
"error",
`${this.$store.state.helpUrl}/ay-report-timeout`
);
} else {
//all ok show report
const reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (window.open(reportUrl, "Report") == null) {
this.reject(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
);
}
}
}
this.isVisible = false;
if (reportName != null) {
this.resolve({ name: reportName, id: reportId });
} else {
this.resolve(null);
async cancelJob() {
if (this.jobId && this.jobId != -1) {
await window.$gz.api.post(`report/request-cancel/${this.jobId}`);
}
this.jobActive = false;
this.resolve(null);
},
async renderReport(reportId, reportName) {
if (this.$route.params.recordid == 0) {
@@ -173,7 +128,7 @@ export default {
reportDataOptions.ReportId = reportId;
//Meta data from client for use by report script
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
this.rendering = true;
this.jobActive = true;
var reportUrl = null;
try {
let jobId = await window.$gz.api.upsert(
@@ -185,6 +140,7 @@ export default {
}
jobId = jobId.jobId;
this.jobActive = true;
this.jobId = jobId;
let jobStatus = 1;
while (this.jobActive == true) {
@@ -202,7 +158,7 @@ export default {
throw new Error("Job failed");
}
if (jobStatus == 3) {
this.rendering = false;
this.jobActive = false;
//success, get the report url name
const jobLogRes = await window.$gz.api.get(
`job-operations/logs/${jobId}`
@@ -236,7 +192,7 @@ export default {
);
}
}
this.rendering = false;
this.jobActive = false;
this.isVisible = false;
if (reportName != null) {
this.resolve({ name: reportName, id: reportId });
@@ -244,7 +200,6 @@ export default {
this.resolve(null);
}
} catch (error) {
this.rendering = false;
this.jobActive = false;
this.reject(error);
//window.$gz.errorHandler.handleFormError(error, this);