mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 17:17:45 -02:30
Related search now works with new search features. Only searches after user stops typing. Disables the input field while search is executing. Moved refresh button to the right side of list page. Fixed bugs: was using contains rather than icontains. Not sure that old refresh button worked. It does now.
This commit is contained in:
@@ -258,6 +258,15 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('job')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
|
||||
@@ -62,6 +62,15 @@ angular.module('OrganizationFormDefinition', [])
|
||||
label: 'Add',
|
||||
icon: 'icon-plus',
|
||||
awToolTip: 'Add a new user'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('user')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -108,6 +117,15 @@ angular.module('OrganizationFormDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
awToolTip: 'Add new administrator'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('admin')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -215,6 +215,15 @@ angular.module('ProjectFormDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
awToolTip: 'Add an organization'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('organization')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -74,6 +74,15 @@ angular.module('TeamFormDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
add: 'Add a new credential'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('credential')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -118,6 +127,15 @@ angular.module('TeamFormDefinition', [])
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission for this user',
|
||||
ngShow: 'PermissionAddAllowed'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('permission')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -176,6 +194,15 @@ angular.module('TeamFormDefinition', [])
|
||||
ngClick: "add('projects')",
|
||||
icon: 'icon-plus',
|
||||
label: 'Add'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('project')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -219,6 +246,15 @@ angular.module('TeamFormDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a user'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('user')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -122,6 +122,15 @@ angular.module('UserFormDefinition', [])
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a credential for this user'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('credential')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -166,6 +175,15 @@ angular.module('UserFormDefinition', [])
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission for this user',
|
||||
ngShow: 'PermissionAddAllowed'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('permission')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -221,6 +239,18 @@ angular.module('UserFormDefinition', [])
|
||||
open: false, // Open accordion on load?
|
||||
base: '/organizations',
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('adminof')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@@ -238,6 +268,18 @@ angular.module('UserFormDefinition', [])
|
||||
iterator: 'organization',
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('organization')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@@ -255,6 +297,18 @@ angular.module('UserFormDefinition', [])
|
||||
iterator: 'team',
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('team')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@@ -272,6 +326,18 @@ angular.module('UserFormDefinition', [])
|
||||
iterator: 'project',
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch('project')",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
|
||||
@@ -33,6 +33,7 @@ angular.module('RefreshRelatedHelper', ['RestServices', 'Utilities'])
|
||||
scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize']));
|
||||
scope[iterator + 'SearchSpin'] = false;
|
||||
scope[iterator + 'Loading'] = false;
|
||||
scope[iterator + 'HoldInput'] = false;
|
||||
scope.$emit('related' + set);
|
||||
if (!params.scope.$$phase) {
|
||||
params.scope.$digest();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelatedHelper'])
|
||||
.factory('RelatedSearchInit', ['Alert', 'Rest', 'RefreshRelated', function(Alert, Rest, RefreshRelated) {
|
||||
.factory('RelatedSearchInit', ['$timeout', 'Alert', 'Rest', 'RefreshRelated', function($timeout, Alert, Rest, RefreshRelated) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope;
|
||||
@@ -24,9 +24,10 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
||||
var form = params.form;
|
||||
|
||||
// Set default values
|
||||
function setDefaults(inIterator) {
|
||||
var iterator, f;
|
||||
for (var set in form.related) {
|
||||
if (form.related[set].type != 'tree') {
|
||||
if (form.related[set].type != 'tree' && (inIterator === undefined || inIterator == form.related[set].iterator)) {
|
||||
iterator = form.related[set].iterator;
|
||||
for (var fld in form.related[set].fields) {
|
||||
if (form.related[set].fields[fld].key) {
|
||||
@@ -36,8 +37,9 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
||||
}
|
||||
}
|
||||
scope[iterator + 'SortOrder'] = null;
|
||||
scope[iterator + 'SearchType'] = 'contains';
|
||||
scope[iterator + 'SearchType'] = 'icontains';
|
||||
scope[iterator + 'SearchTypeLabel'] = 'Contains';
|
||||
scope[iterator + 'SearchValue'] = null;
|
||||
scope[iterator + 'SelectShow'] = false;
|
||||
scope[iterator + 'HideSearchType'] = false;
|
||||
f = scope[iterator + 'SearchField']
|
||||
@@ -54,6 +56,14 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setDefaults();
|
||||
|
||||
scope.resetSearch = function(iterator) {
|
||||
setDefaults(iterator);
|
||||
scope.search(iterator);
|
||||
}
|
||||
|
||||
// Functions to handle search widget changes
|
||||
scope.setSearchField = function(iterator, fld, label) {
|
||||
@@ -93,9 +103,23 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
||||
scope.search(model);
|
||||
}
|
||||
|
||||
scope.startSearch = function(iterator) {
|
||||
//Called on each keydown event for seachValue field. Using a timer
|
||||
//to prevent executing a search until user is finished typing.
|
||||
if (scope.searchTimer) {
|
||||
$timeout.cancel(scope.searchTimer);
|
||||
}
|
||||
scope.searchTimer = $timeout(
|
||||
function() {
|
||||
scope.search(iterator);
|
||||
}
|
||||
, 1000);
|
||||
}
|
||||
|
||||
scope.search = function(iterator) {
|
||||
scope[iterator + 'SearchSpin'] = true;
|
||||
scope[iterator + 'Loading'] = true;
|
||||
scope[iterator + 'HoldInput'] = true;
|
||||
|
||||
if (iterator == 'host') {
|
||||
if (scope['hostSearchField'] == 'has_active_failures') {
|
||||
|
||||
@@ -183,7 +183,6 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
scope.search(iterator);
|
||||
}
|
||||
|
||||
|
||||
if (scope.removeDoSearch) {
|
||||
scope.removeDoSearch();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,15 @@ angular.module('OrganizationListDefinition', [])
|
||||
"class": 'btn-success btn-xs',
|
||||
awToolTip: 'Create a new organization'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@@ -184,9 +184,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
|
||||
.factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit',
|
||||
'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl',
|
||||
'ShowDetail',
|
||||
'ShowDetail', 'LoadBreadCrumbs',
|
||||
function($rootScope, $location, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList,
|
||||
FormatDate, ShowStream, HideStream, BuildDescription, FixUrl, BuildUrl, ShowDetail) {
|
||||
FormatDate, ShowStream, HideStream, BuildDescription, FixUrl, BuildUrl, ShowDetail, LoadBreadCrumbs) {
|
||||
return function(params) {
|
||||
|
||||
var list = StreamList;
|
||||
@@ -207,6 +207,10 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
$('#tab-content-container').append('<div id="stream-container"><div id=\"stream-content\"></div></div><!-- Stream widget -->');
|
||||
|
||||
ShowStream();
|
||||
if ($rootScope.breadcrumbs.length == 0) {
|
||||
var title = base.substr(0,1).toUpperCase() + base.substr(1);
|
||||
$rootScope.breadcrumbs.push({ path: $location.path(), title: title});
|
||||
}
|
||||
|
||||
// Generate the list
|
||||
var scope = view.inject(list, {
|
||||
|
||||
Reference in New Issue
Block a user