[gnome-continuous/wip/apptest: 11/13] build.gnome.org: Make page representing the status of a build



commit 1f44b1924cdb4830756fa7941b7875a8b6c2a537
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Nov 15 15:36:58 2013 -0500

    build.gnome.org: Make page representing the status of a build
    
    ... and put apptest results on it

 extras/build.gnome.org/app.css                     |   25 ++++++++
 extras/build.gnome.org/app.js                      |    6 ++-
 extras/build.gnome.org/controllers.js              |   65 +++++++++++++-------
 extras/build.gnome.org/images/app-bad.png          |  Bin 0 -> 2383 bytes
 extras/build.gnome.org/images/app-generic.png      |  Bin 0 -> 30489 bytes
 extras/build.gnome.org/images/app-good.png         |  Bin 0 -> 3591 bytes
 .../partials/gnome-continuous-build.html           |   18 ++++++
 .../build.gnome.org/partials/gnome-continuous.html |   16 +----
 8 files changed, 93 insertions(+), 37 deletions(-)
---
diff --git a/extras/build.gnome.org/app.css b/extras/build.gnome.org/app.css
index 6dd8adc..ac8f282 100644
--- a/extras/build.gnome.org/app.css
+++ b/extras/build.gnome.org/app.css
@@ -86,3 +86,28 @@ footer {
 .machine.bad .status {
     background-image: url(images/build-bad.svg);
 }
+
+.app {
+    padding: 1em;
+    float: left;
+    text-align: center;
+}
+
+.app .icon, .app .icon img {
+    width: 96px;
+    height: 96px;
+
+    position: relative;
+}
+
+.app .emblem {
+    width: 48px;
+    height: 48px;
+    position: absolute;
+    right: 0px;
+    bottom: 0px;
+}
+
+.app.good .emblem {
+    background-image: url(images/app-good.png);
+}
diff --git a/extras/build.gnome.org/app.js b/extras/build.gnome.org/app.js
index 3ae0488..818bdfa 100644
--- a/extras/build.gnome.org/app.js
+++ b/extras/build.gnome.org/app.js
@@ -16,7 +16,11 @@
             }).
             when('/gnome-continuous', {
                 templateUrl: 'partials/gnome-continuous.html',
-                controller: 'ContinuousTaskViewCtrl',
+                controller: 'ContinuousHomeCtrl',
+            }).
+            when('/gnome-continuous/build/:buildName', {
+                templateUrl: 'partials/gnome-continuous-build.html',
+                controller: 'ContinuousBuildViewCtrl',
             }).
             otherwise({
                 redirectTo: '/',
diff --git a/extras/build.gnome.org/controllers.js b/extras/build.gnome.org/controllers.js
index fe0d3c3..7cb734e 100644
--- a/extras/build.gnome.org/controllers.js
+++ b/extras/build.gnome.org/controllers.js
@@ -5,38 +5,24 @@
 
     var taskNames = ['build', 'smoketest', 'integrationtest', 'applicationstest'];
 
-    function getUrl(suffix) {
-        return window.location.protocol + '//' + window.location.host +
-            window.location.pathname + 'continuous/buildmaster/' + suffix;
-    }
-
-    function getContinuousTask($http, taskName) {
-        return $http.get(getUrl('results/tasks/' + taskName + '/' + taskName + '/meta.json'));
-    }
+    var ROOT = '/continuous/buildmaster/';
 
     bgoControllers.controller('ContinuousStatusCtrl', function($scope, $http) {
-        getContinuousTask($http, 'build').success(function(data) {
+        $http.get(ROOT + 'results/tasks/build/build/meta.json').success(function(data) {
             $scope.status = data.success ? 'good' : 'bad';
             $scope.buildName = data.buildName;
         });
     });
 
-    bgoControllers.controller('ContinuousTaskViewCtrl', function($scope, $http) {
-        $scope.getUrl = getUrl;
-
-        $http.get(getUrl('autobuilder-status.json')).success(function(status) {
-            var text;
-            if (status.running.length > 0)
-                text = 'Running: ' + status.running.join(' ') + '; load=' + status.systemLoad[0];
-            else
-                text = 'Idle, awaiting commits';
+    bgoControllers.controller('ContinuousBuildViewCtrl', function($scope, $http, $routeParams) {
+        var buildName = $routeParams.buildName;
+        $scope.buildName = buildName;
 
-            $scope.runningState = text;
-        });
+        var buildRoot = ROOT + 'builds/' + buildName + '/';
 
         var tasks = [];
         taskNames.forEach(function(taskName) {
-            getContinuousTask($http, taskName).success(function(data) {
+            $http.get(buildRoot + taskName + '/meta.json').success(function(data) {
                 // Mangle the data a bit so we can render it better
                 data['name'] = taskName;
 
@@ -46,8 +32,43 @@
                     $scope.smoketestImage = getUrl(data['path'] + 
'/work-gnome-continuous-x86_64-runtime/screenshot-final.png');
             });
         });
-
         $scope.tasks = tasks;
+
+        var apps = [];
+        $http.get(buildRoot + 'applicationstest/apps.json').success(function(data) {
+            var appsDict = data['apps'];
+            Object.keys(appsDict).forEach(function(id) {
+                var app = appsDict[id];
+                var icon = app.icon ? (ROOT + app.icon) : '/images/app-generic.png';
+                apps.push({ id: id,
+                            name: id, /* XXX */
+                            status: (app.state == "success") ? 'good' : 'bad',
+                            icon: icon });
+            });
+        });
+        $scope.apps = apps;
+
+    });
+
+    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) {
+            builds.push(data);
+        });
+        $scope.builds = builds;
+
+        $http.get(ROOT + 'autobuilder-status.json').success(function(status) {
+            var text;
+            if (status.running.length > 0)
+                text = 'Running: ' + status.running.join(' ') + '; load=' + status.systemLoad[0];
+            else
+                text = 'Idle, awaiting commits';
+
+            $scope.runningState = text;
+        });
     });
 
 })(window);
diff --git a/extras/build.gnome.org/images/app-bad.png b/extras/build.gnome.org/images/app-bad.png
new file mode 100644
index 0000000..49ed530
Binary files /dev/null and b/extras/build.gnome.org/images/app-bad.png differ
diff --git a/extras/build.gnome.org/images/app-generic.png b/extras/build.gnome.org/images/app-generic.png
new file mode 100644
index 0000000..c45955f
Binary files /dev/null and b/extras/build.gnome.org/images/app-generic.png differ
diff --git a/extras/build.gnome.org/images/app-good.png b/extras/build.gnome.org/images/app-good.png
new file mode 100644
index 0000000..84fe175
Binary files /dev/null and b/extras/build.gnome.org/images/app-good.png differ
diff --git a/extras/build.gnome.org/partials/gnome-continuous-build.html 
b/extras/build.gnome.org/partials/gnome-continuous-build.html
new file mode 100644
index 0000000..bc99dc1
--- /dev/null
+++ b/extras/build.gnome.org/partials/gnome-continuous-build.html
@@ -0,0 +1,18 @@
+<article>
+  <h1>GNOME-Continuous</h1>
+  <h2>{{ buildName }}</h2>
+  <div class="tasks">
+    <div ng-repeat="task in tasks">
+      {{ task.name }} : {{ task.status }}
+    </div>
+  </div>
+
+  <div class="app-grid">
+    <a ng-repeat="app in apps" class="app" ng-class="app.status" title="{{ app.name }}" href="???">
+      <div class="icon">
+        <img src="{{ app.icon }}">
+        <div class="emblem"></div>
+      </div>
+    </a>
+  </div>
+</article>
diff --git a/extras/build.gnome.org/partials/gnome-continuous.html 
b/extras/build.gnome.org/partials/gnome-continuous.html
index f574896..d30a72a 100644
--- a/extras/build.gnome.org/partials/gnome-continuous.html
+++ b/extras/build.gnome.org/partials/gnome-continuous.html
@@ -5,21 +5,9 @@
   <p>
     State: <span>{{ runningState }}</span>
   </p>
-  <p ng-repeat="task in tasks">
-    {{ task.name }}: <a href="{{ getUrl(task.path) }}" rel="external">
-      <span>{{ task.buildName }}:</span>
-      <span ng-switch on="{{ task.success }}">
-        <span ng-switch-when="true">success</span>
-        <span ng-switch-when="false">failed</span>
-      </span>
-    </a>
-    <span>{{ task.status }}</span>
+  <p ng-repeat="build in builds">
+    <a href="#/gnome-continuous/build/{{ build.buildName }}">{{ build.buildName }}</a>
   </p>
 
   <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
-  <p>
-    <center>
-      <img src="{{ smoketestImage }}"></img>
-    </center>
-  </p>
 </article>


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