This commit is contained in:
@@ -58,21 +58,20 @@
|
|||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-row>
|
</v-row>
|
||||||
<!-- ################################################################################-->
|
<!-- ################################################################################-->
|
||||||
<!-- ########################## RENDERING FORM ####################################-->
|
<!-- ########################## JOB FORM ####################################-->
|
||||||
<!-- ################################################################################-->
|
<!-- ################################################################################-->
|
||||||
<template>
|
<template>
|
||||||
<v-row justify="center">
|
<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>
|
||||||
<v-card-title>{{ $ay.t("RenderingReport") }}</v-card-title>
|
<v-card-title>{{ $ay.t("RenderingReport") }}</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
soemthing here
|
soemthing here
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn text @click="cancelJob" color="primary">{{
|
<v-btn text @click="cancelJob" color="primary">{{
|
||||||
$ay.t("Cancel")
|
$ay.t("Cancel")
|
||||||
}}</v-btn>
|
}}</v-btn>
|
||||||
|
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
@@ -94,9 +93,9 @@ export default {
|
|||||||
},
|
},
|
||||||
reportList: [],
|
reportList: [],
|
||||||
selectedReport: null,
|
selectedReport: null,
|
||||||
rendering: false,
|
|
||||||
jobActive: false,
|
jobActive: false,
|
||||||
preSelectReportId: null
|
preSelectReportId: null,
|
||||||
|
jobId: null
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
editReport(reportid) {
|
editReport(reportid) {
|
||||||
@@ -110,56 +109,12 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async immediateRenderReport(reportId, reportName) {
|
async cancelJob() {
|
||||||
if (this.$route.params.recordid == 0) {
|
if (this.jobId && this.jobId != -1) {
|
||||||
return;
|
await window.$gz.api.post(`report/request-cancel/${this.jobId}`);
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
this.jobActive = false;
|
||||||
|
this.resolve(null);
|
||||||
},
|
},
|
||||||
async renderReport(reportId, reportName) {
|
async renderReport(reportId, reportName) {
|
||||||
if (this.$route.params.recordid == 0) {
|
if (this.$route.params.recordid == 0) {
|
||||||
@@ -173,7 +128,7 @@ export default {
|
|||||||
reportDataOptions.ReportId = reportId;
|
reportDataOptions.ReportId = reportId;
|
||||||
//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();
|
||||||
this.rendering = true;
|
this.jobActive = true;
|
||||||
var reportUrl = null;
|
var reportUrl = null;
|
||||||
try {
|
try {
|
||||||
let jobId = await window.$gz.api.upsert(
|
let jobId = await window.$gz.api.upsert(
|
||||||
@@ -185,6 +140,7 @@ export default {
|
|||||||
}
|
}
|
||||||
jobId = jobId.jobId;
|
jobId = jobId.jobId;
|
||||||
this.jobActive = true;
|
this.jobActive = true;
|
||||||
|
this.jobId = jobId;
|
||||||
|
|
||||||
let jobStatus = 1;
|
let jobStatus = 1;
|
||||||
while (this.jobActive == true) {
|
while (this.jobActive == true) {
|
||||||
@@ -202,7 +158,7 @@ export default {
|
|||||||
throw new Error("Job failed");
|
throw new Error("Job failed");
|
||||||
}
|
}
|
||||||
if (jobStatus == 3) {
|
if (jobStatus == 3) {
|
||||||
this.rendering = false;
|
this.jobActive = false;
|
||||||
//success, get the report url name
|
//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}`
|
||||||
@@ -236,7 +192,7 @@ export default {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.rendering = false;
|
this.jobActive = false;
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
if (reportName != null) {
|
if (reportName != null) {
|
||||||
this.resolve({ name: reportName, id: reportId });
|
this.resolve({ name: reportName, id: reportId });
|
||||||
@@ -244,7 +200,6 @@ export default {
|
|||||||
this.resolve(null);
|
this.resolve(null);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rendering = false;
|
|
||||||
this.jobActive = false;
|
this.jobActive = false;
|
||||||
this.reject(error);
|
this.reject(error);
|
||||||
//window.$gz.errorHandler.handleFormError(error, this);
|
//window.$gz.errorHandler.handleFormError(error, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user