From 6940dccea248ac90e312e3ecaaacb040c9cb1400 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 11 Feb 2016 11:14:22 -0500 Subject: [PATCH] Re-introduced the search widget dropdown filter functionality to move search back to it's function 2.4.x state. Tag based search will come in a future feature. --- awx/ui/client/legacy-styles/ansible-ui.less | 4 --- awx/ui/client/legacy-styles/lists.less | 28 +++++++++++++++++-- awx/ui/client/src/helpers/related-search.js | 7 ----- awx/ui/client/src/helpers/search.js | 5 ++++ awx/ui/client/src/shared/generator-helpers.js | 28 +++++++++++++++++++ 5 files changed, 59 insertions(+), 13 deletions(-) diff --git a/awx/ui/client/legacy-styles/ansible-ui.less b/awx/ui/client/legacy-styles/ansible-ui.less index 57b8adebc4..a9c4e6fc85 100644 --- a/awx/ui/client/legacy-styles/ansible-ui.less +++ b/awx/ui/client/legacy-styles/ansible-ui.less @@ -774,10 +774,6 @@ select.page-size { vertical-align: middle; } - #search_value_input { - padding-right: 25px; - } - #search-widget-spacer { height: 20px; } diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index ee14cc1f2a..270d3dad59 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -207,6 +207,28 @@ table, tbody { .List-searchDropdown { border-top-left-radius: 5px!important; border-bottom-left-radius: 5px!important; + height: 34px!important; + border-color: @default-second-border; + color: @default-icon; + background-color: @default-bg; + border-right: none; +} + +.List-searchDropdown:focus, +.List-searchDropdown:active, +.List-searchDropdown.active +{ + color: @default-icon; + background-color: @default-tertiary-bg; +} + +.List-searchDropdown:hover { + background-color: @default-tertiary-bg; + color: @default-icon; +} + +.List-searchDropdownCarat { + border-top-color: @default-icon!important; } .List-searchInput { @@ -214,8 +236,10 @@ table, tbody { font-size: 14px!important; color: @list-srch-inpt-txt!important; border-color: @list-srch-inpt-bord!important; - border-radius: 5px!important; + border-radius: 0px 5px 5px 0px!important; padding-left: 15px!important; + height: 34px!important; + padding-right: 45px!important; } .List-searchInput:placeholder-shown { @@ -235,7 +259,7 @@ table, tbody { float: right; position: relative; top: -33px; - left: -1px; + left: -2px; z-index: 10; font-size: 16px; background-color: @list-srch-btn-bg; diff --git a/awx/ui/client/src/helpers/related-search.js b/awx/ui/client/src/helpers/related-search.js index 750864d60a..a6716982ec 100644 --- a/awx/ui/client/src/helpers/related-search.js +++ b/awx/ui/client/src/helpers/related-search.js @@ -162,13 +162,6 @@ export default scope[iterator + 'Loading'] = false; scope[iterator + 'HoldInput'] = true; - if(scope[iterator + 'SearchValue'] && scope[iterator + 'SearchValue'] != '') { - scope[iterator + '_active_search'] = true; - } - else { - scope[iterator + '_active_search'] = false; - } - if (scope[iterator + 'SearchValue']) { // User typed a value in input field scope[iterator + 'ShowStartBtn'] = false; diff --git a/awx/ui/client/src/helpers/search.js b/awx/ui/client/src/helpers/search.js index 5f42d8d27a..33f7ec5c86 100644 --- a/awx/ui/client/src/helpers/search.js +++ b/awx/ui/client/src/helpers/search.js @@ -333,6 +333,8 @@ export default var i, modifier, widgets = (list.searchWidgets) ? list.searchWidgets : 1; + scope[iterator + '_active_search'] = false; + for (i = 1; i <= widgets; i++) { modifier = (i === 1) ? '' : i; if ($('#search-widget-container' + modifier)) { @@ -342,6 +344,7 @@ export default if (list.fields[scope[iterator + 'SearchField' + modifier]].searchObject !== 'all') { // An object type is selected scope[iterator + 'HideAllStartBtn' + modifier] = false; + scope[iterator + '_active_search'] = true; if (scope[iterator + 'SearchValue' + modifier]) { // A search value was entered scope[iterator + 'ShowStartBtn' + modifier] = false; @@ -369,6 +372,7 @@ export default } } } + e.stopPropagation(); scope.$emit('prepareSearch2', iterator, page, load, calcOnly, deferWaitStop); @@ -401,6 +405,7 @@ export default (scope[iterator + 'SelectShow' + modifier] && scope[iterator + 'SearchSelectValue' + modifier]) || (list.fields[scope[iterator + 'SearchField' + modifier]] && list.fields[scope[iterator + 'SearchField' + modifier]].searchType === 'gtzero')) { + scope[iterator + '_active_search'] = true; if (list.fields[scope[iterator + 'SearchField' + modifier]].searchField) { scope[iterator + 'SearchParams'] += '&' + list.fields[scope[iterator + 'SearchField' + modifier]].searchField + '__'; } else if (list.fields[scope[iterator + 'SearchField' + modifier]].sourceModel) { diff --git a/awx/ui/client/src/shared/generator-helpers.js b/awx/ui/client/src/shared/generator-helpers.js index 44364a49e2..d2b9b49d20 100644 --- a/awx/ui/client/src/shared/generator-helpers.js +++ b/awx/ui/client/src/shared/generator-helpers.js @@ -678,6 +678,26 @@ angular.module('GeneratorHelpers', [systemStatus.name]) html += "
"; } + html += "
\n"; + html += "
\n"; + html += "\n"; + html += "
    \n"; + html += addSearchFields(i); + html += "
\n"; + html += "
\n"; + + html += "\n"; + html += "\n"; + // Reset button for drop-down + html += "
\n"; + html += "\n"; + html += "
\n"; + + html += "
\n"; + html += "