mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +00:00
Added a download button to GUI in order to download reports easily
This commit is contained in:
parent
7ff5287a23
commit
65a988f13b
2 changed files with 16 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ View [validator configuration](/server/config) or <a href="/server/health" targe
|
||||||
<div>
|
<div>
|
||||||
<label for="file">Choose a file</label>
|
<label for="file">Choose a file</label>
|
||||||
<input type="file" id="file" name="myFile">
|
<input type="file" id="file" name="myFile">
|
||||||
<input type="submit" id="submit" value="Validate" onclick="return validate();">
|
<input type="submit" id="submit" value="Validate" onclick="return validate();"><input type="button" id="dwn-btn" value="Download Report" onclick="return reporting();">
|
||||||
</div>
|
</div>
|
||||||
<div id="result"></div>
|
<div id="result"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var report;
|
||||||
|
|
||||||
var validate = function () {
|
var validate = function () {
|
||||||
const input = document.getElementById('file');
|
const input = document.getElementById('file');
|
||||||
|
|
@ -62,6 +63,20 @@
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var reporting = function() {
|
||||||
|
var filename = "report.html";
|
||||||
|
|
||||||
|
var element = document.createElement('a');
|
||||||
|
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(report));
|
||||||
|
element.setAttribute('download', filename);
|
||||||
|
|
||||||
|
element.style.display = 'none';
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
document.body.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue