fix: 🐛 global search missing from devices
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
h2 {
|
||||
cursor: pointer;
|
||||
}
|
||||
form:not(.mb-6), .mt-4 {
|
||||
.container form:not(.mb-6), .mt-4 {
|
||||
display: none;
|
||||
}
|
||||
.allocated-ips {
|
||||
|
||||
@@ -30,56 +30,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
});
|
||||
|
||||
// Search functionality
|
||||
const searchInput = document.getElementById('search');
|
||||
searchInput.addEventListener('keypress', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
const query = this.value.toLowerCase();
|
||||
document.querySelectorAll('.site-group').forEach(siteGroup => {
|
||||
let anyVisible = false;
|
||||
siteGroup.querySelectorAll('.device-list li').forEach(li => {
|
||||
const deviceName = li.querySelector('span').textContent.toLowerCase();
|
||||
const ipSpans = li.querySelectorAll('span.inline-block');
|
||||
let match = deviceName.includes(query);
|
||||
if (!match) {
|
||||
ipSpans.forEach(ipSpan => {
|
||||
if (ipSpan.textContent.toLowerCase().includes(query)) {
|
||||
match = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
li.style.display = match ? '' : 'none';
|
||||
const card = li.querySelector('a');
|
||||
if (match) {
|
||||
anyVisible = true;
|
||||
siteGroup.querySelector('.device-list').classList.remove('hidden');
|
||||
const icon = siteGroup.querySelector('.expand-btn i');
|
||||
if (icon && icon.classList.contains('fa-chevron-down')) {
|
||||
icon.classList.remove('fa-chevron-down');
|
||||
icon.classList.add('fa-chevron-up');
|
||||
}
|
||||
if (card) {
|
||||
card.style.transition = 'background-color 0.3s';
|
||||
card.style.backgroundColor = '#2563eb';
|
||||
card.style.color = '#fff';
|
||||
setTimeout(() => {
|
||||
card.style.backgroundColor = '';
|
||||
card.style.color = '';
|
||||
}, 2000);
|
||||
}
|
||||
} else {
|
||||
if (card) {
|
||||
card.style.backgroundColor = '';
|
||||
card.style.color = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
siteGroup.style.display = anyVisible ? '' : 'none';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Scroll to Top Button
|
||||
const scrollToTopButton = document.createElement('button');
|
||||
scrollToTopButton.innerHTML = '<i class="fas fa-arrow-up"></i>';
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
<!-- 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">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</a>
|
||||
<a href="https://github.com/JDB-NET/ipam/releases" target="_blank" rel="noopener noreferrer" class="text-sm font-normal text-gray-300 hover:text-gray-100 -ml-1 mt-3">v{{ VERSION }}</a>
|
||||
</div>
|
||||
<div class="hidden lg:flex items-center justify-center absolute left-1/2 transform -translate-x-1/2">
|
||||
<div class="hidden lg:flex items-center justify-center absolute left-1/2" style="transform: translateX(calc(-50% + 1.5rem));">
|
||||
<form action="/search" method="GET" class="flex items-center space-x-2">
|
||||
<input type="text" name="q" id="search-input" placeholder="Search..."
|
||||
class="bg-zinc-700 text-white placeholder-gray-400 px-4 py-2 rounded-md text-base focus:outline-none focus:ring-2 focus:ring-gray-500 w-100"
|
||||
|
||||
Reference in New Issue
Block a user