From 3b34af0989fe79e8453bb0ddc9ff3bfaa103d526 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Sat, 26 Sep 2015 11:19:03 +0100 Subject: Get last build --- index.html | 4 ++-- js/main.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 69b6044..3a53a88 100644 --- a/index.html +++ b/index.html @@ -10,9 +10,9 @@

Baserock | CIAT

-
- {{step.name}} + {{step.name}} {{step.lastBuild}}
diff --git a/js/main.js b/js/main.js index 4295b8c..6854273 100644 --- a/js/main.js +++ b/js/main.js @@ -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); -- cgit v1.2.1