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

116 lines
4.6 KiB
HTML
Raw Normal View History

{% extends 'base/layout.html' %}
{% load buttons %}
2017-09-21 16:32:05 -04:00
{% load helpers %}
{% load perms %}
2017-09-21 16:32:05 -04:00
2021-04-16 14:58:44 -07:00
{% block title %}Reports{% endblock %}
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">Reports</a>
</li>
</ul>
{% endblock tabs %}
{% 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 content-wrapper %}
<div class="tab-content">
{% for module in report_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_reportmodule %}
<div class="float-end">
<a href="{% url 'extras:reportmodule_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>Status</th>
<th width="120"></th>
</tr>
</thead>
<tbody>
{% for report_name, report in module.reports.items %}
{% with last_result=jobs|get_key:report.full_name %}
2021-11-12 14:44:14 -05:00
<tr>
<td>
<a href="{% url 'extras:report' module=module.path name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a>
2021-11-12 14:44:14 -05:00
</td>
<td>{{ report.description|markdown|placeholder }}</td>
{% if last_result %}
<td>
<a href="{% url 'extras:report_result' job_pk=last_result.pk %}">{{ last_result.created|annotated_date }}</a>
</td>
<td>
{% badge last_result.get_status_display last_result.get_status_color %}
</td>
{% else %}
<td class="text-muted">Never</td>
<td>{{ ''|placeholder }}</td>
{% endif %}
2021-11-12 14:44:14 -05:00
<td>
{% if perms.extras.run_report %}
<div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary btn-sm" style="width: 110px">
{% if last_result %}
2021-11-12 14:44:14 -05:00
<i class="mdi mdi-replay"></i> Run Again
{% else %}
<i class="mdi mdi-play"></i> Run Report
{% endif %}
</button>
</form>
2021-04-18 16:42:28 -07:00
</div>
2021-11-12 14:44:14 -05:00
{% endif %}
</td>
</tr>
{% for method, stats in last_result.data.items %}
2021-11-12 14:44:14 -05:00
<tr>
<td colspan="4" class="method">
<span class="ps-3">{{ method }}</span>
</td>
<td class="text-end text-nowrap report-stats">
<span class="badge bg-success">{{ stats.success }}</span>
<span class="badge bg-info">{{ stats.info }}</span>
<span class="badge bg-warning">{{ stats.warning }}</span>
<span class="badge bg-danger">{{ stats.failure }}</span>
</td>
</tr>
{% endfor %}
{% endwith %}
{% endfor %}
</tbody>
</table>
2017-09-25 16:22:50 -04:00
</div>
</div>
{% empty %}
2021-11-12 14:44:14 -05:00
<div class="alert alert-info" role="alert">
<h4 class="alert-heading">No Reports Found</h4>
Reports should be saved to <code>{{ settings.REPORTS_ROOT }}</code>.
<hr/>
<small>This path can be changed by setting <code>REPORTS_ROOT</code> in NetBox's configuration.</small>
</div>
{% endfor %}
2021-11-12 14:44:14 -05:00
</div>
{% endblock content-wrapper %}