[gnome-continuous] build.gnome.org: Attempt to fix up



commit 50e60e9a5f7bef2512218e8878e2f1ee080439cf
Author: Colin Walters <walters verbum org>
Date:   Sun Nov 17 19:08:52 2013 -0500

    build.gnome.org: Attempt to fix up

 extras/build.gnome.org/app.js                      |    2 +-
 extras/build.gnome.org/controllers.js              |   29 ++++++++++++++++---
 .../partials/gnome-continuous-build.html           |    4 +-
 .../build.gnome.org/partials/gnome-continuous.html |    2 +-
 extras/build.gnome.org/partials/home.html          |    2 +-
 5 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/extras/build.gnome.org/app.js b/extras/build.gnome.org/app.js
index 818bdfa..3c07e10 100644
--- a/extras/build.gnome.org/app.js
+++ b/extras/build.gnome.org/app.js
@@ -18,7 +18,7 @@
                 templateUrl: 'partials/gnome-continuous.html',
                 controller: 'ContinuousHomeCtrl',
             }).
-            when('/gnome-continuous/build/:buildName', {
+            when('/gnome-continuous/build/:buildVersion', {
                 templateUrl: 'partials/gnome-continuous-build.html',
                 controller: 'ContinuousBuildViewCtrl',
             }).
diff --git a/extras/build.gnome.org/controllers.js b/extras/build.gnome.org/controllers.js
index b32fd0d..fb32f7e 100644
--- a/extras/build.gnome.org/controllers.js
+++ b/extras/build.gnome.org/controllers.js
@@ -7,25 +7,43 @@
 
     var ROOT = '/continuous/buildmaster/';
 
+    var YMD_SERIAL_VERSION_RE = /^(\d+)(\d\d)(\d\d)\.(\d+)$/;
+
+    function relpathToVersion(relpath) {
+       var parts = relpath.split('/');
+       parts.shift(); // Remove builds/
+       return parts[0] + parts[1] + parts[2] + '.' + parts[3];
+    };
+
+    function versionToRelpath(version) {
+       var match = YMD_SERIAL_VERSION_RE.exec(version);
+       return 'builds/' + match[1] + '/' + match[2] + '/' +
+           match[3] + '/' + match[4];
+    };
+
     bgoControllers.controller('ContinuousStatusCtrl', function($scope, $http) {
+       console.log("request meta.json");
         $http.get(ROOT + 'results/tasks/build/build/meta.json').success(function(data) {
             $scope.status = data.success ? 'good' : 'bad';
-            $scope.buildName = data.buildName;
+            $scope.buildVersion = relpathToVersion(data.buildName);
+           console.log("scope.buildVersion=" + $scope.buildVersion);
         });
     });
 
     bgoControllers.controller('ContinuousBuildViewCtrl', function($scope, $http, $routeParams) {
-        var buildName = $routeParams.buildName;
-        $scope.buildName = buildName;
+        var buildVersion = $routeParams.buildVersion;
+       console.log("buildVersion=" + buildVersion);
+        $scope.buildVersion = buildVersion;
+        $scope.buildPath = versionToRelpath(buildName);
 
-        var buildRoot = ROOT + 'builds/' + buildName + '/';
+        var buildRoot = ROOT + $scope.buildPath + '/';
 
         var tasks = [];
         taskNames.forEach(function(taskName) {
             $http.get(buildRoot + taskName + '/meta.json').success(function(data) {
                 // Mangle the data a bit so we can render it better
                 data['name'] = taskName;
-
+               data['version'] = relpathToVersion(data['buildName']);
                 tasks.push(data);
             });
         });
@@ -64,6 +82,7 @@
         // 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.buildName);
             builds.push(data);
         });
         $scope.builds = builds;
diff --git a/extras/build.gnome.org/partials/gnome-continuous-build.html 
b/extras/build.gnome.org/partials/gnome-continuous-build.html
index 2627b7f..1a48569 100644
--- a/extras/build.gnome.org/partials/gnome-continuous-build.html
+++ b/extras/build.gnome.org/partials/gnome-continuous-build.html
@@ -1,9 +1,9 @@
 <article>
   <h1>GNOME-Continuous</h1>
-  <h2>{{ buildName }}</h2>
+  <h2>{{ buildVersion }}</h2>
   <div class="tasks">
     <div ng-repeat="task in tasks">
-      {{ task.name }} : {{ task.status }}
+      {{ task.version }} : {{ task.status }}
     </div>
   </div>
 
diff --git a/extras/build.gnome.org/partials/gnome-continuous.html 
b/extras/build.gnome.org/partials/gnome-continuous.html
index d30a72a..1155609 100644
--- a/extras/build.gnome.org/partials/gnome-continuous.html
+++ b/extras/build.gnome.org/partials/gnome-continuous.html
@@ -6,7 +6,7 @@
     State: <span>{{ runningState }}</span>
   </p>
   <p ng-repeat="build in builds">
-    <a href="#/gnome-continuous/build/{{ build.buildName }}">{{ build.buildName }}</a>
+    <a href="#/gnome-continuous/build/{{ build.buildVersion }}">{{ build.buildVersion }}</a>
   </p>
 
   <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
diff --git a/extras/build.gnome.org/partials/home.html b/extras/build.gnome.org/partials/home.html
index b87ef84..7d239a2 100644
--- a/extras/build.gnome.org/partials/home.html
+++ b/extras/build.gnome.org/partials/home.html
@@ -11,6 +11,6 @@
       <h3>GNOME-Continuous</h3>
       <p>Custom build system; produces disk images that can be updated from an OSTree repository.</p>
     </div>
-    <div class="status">{{ buildName }}</div>
+    <div class="status">{{ buildVersion }}</div>
   </a>
 </article>


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