1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
2021-08-13 09:43:23 -04:00

77 lines
3.7 KiB
HTML

{% extends 'base/layout.html' %}
{% load helpers %}
{% block title %}Scripts{% endblock %}
{% block content %}
<div class="row">
<div class="col col-md-9">
{% if scripts %}
{% for module, module_scripts in scripts.items %}
<h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3>
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Description</th>
<th class="text-end">Last Run</th>
</tr>
</thead>
<tbody>
{% for class_name, script in module_scripts.items %}
<tr>
<td>
<a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}">{{ script }}</a>
</td>
<td>
{% include 'extras/inc/job_label.html' with result=script.result %}
</td>
<td>{{ script.Meta.description|render_markdown }}</td>
{% if script.result %}
<td class="text-end">
<a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created|annotated_date }}</a>
</td>
{% else %}
<td class="text-end text-muted">Never</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{% else %}
<div class="alert alert-info">
<h4 class="alert-heading">No Scripts Found</h4>
Scripts should be saved to <code>{{ settings.SCRIPTS_ROOT }}</code>.
<hr/>
This path can be changed by setting <code>SCRIPTS_ROOT</code> in NetBox's configuration.
</div>
{% endif %}
</div>
<div class="col col-md-3">
{% if scripts %}
<div class="card">
<div class="card-body">
{% for module, module_scripts in scripts.items %}
<h5>{{ module|bettertitle }}</h5>
<div class="small mb-2">
<ul class="list-group list-group-flush">
{% for class_name, script in module_scripts.items %}
<a href="#script.{{ class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ script.name }}
<div class="float-end">
{% include 'extras/inc/job_label.html' with result=script.result %}
</div>
</a>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}