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

Closes #6125: Add locations count to home page

This commit is contained in:
jeremystretch
2021-04-09 09:47:34 -04:00
parent 9e62d1ad8f
commit 6efe54aa88
3 changed files with 14 additions and 2 deletions

View File

@ -6,6 +6,7 @@
* [#6097](https://github.com/netbox-community/netbox/issues/6097) - Redirect old slug-based object views * [#6097](https://github.com/netbox-community/netbox/issues/6097) - Redirect old slug-based object views
* [#6109](https://github.com/netbox-community/netbox/issues/6109) - Add device counts to locations table * [#6109](https://github.com/netbox-community/netbox/issues/6109) - Add device counts to locations table
* [#6125](https://github.com/netbox-community/netbox/issues/6125) - Add locations count to home page
### Bug Fixes (from Beta) ### Bug Fixes (from Beta)

View File

@ -16,7 +16,7 @@ from packaging import version
from circuits.models import Circuit, Provider from circuits.models import Circuit, Provider
from dcim.models import ( from dcim.models import (
Cable, ConsolePort, Device, DeviceType, Interface, PowerPanel, PowerFeed, PowerPort, Rack, Site, Cable, ConsolePort, Device, DeviceType, Interface, Location, PowerPanel, PowerFeed, PowerPort, Rack, Site,
) )
from extras.choices import JobResultStatusChoices from extras.choices import JobResultStatusChoices
from extras.models import ObjectChange, JobResult from extras.models import ObjectChange, JobResult
@ -56,6 +56,7 @@ class HomeView(View):
# Organization # Organization
'site_count': Site.objects.restrict(request.user, 'view').count(), 'site_count': Site.objects.restrict(request.user, 'view').count(),
'location_count': Location.objects.restrict(request.user, 'view').count(),
'tenant_count': Tenant.objects.restrict(request.user, 'view').count(), 'tenant_count': Tenant.objects.restrict(request.user, 'view').count(),
# DCIM # DCIM

View File

@ -31,7 +31,17 @@
<span class="badge pull-right"><i class="mdi mdi-lock"></i></span> <span class="badge pull-right"><i class="mdi mdi-lock"></i></span>
<h4 class="list-group-item-heading">Sites</h4> <h4 class="list-group-item-heading">Sites</h4>
{% endif %} {% endif %}
<p class="list-group-item-text text-muted">Geographic locations</p> <p class="list-group-item-text text-muted">Discrete points of presence</p>
</div>
<div class="list-group-item">
{% if perms.dcim.view_location %}
<span class="badge pull-right">{{ stats.location_count }}</span>
<h4 class="list-group-item-heading"><a href="{% url 'dcim:location_list' %}">Locations</a></h4>
{% else %}
<span class="badge pull-right"><i class="mdi mdi-lock"></i></span>
<h4 class="list-group-item-heading">Locations</h4>
{% endif %}
<p class="list-group-item-text text-muted">Locations within sites</p>
</div> </div>
<div class="list-group-item"> <div class="list-group-item">
{% if perms.tenancy.view_tenant %} {% if perms.tenancy.view_tenant %}