From 91246b0f817888e6bb182df12db60ffd7d777f0e Mon Sep 17 00:00:00 2001 From: checktheroads Date: Mon, 19 Jul 2021 22:01:05 -0700 Subject: [PATCH] Add icons to home stat cards --- netbox/netbox/views/__init__.py | 21 +++++++++++---------- netbox/templates/home.html | 12 +++++++++--- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/netbox/netbox/views/__init__.py b/netbox/netbox/views/__init__.py index 6f7f97a0c..bb24cff5a 100644 --- a/netbox/netbox/views/__init__.py +++ b/netbox/netbox/views/__init__.py @@ -94,17 +94,17 @@ class HomeView(View): ("dcim.view_powerfeed", "Power Feeds", PowerFeed.objects.restrict(request.user, 'view').count), ) sections = ( - ("Organization", org), - ("IPAM", ipam), - ("Virtualization", virtualization), - ("Inventory", dcim), - ("Connections", connections), - ("Circuits", circuits), - ("Power", power), + ("Organization", org, "domain"), + ("IPAM", ipam, "counter"), + ("Virtualization", virtualization, "monitor"), + ("Inventory", dcim, "server"), + ("Connections", connections, "cable-data"), + ("Circuits", circuits, "transit-connection-variant"), + ("Power", power, "flash"), ) stats = [] - for section_label, section_items in sections: + for section_label, section_items, icon_class in sections: items = [] for perm, item_label, get_count in section_items: app, scope = perm.split(".") @@ -113,13 +113,14 @@ class HomeView(View): "label": item_label, "count": None, "url": url, - "disabled": True + "disabled": True, + "icon": icon_class, } if request.user.has_perm(perm): item["count"] = get_count() item["disabled"] = False items.append(item) - stats.append((section_label, items)) + stats.append((section_label, items, icon_class)) return stats diff --git a/netbox/templates/home.html b/netbox/templates/home.html index cf55b9dd7..de0dbea90 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -27,10 +27,13 @@ {# General stats #}
- {% for section, items in stats %} + {% for section, items, icon in stats %}
-
{{ section }}
+
+ + {{ section }} +
{% for item in items %} @@ -64,7 +67,10 @@
-
Change Log
+
+ + Change Log +
{% include 'inc/responsive_table.html' with table=changelog_table %}