mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 18:21:12 +03:00
AC-386 All Jobs and All Host Summaries links now work from Inventories-> Hosts page.
This commit is contained in:
parent
78de6b360f
commit
eae151ba31
@ -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) {
|
||||
|
@ -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');
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,8 @@ angular.module('InventoryHostsFormDefinition', [])
|
||||
//ngDisabled: 'host.last_job == null',
|
||||
options: [
|
||||
{ ngClick: "allJobs(\{\{ host.id \}\})", label: 'All jobs', ngShow: 'host.last_job' },
|
||||
{ ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}')", label: 'All host summaries', ngShow: 'host.last_job' },
|
||||
{ ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}', \{\{ inventory_id \}\})", label: 'All host summaries',
|
||||
ngShow: 'host.last_job' },
|
||||
{ ngClick: 'viewJobs(\{\{ host.last_job \}\})', label: 'Latest job', ngShow: 'host.last_job' },
|
||||
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
||||
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest job events', ngShow: 'host.last_job' },
|
||||
|
@ -17,6 +17,13 @@ angular.module('JobHostDefinition', [])
|
||||
hover: true,
|
||||
|
||||
fields: {
|
||||
job: {
|
||||
label: 'Job ID',
|
||||
ngClick: "showJob(\{\{ jobhost.job \}\})",
|
||||
columnShow: 'host_id !== null',
|
||||
key: true,
|
||||
desc: true
|
||||
},
|
||||
host: {
|
||||
label: 'Host',
|
||||
key: true,
|
||||
@ -68,6 +75,7 @@ angular.module('JobHostDefinition', [])
|
||||
label: 'Details',
|
||||
icon: 'icon-edit',
|
||||
ngClick: "jobDetails()",
|
||||
ngShow: 'job_id !== null',
|
||||
"class": 'btn btn-default btn-sm',
|
||||
awToolTip: 'Edit job details',
|
||||
mode: 'all'
|
||||
@ -76,6 +84,7 @@ angular.module('JobHostDefinition', [])
|
||||
label: 'Events',
|
||||
icon: 'icon-list-ul',
|
||||
ngClick: "jobEvents()",
|
||||
ngShow: 'job_id !== null',
|
||||
"class": 'btn btn-default btn-sm',
|
||||
awToolTip: 'View job events',
|
||||
mode: 'all'
|
||||
|
@ -213,6 +213,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
||||
html += "\" id=\"";
|
||||
html += (list.fields[fld].id) ? list.fields[fld].id : fld + "-header";
|
||||
html += "\"";
|
||||
html += (list.fields[fld].columnShow) ? " ng-show=\"" + list.fields[fld].columnShow + "\" " : "";
|
||||
html += (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) ? "ng-click=\"sort('" + fld + "')\"" : "";
|
||||
html += ">";
|
||||
html += list.fields[fld].label;
|
||||
|
@ -133,7 +133,7 @@ angular.module('Utilities',[])
|
||||
}])
|
||||
|
||||
.factory('LoadBreadCrumbs', ['$rootScope', '$routeParams', '$location', function($rootScope, $routeParams, $location, Rest) {
|
||||
return function(crumb) {
|
||||
return function(crumb) {
|
||||
//Keep a list of path/title mappings. When we see /organizations/XX in the path, for example,
|
||||
//we'll know the actual organization name it maps to.
|
||||
if (crumb !== null && crumb !== undefined) {
|
||||
@ -171,10 +171,21 @@ angular.module('Utilities',[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
$rootScope.breadcrumbs.push({ title: child, path: ppath + '/' + paths[i] });
|
||||
if ($rootScope.crumbCache[j].altPath) {
|
||||
$rootScope.breadcrumbs.push({ title: child, path: $rootScope.crumbCache[j].altPath });
|
||||
}
|
||||
else {
|
||||
$rootScope.breadcrumbs.push({ title: child, path: ppath + '/' + paths[i] });
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rootScope.breadcrumbs.push({ title: paths[i], path: ppath + '/' + paths[i] });
|
||||
if (paths[i] == 'hosts') {
|
||||
$rootScope.breadcrumbs.push({ title: paths[i], path: '/inventories/' + $routeParams.inventory +
|
||||
'/hosts' });
|
||||
}
|
||||
else {
|
||||
$rootScope.breadcrumbs.push({ title: paths[i], path: ppath + '/' + paths[i] });
|
||||
}
|
||||
}
|
||||
ppath += '/' + paths[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user