From 35d3c28ae5a0c6812595d7d1dd506fa9dc326dde Mon Sep 17 00:00:00 2001 From: Muhammad Ibrahim Date: Sat, 4 Oct 2025 09:11:47 +0100 Subject: [PATCH] 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 --- backend/src/routes/dashboardRoutes.js | 1 + backend/src/routes/searchRoutes.js | 2 ++ frontend/src/pages/HostDetail.jsx | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/backend/src/routes/dashboardRoutes.js b/backend/src/routes/dashboardRoutes.js index fb54447..5169873 100644 --- a/backend/src/routes/dashboardRoutes.js +++ b/backend/src/routes/dashboardRoutes.js @@ -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, diff --git a/backend/src/routes/searchRoutes.js b/backend/src/routes/searchRoutes.js index 077f780..456dde4 100644 --- a/backend/src/routes/searchRoutes.js +++ b/backend/src/routes/searchRoutes.js @@ -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, diff --git a/frontend/src/pages/HostDetail.jsx b/frontend/src/pages/HostDetail.jsx index 8f2b222..4a9e785 100644 --- a/frontend/src/pages/HostDetail.jsx +++ b/frontend/src/pages/HostDetail.jsx @@ -387,6 +387,17 @@ const HostDetail = () => { )} + {host.machine_id && ( +
+

+ Machine ID +

+

+ {host.machine_id} +

+
+ )} +

Host Group