[bitbake-devel] [PATCH] toaster: fixes for customimage package not found

Elliot Smith elliot.smith at intel.com
Fri Apr 8 08:39:28 UTC 2016


From: Dave Lerner <dave.lerner at windriver.com>

For a custom image, if a search for a package results in no packages
found, then additional information should be presented to the user.
This is different than a 'no results' found for a search in other
contexts, for example, a search for a package in a non-customised build.
For a custom image, a package search failure can happen because the
package was not added to the custom image. This commit presents more
information to the user, suggesting why the package was not found in the
custom image.
The generic table view handling js changes to handle a new div
element no-results-special-... such that, if present, that template
section is shown rather than the default no-results-... section.

[YOCTO #9154]

Signed-off-by: Dave Lerner <dave.lerner at windriver.com>
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 .../toaster/toastergui/static/js/customrecipe.js   |  9 +++++++++
 bitbake/lib/toaster/toastergui/static/js/table.js  | 11 +++++++++--
 .../toaster/toastergui/templates/customrecipe.html | 22 ++++++++++++----------
 3 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
index a31c268..1c0ef9e 100644
--- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
+++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
@@ -265,6 +265,15 @@ function customRecipePageInit(ctx) {
     });
   }
 
+  $("#no-results-show-all-packages").click(function(){
+    $(".no-results-search-input").val("");
+  });
+
+  $("#no-results-remove-search-btn").click(function(){
+      $(".no-results-search-input").val("");
+      $(this).hide();
+  });
+
   /* Trigger a build of your custom image */
   $(".build-custom-image").click(function(){
     libtoaster.startABuild(null, ctx.recipe.name,
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index a7e4fba..2ae7695 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -75,8 +75,15 @@ function tableInit(ctx){
 
     if (tableData.total === 0){
       tableContainer.hide();
-      $("#new-search-input-"+ctx.tableName).val(tableParams.search);
-      $("#no-results-"+ctx.tableName).show();
+      if ($("#no-results-special-"+ctx.tableName).length > 0) {
+        /* use this page's special no-results form instead of the default */
+        $("#no-results-search-input-"+ctx.tableName).val(tableParams.search);
+        $("#no-results-special-"+ctx.tableName).show();
+        $("#results-found-"+ctx.tableName).hide();
+      } else {
+        $("#new-search-input-"+ctx.tableName).val(tableParams.search);
+        $("#no-results-"+ctx.tableName).show();
+      }
       table.trigger("table-done", [tableData.total, tableParams]);
 
       return;
diff --git a/bitbake/lib/toaster/toastergui/templates/customrecipe.html b/bitbake/lib/toaster/toastergui/templates/customrecipe.html
index 4b58992..ea3c9c7 100644
--- a/bitbake/lib/toaster/toastergui/templates/customrecipe.html
+++ b/bitbake/lib/toaster/toastergui/templates/customrecipe.html
@@ -103,25 +103,26 @@
         Download recipe file
       </a>
     </div>
-    <div id="no-package-results" class="air" style="display:none;">
+    <div id="no-results-special-{{table_name}}" class="air" style="display:none;">
       <div class="alert">
         <h3>No packages found</h3>
-        <p>You might consider <a href="all-software-recipes.html">searching the list of recipes</a> instead. If you find a recipe that matches the name of the package you want:</p>
+        <p>You might consider <a href={% url 'projectsoftwarerecipes' project.id %}>searching the list of recipes</a> instead. If you find a recipe that matches the name of the package you want:</p>
         <ol>
           <li>Add the layer providing the recipe to your project</li>
           <li>Build the recipe</li>
           <li>Once the build completes, come back to this page and search for the package</li>
         </ol>
         <form class="input-append no-results">
-          <input type="text" class="input-xlarge" value="search query">
-            <a href="#" class="add-on btn">
-              <i class="icon-remove"></i>
-            </a>
-            <button class="btn">Search</button>
-            <button class="btn btn-link" id="show-all">Show all packages</button>
-          </form>
-        </div>
+          <input type="text" class="input-xlarge no-results-search-input" id="no-results-search-input-{{table_name}}" name="search" placeholder="Search {{title|lower}}" />
+          <a href="#" class="add-on btn" id="no-results-remove-search-btn" tabindex="-1">
+            <i class="icon-remove"></i>
+          </a>
+          <button class="btn search-submit-{{table_name}}">Search</button>
+          <button class="btn btn-link" id="no-results-show-all-packages">Show all packages</button>
+        </form>
+      </div>
       </div>
+      <div id="results-found-{{table_name}}">
       <div id="packages-table">
         {% if recipe.get_all_packages.count == 0 and last_build == None %}
         <h2> Add | Remove packages </h2>
@@ -136,6 +137,7 @@
         {% include "toastertable.html" %}
         {% endif %}
       </div>
+      </div>
     </div>
     <div class="span4 well">
       <h2 style="margin-bottom:20px;">About {{recipe.name}}</h2>
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the bitbake-devel mailing list