From 20b782d50c7e47165467b5a4ca22bef1b78a4c1b Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 10 Aug 2023 16:45:23 -0400 Subject: [PATCH] fix(striker-ui-api): correct left join variables in select host detail --- .../request_handlers/host/buildQueryHostDetail.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts b/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts index 40831a96..80282039 100644 --- a/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/host/buildQueryHostDetail.ts @@ -42,7 +42,7 @@ const setCvar = ( export const buildQueryHostDetail: BuildQueryDetailFunction = ({ keys: hostUUIDs = '*', } = {}) => { - const condHostUUIDs = buildKnownIDCondition(hostUUIDs, 'AND a.host_uuid'); + const condHostUUIDs = buildKnownIDCondition(hostUUIDs, 'a.host_uuid'); stdout(`condHostUUIDs=[${condHostUUIDs}]`); @@ -66,15 +66,15 @@ export const buildQueryHostDetail: BuildQueryDetailFunction = ({ FROM hosts AS a LEFT JOIN variables AS b ON b.variable_source_uuid = a.host_uuid + AND ( + b.variable_name LIKE '${CVAR_PREFIX}%' + OR b.variable_name = 'install-target::enabled' + ) LEFT JOIN network_interfaces AS c ON b.variable_name LIKE '%link%_mac%' AND b.variable_value = c.network_interface_mac_address AND a.host_uuid = c.network_interface_host_uuid - WHERE ( - variable_name LIKE '${CVAR_PREFIX}%' - OR variable_name = 'install-target::enabled' - ) - ${condHostUUIDs} + WHERE ${condHostUUIDs} ORDER BY cvar_name ASC, b.variable_name ASC;`;