From 5303d2c16d184676299212b369dc89e1e570f5eb Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 19 Apr 2019 14:27:19 -0400 Subject: [PATCH] Add device types and power feeds to home page --- netbox/netbox/views.py | 2 ++ netbox/templates/home.html | 61 +++++++++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/netbox/netbox/views.py b/netbox/netbox/views.py index ae6d8a28d..e16fd9c49 100644 --- a/netbox/netbox/views.py +++ b/netbox/netbox/views.py @@ -193,11 +193,13 @@ class HomeView(View): # DCIM 'rack_count': Rack.objects.count(), + 'devicetype_count': DeviceType.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(), + 'powerfeed_count': PowerFeed.objects.count(), # IPAM 'vrf_count': VRF.objects.count(), diff --git a/netbox/templates/home.html b/netbox/templates/home.html index 25b22d6f0..bc00d4a28 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -47,6 +47,16 @@ {% endif %}

Equipment racks, optionally organized by group

+
+ {% if perms.dcim.view_devicetype %} + {{ stats.devicetype_count }} +

Device Types

+ {% else %} + +

Device Types

+ {% endif %} +

Physical hardware models by manufacturer

+
{% if perms.dcim.view_device %} {{ stats.device_count }} @@ -92,28 +102,35 @@
- Virtualization + Power
- {% if perms.virtualization.view_cluster %} - {{ stats.cluster_count }} -

Clusters

+ {% if perms.dcim.view_powerfeed %} + {{ stats.powerfeed_count }} +

Power Feeds

{% else %} -

Clusters

+

Power Feeds

{% endif %} -

Clusters of physical hosts in which VMs reside

+

Electrical circuits delivering power from panels

+
+
+
+
+ Secrets +
+
- {% if perms.virtualization.view_virtualmachine %} - {{ stats.virtualmachine_count }} -

Virtual Machines

+ {% if perms.secrets.view_secret %} + {{ stats.secret_count }} +

Secrets

{% else %} -

Virtual Machines

+

Secrets

{% endif %} -

Virtual compute instances running inside clusters

+

Cryptographically secured secret data

@@ -205,18 +222,28 @@
- Secrets + Virtualization
- {% if perms.secrets.view_secret %} - {{ stats.secret_count }} -

Secrets

+ {% if perms.virtualization.view_cluster %} + {{ stats.cluster_count }} +

Clusters

{% else %} -

Secrets

+

Clusters

{% endif %} -

Sensitive data (such as passwords) which has been stored securely

+

Clusters of physical hosts in which VMs reside

+
+
+ {% if perms.virtualization.view_virtualmachine %} + {{ stats.virtualmachine_count }} +

Virtual Machines

+ {% else %} + +

Virtual Machines

+ {% endif %} +

Virtual compute instances running inside clusters