feat: ✨ display vlan id on main page
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -539,7 +539,7 @@ def prewarm_cache(app):
|
||||
|
||||
# Pre-warm index page (all subnets with utilization)
|
||||
logging.info("Pre-warming cache: Loading all subnets for index page...")
|
||||
cursor.execute('SELECT id, name, cidr, site FROM Subnet')
|
||||
cursor.execute('SELECT id, name, cidr, site, vlan_id FROM Subnet')
|
||||
subnets = cursor.fetchall()
|
||||
sites_subnets = {}
|
||||
for subnet in subnets:
|
||||
@@ -570,6 +570,7 @@ def prewarm_cache(app):
|
||||
'id': subnet[0],
|
||||
'name': subnet[1],
|
||||
'cidr': subnet[2],
|
||||
'vlan_id': subnet[4],
|
||||
'utilization': round(utilization_percent, 1)
|
||||
})
|
||||
cache.set('index', sites_subnets, ttl=10800)
|
||||
@@ -990,7 +991,7 @@ def register_routes(app, limiter=None):
|
||||
conn = get_db_connection(current_app)
|
||||
try:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT id, name, cidr, site FROM Subnet')
|
||||
cursor.execute('SELECT id, name, cidr, site, vlan_id FROM Subnet')
|
||||
subnets = cursor.fetchall()
|
||||
sites_subnets = {}
|
||||
for subnet in subnets:
|
||||
@@ -1024,6 +1025,7 @@ def register_routes(app, limiter=None):
|
||||
'id': subnet[0],
|
||||
'name': subnet[1],
|
||||
'cidr': subnet[2],
|
||||
'vlan_id': subnet[4],
|
||||
'utilization': round(utilization_percent, 1)
|
||||
})
|
||||
# Cache for 3 hours
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
<li class="p-4 bg-gray-300 hover:bg-gray-100 dark:bg-zinc-900 hover:dark:bg-zinc-700 rounded-lg shadow-md flex items-center justify-between">
|
||||
<a href="/subnet/{{ subnet.id }}">
|
||||
<p class="text-gray-900 dark:text-white text-lg font-medium">{{ subnet.name }}</p>
|
||||
<p class="text-sm text-gray-800 dark:text-gray-400">{{ subnet.cidr }}</p>
|
||||
<div class="flex items-center space-x-2">
|
||||
<p class="text-sm text-gray-800 dark:text-gray-400">{{ subnet.cidr }}</p>
|
||||
{% if subnet.vlan_id %}
|
||||
<span class="px-2 py-0.5 text-xs font-semibold bg-gray-200 dark:bg-zinc-800 rounded-full">VLAN {{ subnet.vlan_id }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
<button type="button" class="export-csv-btn ml-2 bg-gray-200 hover:bg-gray-400 dark:bg-zinc-600 dark:hover:bg-zinc-500 hover:cursor-pointer flex items-center justify-center rounded-full w-9 h-9" title="Export as CSV" data-subnet-id="{{ subnet.id }}">
|
||||
<i class="fas fa-file-csv"></i>
|
||||
|
||||
Reference in New Issue
Block a user