summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam@sotk.co.uk>2015-09-26 16:33:54 +0100
committerAdam Coldrick <adam@sotk.co.uk>2015-09-28 20:24:04 +0100
commit3f35b152da563f546257cb4196db92eabc25863f (patch)
tree5281c7febf0ac4480c34fee14fe179736e8a990d
parent033d462b5b942defb291bb37f3c641c531349617 (diff)
downloadciat-ui-3f35b152da563f546257cb4196db92eabc25863f.tar.gz
Sort the steps array and reload the array each minute
-rw-r--r--js/main.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/js/main.js b/js/main.js
index 4e6416d..8b10d78 100644
--- a/js/main.js
+++ b/js/main.js
@@ -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);
+ });
});
});
});