[bitbake-devel] [PATCH 07/14] toastergui: add 'show all' link to no results page

Alex DAMIAN alexandru.damian at intel.com
Tue Jan 27 14:27:28 UTC 2015


From: Belen Barros Pena <belen.barros.pena at intel.com>

When you search for targets or machines in the layer details
page and your search returns no results, you should
see a 'show all' link that you can click to clear the
search and display all table entries.

[YOCTO #7218]

Signed-off-by: Belen Barros Pena <belen.barros.pena at intel.com>
---
 lib/toaster/toastergui/static/js/layerdetails.js   |  4 ++--
 lib/toaster/toastergui/templates/layerdetails.html | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/layerdetails.js b/lib/toaster/toastergui/static/js/layerdetails.js
index 2addecd..2793225 100644
--- a/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/lib/toaster/toastergui/static/js/layerdetails.js
@@ -381,12 +381,12 @@ function layerDetailsPageInit (ctx) {
   });
 
   /* Clear the current search selection and reload the results */
-  $("#target-search-clear").click(function(){
+  $(".target-search-clear").click(function(){
     $("#target-search").val("");
     $(this).parents("form").submit();
   });
 
-  $("#machine-search-clear").click(function(){
+  $(".machine-search-clear").click(function(){
     $("#machine-search").val("");
     $(this).parents("form").submit();
   });
diff --git a/lib/toaster/toastergui/templates/layerdetails.html b/lib/toaster/toastergui/templates/layerdetails.html
index a89ffb0..f8f2d7a 100644
--- a/lib/toaster/toastergui/templates/layerdetails.html
+++ b/lib/toaster/toastergui/templates/layerdetails.html
@@ -205,11 +205,14 @@
 
                       <input type="text" id="target-search" name="targets_search" placeholder="Search targets" class="input-xlarge" value="{{request.GET.targets_search}}">
                         {% if request.GET.targets_search %}
-                        <a class="add-on btn" id="target-search-clear">
+                        <a class="add-on btn target-search-clear">
                           <i class="icon-remove"></i>
                         </a>
                         {% endif %}
                         <button type="submit" class="btn">Search</button>
+                        {% if targets.paginator.count == 0 %}
+                            <button type="submit" class="btn btn-link target-search-clear">Show all targets</a>
+                        {% endif %}
                       </form>
                     {% endif %}
 
@@ -332,11 +335,14 @@
 
                       <input type="text" id="machine-search" name="machines_search" placeholder="Search machines" class="input-xlarge" value="{{request.GET.machines_search}}">
                         {% if request.GET.machines_search %}
-                        <a class="add-on btn" id="machine-search-clear">
+                        <a class="add-on btn machine-search-clear">
                           <i class="icon-remove"></i>
                         </a>
                         {% endif %}
                         <button type="submit" class="btn">Search</button>
+                        {% if machines.paginator.count == 0 %}
+                            <button type="submit" class="btn btn-link machine-search-clear">Show all machines</a>
+                        {% endif %}
                       </form>
                     {% endif %}
 
-- 
1.9.1




More information about the bitbake-devel mailing list