fix(striker-ui-api): file_location_anvil_uuid->_host_uuid in file/anvil request handlers

main
Tsu-ba-me 2 years ago
parent 039d755e89
commit e35f326573
  1. 14
      striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts
  2. 12
      striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts
  3. 6
      striker-ui-api/src/lib/request_handlers/file/updateFile.ts

@ -92,16 +92,16 @@ const buildQueryAnvilDetail = ({
server_definition_server_uuid, server_definition_server_uuid,
CAST( CAST(
SUBSTRING( SUBSTRING(
server_definition_xml, '%cores=''#"[0-9]+#"''%', '#' server_definition_xml, 'cores=''([\\d]*)'''
) AS INTEGER ) AS INTEGER
) AS server_cpu_cores, ) AS server_cpu_cores,
CAST( CAST(
SUBSTRING( SUBSTRING(
server_definition_xml, '%memory%>#"[0-9]+#"</memory%', '#' server_definition_xml, 'memory.*>([\\d]*)</memory'
) AS BIGINT ) AS BIGINT
) AS server_memory_value, ) AS server_memory_value,
SUBSTRING( SUBSTRING(
server_definition_xml, '%memory%unit=''#"[A-Za-z]+#"''%', '#' server_definition_xml, 'memory.*unit=''([A-Za-z]*)'''
) AS server_memory_unit ) AS server_memory_unit
FROM server_definitions AS ser_def FROM server_definitions AS ser_def
) AS ser_def_memory_converted ) AS ser_def_memory_converted
@ -129,7 +129,7 @@ const buildQueryAnvilDetail = ({
const buildFileQuery = () => ` const buildFileQuery = () => `
SELECT SELECT
file_location_anvil_uuid, file_location_host_uuid,
file_uuid, file_uuid,
file_name file_name
FROM file_locations as fil_loc FROM file_locations as fil_loc
@ -181,7 +181,11 @@ const buildQueryAnvilDetail = ({
LEFT JOIN (${buildStorageGroupQuery()}) AS storage_group_list LEFT JOIN (${buildStorageGroupQuery()}) AS storage_group_list
ON anv.anvil_uuid = storage_group_list.storage_group_anvil_uuid ON anv.anvil_uuid = storage_group_list.storage_group_anvil_uuid
LEFT JOIN (${buildFileQuery()}) AS file_list 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 = ` let query = `

@ -30,12 +30,20 @@ export const buildQueryFileDetail = ({
fil_loc.file_location_active, fil_loc.file_location_active,
anv.anvil_uuid, anv.anvil_uuid,
anv.anvil_name, anv.anvil_name,
anv.anvil_description anv.anvil_description,
hos.host_uuid,
hos.host_name
FROM files AS fil FROM files AS fil
JOIN file_locations AS fil_loc JOIN file_locations AS fil_loc
ON fil.file_uuid = fil_loc.file_location_file_uuid ON fil.file_uuid = fil_loc.file_location_file_uuid
JOIN anvils AS anv 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}' WHERE fil.file_type != '${DELETED}'
${condFileUUIDs};`; ${condFileUUIDs};`;
}; };

@ -95,7 +95,11 @@ export const updateFile: RequestHandler = async (request, response) => {
anv.anvil_dr1_host_uuid anv.anvil_dr1_host_uuid
FROM anvils AS anv FROM anvils AS anv
JOIN file_locations AS fil_loc 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}';`, WHERE fil_loc.file_location_uuid = '${fileLocationUUID}';`,
); );

Loading…
Cancel
Save