From 37a096563b74fc963bfd92b303387af2d0903d59 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 21 Sep 2023 00:38:41 -0400 Subject: [PATCH] fix(striker-ui-api): add info to /api/anvil --- .../lib/request_handlers/anvil/getAnvil.ts | 23 ++++++++++++++++--- striker-ui-api/src/types/ApiAn.d.ts | 2 ++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/anvil/getAnvil.ts b/striker-ui-api/src/lib/request_handlers/anvil/getAnvil.ts index 0e952642..945b31f3 100644 --- a/striker-ui-api/src/lib/request_handlers/anvil/getAnvil.ts +++ b/striker-ui-api/src/lib/request_handlers/anvil/getAnvil.ts @@ -12,8 +12,10 @@ export const getAnvil: RequestHandler = buildGetRequestHandler( SELECT anv.anvil_name, anv.anvil_uuid, + anv.anvil_description, hos.host_name, - hos.host_uuid + hos.host_uuid, + hos.host_type FROM anvils AS anv JOIN hosts AS hos ON hos.host_uuid IN ( @@ -31,10 +33,21 @@ export const getAnvil: RequestHandler = buildGetRequestHandler( let rowStage: AnvilOverview | undefined; results = queryStdout.reduce( - (reducedRows, [anvilName, anvilUUID, hostName, hostUUID]) => { + ( + reducedRows, + [ + anvilName, + anvilUUID, + anvilDescription, + hostName, + hostUUID, + hostType, + ], + ) => { if (!rowStage || anvilUUID !== rowStage.anvilUUID) { { rowStage = { + anvilDescription, anvilName, anvilUUID, hosts: [], @@ -44,7 +57,11 @@ export const getAnvil: RequestHandler = buildGetRequestHandler( } } - rowStage.hosts.push({ hostName, hostUUID }); + rowStage.hosts.push({ + hostName, + hostType, + hostUUID, + }); return reducedRows; }, diff --git a/striker-ui-api/src/types/ApiAn.d.ts b/striker-ui-api/src/types/ApiAn.d.ts index 25b74c2b..2885af63 100644 --- a/striker-ui-api/src/types/ApiAn.d.ts +++ b/striker-ui-api/src/types/ApiAn.d.ts @@ -112,10 +112,12 @@ type AnvilDetailStoreSummary = { }; type AnvilOverview = { + anvilDescription: string; anvilName: string; anvilUUID: string; hosts: Array<{ hostName: string; + hostType: string; hostUUID: string; }>; };