mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 03:45:01 -02:30
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:
@@ -48,7 +48,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
|
|||||||
}
|
}
|
||||||
scope.RemoveSetHostLink = scope.$on('setHostLink', function(e, inventory_id) {
|
scope.RemoveSetHostLink = scope.$on('setHostLink', function(e, inventory_id) {
|
||||||
for (var i=0; i < scope.jobhosts.length; i++) {
|
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);
|
escape(scope.jobhosts[i].summary_fields.host.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -91,9 +91,10 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Make the host name appear in breadcrumbs
|
// 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']) {
|
if ($routeParams['inventory']) {
|
||||||
scope.$emit('setHostLink', $routeParams['inventory']);
|
scope.$emit('setHostLink', $routeParams['inventory']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory('HostsReload', [ 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus',
|
.factory('HostsReload', [ '$routeParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus',
|
||||||
function(Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) {
|
function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
@@ -61,6 +61,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
var tree_id = params.tree_id
|
var tree_id = params.tree_id
|
||||||
var inventory_id = params.inventory_id;
|
var inventory_id = params.inventory_id;
|
||||||
|
|
||||||
|
var list = InventoryHosts;
|
||||||
var url = ( !Empty(group_id) ) ? GetBasePath('groups') + group_id + '/all_hosts/' :
|
var url = ( !Empty(group_id) ) ? GetBasePath('groups') + group_id + '/all_hosts/' :
|
||||||
GetBasePath('inventory') + inventory_id + '/hosts/';
|
GetBasePath('inventory') + inventory_id + '/hosts/';
|
||||||
|
|
||||||
@@ -80,9 +81,27 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
scope.$emit('HostReloadComplete');
|
scope.$emit('HostReloadComplete');
|
||||||
});
|
});
|
||||||
|
|
||||||
SearchInit({ scope: scope, set: 'hosts', list: InventoryHosts, url: url });
|
SearchInit({ scope: scope, set: 'hosts', list: list, url: url });
|
||||||
PaginateInit({ scope: scope, list: InventoryHosts, url: url });
|
PaginateInit({ scope: scope, list: list, url: url });
|
||||||
scope.search(InventoryHosts.iterator);
|
|
||||||
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ angular.module('InventoryHostsDefinition', [])
|
|||||||
},
|
},
|
||||||
active_failures: {
|
active_failures: {
|
||||||
//label: 'Job Status',
|
//label: 'Job Status',
|
||||||
|
ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}",
|
||||||
awToolTip: "\{\{ host.badgeToolTip \}\}",
|
awToolTip: "\{\{ host.badgeToolTip \}\}",
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
iconClass: "\{\{ 'fa icon-failures-' + host.has_active_failures \}\}"
|
iconClass: "\{\{ 'fa icon-failures-' + host.has_active_failures \}\}"
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }}, true)\" ng-true-value=\"1\" " +
|
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>";
|
"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
|
// Row level actions
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
html += (fAction.ngHref) ? "ng-href=\"" + fAction.ngHref + "\" " : "";
|
html += (fAction.ngHref) ? "ng-href=\"" + fAction.ngHref + "\" " : "";
|
||||||
html += (action == 'cancel') ? " class=\"cancel red-txt\" " : "";
|
html += (action == 'cancel') ? " class=\"cancel red-txt\" " : "";
|
||||||
for (itm in fAction) {
|
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);
|
html += Attr(fAction, itm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user