mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 09:28:38 -06:00
Added 'recent activity' panel to home view
This commit is contained in:
parent
cb8e0c93f2
commit
199bc57932
@ -2,6 +2,7 @@ from django.shortcuts import render
|
|||||||
|
|
||||||
from circuits.models import Provider, Circuit
|
from circuits.models import Provider, Circuit
|
||||||
from dcim.models import Site, Rack, Device, ConsolePort, PowerPort, InterfaceConnection
|
from dcim.models import Site, Rack, Device, ConsolePort, PowerPort, InterfaceConnection
|
||||||
|
from extras.models import UserAction
|
||||||
from ipam.models import Aggregate, Prefix, IPAddress, VLAN
|
from ipam.models import Aggregate, Prefix, IPAddress, VLAN
|
||||||
from secrets.models import Secret
|
from secrets.models import Secret
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ def home(request):
|
|||||||
|
|
||||||
return render(request, 'home.html', {
|
return render(request, 'home.html', {
|
||||||
'stats': stats,
|
'stats': stats,
|
||||||
|
'recent_activity': UserAction.objects.all()[:20]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +79,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if perms.secrets %}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<strong>Secrets</strong>
|
||||||
|
</div>
|
||||||
|
<div class="list-group">
|
||||||
|
<div class="list-group-item">
|
||||||
|
<span class="badge pull-right">{{ stats.secret_count }}</span>
|
||||||
|
<h4 class="list-group-item-heading"><a href="{% url 'secrets:secret_list' %}">Secrets</a></h4>
|
||||||
|
<p class="list-group-item-text text-muted">Sensitive data (such as passwords) which has been stored securely</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
@ -108,8 +122,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<strong>Circuits</strong>
|
<strong>Circuits</strong>
|
||||||
@ -127,20 +139,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if perms.secrets %}
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="col-md-4">
|
||||||
<div class="panel-heading">
|
<div class="panel panel-default">
|
||||||
<strong>Secrets</strong>
|
<div class="panel-heading">
|
||||||
</div>
|
<strong>Recent Activity</strong>
|
||||||
<div class="list-group">
|
|
||||||
<div class="list-group-item">
|
|
||||||
<span class="badge pull-right">{{ stats.secret_count }}</span>
|
|
||||||
<h4 class="list-group-item-heading"><a href="{% url 'secrets:secret_list' %}">Secrets</a></h4>
|
|
||||||
<p class="list-group-item-text text-muted">Sensitive data (such as passwords) which has been stored securely</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
<table class="table table-hover panel-body">
|
||||||
|
{% for a in recent_activity %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ a.time|date:"Y-m-d H:i" }}</td>
|
||||||
|
<td>{{ a.user }}</td>
|
||||||
|
<td>{{ a.message|safe }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user