summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Hesketh <josh@nitrotech.org>2014-08-21 11:32:44 +1000
committerJoshua Hesketh <josh@nitrotech.org>2014-09-10 17:34:04 +1000
commitcd7a0778e2a455d720ae4472df85adef310fac40 (patch)
tree0e79b08a17c956276a52da21d4410b2572d5ca25
parenta95fd55db94b522c3c14842f5d3c561b54f80015 (diff)
downloadzuul-cd7a0778e2a455d720ae4472df85adef310fac40.tar.gz
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 <slukjanov@mirantis.com> Change-Id: I4f54845675d11e4f76240cf4bf7b48f28f3e7d6a
-rw-r--r--etc/status/public_html/jquery.zuul.js18
1 files 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 = $('<small />');
if (change.url !== null) {
- $change_link.append(
- $('<a />').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(
+ $('<a />').attr('href', change.url).append(
+ $('<abbr />')
+ .attr('title', change.id)
+ .text(change_id_short)
+ )
+ );
+ }
+ else {
+ $change_link.append(
+ $('<a />').attr('href', change.url).text(change.id)
+ );
+ }
}
else {
$change_link.text(change_id);