mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add Cable count to home page (#2556)
* Add stats.cable_count * Add Cable count to home page
This commit is contained in:
@ -14,7 +14,7 @@ from dcim.filters import (
|
||||
DeviceFilter, DeviceTypeFilter, RackFilter, RackGroupFilter, SiteFilter, VirtualChassisFilter
|
||||
)
|
||||
from dcim.models import (
|
||||
ConsolePort, Device, DeviceType, Interface, PowerPort, Rack, RackGroup, Site, VirtualChassis
|
||||
Cable, ConsolePort, Device, DeviceType, Interface, PowerPort, Rack, RackGroup, Site, VirtualChassis
|
||||
)
|
||||
from dcim.tables import (
|
||||
DeviceDetailTable, DeviceTypeTable, RackTable, RackGroupTable, SiteTable, VirtualChassisTable
|
||||
@ -166,6 +166,7 @@ class HomeView(View):
|
||||
_connected_interface__isnull=False,
|
||||
pk__lt=F('_connected_interface')
|
||||
)
|
||||
cables = Cable.objects.all()
|
||||
|
||||
stats = {
|
||||
|
||||
@ -177,6 +178,7 @@ class HomeView(View):
|
||||
'rack_count': Rack.objects.count(),
|
||||
'device_count': Device.objects.count(),
|
||||
'interface_connections_count': connected_interfaces.count(),
|
||||
'cable_count': cables.count(),
|
||||
'console_connections_count': connected_consoleports.count(),
|
||||
'power_connections_count': connected_powerports.count(),
|
||||
|
||||
|
@ -39,6 +39,8 @@
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Connections</h4>
|
||||
<span class="badge pull-right">{{ stats.cable_count }}</span>
|
||||
<p style="padding-left: 20px;"><a href="{% url 'dcim:cable_list' %}">Cables</a></p>
|
||||
<span class="badge pull-right">{{ stats.interface_connections_count }}</span>
|
||||
<p style="padding-left: 20px;"><a href="{% url 'dcim:interface_connections_list' %}">Interfaces</a></p>
|
||||
<span class="badge pull-right">{{ stats.console_connections_count }}</span>
|
||||
|
Reference in New Issue
Block a user