Patchwork [bitbake-devel,03/18] toaster: reset default filter for configvar page on new searches

login
register
mail settings
Submitter Alexandru DAMIAN
Date March 24, 2014, 6:37 p.m.
Message ID <b80c578d9330a45e9c2502701de2ebb6307b1caf.1395686148.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/69083/
State New
Headers show

Comments

Alexandru DAMIAN - March 24, 2014, 6:37 p.m.
From: David Reyna <David.Reyna@windriver.com>

The configvar page has a default filter by design. However, new search terms
should override and clear that filter, for consistency across the interface.

[YOCTO #5961]

Signed-off-by: David Reyna <David.Reyna@windriver.com>
---
 lib/toaster/toastergui/views.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 97514cc..eaa6cf8 100644
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -1010,10 +1010,13 @@  def configvars(request, build_id):
     template = 'configvars.html'
     mandatory_parameters = { 'count': 100,  'page' : 1, 'orderby':'variable_name:+', 'filter':'description__regex:.+'};
     retval = _verify_parameters( request.GET, mandatory_parameters )
+    (filter_string, search_term, ordering_string) = _search_tuple(request, Variable)
     if retval:
+        # if new search, clear the default filter
+        if search_term and len(search_term):
+            mandatory_parameters['filter']=''
         return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id)
 
-    (filter_string, search_term, ordering_string) = _search_tuple(request, Variable)
     queryset = Variable.objects.filter(build=build_id).exclude(variable_name__istartswith='B_').exclude(variable_name__istartswith='do_')
     queryset_with_search =  _get_queryset(Variable, queryset, None, search_term, ordering_string).distinct().exclude(variable_value='',vhistory__file_name__isnull=True)
     queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string)