From dbaeedcef31153a233f54a38d6f0faf771a8513e Mon Sep 17 00:00:00 2001 From: marvindoering Date: Mon, 15 Feb 2021 09:19:50 +0100 Subject: [PATCH] - Fixed issue with download button not working. - Set button to only be active once the document has been validated. - Fixed issue where the report was simple text and not readable html. --- src/main/resources/gui/README.md | 2 +- src/main/resources/gui/index.html | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/resources/gui/README.md b/src/main/resources/gui/README.md index 144d2fb..a4e627e 100644 --- a/src/main/resources/gui/README.md +++ b/src/main/resources/gui/README.md @@ -13,7 +13,7 @@ View [validator configuration](/server/config) or - +
diff --git a/src/main/resources/gui/index.html b/src/main/resources/gui/index.html index b8d1ff4..560102f 100644 --- a/src/main/resources/gui/index.html +++ b/src/main/resources/gui/index.html @@ -42,9 +42,10 @@ var report; - var validate = function () { + var validate = function validate() { const input = document.getElementById('file'); const output = document.getElementById('result'); + const download = document.getElementById('dwn-btn'); var headers = new Headers(); headers.append('Content-Type', 'application/xml'); @@ -58,12 +59,16 @@ fetch('/', requestOptions) .then(response => response.text()) - .then(result => output.innerText = result) + .then(result => { + output.innerHTML = result; + report = result; + download.disabled = false; + }) .catch(error => output.innerText = result); return false; }; - var reporting = function() { + var reporting = function reporting() { var filename = "report.html"; var element = document.createElement('a'); @@ -76,7 +81,7 @@ element.click(); document.body.removeChild(element); - } + };