Fixes: #19492: Add Save Button to Script Output Window (#19721)

* Add condition to ScriptResultView.get function to generate a download
file of job output if job is completed

* Update template script_result.html adding a download button to trigger
output download in ScriptResultView.get

* Simplify conditional logic; tweak timestamp format

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Omripresent
2025-06-19 13:31:54 -04:00
committed by GitHub
parent c660f1c019
commit 7dab7d730d
2 changed files with 20 additions and 2 deletions

View File

@@ -53,7 +53,16 @@
{# Script output. Legacy reports will not have this. #}
{% if 'output' in job.data %}
<div class="card mb-3">
<h2 class="card-header">{% trans "Output" %}</h2>
<h2 class="card-header d-flex justify-content-between">
{% trans "Output" %}
{% if job.completed %}
<div>
<a href="?export=output" class="btn btn-primary lh-1" role="button">
<i class="mdi mdi-download" aria-hidden="true"></i> {% trans "Download" %}
</a>
</div>
{% endif %}
</h2>
{% if job.data.output %}
<pre class="card-body font-monospace">{{ job.data.output }}</pre>
{% else %}