[gnome-continuous] build.gnome.org: Rewrite using AngularJS



commit 71fa8a0db477b7b0822423ef7f95c24aaa507de0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Oct 14 12:35:55 2013 -0400

    build.gnome.org: Rewrite using AngularJS
    
    I spent more time fighting jQuery Mobile than writing the website,
    so I figured that jQuery Mobile wasn't build for this use case.
    
    Through a dice roll, I picked AngularJS, and it seems to be working
    fairly well for me.

 extras/build.gnome.org/app.js                      |   26 +
 extras/build.gnome.org/build.gnome.org.js          |  156 -
 extras/build.gnome.org/controllers.js              |   42 +
 extras/build.gnome.org/index.html                  |   78 +-
 extras/build.gnome.org/lib                         |    1 -
 .../build.gnome.org/partials/gnome-continuous.html |   25 +
 extras/build.gnome.org/partials/home.html          |   19 +
 .../partials/jhbuild-ubuntu-raring.html            |    8 +
 extras/lib/images/ajax-loader.gif                  |  Bin 7825 -> 0 bytes
 extras/lib/images/icons-18-black.png               |  Bin 1968 -> 0 bytes
 extras/lib/images/icons-18-white.png               |  Bin 1988 -> 0 bytes
 extras/lib/images/icons-36-black.png               |  Bin 3859 -> 0 bytes
 extras/lib/images/icons-36-white.png               |  Bin 3861 -> 0 bytes
 extras/lib/images/texture.png                      |  Bin 748 -> 0 bytes
 extras/lib/jquery-1.8.2.js                         | 9440 -----------------
 extras/lib/jquery.flot.js                          | 2599 -----
 extras/lib/jquery.mobile-1.3.0.js                  |11092 --------------------
 extras/lib/jquery.mobile.structure-1.3.0.css       | 2197 ----
 extras/lib/jquery.mobile.theme-1.3.0.css           | 1167 --
 19 files changed, 127 insertions(+), 26723 deletions(-)
---
diff --git a/extras/build.gnome.org/app.js b/extras/build.gnome.org/app.js
new file mode 100644
index 0000000..13d2b00
--- /dev/null
+++ b/extras/build.gnome.org/app.js
@@ -0,0 +1,26 @@
+(function(exports) {
+    'use strict';
+
+    var bgo = angular.module('build.gnome.org', [
+        'ngRoute',
+        'bgoControllers',
+    ]);
+
+    bgo.config(['$routeProvider', function($routeProvider) {
+        $routeProvider.
+            when('/', {
+                templateUrl: 'partials/home.html'
+            }).
+            when('/jhbuild-ubuntu-raring', {
+                templateUrl: 'partials/jhbuild-ubuntu-raring.html'
+            }).
+            when('/gnome-continuous', {
+                templateUrl: 'partials/gnome-continuous.html',
+                controller: 'GnomeContinuousCtrl',
+            }).
+            otherwise({
+                redirectTo: '/',
+            });
+    }]);
+
+})(window);
diff --git a/extras/build.gnome.org/controllers.js b/extras/build.gnome.org/controllers.js
new file mode 100644
index 0000000..e6af3a5
--- /dev/null
+++ b/extras/build.gnome.org/controllers.js
@@ -0,0 +1,42 @@
+(function(exports) {
+    'use strict';
+
+    var bgoControllers = angular.module('bgoControllers', []);
+
+    var taskNames = ['build', 'smoketest', 'integrationtest', 'applicationstest'];
+
+    function getUrl(suffix) {
+        return window.location.protocol + '//' + window.location.host +
+            window.location.pathname + 'continuous/buildmaster/' + suffix;
+    }
+
+    bgoControllers.controller('GnomeContinuousCtrl', 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';
+
+            $scope.runningState = text;
+        });
+
+        var tasks = [];
+        taskNames.forEach(function(taskName) {
+            $http.get(getUrl('results/tasks/' + taskName + '/' + taskName + 
'/meta.json')).success(function(data) {
+                // Mangle the data a bit so we can render it better
+                data['name'] = taskName;
+
+                tasks.push(data);
+
+                if (taskName == 'smoketest')
+                    $scope.smoketestImage = getUrl(data['path'] + 
'/work-gnome-continuous-x86_64-runtime/screenshot-final.png');
+            });
+        });
+
+        $scope.tasks = tasks;
+    });
+
+})(window);
diff --git a/extras/build.gnome.org/index.html b/extras/build.gnome.org/index.html
index 26b8e00..9e1a705 100644
--- a/extras/build.gnome.org/index.html
+++ b/extras/build.gnome.org/index.html
@@ -1,78 +1,14 @@
-<!DOCTYPE html>
-<html>
+<!doctype html>
+<html ng-app="build.gnome.org">
   <head>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <link rel="stylesheet" href="lib/jquery.mobile.structure-1.3.0.css" />
-    <link rel="stylesheet" href="lib/jquery.mobile.theme-1.3.0.css" />
-    <style>
-      /* App custom styles */
-    </style>
-    <script src="lib/jquery-1.8.2.js"></script>
-    <script src="lib/jquery.mobile-1.3.0.js"></script>
-    <script src="build.gnome.org.js"></script>
+    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js";></script>
+    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-route.min.js";></script>
+    <script src="app.js"></script>
+    <script src="controllers.js"></script>
   </head>
   <body>
