Inventory refactor: fixed group host-failed link to refresh hosts view with only failed hosts. Link from hosts to hosts/N/job_hosts_summaries works again.s

This commit is contained in:
chris Houseknecht 2014-01-16 12:26:21 -05:00
parent a0affa90d4
commit 283b21475a
4 changed files with 31 additions and 10 deletions

View File

@ -48,7 +48,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
}
scope.RemoveSetHostLink = scope.$on('setHostLink', function(e, inventory_id) {
for (var i=0; i < scope.jobhosts.length; i++) {
scope.jobhosts[i].hostLinkTo = '/#/inventories/' + inventory_id + '/hosts/?name=' +
scope.jobhosts[i].hostLinkTo = '/#/inventories/' + inventory_id + '/?host_name=' +
escape(scope.jobhosts[i].summary_fields.host.name);
}
});
@ -91,9 +91,10 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
}
else {
// Make the host name appear in breadcrumbs
LoadBreadCrumbs({ path: '/hosts/' + scope['host_id'], title: $routeParams['host_name'] });
LoadBreadCrumbs({ path: '/hosts/' + scope['host_id'],
title: ( (scope.jobhosts.length > 0) ? scope.jobhosts[0].summary_fields.host.name : 'Host' ) });
if ($routeParams['inventory']) {
scope.$emit('setHostLink', $routeParams['inventory']);
scope.$emit('setHostLink', $routeParams['inventory']);
}
}
});

View File

@ -52,8 +52,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
}
}])
.factory('HostsReload', [ 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus',
function(Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) {
.factory('HostsReload', [ '$routeParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus',
function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) {
return function(params) {
var scope = params.scope;
@ -61,6 +61,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
var tree_id = params.tree_id
var inventory_id = params.inventory_id;
var list = InventoryHosts;
var url = ( !Empty(group_id) ) ? GetBasePath('groups') + group_id + '/all_hosts/' :
GetBasePath('inventory') + inventory_id + '/hosts/';
@ -80,9 +81,27 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
scope.$emit('HostReloadComplete');
});
SearchInit({ scope: scope, set: 'hosts', list: InventoryHosts, url: url });
PaginateInit({ scope: scope, list: InventoryHosts, url: url });
scope.search(InventoryHosts.iterator);
SearchInit({ scope: scope, set: 'hosts', list: list, url: url });
PaginateInit({ scope: scope, list: list, url: url });
if ($routeParams['host_name']) {
scope[list.iterator + 'InputDisable'] = false;
scope[list.iterator + 'SearchValue'] = $routeParams['host_name'];
scope[list.iterator + 'SearchField'] = 'name';
scope[list.iterator + 'SearchFieldLabel'] = list.fields['name'].label;
scope[list.iterator + 'SearchSelectValue'] = null;
}
if (scope.show_failures) {
scope[list.iterator + 'InputDisable'] = true;
scope[list.iterator + 'SearchValue'] = 'true';
scope[list.iterator + 'SearchField'] = 'has_active_failures';
scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_active_failures'].label;
scope[list.iterator + 'SearchSelectValue'] = { value: 1 };
}
scope.search(list.iterator);
}
}])

View File

@ -74,6 +74,7 @@ angular.module('InventoryHostsDefinition', [])
},
active_failures: {
//label: 'Job Status',
ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}",
awToolTip: "\{\{ host.badgeToolTip \}\}",
dataPlacement: 'top',
iconClass: "\{\{ 'fa icon-failures-' + host.has_active_failures \}\}"

View File

@ -326,7 +326,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }}, true)\" ng-true-value=\"1\" " +
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
}
else if (options.mode == 'edit' || options.mode == 'summary') {
else if ((options.mode == 'edit' || options.mode == 'summary') && list.fieldActions) {
// Row level actions
@ -349,7 +349,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
html += (fAction.ngHref) ? "ng-href=\"" + fAction.ngHref + "\" " : "";
html += (action == 'cancel') ? " class=\"cancel red-txt\" " : "";
for (itm in fAction) {
if (itm != 'href' && itm != 'label' && itm != 'icon' && itm != 'class' && itm != 'iconClass') {
if (itm != 'ngHref' && itm != 'href' && itm != 'label' && itm != 'icon' && itm != 'class' && itm != 'iconClass') {
html += Attr(fAction, itm);
}
}