feat(ui): Display machine_id in host details page and enable search

- Added machine_id field to host details page
- Backend now returns machine_id in all host queries
- Users can search hosts by machine_id
- Added hostname index to schema for better performance
This commit is contained in:
Muhammad Ibrahim
2025-10-04 09:11:47 +01:00
parent 3cf2ada84e
commit 35d3c28ae5
3 changed files with 14 additions and 0 deletions

View File

@@ -185,6 +185,7 @@ router.get("/hosts", authenticateToken, requireViewHosts, async (_req, res) => {
// Show all hosts regardless of status
select: {
id: true,
machine_id: true,
friendly_name: true,
hostname: true,
ip: true,

View File

@@ -70,10 +70,12 @@ router.get("/", authenticateToken, async (req, res) => {
{ hostname: { contains: searchTerm, mode: "insensitive" } },
{ friendly_name: { contains: searchTerm, mode: "insensitive" } },
{ ip: { contains: searchTerm, mode: "insensitive" } },
{ machine_id: { contains: searchTerm, mode: "insensitive" } },
],
},
select: {
id: true,
machine_id: true,
hostname: true,
friendly_name: true,
ip: true,

View File

@@ -387,6 +387,17 @@ const HostDetail = () => {
</div>
)}
{host.machine_id && (
<div>
<p className="text-xs text-secondary-500 dark:text-secondary-300 mb-1.5">
Machine ID
</p>
<p className="font-medium text-secondary-900 dark:text-white font-mono text-sm break-all">
{host.machine_id}
</p>
</div>
)}
<div>
<p className="text-xs text-secondary-500 dark:text-secondary-300 mb-1.5">
Host Group