mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 12:06:53 -06:00
Fixes #61: Added list of RackGroups to Site view
This commit is contained in:
parent
fdfc32899d
commit
8b357a311d
@ -75,11 +75,13 @@ def site(request, slug):
|
|||||||
'vlan_count': VLAN.objects.filter(site=site).count(),
|
'vlan_count': VLAN.objects.filter(site=site).count(),
|
||||||
'circuit_count': Circuit.objects.filter(site=site).count(),
|
'circuit_count': Circuit.objects.filter(site=site).count(),
|
||||||
}
|
}
|
||||||
|
rack_groups = RackGroup.objects.filter(site=site).annotate(rack_count=Count('racks'))
|
||||||
topology_maps = TopologyMap.objects.filter(site=site)
|
topology_maps = TopologyMap.objects.filter(site=site)
|
||||||
|
|
||||||
return render(request, 'dcim/site.html', {
|
return render(request, 'dcim/site.html', {
|
||||||
'site': site,
|
'site': site,
|
||||||
'stats': stats,
|
'stats': stats,
|
||||||
|
'rack_groups': rack_groups,
|
||||||
'topology_maps': topology_maps,
|
'topology_maps': topology_maps,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -124,6 +124,25 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<strong>Rack Groups</strong>
|
||||||
|
</div>
|
||||||
|
{% if rack_groups %}
|
||||||
|
<table class="table table-hover panel-body">
|
||||||
|
{% for rg in rack_groups %}
|
||||||
|
<tr>
|
||||||
|
<td><i class="fa fa-fw fa-folder"></i> <a href="{{ rg.get_absolute_url }}">{{ rg.name }}</a></td>
|
||||||
|
<td>{{ rg.rack_count }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="panel-body text-muted">
|
||||||
|
None
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<strong>Topology Maps</strong>
|
<strong>Topology Maps</strong>
|
||||||
@ -132,7 +151,7 @@
|
|||||||
<table class="table table-hover panel-body">
|
<table class="table table-hover panel-body">
|
||||||
{% for tm in topology_maps %}
|
{% for tm in topology_maps %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><i class="fa fa-fw fa-map text-success"></i> <a href="{% url 'dcim-api:topology_map' slug=tm.slug %}" target="_blank">{{ tm }}</a></td>
|
<td><i class="fa fa-fw fa-map"></i> <a href="{% url 'dcim-api:topology_map' slug=tm.slug %}" target="_blank">{{ tm }}</a></td>
|
||||||
<td>{{ tm.description }}</td>
|
<td>{{ tm.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user