diff options
author | Adam Coldrick <adam@sotk.co.uk> | 2015-10-03 15:16:01 +0100 |
---|---|---|
committer | Adam Coldrick <adam@sotk.co.uk> | 2015-10-03 18:46:06 +0100 |
commit | 7876e614898a26ebeb899e893e1dcc64430e4cb2 (patch) | |
tree | 143fd4a3f812889105bae84770085b255af2f7b4 /js/main.js | |
parent | fb72238788cb42961c544251ffcf7ccc80686a96 (diff) | |
download | ciat-ui-7876e614898a26ebeb899e893e1dcc64430e4cb2.tar.gz |
Show real data on the builder detail page
Get data for the recent builds on a specific builder, and display
it in the table in a nice way.
Diffstat (limited to 'js/main.js')
-rw-r--r-- | js/main.js | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -1,6 +1,16 @@ var apiBase = 'http://ciat.baserock.org:8010/json'; var app = angular.module('ciat', ['ngRoute']); +function checkInArray(array, key) { + if (array) { + if (array.indexOf(key) > -1) { + return true; + } + } + return false; +} + + app.config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; @@ -20,15 +30,6 @@ app.config(['$routeProvider', function($routeProvider) { }]); app.controller('VisualisationController', function($scope, $http, $q, $interval) { - function checkInArray(array, key) { - if (array) { - if (array.indexOf(key) > -1) { - return true; - } - } - return false; - } - function load() { $scope.steps = []; $scope.integrations = []; @@ -183,11 +184,29 @@ app.controller('VisualisationController', function($scope, $http, $q, $interval) app.controller('BuilderDetailController', function($scope, $http, $routeParams) { - $http.get(apiBase + '/builders/' + $routeParams.name).then(function(builder) { + var builderUrl = apiBase + '/builders/' + $routeParams.name; + + // GET details of the builder + $http.get(builderUrl).then(function(builder) { $scope.builder = { name: $routeParams.name, data: builder.data }; }); + + $scope.builds = []; + // GET list of all builds from this builder + $http.get(builderUrl + '/builds/_all').then(function(response) { + for (var n in response.data) { + var build_data = response.data[n]; + $scope.builds.push({ + success: checkInArray(build_data.text, 'successful'), + number: n, + startTime: build_data.times[0], + finishTime: build_data.times[1], + data: build_data + }); + } + }); } ); |