From f5c5a74c717f2a1a294cb0d11345000c84ee6029 Mon Sep 17 00:00:00 2001 From: Michael Winsauer Date: Sun, 20 Jan 2019 20:37:13 +0100 Subject: [PATCH] Minor code cleanup, added prop types --- service-website/src/components/PdfReport.js | 13 ++++---- .../src/components/SentimentAnalysis.js | 31 +++++++++---------- .../src/services/CamundaService.js | 27 ++++++++-------- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/service-website/src/components/PdfReport.js b/service-website/src/components/PdfReport.js index 3a1c63c..1aea6f8 100644 --- a/service-website/src/components/PdfReport.js +++ b/service-website/src/components/PdfReport.js @@ -8,14 +8,14 @@ const PdfReport = ({pdfLink, loading}) => { Download PDF report ); - } else if (loading){ + } else if (loading) { return (
-
-
-
-
-
+
+
+
+
+
); } else { @@ -25,6 +25,7 @@ const PdfReport = ({pdfLink, loading}) => { PdfReport.propTypes = { pdfLink: PropTypes.string, + loading: PropTypes.bool.isRequired, }; export default PdfReport; diff --git a/service-website/src/components/SentimentAnalysis.js b/service-website/src/components/SentimentAnalysis.js index 8cf5f04..eef730d 100644 --- a/service-website/src/components/SentimentAnalysis.js +++ b/service-website/src/components/SentimentAnalysis.js @@ -39,7 +39,6 @@ class SentimentAnalysis extends Component { }); this.createPdf(); this.emptyTerms(); - } handleTermChange(id, value) { @@ -99,21 +98,21 @@ class SentimentAnalysis extends Component {
-
- Search Terms: - - -

- -

-

- -

-
- +
+ Search Terms: + + +

+ +

+

+ +

+
+
diff --git a/service-website/src/services/CamundaService.js b/service-website/src/services/CamundaService.js index 44053e6..e4e5cef 100644 --- a/service-website/src/services/CamundaService.js +++ b/service-website/src/services/CamundaService.js @@ -8,6 +8,7 @@ class CamundaService { baseURL: this.baseUrl, }); this.submitPdfForm = this.submitPdfForm.bind(this); + this.delay = this.delay.bind(this); this.getPdfDownloadLink = this.getPdfDownloadLink.bind(this); this.completeTask = this.completeTask.bind(this); } @@ -41,28 +42,26 @@ class CamundaService { } delay(ms) { - return new Promise(function (resolve, reject) { + return new Promise((resolve, reject) => { setTimeout(resolve, ms); }); } getPdfDownloadLink(id) { - const downloadUrl = this.baseUrl + 'process-instance/' + id + '/variables/reportPDF/data'; - console.log('download: ' + downloadUrl); + const downloadUrl = this.baseUrl + 'process-instance/' + id + '/variables/reportPDF/data'; + console.log('download: ' + downloadUrl); - this.axiosInstance - .get(downloadUrl) - .then(response => { - this.callback(downloadUrl); - }) - .catch(error => { - this.delay(5000) + this.axiosInstance + .get(downloadUrl) + .then(response => { + this.callback(downloadUrl); + }) + .catch(error => { + this.delay(5000) .then(() => { this.getPdfDownloadLink(id); - }); - - }) - + }); + }) } completeTask(id) { -- 2.43.0