AC-525 Found and fixed inconsistencies and bugs in links from Inventories->Hosts to Jobs. Changed Job->Hosts to Job->Summaries so that it works or is consistent with Host->All summaries title. When viewing Host->All summaries disable the breadcrumb drop-down menu. Made breadcrumbs work after browser refresh.

This commit is contained in:
chouseknecht 2013-09-27 13:40:47 -04:00
parent 7bfa0c4b0c
commit 6d9ef4dfa6
10 changed files with 63 additions and 38 deletions

View File

@ -109,10 +109,10 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
return html;
}
if (scope.RemovePostRefresh) {
scope.RemovePostRefresh();
if (scope.PostRefreshRemove) {
scope.PostRefreshRemove();
}
scope.RemovePostRefresh = scope.$on('PostRefresh', function() {
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
// Initialize the parent levels
var set = scope[list.name];
var cDate;
@ -189,8 +189,9 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
}
scope.refresh = function() {
scope.expand = true;
scope.search(list.iterator);
scope['jobSearchSpin'] = true;
scope['jobLoading'] = true;
Refresh({ scope: scope, set: 'jobevents', iterator: 'jobevent', url: scope['current_url'] });
}
}

View File

@ -12,7 +12,7 @@
function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobHostList,
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath)
ClearScope, ProcessErrors, GetBasePath, Refresh)
{
ClearScope('htmlTemplate');
var list = JobHostList;
@ -31,7 +31,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
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;
@ -41,7 +41,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
scope.job_id = $routeParams.id;
scope.host_id = null;
}
// After a refresh, populate any needed summary field values on each row
if (scope.PostRefreshRemove) {
scope.PostRefreshRemove();
@ -51,7 +51,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
scope.jobhosts[i].host_name = scope.jobhosts[i].summary_fields.host.name;
scope.jobhosts[i].status = (scope.jobhosts[i].failed) ? 'error' : 'success';
}
if (scope.host_id == null) {
if (scope.job_id !== null && scope.job_id !== undefined && scope.job_id !== '') {
// need job_status so we can show/hide refresh button
Rest.setUrl(GetBasePath('jobs') + scope.job_id);
Rest.get()
@ -81,7 +81,6 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
}
scope.search(list.iterator);
LoadBreadCrumbs();
scope.showEvents = function(host_name, last_job) {
@ -103,12 +102,16 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
}
scope.refresh = function() {
scope.search(list.iterator);
if (scope.host_id == null) {
scope['jobSearchSpin'] = true;
scope['jobLoading'] = true;
Refresh({ scope: scope, set: 'jobhosts', iterator: 'jobhost', url: scope['current_url'] });
}
}
}
JobHostSummaryList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList',
'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
'ProcessErrors','GetBasePath'
'ProcessErrors', 'GetBasePath', 'Refresh'
];

View File

@ -64,14 +64,14 @@ angular.module('InventoryHostsFormDefinition', [])
icon: 'icon-zoom-in',
"class": "btn-default btn-sm",
options: [
{ ngClick: "allJobs(\{\{ host.id \}\})", label: 'All jobs', ngShow: 'host.last_job' },
{ ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}', \{\{ inventory_id \}\})", label: 'All host summaries',
{ ngClick: "allJobs(\{\{ host.id \}\})", label: 'All', ngShow: 'host.last_job' },
{ ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}', \{\{ inventory_id \}\})", label: 'All summaries',
ngShow: 'host.last_job' },
{ ngClick: 'viewJobs(\{\{ host.last_job \}\})', label: 'Latest job', ngShow: 'host.last_job' },
{ ngClick: 'viewJobs(\{\{ host.last_job \}\})', label: 'Latest', 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' },
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest events', ngShow: 'host.last_job' },
{ ngClick: "viewLastSummary(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest host summary', ngShow: 'host.last_job' },
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest summary', ngShow: 'host.last_job' },
{ ngClick: "", label: 'No job data available', ngShow: 'host.last_job == null' }
]
},

View File

