summaryrefslogtreecommitdiff
path: root/js/main.js
diff options
context:
space:
mode:
authorAdam Coldrick <adam@sotk.co.uk>2015-10-03 15:16:01 +0100
committerAdam Coldrick <adam@sotk.co.uk>2015-10-03 18:46:06 +0100
commit7876e614898a26ebeb899e893e1dcc64430e4cb2 (patch)
tree143fd4a3f812889105bae84770085b255af2f7b4 /js/main.js
parentfb72238788cb42961c544251ffcf7ccc80686a96 (diff)
downloadciat-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.js39
1 files changed, 29 insertions, 10 deletions
diff --git a/js/main.js b/js/main.js
index 77d5c86..8afcf2a 100644
--- a/js/main.js
+++ b/js/main.js
@@ -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
+ });
+ }
+ });
}
);