AC-386 All Jobs and All Host Summaries links now work from Inventories-> Hosts page.

This commit is contained in:
chouseknecht
2013-09-03 17:38:28 -04:00
parent 78de6b360f
commit eae151ba31
6 changed files with 62 additions and 25 deletions

View File

@@ -89,9 +89,10 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
$location.url('/jobs/?job_host_summaries__host=' + id);
}
scope.allHostSummaries = function(id, name) {
LoadBreadCrumbs({ path: '/inventories/' + scope.inventory_id + '/hosts', title: name });
$location.url('/hosts/' + id + '/job_host_summaries');
scope.allHostSummaries = function(id, name, inventory_id) {
LoadBreadCrumbs({ path: '/hosts/' + id, title: name, altPath: '/inventories/' + inventory_id + '/hosts',
inventory_id: inventory_id });
$location.url('/hosts/' + id + '/job_host_summaries/?inventory=' + inventory_id);
}
scope.viewLastEvents = function(host_id, last_job, host_name, last_job_name) {

View File

@@ -21,6 +21,16 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
var view = GenerateList;
var scope = view.inject(list, { mode: 'edit' });
scope.selected = [];
// control enable/disable/show of job specific view elements
if (base == 'hosts') {
scope.job_id = null;
scope.host_id = $routeParams.id;
}
else {
scope.job_id = $routeParams.id;
scope.host_id = null;
}
// After a refresh, populate any needed summary field values on each row
if (scope.PostRefreshRemove) {
@@ -48,30 +58,34 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
LoadBreadCrumbs();
scope.showEvents = function(host_name, last_job) {
// When click on !Failed Events link, redirect to latest job/job_events for the host
Rest.setUrl(last_job);
Rest.get()
.success( function(data, status, headers, config) {
LoadBreadCrumbs({ path: '/jobs/' + data.id, title: data.name });
$location.url('/jobs/' + data.id + '/job_events/?host=' + escape(host_name));
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to lookup last job: ' + last_job + '. GET status: ' + status });
});
}
// When click on !Failed Events link, redirect to latest job/job_events for the host
Rest.setUrl(last_job);
Rest.get()
.success( function(data, status, headers, config) {
LoadBreadCrumbs({ path: '/jobs/' + data.id, title: data.name });
$location.url('/jobs/' + data.id + '/job_events/?host=' + escape(host_name));
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to lookup last job: ' + last_job + '. GET status: ' + status });
});
}
scope.showJob = function(id) {
$location.path('/jobs/' + id);
}
scope.refresh = function() {
scope.search(list.iterator);
}
scope.search(list.iterator);
}
scope.jobDetails = function() {
$location.path('/jobs/' + $routeParams.id);
};
$location.path('/jobs/' + $routeParams.id);
};
scope.jobEvents = function() {
$location.path('/jobs/' + $routeParams.id + '/job_events');
};
$location.path('/jobs/' + $routeParams.id + '/job_events');
};
}