From e35f32657319fe1470996f81117695e9f16b355e Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 3 May 2023 19:45:08 -0400 Subject: [PATCH] fix(striker-ui-api): file_location_anvil_uuid->_host_uuid in file/anvil request handlers --- .../anvil/buildQueryAnvilDetail.ts | 14 +++++++++----- .../request_handlers/file/buildQueryFileDetail.ts | 12 ++++++++++-- .../src/lib/request_handlers/file/updateFile.ts | 6 +++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts b/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts index a1561bd5..126196bf 100644 --- a/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts @@ -92,16 +92,16 @@ const buildQueryAnvilDetail = ({ server_definition_server_uuid, CAST( SUBSTRING( - server_definition_xml, '%cores=''#"[0-9]+#"''%', '#' + server_definition_xml, 'cores=''([\\d]*)''' ) AS INTEGER ) AS server_cpu_cores, CAST( SUBSTRING( - server_definition_xml, '%memory%>#"[0-9]+#"([\\d]*) ` SELECT - file_location_anvil_uuid, + file_location_host_uuid, file_uuid, file_name FROM file_locations as fil_loc @@ -181,7 +181,11 @@ const buildQueryAnvilDetail = ({ LEFT JOIN (${buildStorageGroupQuery()}) AS storage_group_list ON anv.anvil_uuid = storage_group_list.storage_group_anvil_uuid LEFT JOIN (${buildFileQuery()}) AS file_list - ON anv.anvil_uuid = file_list.file_location_anvil_uuid + ON file_list.file_location_host_uuid IN ( + anv.anvil_node1_host_uuid, + anv.anvil_node2_host_uuid, + anv.anvil_dr1_host_uuid + ) ;`; let query = ` diff --git a/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts b/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts index 3fb2a89f..a6000745 100644 --- a/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts @@ -30,12 +30,20 @@ export const buildQueryFileDetail = ({ fil_loc.file_location_active, anv.anvil_uuid, anv.anvil_name, - anv.anvil_description + anv.anvil_description, + hos.host_uuid, + hos.host_name FROM files AS fil JOIN file_locations AS fil_loc ON fil.file_uuid = fil_loc.file_location_file_uuid JOIN anvils AS anv - ON fil_loc.file_location_anvil_uuid = anv.anvil_uuid + ON fil_loc.file_location_host_uuid IN ( + anv.anvil_node1_host_uuid, + anv.anvil_node2_host_uuid, + anv.anvil_dr1_host_uuid + ) + JOIN hosts AS hos + ON fil_loc.file_location_host_uuid = hos.host_uuid WHERE fil.file_type != '${DELETED}' ${condFileUUIDs};`; }; diff --git a/striker-ui-api/src/lib/request_handlers/file/updateFile.ts b/striker-ui-api/src/lib/request_handlers/file/updateFile.ts index 8e257b70..bed5e0ca 100644 --- a/striker-ui-api/src/lib/request_handlers/file/updateFile.ts +++ b/striker-ui-api/src/lib/request_handlers/file/updateFile.ts @@ -95,7 +95,11 @@ export const updateFile: RequestHandler = async (request, response) => { anv.anvil_dr1_host_uuid FROM anvils AS anv JOIN file_locations AS fil_loc - ON anv.anvil_uuid = fil_loc.file_location_anvil_uuid + ON fil_loc.file_location_host_uuid IN ( + anv.anvil_node1_host_uuid, + anv.anvil_node2_host_uuid, + anv.anvil_dr1_host_uuid + ) WHERE fil_loc.file_location_uuid = '${fileLocationUUID}';`, );