@ -29,7 +29,7 @@ angular.module('JobFormDefinition', [])
},
hosts: {
href: "/#/jobs/{{ job_id }}/job_host_summaries",
label: 'Hosts',
label: 'Summary',
icon: 'icon-laptop'
},
events: {

View File

@ -59,8 +59,8 @@ angular.module('InventoriesListDefinition', [])
icon: 'icon-zoom-in',
'class': 'btn-default btn-xs',
options: [
{ ngClick: 'viewJobs(\{\{ inventory.id \}\})', label: 'All Jobs' },
{ ngClick: "viewFailedJobs(\{\{ inventory.id \}\})", label: 'Failed jobs' }
{ ngClick: 'viewJobs(\{\{ inventory.id \}\})', label: 'All' },
{ ngClick: "viewFailedJobs(\{\{ inventory.id \}\})", label: 'Failed' }
]
},
edit: {

View File

@ -27,7 +27,7 @@ angular.module('JobEventsListDefinition', [])
},
hosts: {
href: "/#/jobs/{{ job_id }}/job_host_summaries",
label: 'Hosts',
label: 'Summary',
icon: 'icon-laptop'
},
events: {

View File

@ -12,11 +12,12 @@ angular.module('JobHostDefinition', [])
name: 'jobhosts',
iterator: 'jobhost',
editTitle: 'Job Host Summary',
editTitle: 'All summaries',
index: true,
hover: true,
navigationLinks: {
ngHide: 'host_id !== null',
details: {
href: "/#/jobs/{{ job_id }}",
label: 'Status',
@ -25,7 +26,7 @@ angular.module('JobHostDefinition', [])
},
hosts: {
href: "/#/jobs/{{ job_id }}/job_host_summaries",
label: 'Hosts',
label: 'Summary',
active: true,
icon: 'icon-laptop'
},

View File

@ -98,7 +98,7 @@ angular.module('JobsListDefinition', [])
'class': 'btn-default btn-xs',
options: [
{ ngClick: "editJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Status' },
{ ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Hosts',
{ ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Summary',
ngHide: "job.status == 'new'" },
{ ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Events',
ngHide: "job.status == 'new'" }

View File

@ -194,7 +194,15 @@ angular.module('Utilities',[])
$rootScope.breadcrumbs.push({ title: child, path: $rootScope.crumbCache[j].altPath });
}
else {
$rootScope.breadcrumbs.push({ title: child, path: ppath + '/' + paths[i] });
if (paths[i - 1] == 'hosts') {
// For hosts, there is no /hosts, so we need to link back to the inventory
// We end up here when user has clicked refresh and the crumbcache is missing
$rootScope.breadcrumbs.push({ title: child,
path: '/inventories/' + $routeParams.inventory + '/hosts' });
}
else {
$rootScope.breadcrumbs.push({ title: child, path: ppath + '/' + paths[i] });
}
}
}
else {

View File

@ -108,11 +108,21 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
if (list.navigationLinks) {
var navigation = list.navigationLinks;
html += "<li class=\"active\"> </li>\n";
html += "</ul>\n";
html += "<div class=\"dropdown\">\n";
if (navigation['ngHide']) {
html += "<li class=\"active\" ng-show=\"" + navigation['ngHide'] + "\">";
html += list.editTitle;
html += "</li>\n";
html += "<li class=\"active\" ng-hide=\"" + navigation['ngHide'] + "\"> </li>\n";
}
else {
html += "<li class=\"active\"> </li>\n";
html += "</ul>\n";
}
html += "<div class=\"dropdown\" ";
html += (navigation['ngHide']) ? Attr(navigation, 'ngHide') : '';
html += ">\n";
for (var itm in navigation) {
if (navigation[itm].active) {
if (typeof navigation[itm] == 'object' && navigation[itm].active) {
html += "<a href=\"\" class=\"toggle\" ";
html += "data-toggle=\"dropdown\" ";
html += ">" + navigation[itm].label + " <i class=\"icon-chevron-sign-down crumb-icon\"></i></a>";
@ -121,15 +131,17 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
}
html += "<ul class=\"dropdown-menu\" role=\"menu\">\n";
for (var itm in navigation) {
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"" +
navigation[itm].href + "\" ";
// html += (navigation[itm].active) ? "class=\"active\" " : "";
html += ">";
html += "<i class=\"icon-ok\" style=\"visibility: ";
html += (navigation[itm].active) ? "visible" : "hidden";
html += "\"></i> ";
html += navigation[itm].label;
html += "</a></li>\n";
if (typeof navigation[itm] == 'object') {
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"" +
navigation[itm].href + "\" ";
// html += (navigation[itm].active) ? "class=\"active\" " : "";
html += ">";
html += "<i class=\"icon-ok\" style=\"visibility: ";
html += (navigation[itm].active) ? "visible" : "hidden";
html += "\"></i> ";
html += navigation[itm].label;
html += "</a></li>\n";
}
}
html += "</ul>\n";
html += "</div><!-- dropdown -->\n";