-    <!-- Home -->
-    <div data-role="page" id="home">
-      <div data-theme="" data-role="header">
-        <h3>GNOME build status</h3>
-      </div>
-      <div data-role="content">
-       <div class="content-primary">
-         <h2>GNOME master</h2>
-         <ul data-role="listview" data-inset="true">
-           <li><a href="#jhbuild-ubuntu-raring">
-               <h3>jhbuild (Ubuntu Raring)</h3>
-               <p>This builder uses JHBuild on Ubuntu Raring.</p>
-               <p class="ui-li-aside"><strong>status unknown</strong></p>
-           </a></li>
-           <li><a href="#gnome-continuous">
-               <h3>GNOME-Continuous</h3>
-               <p>Custom build system; produces disk images that can
-                 be updated from an OSTree repository.</p>
-               <p class="ui-li-aside"><strong>status unknown</strong></p>
-           </a></li>
-         </ul>
-         <p>This site is maintained in
-         the <a href="http://git.gnome.org/browse/gnome-continuous";>gnome-continuous</a>
-         git module.</p>
-       </div>
-      </div>
-    </div>
-    
-    <div data-role="page" id="jhbuild-ubuntu-raring">
-      <div data-theme="" data-role="header">
-        <h3>jhbuild (Ubuntu Raring)</h3>
-      </div>
-      <div data-role="content">
-       <p><a href="https://jenkins.qa.ubuntu.com/view/Raring/view/JHBuild%20Gnome/";>Jenkins view</a>.</p>
-       <p>Uses <a href="https://live.gnome.org/Jhbuild";>Jhbuild</a> with custom Jenkins glue to build from 
git on an <a href="https://wiki.ubuntu.com/RaringRingtail/ReleaseSchedule";>Ubuntu Raring</a> base.</p>
-       <p>Maintainer: Martin Pitt &lt;pitti gnome org&gt;</p>
-      </div>
-    </div>
-
-    <div data-role="page" id="gnome-continuous">
-      <div data-theme="" data-role="header">
-        <h3>GNOME-Continuous</h3>
-      </div>
-      <div data-role="content">
-       <p>See <a href="https://live.gnome.org/GnomeContinuous";>GNOME-Continuous</a>
-         for more information. </p>
-       <p>
-         State: <span id="running-state"></span>
-       </p>
-       <p>Build: <a href="" id="build-link"></a><span id="build-span"></span></p>
-       <p>Smoketest: <a href="" id="smoketest-link"></a><span id="smoketest-span"></span></p>
-       <p>Integrationtest: <a href="" id="integrationtest-link"></a><span 
id="integrationtest-span"></span></p>
-       <p>Applicationstest: <a href="" id="applicationstest-link"></a><span 
id="applicationstest-span"></span></p>
-       <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
-       <p>
-         <center>
-           <img id="smoketest-final-img"></img>
-         </center>
-       </p>
-      </div>
-    </div>
+    <div ng-view></div>
   </body>
 </html>
diff --git a/extras/build.gnome.org/partials/gnome-continuous.html 
b/extras/build.gnome.org/partials/gnome-continuous.html
new file mode 100644
index 0000000..e9da29d
--- /dev/null
+++ b/extras/build.gnome.org/partials/gnome-continuous.html
@@ -0,0 +1,25 @@
+<div>
+  <h1>GNOME-Continuous</h1>
+  <p>See <a href="https://wiki.gnome.org/GnomeContinuous";>GNOME-Continuous</a>
+    for more information. </p>
+  <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>
+
+  <p>Maintainer: Colin Walters &lt;walters verbum org&gt;</p>
+  <p>
+    <center>
+      <img src="{{ smoketestImage }}"></img>
+    </center>
+  </p>
+</div>
diff --git a/extras/build.gnome.org/partials/home.html b/extras/build.gnome.org/partials/home.html
new file mode 100644
index 0000000..5940e4c
--- /dev/null
+++ b/extras/build.gnome.org/partials/home.html
@@ -0,0 +1,19 @@
+<div>
+  <h1>GNOME Build Status</h1>
+  <ul>
+    <li><a href="#/jhbuild-ubuntu-raring">
+       <h3>jhbuild (Ubuntu Raring)</h3>
+       <p>This builder uses JHBuild on Ubuntu Raring.</p>
+       <p><strong>status unknown</strong></p>
+    </a></li>
+    <li><a href="#/gnome-continuous">
+       <h3>GNOME-Continuous</h3>
+       <p>Custom build system; produces disk images that can
+         be updated from an OSTree repository.</p>
+       <p><strong>status unknown</strong></p>
+    </a></li>
+  </ul>
+  <p>This site is maintained in
+    the <a href="http://git.gnome.org/browse/gnome-continuous";>gnome-continuous</a>
+    git module.</p>
+</div>
diff --git a/extras/build.gnome.org/partials/jhbuild-ubuntu-raring.html 
b/extras/build.gnome.org/partials/jhbuild-ubuntu-raring.html
new file mode 100644
index 0000000..880b2b1
--- /dev/null
+++ b/extras/build.gnome.org/partials/jhbuild-ubuntu-raring.html
@@ -0,0 +1,8 @@
+<div>
+  <h1>jhbuild (Ubuntu Raring)</h1>
+  <div>
+    <p><a href="https://jenkins.qa.ubuntu.com/view/Raring/view/JHBuild%20Gnome/";>Jenkins view</a>.</p>
+    <p>Uses <a href="https://wiki.gnome.org/Jhbuild";>Jhbuild</a> with custom Jenkins glue to build from git 
on an <a href="https://wiki.ubuntu.com/RaringRingtail/ReleaseSchedule";>Ubuntu Raring</a> base.</p>
+    <p>Maintainer: Martin Pitt &lt;pitti gnome org&gt;</p>
+  </div>
+</div>


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