made dashboard graphs live and fixed url checking of sockets

This commit is contained in:
John Mitchell 2015-05-29 13:32:34 -04:00
parent 31d0342d41
commit 465518a2bc
3 changed files with 33 additions and 9 deletions

View File

@ -990,24 +990,29 @@ var tower = angular.module('Tower', [
' status changed to ' + data.status +
' send to ' + $location.$$url);
var urlToCheck = $location.$$url;
if (urlToCheck.indexOf("?") !== -1) {
urlToCheck = urlToCheck.substr(0, urlToCheck.indexOf("?"));
}
// this acts as a router...it emits the proper
// value based on what URL the user is currently
// accessing.
if ($location.$$url === '/jobs') {
if (urlToCheck === '/jobs') {
$rootScope.$emit('JobStatusChange-jobs', data);
} else if (/\/jobs\/(\d)+\/stdout/.test($location.$$url) ||
/\/ad_hoc_commands\/(\d)+/.test($location.$$url)) {
} else if (/\/jobs\/(\d)+\/stdout/.test(urlToCheck) ||
/\/ad_hoc_commands\/(\d)+/.test(urlToCheck)) {
$log.debug("sending status to standard out");
$rootScope.$emit('JobStatusChange-jobStdout', data);
} else if (/\/jobs\/(\d)+/.test($location.$$url)) {
} else if (/\/jobs\/(\d)+/.test(urlToCheck)) {
$rootScope.$emit('JobStatusChange-jobDetails', data);
} else if ($location.$$url === '/home') {
} else if (urlToCheck === '/home') {
$rootScope.$emit('JobStatusChange-home', data);
} else if ($location.$$url === '/portal') {
} else if (urlToCheck === '/portal') {
$rootScope.$emit('JobStatusChange-portal', data);
} else if ($location.$$url === '/projects') {
} else if (urlToCheck === '/projects') {
$rootScope.$emit('JobStatusChange-projects', data);
} else if (/\/inventory\/(\d)+\/manage/.test($location.$$url)) {
} else if (/\/inventory\/(\d)+\/manage/.test(urlToCheck)) {
$rootScope.$emit('JobStatusChange-inventory', data);
}
});

View File

@ -25,7 +25,7 @@
tooltip_delay: {show: 500, hide: 100}, // Default number of milliseconds to delay displaying/hiding tooltips
debug_mode: false, // Enable console logging messages
debug_mode: true, // Enable console logging messages
password_length: 8, // Minimum user password length. Set to 0 to not set a limit
password_hasLowercase: true, // require a lowercase letter in the password

View File

@ -33,6 +33,25 @@ export function Home($scope, $compile, $routeParams, $rootScope, $location, $log
var dataCount = 0;
$rootScope.$on('JobStatusChange-home', function () {
Rest.setUrl(GetBasePath("jobs") + "?order_by=-finished&page_size=5&finished__isnull=false");
Rest.get()
.success(function (data) {
$scope.dashboardJobsListData = data.results;
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard jobs list: ' + status });
});
Rest.setUrl(GetBasePath("job_templates") + "?order_by=-last_job_run&page_size=5&last_job_run__isnull=false");
Rest.get()
.success(function (data) {
$scope.dashboardJobTemplatesListData = data.results;
})
.error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard jobs list: ' + status });
});
});
if ($scope.removeDashboardDataLoadComplete) {
$scope.removeDashboardDataLoadComplete();
}