mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 14:09:28 -02:30
AC-331 checkbox for 'Only show hosts will failed jobs' now working on Hosts tabs. Removed from Groups tab.
This commit is contained in:
@@ -238,7 +238,9 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
});
|
});
|
||||||
|
|
||||||
scope.filterInventory = function() {
|
scope.filterInventory = function() {
|
||||||
HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] });
|
$rootScope.hostFailureFilter = scope.hostFailureFilter;
|
||||||
|
LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] });
|
||||||
|
//HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] });
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.filterHosts = function() {
|
scope.filterHosts = function() {
|
||||||
@@ -383,10 +385,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
|
|
||||||
scope['selectedNode'] = node;
|
scope['selectedNode'] = node;
|
||||||
scope['selectedNodeName'] = node.attr('name');
|
scope['selectedNodeName'] = node.attr('name');
|
||||||
scope['selectedNodeName'] += (node.attr('data-failures') == 'true') ?
|
|
||||||
' <span class="nav-badge">' +
|
|
||||||
'<i class="icon-exclamation-sign" title="Contains hosts with failed jobs"></i></span>' : '';
|
|
||||||
|
|
||||||
$('#tree-view').jstree('open_node',node);
|
$('#tree-view').jstree('open_node',node);
|
||||||
|
|
||||||
if (type == 'group') {
|
if (type == 'group') {
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
RelatedSearchInit({ scope: params.scope, form: InventoryForm, relatedSets: relatedSets });
|
RelatedSearchInit({ scope: params.scope, form: InventoryForm, relatedSets: relatedSets });
|
||||||
RelatedPaginateInit({ scope: params.scope, relatedSets: relatedSets, pageSize: 40 });
|
RelatedPaginateInit({ scope: params.scope, relatedSets: relatedSets, pageSize: 40 });
|
||||||
|
|
||||||
if (scope['hostFailureFilter']) {
|
/*if (scope['hostFailureFilter']) {
|
||||||
// If the user checked 'show only hosts with failures', filter for hosts with failed jobs
|
// If the user checked 'show only hosts with failures', filter for hosts with failed jobs
|
||||||
scope['hostSearchFieldLabel'] = 'Failed jobs?';
|
scope['hostSearchFieldLabel'] = 'Failed jobs?';
|
||||||
scope['hostSearchField'] = 'has_active_failures';
|
scope['hostSearchField'] = 'has_active_failures';
|
||||||
@@ -488,7 +488,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
scope['hostSearchSelectValue'] = scope['hostSearchSelectOpts'][i];
|
scope['hostSearchSelectValue'] = scope['hostSearchSelectOpts'][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
scope.search('host');
|
scope.search('host');
|
||||||
|
|
||||||
|
|||||||
@@ -35,17 +35,14 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
scope.inventoryLoadedRemove();
|
scope.inventoryLoadedRemove();
|
||||||
}
|
}
|
||||||
scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() {
|
scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() {
|
||||||
var filter = (scope.inventoryFailureFilter) ? "has_active_failures=true&" : "";
|
var url = groups + '?order_by=name';
|
||||||
var url = groups + '?' + filter + 'order_by=name';
|
|
||||||
var title;
|
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
for (var i=0; i < data.results.length; i++) {
|
for (var i=0; i < data.results.length; i++) {
|
||||||
title = data.results[i].name;
|
|
||||||
treeData[0].children.push({
|
treeData[0].children.push({
|
||||||
data: {
|
data: {
|
||||||
title: title
|
title: data.results[i].name
|
||||||
},
|
},
|
||||||
attr: {
|
attr: {
|
||||||
id: idx,
|
id: idx,
|
||||||
@@ -55,7 +52,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
description: data.results[i].description,
|
description: data.results[i].description,
|
||||||
inventory: data.results[i].inventory,
|
inventory: data.results[i].inventory,
|
||||||
all: data.results[i].related.all_hosts,
|
all: data.results[i].related.all_hosts,
|
||||||
children: data.results[i].related.children + '?' + filter + 'order_by=name',
|
children: data.results[i].related.children + '?order_by=name',
|
||||||
hosts: data.results[i].related.hosts,
|
hosts: data.results[i].related.hosts,
|
||||||
variable: data.results[i].related.variable_data,
|
variable: data.results[i].related.variable_data,
|
||||||
"data-failures": data.results[i].has_active_failures
|
"data-failures": data.results[i].has_active_failures
|
||||||
@@ -71,13 +68,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var title = inventory_name;
|
|
||||||
title += (has_active_failures) ? ' <span class="tree-badge" title="Contains hosts with failed jobs">' +
|
|
||||||
'<i class="icon-exclamation-sign"></i></span>' : '';
|
|
||||||
treeData =
|
treeData =
|
||||||
[{
|
[{
|
||||||
data: {
|
data: {
|
||||||
title: title
|
title: inventory_name
|
||||||
},
|
},
|
||||||
attr: {
|
attr: {
|
||||||
type: 'inventory',
|
type: 'inventory',
|
||||||
@@ -142,13 +136,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
headers: { 'Authorization': 'Token ' + Authorization.getToken() },
|
headers: { 'Authorization': 'Token ' + Authorization.getToken() },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var response = [];
|
var response = [];
|
||||||
var title;
|
|
||||||
var filter = (scope.inventoryFailureFilter) ? "has_active_failures=true&" : "";
|
|
||||||
for (var i=0; i < data.results.length; i++) {
|
for (var i=0; i < data.results.length; i++) {
|
||||||
title = data.results[i].name;
|
|
||||||
response.push({
|
response.push({
|
||||||
data: {
|
data: {
|
||||||
title: title
|
title: data.results[i].name
|
||||||
},
|
},
|
||||||
attr: {
|
attr: {
|
||||||
id: idx,
|
id: idx,
|
||||||
@@ -158,7 +149,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
description: data.results[i].description,
|
description: data.results[i].description,
|
||||||
inventory: data.results[i].inventory,
|
inventory: data.results[i].inventory,
|
||||||
all: data.results[i].related.all_hosts,
|
all: data.results[i].related.all_hosts,
|
||||||
children: data.results[i].related.children + '?' + filter + 'order_by=name',
|
children: data.results[i].related.children + '?order_by=name',
|
||||||
hosts: data.results[i].related.hosts,
|
hosts: data.results[i].related.hosts,
|
||||||
variable: data.results[i].related.variable_data,
|
variable: data.results[i].related.variable_data,
|
||||||
"data-failures": data.results[i].has_active_failures
|
"data-failures": data.results[i].has_active_failures
|
||||||
@@ -385,8 +376,6 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
node.attr('description', description);
|
node.attr('description', description);
|
||||||
scope = angular.element(getElementById('htmlTemplate')).scope();
|
scope = angular.element(getElementById('htmlTemplate')).scope();
|
||||||
scope['selectedNodeName'] = name;
|
scope['selectedNodeName'] = name;
|
||||||
scope['selectedNodeName'] += (node.attr('data-failures') == 'true') ?
|
|
||||||
' <span class="nav-badge"><i class="icon-exclamation-sign" title="Contains hosts with failed jobs"></i></span>' : '';
|
|
||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
|||||||
@@ -83,15 +83,6 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
|||||||
scope[iterator + 'HideSearchType'] = true;
|
scope[iterator + 'HideSearchType'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iterator == 'host') {
|
|
||||||
if (fld == 'has_active_failures') {
|
|
||||||
scope['hostFailureFilter'] = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scope['hostFailureFilter'] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scope.search(iterator);
|
scope.search(iterator);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -143,13 +134,13 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
|||||||
(scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) || (f.searchType && f.searchType == 'gtzero') ) {
|
(scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) || (f.searchType && f.searchType == 'gtzero') ) {
|
||||||
if (f.sourceModel) {
|
if (f.sourceModel) {
|
||||||
// handle fields whose source is a related model e.g. inventories.organization
|
// handle fields whose source is a related model e.g. inventories.organization
|
||||||
scope[iterator + 'SearchParams'] = '?' + f.sourceModel + '__' + f.sourceField + '__';
|
scope[iterator + 'SearchParams'] = f.sourceModel + '__' + f.sourceField + '__';
|
||||||
}
|
}
|
||||||
else if (f.searchField) {
|
else if (f.searchField) {
|
||||||
scope[iterator + 'SearchParams'] = '?' + f.searchField + '__';
|
scope[iterator + 'SearchParams'] = f.searchField + '__';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope[iterator + 'SearchParams'] = '?' + scope[iterator + 'SearchField'] + '__';
|
scope[iterator + 'SearchParams'] = scope[iterator + 'SearchField'] + '__';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( f.searchType && (f.searchType == 'int' || f.searchType == 'boolean' ) ) {
|
if ( f.searchType && (f.searchType == 'int' || f.searchType == 'boolean' ) ) {
|
||||||
@@ -171,11 +162,10 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
|||||||
scope[iterator + 'SearchParams'] += (sort_order) ? '&order_by=' + escape(sort_order) : '';
|
scope[iterator + 'SearchParams'] += (sort_order) ? '&order_by=' + escape(sort_order) : '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope[iterator + 'SearchParams'] = '';
|
scope[iterator + 'SearchParams'] = (sort_order) ? 'order_by=' + escape(sort_order) : '';
|
||||||
scope[iterator + 'SearchParams'] += (sort_order) ? '?order_by=' + escape(sort_order) : '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scope[iterator + 'Page'] = 0;
|
scope[iterator + 'Page'] = 0;
|
||||||
|
url += (url.match(/\/$/)) ? '?' : '&';
|
||||||
url += scope[iterator + 'SearchParams'];
|
url += scope[iterator + 'SearchParams'];
|
||||||
url += (scope[iterator + 'PageSize']) ? '&page_size=' + scope[iterator + 'PageSize'] : "";
|
url += (scope[iterator + 'PageSize']) ? '&page_size=' + scope[iterator + 'PageSize'] : "";
|
||||||
RefreshRelated({ scope: scope, set: set, iterator: iterator, url: url });
|
RefreshRelated({ scope: scope, set: set, iterator: iterator, url: url });
|
||||||
|
|||||||
@@ -474,10 +474,13 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Hos
|
|||||||
var url = parent.attr('data-groups');
|
var url = parent.attr('data-groups');
|
||||||
var html = '';
|
var html = '';
|
||||||
var token = Authorization.getToken();
|
var token = Authorization.getToken();
|
||||||
|
|
||||||
|
url += ($rootScope.hostFailureFilter) ? '?has_active_failures=true&order_by=name' : '?order_by=name';
|
||||||
|
|
||||||
/* For reasons unknown calling Rest fails. It just dies with no errors
|
/* For reasons unknown calling Rest fails. It just dies with no errors
|
||||||
or any info */
|
or any info */
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url + '?order_by=name',
|
url: url,
|
||||||
headers: { 'Authorization': 'Token ' + token },
|
headers: { 'Authorization': 'Token ' + token },
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user