aboutsummaryrefslogtreecommitdiffstats
path: root/templates/layerindex
diff options
context:
space:
mode:
authorAmanda Brindle <amanda.r.brindle@intel.com>2017-11-07 14:31:38 -0800
committerPaul Eggleton <paul.eggleton@linux.intel.com>2017-12-05 10:01:10 +1300
commita64bfed81b3827503ff825090f1fb4b94e1cd9bd (patch)
treebc0a3c454cbfc938b7c27e3d4df9b3e39331fb6d /templates/layerindex
parent78c2561181f07b1c39f1dc3516a9110a39d874f2 (diff)
downloadopenembedded-core-contrib-a64bfed81b3827503ff825090f1fb4b94e1cd9bd.tar.gz
recipes.html: Require keyword for recipe search
Use JavaScript to check if the search box for recipe search is empty before querying the database. This will prevent the "502 Bad Gateway" error that occurs when the query takes too long due to the large list of recipes. Since there are so many recipes spread across the layers in the OE index, there's no point in allowing a user to search without a keyword in order to browse the list; it simply isn't digestible as a whole. For the Machines, Classes, and Distros pages, the search behaviour is unaffected, however to make it more obvious that you can browse the list add an explicit "browse" button. Fixes [YOCTO #11930] Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'templates/layerindex')
-rw-r--r--templates/layerindex/classes.html3
-rw-r--r--templates/layerindex/distros.html3
-rw-r--r--templates/layerindex/machines.html3
-rw-r--r--templates/layerindex/recipes.html27
4 files changed, 27 insertions, 9 deletions
diff --git a/templates/layerindex/classes.html b/templates/layerindex/classes.html
index 34ac5aa3d2..574cdb8846 100644
--- a/templates/layerindex/classes.html
+++ b/templates/layerindex/classes.html
@@ -35,7 +35,8 @@
<div class="input-append">
<form id="filter-form" action="{% url 'class_search' url_branch %}" method="get">
<input type="text" class="input-xxlarge" id="appendedInputButtons" placeholder="Search classes" name="q" value="{{ search_keyword }}" />
- <button class="btn" type="submit">search</button>
+ <button class="btn" type="submit" name="search" value="1">search</button>
+ <button class="btn" type="submit" name="browse" value="1">browse</button>
</form>
</div>
</div>
diff --git a/templates/layerindex/distros.html b/templates/layerindex/distros.html
index 5b6995a5dd..3266bf60ec 100644
--- a/templates/layerindex/distros.html
+++ b/templates/layerindex/distros.html
@@ -35,7 +35,8 @@
<div class="input-append">
<form id="filter-form" action="{% url 'distro_search' url_branch %}" method="get">
<input type="text" class="input-xxlarge" id="appendedInputButtons" placeholder="Search distros" name="q" value="{{ search_keyword }}" />
- <button class="btn" type="submit">search</button>
+ <button class="btn" type="submit" name="search" value="1">search</button>
+ <button class="btn" type="submit" name="browse" value="1">browse</button>
</form>
</div>
</div>
diff --git a/templates/layerindex/machines.html b/templates/layerindex/machines.html
index c0c6f33b3b..e9633760b9 100644
--- a/templates/layerindex/machines.html
+++ b/templates/layerindex/machines.html
@@ -34,7 +34,8 @@
<div class="input-append">
<form id="filter-form" action="{% url 'machine_search' url_branch %}" method="get">
<input type="text" class="input-xxlarge" id="appendedInputButtons" placeholder="Search machines" name="q" value="{{ search_keyword }}" />
- <button class="btn" type="submit">search</button>
+ <button class="btn" type="submit" name="search" value="1">search</button>
+ <button class="btn" type="submit" name="browse" value="1">browse</button>
</form>
</div>
</div>
diff --git a/templates/layerindex/recipes.html b/templates/layerindex/recipes.html
index 13227504dc..5ff92ab622 100644
--- a/templates/layerindex/recipes.html
+++ b/templates/layerindex/recipes.html
@@ -32,14 +32,20 @@
<div class="row-fluid">
- <div class="input-append">
- <form id="filter-form" action="{% url 'recipe_search' url_branch %}" method="get">
- <input type="text" class="input-xxlarge" id="appendedInputButtons" placeholder="Search recipes" name="q" value="{{ search_keyword }}" />
- <button class="btn" type="submit">search</button>
- </form>
- </div>
+ <form id="filter-form" action="{% url 'recipe_search' url_branch %}" method="get" onsubmit="return validate()">
+ <div class="control-group" id="searchfield">
+ <div class="controls">
+ <div class="input-append">
+ <input type="text" class="input-xxlarge" id="appendedInputButtons" placeholder="Search recipes" name="q" value="{{ search_keyword }}" />
+ <button class="btn" type="submit">search</button>
+ </div>
+ <span class="help-inline" id="errortext"></span>
+ </div>
+ </div>
+ </form>
</div>
+ <div id="error"> </div>
{% if recipe_list %}
<table class="table table-striped table-bordered recipestable">
<thead>
@@ -88,5 +94,14 @@
$('.icon-hdd').tooltip({title:"Inherits image"});
$('.label-inverse').tooltip();
});
+
+ function validate(){
+ if (!$("#appendedInputButtons").val()){
+ $("#errortext").html("<p>Please specify search text</p>");
+ $("#searchfield").addClass("error");
+ return false;
+ }
+ }
+
</script>
{% endblock %}