From a6b33baadec28e09782f3e5879bcb62269b18b75 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Fri, 10 Feb 2017 11:33:44 +1100 Subject: [PATCH] Represent github change ID in status page by PR number The change.id given to the status.json output for github PRs is a full "PR#,SHA" combo. This gives it uniqueness when we can have multiple commits and versions of commits per PR. When we display this in the status page though i think all we care about is the PR number, so trim it out and just display that. Change-Id: I73385a6b0743a6764fdfdd51cd1d8ee02b71c53c Signed-off-by: Jamie Lennox --- etc/status/public_html/jquery.zuul.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/etc/status/public_html/jquery.zuul.js b/etc/status/public_html/jquery.zuul.js index c7e23b20ae..aec7a46557 100644 --- a/etc/status/public_html/jquery.zuul.js +++ b/etc/status/public_html/jquery.zuul.js @@ -279,7 +279,16 @@ var $change_link = $(''); if (change.url !== null) { - if (/^[0-9a-f]{40}$/.test(change.id)) { + var github_id = change.id.match(/^([0-9]+),([0-9a-f]{40})$/); + if (github_id) { + $change_link.append( + $('').attr('href', change.url).append( + $('') + .attr('title', change.id) + .text('#' + github_id[1]) + ) + ); + } else if (/^[0-9a-f]{40}$/.test(change.id)) { var change_id_short = change.id.slice(0, 7); $change_link.append( $('').attr('href', change.url).append(