changeset 27:43da06d64c2d

Buildbot info is now mashed-up with hg log.
author Atul Varma <varmaa@toolness.com>
date Mon, 02 Mar 2009 22:28:57 -0800
parents 0ea70c7a4591
children 8df874718919
files about-mozilla.css about-mozilla.js
diffstat 2 files changed, 74 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/about-mozilla.css	Mon Mar 02 21:54:05 2009 -0800
+++ b/about-mozilla.css	Mon Mar 02 22:28:57 2009 -0800
@@ -106,3 +106,17 @@
 #row-labels .content {
     font-weight: bold;
 }
+
+.build {
+    padding-right: 1em;
+    margin-right: 2pt;
+    opacity: .5;
+}
+
+.build-errors {
+    background-color: #ff0000;
+}
+
+.build-success {
+    background-color: #00ff00;
+}
--- a/about-mozilla.js	Mon Mar 02 21:54:05 2009 -0800
+++ b/about-mozilla.js	Mon Mar 02 22:28:57 2009 -0800
@@ -1,3 +1,61 @@
+var BUILDBOT_BASE = "http://ubiquity.mozilla.com/buildbot/";
+var HG_BASE = "https://ubiquity.mozilla.com/hg/ubiquity-firefox/";
+
+function getBuildInfo(page) {
+  var builds = [];
+  $("li", page).each(
+    function(i) {
+      var revRegexp = /.*rev=\[([0-9a-f]+)\].*/;
+      builds.push({rev: $(this).text().match(revRegexp)[1],
+                   href: (BUILDBOT_BASE +
+                          $("a:not(:first)", this).attr("href")),
+                   isSuccessful: $(".success", this).length > 0
+                  });
+    }
+  );
+  return builds;
+}
+
+function mashupBuildbotWithHgData(hgLog, buildbotPage) {
+  var builds = getBuildInfo(buildbotPage);
+  builds.forEach(
+    function(build) {
+      var revUrl = HG_BASE + "rev/" + build.rev;
+      var revSelector = ("a[href='" + revUrl + "']");
+      var link = jQuery(revSelector, hgLog);
+      var className = "build-errors";
+      var title = "This build may have errors.";
+      if (build.isSuccessful) {
+        className = "build-success";
+        title = "This build passed all tests.";
+      }
+      var status = jQuery('<span></span>');
+      status.addClass(className);
+      status.addClass("build");
+      link.before(status);
+      status.wrap('<a title="' + title +
+                  '" href="' + build.href + '"></a>');
+    });
+}
+
+function processHgFeed(feed, content, cb) {
+  processBlogFeed(
+    feed,
+    content,
+    function() {
+      jQuery.get(
+        ("http://about-mozilla.appspot.com/?url=" +
+         BUILDBOT_BASE + "one_line_per_build&jsonp=?"),
+        null,
+        function(result) {
+          mashupBuildbotWithHgData(content, $(result.data));
+          cb();
+        },
+      "jsonp"
+      );
+    });
+}
+
 function processBlogFeed(feed, content, cb) {
   jQuery.each(
     feed.entries,
@@ -40,8 +98,8 @@
    processFeed: processBlogFeed,
    entries: 10},
   {name: "Code",
-   url: "https://ubiquity.mozilla.com/hg/ubiquity-firefox/rss-log",
-   processFeed: processBlogFeed,
+   url: HG_BASE + "rss-log",
+   processFeed: processHgFeed,
    entries: 15},
   {name: "Discussions",
    url: "http://groups.google.com/group/ubiquity-firefox/feed/rss_v2_0_msgs.xml",