From 14653ae9029c8951ac4ee579a452c68eeff70aca Mon Sep 17 00:00:00 2001 From: Laura Barcziova Date: Thu, 29 Sep 2022 14:25:05 +0200 Subject: [PATCH] Display multiple Copr builds for TF results if present In packit/packit-service#1658 there was implemented that a TF run can be triggered with multiple Copr builds and API for TF runs changed (copr_build_id -> copr_build_ids) as well. This PR implements displaying those builds correctly in the TF result view. --- .../src/components/results/testing_farm.js | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/results/testing_farm.js b/frontend/src/components/results/testing_farm.js index 10714c6e..deb387c4 100644 --- a/frontend/src/components/results/testing_farm.js +++ b/frontend/src/components/results/testing_farm.js @@ -68,20 +68,35 @@ const ResultsPageTestingFarm = (props) => { <>{data.status} ); - const coprBuildInfo = data.copr_build_id ? ( - - - COPR build - - - - Details - - - - ) : ( - "" - ); + function getCoprBuilds() { + let coprBuilds = []; + let title = + data.copr_build_ids.length == 1 ? "Copr build" : "Copr builds"; + + for (var i = 0; i < data.copr_build_ids.length; i++) { + var coprBuildId = data.copr_build_ids[i]; + var linkText = + data.copr_build_ids.length == 1 + ? "Details" + : `Build ${i + 1} `; + coprBuilds.push( + + ); + } + + return ( + + + {title} + + {coprBuilds} + + ); + } + + const coprBuildInfo = data.copr_build_ids.length > 0 ? getCoprBuilds() : ""; return (