94 lines
5.9 KiB
HTML
94 lines
5.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Device Manager</title>
|
|
<link rel="icon" type="image/png" href="{{ LOGO_PNG }}">
|
|
<link href="/static/css/output.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
|
|
<link href="/static/css/devices.css" rel="stylesheet">
|
|
</head>
|
|
<body class="bg-gray-300 text-gray-900 dark:bg-zinc-900 dark:text-gray-100 min-h-screen flex flex-col">
|
|
{% include 'header.html' %}
|
|
<div class="flex-1 flex items-center justify-center mx-4">
|
|
<div class="container py-8 max-w-4xl pt-20">
|
|
<h1 class="text-3xl font-bold mb-6 text-center">Device Manager</h1>
|
|
<div class="flex flex-row justify-center gap-4 mb-6 flex-wrap">
|
|
<a href="/add_device" class="text-center bg-gray-200 hover:bg-gray-400 dark:bg-zinc-700 dark:hover:bg-zinc-600 px-4 py-2 rounded-lg">Add New Device</a>
|
|
<a href="/bulk" class="text-center bg-gray-200 hover:bg-gray-400 dark:bg-zinc-700 dark:hover:bg-zinc-600 px-4 py-2 rounded-lg">Bulk Operations</a>
|
|
<a href="/device_type_stats" class="text-center bg-gray-200 hover:bg-gray-400 dark:bg-zinc-700 dark:hover:bg-zinc-600 px-4 py-2 rounded-lg">View Device Stats</a>
|
|
</div>
|
|
|
|
<!-- Filters Section -->
|
|
<div class="mb-6 space-y-4">
|
|
<input type="text" id="search" placeholder="Search devices or IPs..." class="border p-3 rounded-lg bg-gray-200 dark:bg-zinc-800 border-gray-600 w-full">
|
|
|
|
<!-- Tag Filter -->
|
|
{% if all_tag_names %}
|
|
<div class="flex items-center space-x-2">
|
|
<label class="text-sm font-medium">Filter by tag:</label>
|
|
<select id="tag-filter" class="border p-2 rounded-lg bg-gray-200 dark:bg-zinc-800 border-gray-600">
|
|
<option value="">All devices</option>
|
|
{% for tag_name in all_tag_names %}
|
|
<option value="{{ tag_name }}" {% if current_tag_filter == tag_name %}selected{% endif %}>{{ tag_name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% if current_tag_filter %}
|
|
<a href="/devices" class="text-red-500 hover:text-red-700 text-sm">
|
|
<i class="fas fa-times"></i> Clear filter
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div id="site-list" class="space-y-6">
|
|
{% for site, devices in sites_devices.items() %}
|
|
<div class="site-group bg-gray-200 dark:bg-zinc-800 rounded-lg shadow-md">
|
|
<div class="flex flex-row items-center justify-between p-4 cursor-pointer site-header">
|
|
<h2 class="text-xl font-bold mb-0 dark:text-white">{{ site }}</h2>
|
|
<button type="button" class="expand-btn text-gray-400 hover:text-gray-200 hover:cursor-pointer ml-2 flex items-center" aria-label="Expand site">
|
|
<i class="fas fa-chevron-down"></i>
|
|
</button>
|
|
</div>
|
|
<ul class="device-list hidden px-6 pb-4">
|
|
{% for device in devices %}
|
|
<li class="my-2">
|
|
<a href="/device/{{ device.id }}" class="block bg-gray-300 hover:bg-gray-100 dark:bg-zinc-900 dark:hover:bg-gray-700 dark:text-gray-200 font-semibold rounded-lg px-4 py-2 shadow transition-colors duration-150">
|
|
<div class="flex items-center justify-between">
|
|
<span><i class="fas {{ device.icon_class or 'fa-server' }} mr-2"></i>{{ device.name }}</span>
|
|
{% set ips = device_ips.get(device.id, []) %}
|
|
<span class="flex flex-row flex-wrap justify-end items-center ml-4 text-xs text-blue-300 font-normal align-middle">
|
|
{% if ips|length > 0 %}
|
|
{% for ip in ips %}
|
|
<span class="inline-block bg-gray-200 dark:bg-zinc-800 text-gray-900 dark:text-white rounded px-2 py-1 ml-1 font-mono">{{ ip[1] }}</span>
|
|
{% endfor %}
|
|
{% else %}
|
|
<span class="text-gray-400">No IPs</span>
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
<!-- Tags -->
|
|
{% set tags = device_tags.get(device.id, []) %}
|
|
{% if tags %}
|
|
<div class="flex flex-wrap gap-1 mt-2">
|
|
{% for tag in tags %}
|
|
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs" style="background-color: {{ tag.color }}20; border: 1px solid {{ tag.color }}; color: {{ tag.color }}">
|
|
<div class="w-1.5 h-1.5 rounded-full mr-1" style="background-color: {{ tag.color }}"></div>
|
|
{{ tag.name }}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/static/js/devices.js"></script>
|
|
</body>
|
|
</html> |