diff --git a/proxy/collector.js b/proxy/collector.js index d949ee7..57b7a5b 100644 --- a/proxy/collector.js +++ b/proxy/collector.js @@ -41,11 +41,13 @@ async function collectAllAgents() { $set: { uuid: a.uuid, serial: a.serial || a.uuid, - label: a.label, site_uuid: 'global', // Store globally provisioned: a.provisioned ?? true, activated: a.activated ?? false, last_seen_at: a.last_seen_at ?? null, + }, + $setOnInsert: { + label: a.label, } }, { upsert: true, new: true } diff --git a/src/app/(dashboard)/devices/page.tsx b/src/app/(dashboard)/devices/page.tsx index fcdb805..c0ea820 100644 --- a/src/app/(dashboard)/devices/page.tsx +++ b/src/app/(dashboard)/devices/page.tsx @@ -163,6 +163,12 @@ export default function DevicesPage() { if (filters.device_type && filters.device_type !== "All" && row.device_type !== filters.device_type) return false; if (filters.os_label && filters.os_label !== "All" && row.os_label !== filters.os_label) return false; if (filters.manufacturer && filters.manufacturer !== "All" && row.manufacturer !== filters.manufacturer) return false; + if (filters.ip && filters.ip.trim() !== "" && filters.ip !== "All") { + if (!row.ip_address || !row.ip_address.toLowerCase().includes(filters.ip.toLowerCase())) return false; + } + if (filters.mac && filters.mac.trim() !== "" && filters.mac !== "All") { + if (!row.mac_address || !row.mac_address.toLowerCase().includes(filters.mac.toLowerCase())) return false; + } if (dateFrom || dateTo) { const d = row.last_seen ? new Date(row.last_seen).toISOString().slice(0, 10) : "";