diff options
author | Adam Coldrick <adam@sotk.co.uk> | 2015-09-26 16:33:54 +0100 |
---|---|---|
committer | Adam Coldrick <adam@sotk.co.uk> | 2015-09-28 20:24:04 +0100 |
commit | 3f35b152da563f546257cb4196db92eabc25863f (patch) | |
tree | 5281c7febf0ac4480c34fee14fe179736e8a990d | |
parent | 033d462b5b942defb291bb37f3c641c531349617 (diff) | |
download | ciat-ui-3f35b152da563f546257cb4196db92eabc25863f.tar.gz |
Sort the steps array and reload the array each minute
-rw-r--r-- | js/main.js | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -6,7 +6,7 @@ app.config(['$httpProvider', function($httpProvider) { } ]); -app.controller('VisualisationController', function($scope, $http, $q) { +app.controller('VisualisationController', function($scope, $http, $q, $interval) { function checkInArray(array, key) { if (array) { if (array.indexOf(key) > -1) { @@ -28,17 +28,21 @@ app.controller('VisualisationController', function($scope, $http, $q) { lastBuildID = value.cachedBuilds[value.cachedBuilds.length - 1]; } - var buildsPath = 'http://ciat.baserock.org:8010/json/builders/' + - key + '/builds/' + lastBuildID; - $http.get(buildsPath).then(function(response) { - var details = { - success: checkInArray(response.data.text, 'successful'), - failed: checkInArray(response.data.text, 'failed') - }; - $scope.steps.push({ - name: key, - lastBuild: details, - data: value + var buildsPath = 'http://ciat.baserock.org:8010/json/builders/' + + key + '/builds/' + lastBuildID; + $http.get(buildsPath).then(function(response) { + var details = { + success: checkInArray(response.data.text, 'successful'), + failed: checkInArray(response.data.text, 'failed') + }; + $scope.steps.push({ + name: key, + lastBuild: details, + data: value + }); + $scope.steps.sort(function(a, b) { + return a.charAt(0) > b.charAt(0); + }); }); }); }); |