From 9063e9a3ffda27eafc70c0e52ec48eaff69396d7 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Mon, 9 Apr 2018 15:29:36 +1000 Subject: [PATCH] Make links in CI results optional In some cases (specifically noop's) a CI result may not contain a link. This change properly parses results inside a "comment_test" list regardless if there is a link. Change-Id: Ibf9e959d06f4b5fd60763f647c93cb4964ee7caf --- modules/openstack_project/files/gerrit/hideci.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/openstack_project/files/gerrit/hideci.js b/modules/openstack_project/files/gerrit/hideci.js index e9c9bf2058..6aad2e8c26 100644 --- a/modules/openstack_project/files/gerrit/hideci.js +++ b/modules/openstack_project/files/gerrit/hideci.js @@ -110,8 +110,13 @@ var ci_parse_results = function($panel) { if (test_results !== null) { test_results.each(function(i, li) { var result = {}; - result["name"] = $(li).find("span.comment_test_name").find("a")[0].innerHTML; - result["link"] = $(li).find("span.comment_test_name").find("a")[0]; + if ($(li).find("a").length > 0) { + result["name"] = $(li).find("span.comment_test_name").find("a")[0].innerHTML; + result["link"] = $(li).find("span.comment_test_name").find("a")[0]; + } + else { + result["name"] = $(li).find("span.comment_test_name")[0].innerHTML; + } result["result"] = $(li).find("span.comment_test_result")[0]; result_list.push(result); }); @@ -315,7 +320,12 @@ var ci_display_results = function(comments) { for (var j = 0; j < comment.results.length; j++) { var result = comment.results[j]; var tr = $(""); - tr.append($("").append($(result["link"]).clone())); + if ("link" in result) { + tr.append($("").append($(result["link"]).clone())); + } + else { + tr.append($("").text(result["name"])); + } tr.append($("").append($(result["result"]).clone())); $(table).append(tr); }