Skip to content

Commit

Permalink
Fix _fetchTemplateInfosAsync method in PrintingInfosAnalyzer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasstein committed Mar 15, 2022
1 parent 31cdc3d commit 7edaeb9
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/main/js/bundles/dn_printingenhanced/PrintingInfosAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,23 @@ export default class PrintingInfosAnalyzer {
const outputParamName = properties.layoutTemplatesInfoTaskResultParameter || "Output_JSON";
return new Promise((resolve, reject) => {
gp.submitJob({}).then((jobInfo) => {
if (jobInfo.jobStatus === "job-succeeded") {
gp.getResultData(jobInfo.jobId, outputParamName).then((results) => {
resolve(results.value);
});
} else if (jobInfo.jobStatus === "job-failed") {
reject(jobInfo.messages[0]);
}
const jobId = jobInfo.jobId;
const options = {
interval: 1000,
statusCallback: (j) => {
console.info("Get Layout Templates Info Task Job Status: ", j.jobStatus);
}
};

gp.waitForJobCompletion(jobId, options).then((jobInfo) => {
if (jobInfo.jobStatus === "job-succeeded") {
gp.getResultData(jobInfo.jobId, outputParamName).then((results) => {
resolve(results.value);
});
} else if (jobInfo.jobStatus === "job-failed") {
reject(jobInfo.messages[0]);
}
});
});
});
}
Expand Down

0 comments on commit 7edaeb9

Please sign in to comment.