mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Add Cable count to home page (#2556)
* Add stats.cable_count * Add Cable count to home page
This commit is contained in:
parent
f61cea695b
commit
c063961e4a
@ -14,7 +14,7 @@ from dcim.filters import (
|
|||||||
DeviceFilter, DeviceTypeFilter, RackFilter, RackGroupFilter, SiteFilter, VirtualChassisFilter
|
DeviceFilter, DeviceTypeFilter, RackFilter, RackGroupFilter, SiteFilter, VirtualChassisFilter
|
||||||
)
|
)
|
||||||
from dcim.models import (
|
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 (
|
from dcim.tables import (
|
||||||
DeviceDetailTable, DeviceTypeTable, RackTable, RackGroupTable, SiteTable, VirtualChassisTable
|
DeviceDetailTable, DeviceTypeTable, RackTable, RackGroupTable, SiteTable, VirtualChassisTable
|
||||||
@ -166,6 +166,7 @@ class HomeView(View):
|
|||||||
_connected_interface__isnull=False,
|
_connected_interface__isnull=False,
|
||||||
pk__lt=F('_connected_interface')
|
pk__lt=F('_connected_interface')
|
||||||
)
|
)
|
||||||
|
cables = Cable.objects.all()
|
||||||
|
|
||||||
stats = {
|
stats = {
|
||||||
|
|
||||||
@ -177,6 +178,7 @@ class HomeView(View):
|
|||||||
'rack_count': Rack.objects.count(),
|
'rack_count': Rack.objects.count(),
|
||||||
'device_count': Device.objects.count(),
|
'device_count': Device.objects.count(),
|
||||||
'interface_connections_count': connected_interfaces.count(),
|
'interface_connections_count': connected_interfaces.count(),
|
||||||
|
'cable_count': cables.count(),
|
||||||
'console_connections_count': connected_consoleports.count(),
|
'console_connections_count': connected_consoleports.count(),
|
||||||
'power_connections_count': connected_powerports.count(),
|
'power_connections_count': connected_powerports.count(),
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
<h4 class="list-group-item-heading">Connections</h4>
|
<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>
|
<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>
|
<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>
|
<span class="badge pull-right">{{ stats.console_connections_count }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user