mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47: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,
|
open: false,
|
||||||
|
|
||||||
actions: {
|
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: {
|
fields: {
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ angular.module('OrganizationFormDefinition', [])
|
|||||||
label: 'Add',
|
label: 'Add',
|
||||||
icon: 'icon-plus',
|
icon: 'icon-plus',
|
||||||
awToolTip: 'Add a new user'
|
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',
|
icon: 'icon-plus',
|
||||||
label: 'Add',
|
label: 'Add',
|
||||||
awToolTip: 'Add new administrator'
|
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: {
|
fields: {
|
||||||
|
|||||||
@@ -215,6 +215,15 @@ angular.module('ProjectFormDefinition', [])
|
|||||||
icon: 'icon-plus',
|
icon: 'icon-plus',
|
||||||
label: 'Add',
|
label: 'Add',
|
||||||
awToolTip: 'Add an organization'
|
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',
|
icon: 'icon-plus',
|
||||||
label: 'Add',
|
label: 'Add',
|
||||||
add: 'Add a new credential'
|
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',
|
label: 'Add',
|
||||||
awToolTip: 'Add a permission for this user',
|
awToolTip: 'Add a permission for this user',
|
||||||
ngShow: 'PermissionAddAllowed'
|
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')",
|
ngClick: "add('projects')",
|
||||||
icon: 'icon-plus',
|
icon: 'icon-plus',
|
||||||
label: 'Add'
|
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',
|
icon: 'icon-plus',
|
||||||
label: 'Add',
|
label: 'Add',
|
||||||
awToolTip: 'Add a user'
|
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',
|
icon: 'icon-plus',
|
||||||
label: 'Add',
|
label: 'Add',
|
||||||
awToolTip: 'Add a credential for this user'
|
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',
|
label: 'Add',
|
||||||
awToolTip: 'Add a permission for this user',
|
awToolTip: 'Add a permission for this user',
|
||||||
ngShow: 'PermissionAddAllowed'
|
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?
|
open: false, // Open accordion on load?
|
||||||
base: '/organizations',
|
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: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
@@ -238,6 +268,18 @@ angular.module('UserFormDefinition', [])
|
|||||||
iterator: 'organization',
|
iterator: 'organization',
|
||||||
open: false,
|
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: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
@@ -255,6 +297,18 @@ angular.module('UserFormDefinition', [])
|
|||||||
iterator: 'team',
|
iterator: 'team',
|
||||||
open: false,
|
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: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
@@ -272,6 +326,18 @@ angular.module('UserFormDefinition', [])
|
|||||||
iterator: 'project',
|
iterator: 'project',
|
||||||
open: false,
|
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: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ angular.module('RefreshRelatedHelper', ['RestServices', 'Utilities'])
|
|||||||
scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize']));
|
scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize']));
|
||||||
scope[iterator + 'SearchSpin'] = false;
|
scope[iterator + 'SearchSpin'] = false;
|
||||||
scope[iterator + 'Loading'] = false;
|
scope[iterator + 'Loading'] = false;
|
||||||
|
scope[iterator + 'HoldInput'] = false;
|
||||||
scope.$emit('related' + set);
|
scope.$emit('related' + set);
|
||||||
if (!params.scope.$$phase) {
|
if (!params.scope.$$phase) {
|
||||||
params.scope.$digest();
|
params.scope.$digest();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelatedHelper'])
|
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) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
@@ -24,36 +24,46 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
|||||||
var form = params.form;
|
var form = params.form;
|
||||||
|
|
||||||
// Set default values
|
// Set default values
|
||||||
var iterator, f;
|
function setDefaults(inIterator) {
|
||||||
for (var set in form.related) {
|
var iterator, f;
|
||||||
if (form.related[set].type != 'tree') {
|
for (var set in form.related) {
|
||||||
iterator = form.related[set].iterator;
|
if (form.related[set].type != 'tree' && (inIterator === undefined || inIterator == form.related[set].iterator)) {
|
||||||
for (var fld in form.related[set].fields) {
|
iterator = form.related[set].iterator;
|
||||||
if (form.related[set].fields[fld].key) {
|
for (var fld in form.related[set].fields) {
|
||||||
scope[iterator + 'SearchField'] = fld
|
if (form.related[set].fields[fld].key) {
|
||||||
scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label;
|
scope[iterator + 'SearchField'] = fld
|
||||||
break;
|
scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scope[iterator + 'SortOrder'] = null;
|
||||||
|
scope[iterator + 'SearchType'] = 'icontains';
|
||||||
|
scope[iterator + 'SearchTypeLabel'] = 'Contains';
|
||||||
|
scope[iterator + 'SearchValue'] = null;
|
||||||
|
scope[iterator + 'SelectShow'] = false;
|
||||||
|
scope[iterator + 'HideSearchType'] = false;
|
||||||
|
f = scope[iterator + 'SearchField']
|
||||||
|
if (form.related[set].fields[f].searchType && ( form.related[set].fields[f].searchType == 'boolean'
|
||||||
|
|| form.related[set].fields[f].searchType == 'select')) {
|
||||||
|
scope[iterator + 'SelectShow'] = true;
|
||||||
|
scope[iterator + 'SearchSelectOpts'] = list.fields[f].searchOptions;
|
||||||
|
}
|
||||||
|
if (form.related[set].fields[f].searchType && form.related[set].fields[f].searchType == 'int') {
|
||||||
|
scope[iterator + 'HideSearchType'] = true;
|
||||||
|
}
|
||||||
|
if (form.related[set].fields[f].searchType && form.related[set].fields[f].searchType == 'gtzero') {
|
||||||
|
scope[iterator + "InputHide"] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scope[iterator + 'SortOrder'] = null;
|
|
||||||
scope[iterator + 'SearchType'] = 'contains';
|
|
||||||
scope[iterator + 'SearchTypeLabel'] = 'Contains';
|
|
||||||
scope[iterator + 'SelectShow'] = false;
|
|
||||||
scope[iterator + 'HideSearchType'] = false;
|
|
||||||
f = scope[iterator + 'SearchField']
|
|
||||||
if (form.related[set].fields[f].searchType && ( form.related[set].fields[f].searchType == 'boolean'
|
|
||||||
|| form.related[set].fields[f].searchType == 'select')) {
|
|
||||||
scope[iterator + 'SelectShow'] = true;
|
|
||||||
scope[iterator + 'SearchSelectOpts'] = list.fields[f].searchOptions;
|
|
||||||
}
|
|
||||||
if (form.related[set].fields[f].searchType && form.related[set].fields[f].searchType == 'int') {
|
|
||||||
scope[iterator + 'HideSearchType'] = true;
|
|
||||||
}
|
|
||||||
if (form.related[set].fields[f].searchType && form.related[set].fields[f].searchType == 'gtzero') {
|
|
||||||
scope[iterator + "InputHide"] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDefaults();
|
||||||
|
|
||||||
|
scope.resetSearch = function(iterator) {
|
||||||
|
setDefaults(iterator);
|
||||||
|
scope.search(iterator);
|
||||||
|
}
|
||||||
|
|
||||||
// Functions to handle search widget changes
|
// Functions to handle search widget changes
|
||||||
scope.setSearchField = function(iterator, fld, label) {
|
scope.setSearchField = function(iterator, fld, label) {
|
||||||
@@ -93,9 +103,23 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat
|
|||||||
scope.search(model);
|
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.search = function(iterator) {
|
||||||
scope[iterator + 'SearchSpin'] = true;
|
scope[iterator + 'SearchSpin'] = true;
|
||||||
scope[iterator + 'Loading'] = true;
|
scope[iterator + 'Loading'] = true;
|
||||||
|
scope[iterator + 'HoldInput'] = true;
|
||||||
|
|
||||||
if (iterator == 'host') {
|
if (iterator == 'host') {
|
||||||
if (scope['hostSearchField'] == 'has_active_failures') {
|
if (scope['hostSearchField'] == 'has_active_failures') {
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
scope.search(iterator);
|
scope.search(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (scope.removeDoSearch) {
|
if (scope.removeDoSearch) {
|
||||||
scope.removeDoSearch();
|
scope.removeDoSearch();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ angular.module('OrganizationListDefinition', [])
|
|||||||
"class": 'btn-success btn-xs',
|
"class": 'btn-success btn-xs',
|
||||||
awToolTip: 'Create a new organization'
|
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: {
|
stream: {
|
||||||
'class': "btn-primary btn-xs activity-btn",
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
ngClick: "showActivity()",
|
ngClick: "showActivity()",
|
||||||
|
|||||||
@@ -184,9 +184,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
|
|
||||||
.factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit',
|
.factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit',
|
||||||
'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl',
|
'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl',
|
||||||
'ShowDetail',
|
'ShowDetail', 'LoadBreadCrumbs',
|
||||||
function($rootScope, $location, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList,
|
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) {
|
return function(params) {
|
||||||
|
|
||||||
var list = StreamList;
|
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 -->');
|
$('#tab-content-container').append('<div id="stream-container"><div id=\"stream-content\"></div></div><!-- Stream widget -->');
|
||||||
|
|
||||||
ShowStream();
|
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
|
// Generate the list
|
||||||
var scope = view.inject(list, {
|
var scope = view.inject(list, {
|
||||||
|
|||||||
Reference in New Issue
Block a user