mirror of
https://github.com/ansible/awx.git
synced 2026-08-03 03:19:57 -02:30
Activity stream: implemented new search. Fixed a bunch of things related to the new data structure. Fixed /home/groups page.
This commit is contained in:
@@ -93,7 +93,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
var found = false;
|
||||
var group = Find({ list: scope.groups, key: 'id', val: tree_id });
|
||||
|
||||
scope.showHosts(tree_id, group_id, false);
|
||||
if (scope.showHosts) {
|
||||
if (scope.selected_tree_id !== tree_id)
|
||||
scope.showHosts(tree_id, group_id, false);
|
||||
}
|
||||
|
||||
if (group) {
|
||||
if (Empty(group.source)) {
|
||||
@@ -141,9 +144,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
// Return values for use on host status indicator
|
||||
|
||||
if (active_failures > 0) {
|
||||
tip = active_failures +
|
||||
[ (active_failures == 1) ? ' host' : ' hosts' ] + ' with failed jobs.' +
|
||||
[ (active_failures == 1) ? ' host' : ' hosts' ] + '.';
|
||||
tip = total_hosts + ( (total_hosts == 1) ? ' host' : ' hosts' ) + '. ' + active_failures + ' with failed jobs.';
|
||||
html_class = 'true';
|
||||
failures = true;
|
||||
}
|
||||
@@ -156,7 +157,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
}
|
||||
else {
|
||||
// many hosts with 0 failures
|
||||
tip = 'No job failures';
|
||||
tip = total_hosts + ( (total_hosts == 1) ? ' host' : ' hosts' ) + '. No job failures';
|
||||
html_class = 'false';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,8 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
}
|
||||
Refresh({ scope: scope, set: set, iterator: iterator, url: url });
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
if (scope.removeFoundObject) {
|
||||
scope.removeFoundObject();
|
||||
}
|
||||
@@ -269,8 +270,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
scope.$emit('prepareSearch2', iterator, page, load, spin);
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
if (scope.removeResultWarning) {
|
||||
/*if (scope.removeResultWarning) {
|
||||
scope.removeResultWarning();
|
||||
}
|
||||
scope.removeResultWarning = scope.$on('resultWarning', function(e, objs, length) {
|
||||
@@ -278,6 +280,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
var label = (objs == 'inventory') ? 'inventories' : objs.replace(/s$/,'');
|
||||
Alert('Warning', 'The number of matching ' + label + ' was too large. We limited your search to the first 30.', 'alert-info');
|
||||
});
|
||||
*/
|
||||
|
||||
if (scope.removePrepareSearch) {
|
||||
scope.removePrepareSearch();
|
||||
@@ -293,6 +296,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
var modifier;
|
||||
|
||||
// Determine how many object values we're dealing with.
|
||||
/*
|
||||
expected_objects = 0;
|
||||
found_objects = 0;
|
||||
for (var i=1; i <= widgets; i++) {
|
||||
@@ -305,18 +309,27 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
expected_objects++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (var i=1; i <= widgets; i++) {
|
||||
var modifier = (i == 1) ? '' : i;
|
||||
if ( $('#search-widget-container' + modifier) ) {
|
||||
if (list.fields[scope[iterator + 'SearchField' + modifier]] &&
|
||||
list.fields[scope[iterator + 'SearchField' + modifier]].searchObject) {
|
||||
// Search field of object type
|
||||
if (list.fields[scope[iterator + 'SearchField' + modifier]].searchObject !== 'all') {
|
||||
// An object type is selected
|
||||
scope[iterator + 'HideAllStartBtn' + modifier] = false;
|
||||
if (scope[iterator + 'SearchValue' + modifier]) {
|
||||
// A search value was entered
|
||||
scope[iterator + 'ShowStartBtn' + modifier] = false;
|
||||
var objs = list.fields[scope[iterator + 'SearchField' + modifier]].searchObject;
|
||||
var objUrl = GetBasePath('base') + objs + '/?name__icontains=' + scope[iterator + 'SearchValue' + modifier];
|
||||
scope[iterator + 'SearchParams'] += '&' +
|
||||
list.fields[scope[iterator + 'SearchField' + modifier]].searchObject +
|
||||
'__name__icontains=' +
|
||||
scope[iterator + 'SearchValue' + modifier];
|
||||
|
||||
//var objUrl = GetBasePath('base') + objs + '/?name__icontains=' + scope[iterator + 'SearchValue' + modifier];
|
||||
/*
|
||||
Rest.setUrl(objUrl);
|
||||
Rest.setHeader({ widget: i });
|
||||
Rest.setHeader({ object: objs });
|
||||
@@ -340,10 +353,11 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
{ hdr: 'Error!', msg: 'Retrieving list of ' + objs + ' where name contains: ' + scope[iterator + 'SearchValue' + modifier] +
|
||||
' GET returned status: ' + status });
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
scope[iterator + 'ShowStartBtn' + modifier] = true;
|
||||
scope.$emit('foundObject', iterator, page, load, spin, i, null);
|
||||
//scope.$emit('foundObject', iterator, page, load, spin, i, null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -353,10 +367,11 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
}
|
||||
}
|
||||
}
|
||||
if (expected_objects == 0) {
|
||||
scope.$emit('prepareSearch2', iterator, page, load, spin);
|
||||
//if (expected_objects == 0) {
|
||||
// No search widgets contain objects
|
||||
scope.$emit('prepareSearch2', iterator, page, load, spin);
|
||||
}
|
||||
// scope.$emit('prepareSearch2', iterator, page, load, spin);
|
||||
//}
|
||||
});
|
||||
|
||||
if (scope.removePrepareSearch2) {
|
||||
|
||||
Reference in New Issue
Block a user