checktheroads 4 лет назад
Родитель
Сommit
91246b0f81
2 измененных файлов с 20 добавлено и 13 удалено
  1. 11 10
      netbox/netbox/views/__init__.py
  2. 9 3
      netbox/templates/home.html

+ 11 - 10
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
 

+ 9 - 3
netbox/templates/home.html

@@ -27,10 +27,13 @@
 
   {# General stats #}
   <div class="row masonry">
-    {% for section, items in stats %}
+    {% for section, items, icon in stats %}
       <div class="col col-sm-12 col-lg-6 col-xl-4 my-2 masonry-item">
         <div class="card">
-          <h6 class="card-header text-primary text-center">{{ section }}</h6>
+          <h6 class="card-header text-primary text-center">
+            <i class="mdi mdi-{{ icon }}"></i>
+            <span class="ms-1">{{ section }}</span>
+          </h6>
           <div class="card-body">
             <div class="list-group list-group-flush">
               {% for item in items %}
@@ -64,7 +67,10 @@
     <div class="row my-4 flex-grow-1 changelog-container">
       <div class="col">
         <div class="card">
-          <h6 class="card-header text-primary text-center">Change Log</h6>
+          <h6 class="card-header text-primary text-center">
+            <i class="mdi mdi-clipboard-clock"></i>
+            <span class="ms-1">Change Log</span>
+          </h6>
           <div class="card-body">
             {% include 'inc/responsive_table.html' with table=changelog_table %}
           </div>