Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 1.40 KB  |  views: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ## highlight a link to buildbot in red if there are serious failures
  2.  
  3.   <script type="text/javascript" src="jquery/jquery.min.js"></script>
  4.   <script type="text/javascript">
  5.     $(function() {
  6.         var format_number = function(n, word, words) {
  7.             if (n == 1) {
  8.                 return n + " " + word;
  9.             } else {
  10.                 return n + " " + words;
  11.             }
  12.         }
  13.         $.get('/buildbot/one_box_per_builder', function(data) {
  14.             var boxes = $(data).find('.LastBuild.box');
  15.             var total = boxes.length;
  16.             var success = boxes.filter('.success').length;
  17.             var link = $("#buildbot-link");
  18.             if (total == success) {
  19.                 link.addClass("success");
  20.                 link.attr("title", "all " + format_number(success, "builder", "builders") + " green");
  21.             } else {
  22.                 var names = boxes.filter('.failure').prev('td').children('a').map(function(){return $(this).text();}).toArray();
  23.                 var realFailures = $.grep(names, function(n) {
  24.                     return n.indexOf('selenium') == -1 && n.indexOf('-ie') == -1;
  25.                 });
  26.                 link.addClass(realFailures.length ? "fail" : "warning");
  27.                 link.attr("title", format_number(total - success, "builder", "builders") + " failed:\n" + names.join("\n"));
  28.             }
  29.         });
  30.     });
  31.   </script>
clone this paste RAW Paste Data