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

Replaced home page user activity with changelog

This commit is contained in:
Jeremy Stretch
2018-07-03 14:07:46 -04:00
parent 89e196e86d
commit d1c9a18d04
2 changed files with 26 additions and 9 deletions

View File

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

View File

@ -157,7 +157,7 @@
</div>
<table class="table table-hover panel-body">
{% for result in report_results %}
<span>
<tr>
<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>
@ -167,14 +167,31 @@
{% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Recent Activity</strong>
<strong>Changelog</strong>
</div>
<div class="list-group">
{% for a in recent_activity %}
<div class="list-group-item">
{{ a.icon }} {{ a.message|safe }}<br />
<small class="text-muted">{{ a.user }} - {{ a.time|date:'SHORT_DATETIME_FORMAT' }}</small>
</div>
{% for change in changelog %}
{% with action=change.get_action_display|lower %}
<div class="list-group-item">
{% if action == 'created' %}
<span class="label label-success"><i class="fa fa-plus"></i></span>
{% elif action == 'updated' %}
<span class="label label-warning"><i class="fa fa-pencil"></i></span>
{% elif action == 'deleted' %}
<span class="label label-danger"><i class="fa fa-trash"></i></span>
{% endif %}
{% if change.changed_object.get_absolute_url %}
<a href="{{ change.changed_object.get_absolute_url }}">{{ change.changed_object }}</a>
{% else %}
{{ change.changed_object|default:change.object_repr }}
{% endif %}
<br />
<small>
<span class="text-muted">{{ change.user|default:change.user_name }} -</span>
<a href="{{ change.get_absolute_url }}" class="text-muted">{{ change.time|date:'SHORT_DATETIME_FORMAT' }}</a>
</small>
</div>
{% endwith %}
{% empty %}
<div class="list-group-item">
Welcome to NetBox! {% if perms.add_site %} <a href="{% url 'dcim:site_add' %}">Add a site</a> to get started.{% endif %}