[gnome-continuous] build.gnome.org: Rework front page to show current task status



commit 512aa260d511dae5f5970193ef2a4098e18059dc
Author: Colin Walters <walters verbum org>
Date:   Sat Nov 23 17:31:48 2013 -0500

    build.gnome.org: Rework front page to show current task status
    
    And have a bit more explanation around each task.

 extras/build.gnome.org/app.css                     |    4 +
 extras/build.gnome.org/controllers.js              |  114 ++++++++++++++------
 .../build.gnome.org/partials/gnome-continuous.html |   28 +++++-
 3 files changed, 111 insertions(+), 35 deletions(-)
---
diff --git a/extras/build.gnome.org/app.css b/extras/build.gnome.org/app.css
index ac8f282..aec52d6 100644
--- a/extras/build.gnome.org/app.css
+++ b/extras/build.gnome.org/app.css
@@ -71,6 +71,10 @@ footer {
     text-decoration: none;
 }
 
+.task-failed {
+    color: red
+}
+
 .machine.good {
     background-color: lightgreen;
 }
diff --git a/extras/build.gnome.org/controllers.js b/extras/build.gnome.org/controllers.js
index 1bb1f70..27ae5ae 100644
--- a/extras/build.gnome.org/controllers.js
+++ b/extras/build.gnome.org/controllers.js
@@ -28,6 +28,33 @@
         });
     });
 
+    function renderApps($http, path, callback) {
+        $http.get(ROOT + path + '/applicationstest/apps.json').success(function(data) {
+            var apps = data['apps'];
+
+            // Older builds use a different scheme for the
+            // applicationstest; just ignore them.
+            if (!apps.forEach)
+                return;
+
+            apps.forEach(function(app) {
+                // Mangle the data a bit
+
+                app.name = app.id; /* XXX */
+                app.status = (app.state == "success") ? 'good' : 'bad';
+
+                // XXX -- this should probably be in the template
+                if (app.icon)
+                    app.icon = ROOT + app.icon;
+                else
+                    app.icon = '/images/app-generic.png';
+
+                app.screenshot = ROOT + app.screenshot;
+            });
+           callback(apps);
+        });
+    }
+
     bgoControllers.controller('ContinuousBuildViewCtrl', function($scope, $http, $routeParams) {
         var buildVersion = $routeParams.buildVersion;
         $scope.buildVersion = buildVersion;
@@ -51,44 +78,20 @@
         });
         $scope.tasks = tasks;
 
-        var apps = [];
-        $http.get(buildRoot + 'applicationstest/apps.json').success(function(data) {
-            var apps = data['apps'];
-
-            // Older builds use a different scheme for the
-            // applicationstest; just ignore them.
-            if (!apps.forEach)
-                return;
-
-            apps.forEach(function(app) {
-                // Mangle the data a bit
-
-                app.name = app.id; /* XXX */
-                app.status = (app.state == "success") ? 'good' : 'bad';
-
-                // XXX -- this should probably be in the template
-                if (app.icon)
-                    app.icon = ROOT + app.icon;
-                else
-                    app.icon = '/images/app-generic.png';
-
-                app.screenshot = ROOT + app.screenshot;
-            });
+       renderApps($http, 'builds/' + buildPath, function(apps) {
             $scope.apps = apps;
-        });
+       });
     });
 
+    function compareTaskData(a, b) {
+       var ai = taskNames.indexOf(a['name']);
+       var bi = taskNames.indexOf(b['name']);
+       return ai - bi;
+    }
+
     bgoControllers.controller('ContinuousHomeCtrl', function($scope, $http) {
         var builds = [];
 
-        // Just get the most recent build for now. We need an
-        // API to iterate over all the builds.
-        $http.get(ROOT + 'results/tasks/build/build/meta.json').success(function(data) {
-            data.buildVersion = relpathToVersion(data.buildPath);
-            builds.push(data);
-        });
-        $scope.builds = builds;
-
         $http.get(ROOT + 'autobuilder-status.json').success(function(status) {
             var text;
             if (status.running.length > 0)
@@ -98,6 +101,53 @@
 
             $scope.runningState = text;
         });
+
+        var completedTasks = [];
+        taskNames.forEach(function(taskName) {
+           var href = ROOT + 'results/tasks/' + taskName + '/' + taskName;
+            $http.get(href + '/meta.json').success(function(data) {
+                // Mangle the data a bit so we can render it better
+                data['name'] = taskName;
+               data['version'] = relpathToVersion(data['buildPath']);
+               data['href'] = href;
+                completedTasks.push(data);
+               completedTasks.sort(compareTaskData);
+               $scope[taskName] = data;
+            }).error(function(data, status, headers, config) {
+               data = {};
+               data['name'] = taskName;
+               data['status'] = '(none completed)';
+                completedTasks.push(data);
+               completedTasks.sort(compareTaskData);
+           });
+        });
+        $scope.completedTasks = completedTasks;
+
+       $http.get(ROOT + '/results/tasks/integrationtest/installed-test-results.js').success(function(data) {
+           var testname;
+           var total = 0;
+           var failed = [];
+           var successful = [];
+           var skipped = [];
+           for (testname in data) {
+               total++;
+               var status = data[testname];
+               if (status == 'success')
+                   successful.push(testname);
+               else if (status == 'failed')
+                   failed.push(testname);
+               else if (status == 'skipped')
+                   skipped.push(testname);
+           }
+           $scope.installedTestsTotal = total;
+           $scope.installedTestsSuccessful = successful;
+           $scope.installedTestsFailed = failed;
+           $scope.installedTestsSkipped = skipped;
+       });
+
+       renderApps($http, 'results/tasks/build', function(apps) {
+            $scope.apps = apps;
+       });
     });
 
 })(window);
diff --git a/extras/build.gnome.org/partials/gnome-continuous.html 
b/extras/build.gnome.org/partials/gnome-continuous.html
index 1155609..9c9ecf6 100644
--- a/extras/build.gnome.org/partials/gnome-continuous.html
+++ b/extras/build.gnome.org/partials/gnome-continuous.html
@@ -5,9 +5,31 @@
   <p>
     State: <span>{{ runningState }}</span>
   </p>
-  <p ng-repeat="build in builds">
-    <a href="#/gnome-continuous/build/{{ build.buildVersion }}">{{ build.buildVersion }}</a>
-  </p>
+  
+  <div>
+    <h3>Tasks</h3>
+    <p ng-repeat="task in completedTasks">
+      <span><a class="task" href="{{ task.href }}">{{ task.name }} {{ task.version }}</a>: <span 
ng-if="task.success" class="task-success">Successful</span> <span ng-if="!task.success" 
class="task-failed">Failed</span></span>
+    </p>
+  </div>
+    
+  <div class="installed-tests">
+    <h3><a href="https://live.gnome.org/GnomeGoals/InstalledTests";>InstalledTests</a></h3>
+    <div>Version {{ integrationtest.version }}</div>
+    <div> {{ installedTestsSuccessful.length }} successful, {{ installedTestsSkipped.length }} skipped</div>
+    <div>Failed: {{ installedTestsFailed }}</div>
+  </div>
+
+  <div class="app-grid">
+    <h3>Application Tests</h3>
+    <div>Version {{ applicationstest.version }}</div>
+    <a ng-repeat="app in apps" class="app" ng-class="app.status" title="{{ app.name }}" href="{{ 
app.screenshot }}">
+      <div class="icon">
+        <img src="{{ app.icon }}">
+        <div class="emblem"></div>
+      </div>
+    </a>
+  </div>
 
   <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
 </article>


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