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

Added report results to the home page

This commit is contained in:
Jeremy Stretch
2018-01-30 21:01:08 -05:00
parent 2bb0e65aea
commit 49f268a14c
5 changed files with 21 additions and 5 deletions

View File

@ -15,7 +15,7 @@ from circuits.tables import CircuitTable, ProviderTable
from dcim.filters import DeviceFilter, DeviceTypeFilter, RackFilter, SiteFilter from dcim.filters import DeviceFilter, DeviceTypeFilter, RackFilter, SiteFilter
from dcim.models import ConsolePort, Device, DeviceType, InterfaceConnection, PowerPort, Rack, Site from dcim.models import ConsolePort, Device, DeviceType, InterfaceConnection, PowerPort, Rack, Site
from dcim.tables import DeviceDetailTable, DeviceTypeTable, RackTable, SiteTable from dcim.tables import DeviceDetailTable, DeviceTypeTable, RackTable, SiteTable
from extras.models import TopologyMap, UserAction from extras.models import ReportResult, TopologyMap, UserAction
from ipam.filters import AggregateFilter, IPAddressFilter, PrefixFilter, VLANFilter, VRFFilter from ipam.filters import AggregateFilter, IPAddressFilter, PrefixFilter, VLANFilter, VRFFilter
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
from ipam.tables import AggregateTable, IPAddressTable, PrefixTable, VLANTable, VRFTable from ipam.tables import AggregateTable, IPAddressTable, PrefixTable, VLANTable, VRFTable
@ -177,6 +177,7 @@ class HomeView(View):
'search_form': SearchForm(), 'search_form': SearchForm(),
'stats': stats, 'stats': stats,
'topology_maps': TopologyMap.objects.filter(site__isnull=True), 'topology_maps': TopologyMap.objects.filter(site__isnull=True),
'report_results': ReportResult.objects.order_by('-created')[:10],
'recent_activity': UserAction.objects.select_related('user')[:50] 'recent_activity': UserAction.objects.select_related('user')[:50]
}) })

View File

@ -1,6 +1,6 @@
{% if report.result.failed %} {% if result.failed %}
<label class="label label-danger">Failed</label> <label class="label label-danger">Failed</label>
{% elif report.result %} {% elif result %}
<label class="label label-success">Passed</label> <label class="label label-success">Passed</label>
{% else %} {% else %}
<label class="label label-default">N/A</label> <label class="label label-default">N/A</label>

View File

@ -22,7 +22,7 @@
</form> </form>
</div> </div>
{% endif %} {% endif %}
<h1>{{ report.name }}{% include 'extras/inc/report_label.html' %}</h1> <h1>{{ report.name }}{% include 'extras/inc/report_label.html' with result=report.result %}</h1>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{% if report.description %} {% if report.description %}

View File

@ -24,7 +24,7 @@
<a href="{% url 'extras:report' name=report.full_name %}" name="report.{{ report.name }}"><strong>{{ report.name }}</strong></a> <a href="{% url 'extras:report' name=report.full_name %}" name="report.{{ report.name }}"><strong>{{ report.name }}</strong></a>
</td> </td>
<td> <td>
{% include 'extras/inc/report_label.html' %} {% include 'extras/inc/report_label.html' with result=report.result %}
</td> </td>
<td>{{ report.description|default:"" }}</td> <td>{{ report.description|default:"" }}</td>
{% if report.result %} {% if report.result %}

View File

@ -150,6 +150,21 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% if report_results %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Reports</strong>
</div>
<table class="table table-hover panel-body">
{% for result in report_results %}
<span>
<td><a href="{% url 'extras:report' name=result.report %}">{{ result.report }}</a></td>
<td class="text-right"><span title="{{ result.created }}">{% include 'extras/inc/report_label.html' %}</span></td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Recent Activity</strong> <strong>Recent Activity</strong>