From cd7a0778e2a455d720ae4472df85adef310fac40 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Thu, 21 Aug 2014 11:32:44 +1000 Subject: Display only first 7 chars for git commit id On the status page, if a job was queued via a timer or some way other than a gerrit change id, the git commit id would be too long for the change box. Limit it to 7 chars. Co-Authored-By: Sergey Lukjanov Change-Id: I4f54845675d11e4f76240cf4bf7b48f28f3e7d6a --- etc/status/public_html/jquery.zuul.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/etc/status/public_html/jquery.zuul.js b/etc/status/public_html/jquery.zuul.js index 7e5f640b3..5d155aff6 100644 --- a/etc/status/public_html/jquery.zuul.js +++ b/etc/status/public_html/jquery.zuul.js @@ -267,9 +267,21 @@ var $change_link = $(''); if (change.url !== null) { - $change_link.append( - $('').attr('href', change.url).text(change.id) - ); + 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( + $('') + .attr('title', change.id) + .text(change_id_short) + ) + ); + } + else { + $change_link.append( + $('').attr('href', change.url).text(change.id) + ); + } } else { $change_link.text(change_id); -- cgit v1.2.1