From 199bc57932c98c594187cde8ebcc2edd94590f49 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 23 May 2016 14:32:53 -0400 Subject: [PATCH] Added 'recent activity' panel to home view --- netbox/netbox/views.py | 2 ++ netbox/templates/home.html | 44 +++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/netbox/netbox/views.py b/netbox/netbox/views.py index a88361e3f..e0ce6803c 100644 --- a/netbox/netbox/views.py +++ b/netbox/netbox/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render from circuits.models import Provider, Circuit from dcim.models import Site, Rack, Device, ConsolePort, PowerPort, InterfaceConnection +from extras.models import UserAction from ipam.models import Aggregate, Prefix, IPAddress, VLAN from secrets.models import Secret @@ -35,6 +36,7 @@ def home(request): return render(request, 'home.html', { 'stats': stats, + 'recent_activity': UserAction.objects.all()[:20] }) diff --git a/netbox/templates/home.html b/netbox/templates/home.html index d22c31e83..ccdb2cbd2 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -79,6 +79,20 @@ + {% if perms.secrets %} +
+
+ Secrets +
+
+
+ {{ stats.secret_count }} +

Secrets

+

Sensitive data (such as passwords) which has been stored securely

+
+
+
+ {% endif %}
@@ -108,8 +122,6 @@
- -
Circuits @@ -127,20 +139,22 @@
- {% if perms.secrets %} -
-
- Secrets -
-
-
- {{ stats.secret_count }} -

Secrets

-

Sensitive data (such as passwords) which has been stored securely

-
-
+
+
+
+
+ Recent Activity
- {% endif %} + + {% for a in recent_activity %} + + + + + + {% endfor %} +
{{ a.time|date:"Y-m-d H:i" }}{{ a.user }}{{ a.message|safe }}
+
{% endblock %}