[gnome-ostree] extras/build.gnome.org: Add integrationtest output, clean up logic



commit c4b1134b9516d7aab7331dfec6c30d0494ed5ba6
Author: Colin Walters <walters verbum org>
Date:   Sat May 18 10:53:19 2013 -0400

    extras/build.gnome.org: Add integrationtest output, clean up logic

 extras/build.gnome.org/gnome-ostree.js |   79 +++++++++++++------------------
 extras/build.gnome.org/index.html      |   19 +-------
 2 files changed, 34 insertions(+), 64 deletions(-)
---
diff --git a/extras/build.gnome.org/gnome-ostree.js b/extras/build.gnome.org/gnome-ostree.js
index 85be71a..6d9c8ac 100644
--- a/extras/build.gnome.org/gnome-ostree.js
+++ b/extras/build.gnome.org/gnome-ostree.js
@@ -26,23 +26,25 @@ function get_page_arg(key) {
 }
 
 var repoDataSignal = {};
-var currentBuildMeta = null;
-var currentSmoketestMeta = null;
+var taskData = {};
+var taskNames = ['build', 'smoketest', 'integrationtest'];
 
-function repowebInit() {
-    var url;
-    url = "work/tasks/build/current/meta.json";
-    $.getJSON(url, function(data) {
-        currentBuildMeta = data;
-        $(repoDataSignal).trigger("current-build-meta-loaded");
-    });
-    url = "work/tasks/smoketest/current/meta.json";
+function _loadTask(taskname) {
+    var url = 'work/tasks/' + taskname + '/current/meta.json';
+    console.log("loading " + url);
     $.getJSON(url, function(data) {
-        currentSmoketestMeta = data;
-        $(repoDataSignal).trigger("current-smoketest-meta-loaded");
+        console.log("load of " + taskname + " complete");
+        taskData[taskname] = data;
+        $(repoDataSignal).trigger("taskdata-changed", [taskname]);
     });
 }
 
+function repowebInit() {
+    for (var i = 0; i < taskNames.length; i++) {
+        _loadTask(taskNames[i]);
+    }
+}
+
 function timeago(d, now) {
     var diffSeconds = (now.getTime() - d.getTime()) / 1000;
     if (diffSeconds < 0)
@@ -122,41 +124,26 @@ function renderBuild(container, build) {
 
 }
 
+function _renderTask(taskName) {
+    var statusNode = $("#" + taskName + "-meta").get(0);
+    $(statusNode).empty();
+    
+    var meta = taskData[taskName];
+    var ref = 'work/tasks/' + taskName;
+    if (meta.success)
+        ref += '/successful';
+    else
+        ref += '/failed';
+    ref += '/' + meta.taskVersion;
+    statusNode.setAttribute('href', ref);
+    statusNode.setAttribute('rel', 'external');
+    var text = currentBuildMeta.taskVersion + ': ' + (meta.success ? "success" : "failed ");
+    statusNode.appendChild(document.createTextNode(text));
+}
+
 function repowebIndexInit() {
     repowebInit();
-    $(repoDataSignal).on("current-build-meta-loaded", function () {
-       var buildMetaNode = $("#build-meta").get(0);
-
-        $(buildMetaNode).empty();
-        var ref = 'work/tasks/build/';
-        if (currentBuildMeta.success)
-            ref += '/successful';
-        else
-            ref += '/failed';
-        ref += '/' + currentBuildMeta.taskVersion;
-        var a = document.createElement('a');
-        a.setAttribute('href', ref);
-        a.setAttribute('rel', 'external');
-        a.appendChild(document.createTextNode(currentBuildMeta.taskVersion));
-        buildMetaNode.appendChild(a);
-        buildMetaNode.appendChild(document.createTextNode(': ' + (currentBuildMeta.success ? "success" : 
"failed ")));
-        
-    });
-    $(repoDataSignal).on("current-smoketest-meta-loaded", function () {
-       var node = $("#smoketest-meta").get(0);
-
-        $(node).empty();
-        var ref = 'work/tasks/smoketest/';
-        if (currentSmoketestMeta.success)
-            ref += '/successful';
-        else
-            ref += '/failed';
-        ref += '/' + currentSmoketestMeta.taskVersion;
-        var a = document.createElement('a');
-        a.setAttribute('href', ref);
-        a.setAttribute('rel', 'external');
-        a.appendChild(document.createTextNode(currentSmoketestMeta.taskVersion));
-        node.appendChild(a);
-        node.appendChild(document.createTextNode(': ' + (currentSmoketestMeta.success ? "success" : "failed 
")));
+    $(repoDataSignal).on("taskdata-changed", function (event, taskName) {
+        this._renderTask(taskNames);
     });
 }
diff --git a/extras/build.gnome.org/index.html b/extras/build.gnome.org/index.html
index 9093733..d99f43b 100644
--- a/extras/build.gnome.org/index.html
+++ b/extras/build.gnome.org/index.html
@@ -64,25 +64,8 @@
          for more information. </p>
        <p>Build: <a href="" id="build-meta"></a></p>
        <p>Smoketest: <a href="" id="smoketest-meta"></a></p>
+       <p>Integrationtest: <a href="" id="integrationtest-meta"></a></p>
        <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
-       <ul data-role="listview" data-inset="true">
-         <li><a href="#dummy-change-1">
-             <h3>Build 20130416.7</h3>
-             <p>Updated modules: gdm, dbus</p>
-         </a></li>
-         <li><a href="#dummy-change-2">
-             <h3>Build 20130416.6</h3>
-             <p>Updated modules: glib</p>
-         </a></li>
-         <li><a href="#dummy-smoketest-1">
-             <h3>Smoketest 20130416.2</h3>
-             <p>Passed</p>
-         </a></li>
-         <li><a href="#dummy-change-2">
-             <h3>Build 20130416.5</h3>
-             <p>Updated modules: glib, gtk3</p>
-         </a></li>
-       </ul>
       </div>
     </div>
   </body>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]