2019-08-09 12:33:33 -04:00
{% extends '_base.html' %}
{% load helpers %}
{% load form_helpers %}
{% load log_levels %}
{% block title %}{{ script }}{% endblock %}
{% block content %}
< div class = "row noprint" >
< div class = "col-md-12" >
< ol class = "breadcrumb" >
< li > < a href = "{% url 'extras:script_list' %}" > Scripts< / a > < / li >
< li > < a href = "{% url 'extras:script_list' %}#module.{{ module }}" > {{ module|bettertitle }}< / a > < / li >
< li > {{ script }}< / li >
< / ol >
< / div >
< / div >
< h1 > {{ script }}< / h1 >
2019-08-12 13:16:18 -04:00
< p > {{ script.Meta.description }}< / p >
2019-08-09 12:33:33 -04:00
< ul class = "nav nav-tabs" role = "tablist" >
< li role = "presentation" class = "active" >
< a href = "#run" role = "tab" data-toggle = "tab" class = "active" > Run< / a >
< / li >
2019-08-09 13:56:37 -04:00
< li role = "presentation" { % if not output % } class = "disabled" { % endif % } >
< a href = "#output" role = "tab" data-toggle = "tab" > Output< / a >
< / li >
2019-08-09 12:33:33 -04:00
< li role = "presentation" >
< a href = "#source" role = "tab" data-toggle = "tab" > Source< / a >
< / li >
< / ul >
< div class = "tab-content" >
< div role = "tabpanel" class = "tab-pane active" id = "run" >
2019-08-14 12:19:36 -04:00
{% if execution_time or script.log %}
2019-08-09 12:33:33 -04:00
< div class = "row" >
< div class = "col-md-12" >
< div class = "panel panel-default" >
< div class = "panel-heading" >
2019-08-14 10:12:30 -04:00
< strong > Script Log< / strong >
2019-08-09 12:33:33 -04:00
< / div >
< table class = "table table-hover panel-body" >
< tr >
< th > Line< / th >
< th > Level< / th >
< th > Message< / th >
< / tr >
{% for level, message in script.log %}
< tr >
< td > {{ forloop.counter }}< / td >
< td > {% log_level level %}< / td >
2019-08-14 14:38:11 -04:00
< td class = "rendered-markdown" > {{ message|gfm }}< / td >
2019-08-09 12:33:33 -04:00
< / tr >
2019-08-14 10:12:30 -04:00
{% empty %}
< tr >
< td colspan = "3" class = "text-center text-muted" >
No log output
< / td >
< / tr >
2019-08-09 12:33:33 -04:00
{% endfor %}
< / table >
2019-08-14 10:12:30 -04:00
< div class = "panel-footer text-right text-muted" >
< small > Exec time: {{ execution_time|floatformat:3 }}s< / small >
< / div >
2019-08-09 12:33:33 -04:00
< / div >
< / div >
< / div >
{% endif %}
< div class = "row" >
2019-08-12 14:28:06 -04:00
< div class = "col-md-6 col-md-offset-3" >
2019-08-12 11:39:36 -04:00
{% if not perms.extras.run_script %}
< div class = "alert alert-warning" >
< i class = "fa fa-warning" > < / i >
You do not have permission to run scripts.
< / div >
{% endif %}
2019-08-14 09:40:23 -04:00
< form action = "" method = "post" class = "form form-horizontal" >
2019-08-09 12:33:33 -04:00
{% csrf_token %}
2019-08-14 10:18:25 -04:00
{% if not form.requires_input %}
< div class = "alert alert-info" >
< i class = "fa fa-exclamation-circle" > < / i >
This script does not require any input to run.
< / div >
2019-08-09 12:33:33 -04:00
{% endif %}
2019-08-14 10:18:25 -04:00
{% render_form form %}
2019-08-09 12:33:33 -04:00
< div class = "pull-right" >
2019-08-12 11:39:36 -04:00
< button type = "submit" name = "_run" class = "btn btn-primary" { % if not perms . extras . run_script % } disabled = "disabled" { % endif % } > < i class = "fa fa-play" > < / i > Run Script< / button >
2019-08-09 12:33:33 -04:00
< a href = "{% url 'extras:script_list' %}" class = "btn btn-default" > Cancel< / a >
< / div >
< / form >
< / div >
< / div >
< / div >
2019-08-09 13:56:37 -04:00
< div role = "tabpanel" class = "tab-pane" id = "output" >
< pre > {{ output }}< / pre >
< / div >
2019-08-09 12:33:33 -04:00
< div role = "tabpanel" class = "tab-pane" id = "source" >
2019-08-12 14:28:06 -04:00
< p > < code > {{ script.filename }}< / code > < / p >
2019-08-09 12:33:33 -04:00
< pre > {{ script.source }}< / pre >
< / div >
< / div >
{% endblock %}