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; return html;
} }
if (scope.RemovePostRefresh) { if (scope.PostRefreshRemove) {
scope.RemovePostRefresh(); scope.PostRefreshRemove();
} }
scope.RemovePostRefresh = scope.$on('PostRefresh', function() { scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
// Initialize the parent levels // Initialize the parent levels
var set = scope[list.name]; var set = scope[list.name];
var cDate; var cDate;
@@ -189,8 +189,9 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
} }
scope.refresh = function() { scope.refresh = function() {
scope.expand = true; scope['jobSearchSpin'] = true;
scope.search(list.iterator); 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, function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobHostList,
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath) ClearScope, ProcessErrors, GetBasePath, Refresh)
{ {
ClearScope('htmlTemplate'); ClearScope('htmlTemplate');
var list = JobHostList; var list = JobHostList;
@@ -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].host_name = scope.jobhosts[i].summary_fields.host.name;
scope.jobhosts[i].status = (scope.jobhosts[i].failed) ? 'error' : 'success'; 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 // need job_status so we can show/hide refresh button
Rest.setUrl(GetBasePath('jobs') + scope.job_id); Rest.setUrl(GetBasePath('jobs') + scope.job_id);
Rest.get() Rest.get()
@@ -81,7 +81,6 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
} }
scope.search(list.iterator); scope.search(list.iterator);
LoadBreadCrumbs(); LoadBreadCrumbs();
scope.showEvents = function(host_name, last_job) { scope.showEvents = function(host_name, last_job) {
@@ -103,12 +102,16 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
} }
scope.refresh = function() { 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', JobHostSummaryList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList',
'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', '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', icon: 'icon-zoom-in',
"class": "btn-default btn-sm", "class": "btn-default btn-sm",
options: [ options: [
{ ngClick: "allJobs(\{\{ host.id \}\})", label: 'All jobs', ngShow: 'host.last_job' }, { ngClick: "allJobs(\{\{ host.id \}\})", label: 'All', ngShow: 'host.last_job' },
{ ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}', \{\{ inventory_id \}\})", label: 'All host summaries', { ngClick: "allHostSummaries(\{\{ host.id \}\},'\{\{ host.name \}\}', \{\{ inventory_id \}\})", label: 'All summaries',
ngShow: 'host.last_job' }, 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 \}\}', " + { 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 \}\}', " + { 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' } { ngClick: "", label: 'No job data available', ngShow: 'host.last_job == null' }
] ]
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -194,7 +194,15 @@ angular.module('Utilities',[])
$rootScope.breadcrumbs.push({ title: child, path: $rootScope.crumbCache[j].altPath }); $rootScope.breadcrumbs.push({ title: child, path: $rootScope.crumbCache[j].altPath });
} }
else { 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 { else {

View File

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