Added a download button to GUI in order to download reports easily#79
Added a download button to GUI in order to download reports easily#79marvindoering wants to merge 4 commits intoitplr-kosit:old_masterfrom
Conversation
- Set button to only be active once the document has been validated. - Fixed issue where the report was simple text and not readable html.
apenski
left a comment
There was a problem hiding this comment.
thank you for your PR. I have a few questions and change requests. I am no JS expert though
src/main/resources/gui/index.html
Outdated
| .then(response => response.text()) | ||
| .then(result => output.innerText = result) | ||
| .then(result => { | ||
| output.innerHTML = result; |
There was a problem hiding this comment.
I am not a javascript expert, but why change from innerText to innerHTML here? Doesn't it work with innerText? I mean with innerText security should be high
There was a problem hiding this comment.
Well the problem with innerText is that the result won't actually be displayed on the result page. Its only showing the text which than you will need to put in a html file to actually see the result of the validation. I dont know if this is wanted but for a 0815 user this would be easier to validate their XRechnungen.
There was a problem hiding this comment.
Well, then I want definetely innerText! The report isn't html, only can contain html. If you want to display the html parts, we need a different solution and I am not sure whether this is in scope of the validator gui.
There was a problem hiding this comment.
Changed back to innerText. Now the report data gets extracted from the div-box like you required it.
src/main/resources/gui/index.html
Outdated
| <body> | ||
| <script type="text/javascript"> | ||
|
|
||
| var report; |
There was a problem hiding this comment.
Why storing the report into variable? Isn't better to capture the report from the "result"-element if neccessary?
There was a problem hiding this comment.
Yeah, that can be done but only if the result-element contains actual HTML and not "innerText" otherwise you will be seeing the HTML as text and not as an actual HTML page. And the variable is global which means it can be accessed by other functions.
There was a problem hiding this comment.
I want to see it as text because it's XML not html
There was a problem hiding this comment.
Changed back to innerText. Now the report data gets extracted from the div-box like you required it.
src/main/resources/gui/index.html
Outdated
| .then(result => { | ||
| output.innerHTML = result; | ||
| report = result; | ||
| download.disabled = false; |
There was a problem hiding this comment.
This should be disabled prior request then, or not?
There was a problem hiding this comment.
Actually "download.disabled = false" activates the button. The button is disabled at start. See in README.md Line 16
<input type="button" id="dwn-btn" value="Download Report" onclick="return reporting();" disabled>
There was a problem hiding this comment.
I had a second submit in mind, with a long processing time. Is your implementation safe then? (not double checked it)
There was a problem hiding this comment.
I implemented a check to the javascript that should prevent downloading if there is not data.
There was a problem hiding this comment.
Sorry for not reviewing for long time. I wanted to prepare a release and put this into it. I checked your implementation and noticed just now that only focus on included html. I guess your are - as most of the users - using the validator with xrechnung configuration and then it makes sense to somehow extract the included html fragments.
But including html fragments into the report is a decission xrechnung validator configuration project did. The validator does not know about "embedded" reports/html. And since we have other configurations as well, extracting/downloading only parts of the report wouldn't make sense. Only downloading the complete report would.
- Changed back to innerText on output - replaced global var report and extracted info for download from div - put another check on the download button to insure that the report can only be downloaded once data is available


Hey,
the GUI is awesome; but is missing one key part. A download button which allows users to download the report more easily.
New pull request because these topics had to be fixed:
Greetings
Marvin