diff options
-rw-r--r-- | index.html | 4 | ||||
-rw-r--r-- | js/main.js | 11 |
2 files changed, 12 insertions, 3 deletions
@@ -10,9 +10,9 @@ <h1><em>Baserock</em> <span>|</span> CIAT</h1> <div class="visualisation" ng-controller="VisualisationController"> - <div class="box" + <div class="box pass" ng-repeat="step in steps"> - {{step.name}} + {{step.name}} {{step.lastBuild}} </div> </div> </body> @@ -8,13 +8,22 @@ app.config(['$httpProvider', function($httpProvider) { app.controller('VisualisationController', ['$scope', '$http', function($scope, $http) { + function formatBuild(response) { + return { + success: response.data.text[response.data.text.length - 1] === 'successful', + }; + } + $scope.steps = []; $http.get('http://ciat.baserock.org:8010/json/builders') .then(function(builders) { angular.forEach(builders.data, function(value, key) { + var lastBuildID = value.cachedBuilds[value.cachedBuilds.length - 1]; + var buildsPath = 'http://ciat.baserock.org:8010/json/builders/' + + key + '/builds/' + lastBuildID; var step = { name: key, - last_build: value.cachedBuilds[value.cachedBuilds.length - 1], + lastBuild: $http.get(buildsPath).then(formatBuild), data: value } $scope.steps.push(step); |