1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

87 lines
3.1 KiB
HTML
Raw Normal View History

{% extends 'base/layout.html' %}
{% load buttons %}
2019-08-09 12:33:33 -04:00
{% load helpers %}
2021-04-16 14:58:44 -07:00
{% block title %}Scripts{% endblock %}
{% block controls %}
<div class="controls">
<div class="control-group">
{% block extra_controls %}{% endblock %}
{% add_button model %}
</div>
</div>
{% endblock controls %}
2021-11-12 14:44:14 -05:00
{% block tabs %}
<ul class="nav nav-tabs px-3">
<li class="nav-item" role="presentation">
<a class="nav-link active" role="tab">Scripts</a>
</li>
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% for module in script_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_scriptmodule %}
<div class="float-end">
<a href="{% url 'extras:scriptmodule_delete' pk=module.pk %}" class="btn btn-danger btn-sm">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete
</a>
</div>
{% endif %}
<i class="mdi mdi-file-document-outline"></i> {{ module.name|bettertitle }}
</h5>
<div class="card-body">
{% include 'inc/sync_warning.html' with object=module %}
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th width="250">Name</th>
<th>Description</th>
<th>Last Run</th>
<th class="text-end">Status</th>
</tr>
</thead>
<tbody>
{% for script_name, script_class in module.scripts.items %}
{% with last_result=jobs|get_key:script_class.full_name %}
2021-11-12 14:44:14 -05:00
<tr>
<td>
<a href="{% url 'extras:script' module=module.path name=script_name %}" name="script.{{ script_name }}">{{ script_class.name }}</a>
2021-11-12 14:44:14 -05:00
</td>
<td>
{{ script_class.Meta.description|markdown|placeholder }}
2021-11-12 14:44:14 -05:00
</td>
{% if last_result %}
<td>
<a href="{% url 'extras:script_result' job_pk=last_result.pk %}">{{ last_result.created|annotated_date }}</a>
</td>
2021-11-12 14:44:14 -05:00
<td class="text-end">
{% badge last_result.get_status_display last_result.get_status_color %}
2021-11-12 14:44:14 -05:00
</td>
{% else %}
<td class="text-muted">Never</td>
<td class="text-end">{{ ''|placeholder }}</td>
2021-11-12 14:44:14 -05:00
{% endif %}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
2020-07-06 01:58:28 -04:00
</div>
</div>
{% empty %}
2021-11-12 14:44:14 -05:00
<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>
{% endfor %}
2021-11-12 14:44:14 -05:00
</div>
{% endblock content-wrapper %}