summaryrefslogtreecommitdiff
path: root/js/main.js
diff options
context:
space:
mode:
authorAdam Coldrick <adam@sotk.co.uk>2015-09-26 11:19:03 +0100
committerAdam Coldrick <adam@sotk.co.uk>2015-09-28 20:20:09 +0100
commit3b34af0989fe79e8453bb0ddc9ff3bfaa103d526 (patch)
tree8dea67b5c2154ec2e72a7b234ae9117780b75d74 /js/main.js
parent05522667a1f80877af2d251369dcea72685e5522 (diff)
downloadciat-ui-3b34af0989fe79e8453bb0ddc9ff3bfaa103d526.tar.gz
Get last build
Diffstat (limited to 'js/main.js')
-rw-r--r--js/main.js11
1 files changed, 10 insertions, 1 deletions
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);