2014-01-16 05:54:21 -08:00
|
|
|
'use strict';
|
|
|
|
|
2014-01-20 07:10:49 -08:00
|
|
|
angular.module('insight.status').controller('StatusController', ['$scope', '$routeParams', '$location', '$rootScope', 'Global', 'Status', 'Sync', function ($scope, $routeParams, $location, $rootScope, Global, Status, Sync) {
|
2014-01-16 05:54:21 -08:00
|
|
|
$scope.global = Global;
|
2014-01-17 06:46:12 -08:00
|
|
|
|
2014-01-20 06:45:01 -08:00
|
|
|
$scope.getStatus = function(q) {
|
2014-01-16 05:54:21 -08:00
|
|
|
Status.get({
|
2014-01-20 06:45:01 -08:00
|
|
|
q: 'get' + q
|
2014-01-16 05:54:21 -08:00
|
|
|
}, function(d) {
|
2014-01-20 11:40:20 -08:00
|
|
|
$rootScope.infoError = null;
|
2014-01-20 06:45:01 -08:00
|
|
|
angular.extend($scope, d);
|
2014-01-20 11:40:20 -08:00
|
|
|
}, function(e) {
|
|
|
|
if (e.status === 503) {
|
|
|
|
$rootScope.infoError = 'Backend Error. ' + e.data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$rootScope.infoError = 'Unknown error:' + e.data;
|
|
|
|
}
|
2014-01-16 05:54:21 -08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-01-20 06:45:01 -08:00
|
|
|
$scope.getSync = function() {
|
|
|
|
Sync.get({}, function(sync) {
|
2014-01-20 11:40:20 -08:00
|
|
|
$rootScope.syncError = null;
|
2014-01-20 06:45:01 -08:00
|
|
|
$scope.sync = sync;
|
2014-01-20 11:40:20 -08:00
|
|
|
}, function(e) {
|
|
|
|
$rootScope.syncError = 'Could not get sync information' + e;
|
2014-01-20 06:45:01 -08:00
|
|
|
});
|
|
|
|
};
|
2014-01-16 05:54:21 -08:00
|
|
|
}]);
|
|
|
|
|