diff options
Diffstat (limited to 'extensions')
3 files changed, 22 insertions, 6 deletions
diff --git a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl index b3d1deab1..38f87dc1a 100644 --- a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl +++ b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl @@ -6,6 +6,7 @@ # defined by the Mozilla Public License, v. 2.0. #%] +[% DEFAULT max_results = 100 %] <script type="text/javascript"> [% IF script_name %] ProdCompSearch.script_name = '[% script_name FILTER js %]'; @@ -19,6 +20,7 @@ [% IF new_tab %] ProdCompSearch.new_tab = true; [% END %] + ProdCompSearch.max_results = [% max_results FILTER js %]; </script> <div id="prod_comp_search_form" class="yui3-skin-sam"> @@ -28,6 +30,8 @@ class="bz_default_hidden" width="16" height="11"> <span id="prod_comp_no_components" class="bz_default_hidden"> No components found</span> + <span id="prod_comp_too_many_components" class="bz_default_hidden"> + Result limited to [% max_results FILTER html %] components <span id="prod_comp_error" class="bz_default_hidden"> An error occured</span> </div> diff --git a/extensions/ProdCompSearch/web/js/prod_comp_search.js b/extensions/ProdCompSearch/web/js/prod_comp_search.js index cb4a50ccc..f294994e3 100644 --- a/extensions/ProdCompSearch/web/js/prod_comp_search.js +++ b/extensions/ProdCompSearch/web/js/prod_comp_search.js @@ -12,7 +12,8 @@ var ProdCompSearch = { script_choices: ['enter_bug.cgi', 'describecomponents.cgi'], format: null, cloned_bug_id: null, - new_tab: null + new_tab: null, + max_results: 100 }; YUI({ @@ -21,8 +22,8 @@ YUI({ }).use("node", "json-stringify", "autocomplete", "escape", "datasource-io", "datasource-jsonschema", function(Y) { Y.on("domready", function() { - var counter = 0, - dataSource = null, + var counter = 0, + dataSource = null, autoComplete = null; var resultListFormat = function(query, results) { @@ -39,7 +40,7 @@ YUI({ version: "1.1", method : "PCS.prod_comp_search", id : counter, - params : { search: query } + params : { search: query, limit: ProdCompSearch.max_results } }; return Y.JSON.stringify(json_object); }; @@ -79,13 +80,14 @@ YUI({ queryDelay: 0.05, resultFormatter: resultListFormat, suppressInputUpdate: true, - maxResults: 25, + maxResults: ProdCompSearch.max_results, scrollIntoView: true, requestTemplate: requestTemplate, on: { query: function(e) { Y.one("#prod_comp_throbber").removeClass('bz_default_hidden'); Y.one("#prod_comp_no_components").addClass('bz_default_hidden'); + Y.one("#prod_comp_too_many_components").addClass('bz_default_hidden'); Y.one("#prod_comp_error").addClass('bz_default_hidden'); }, results: function(e) { @@ -94,6 +96,9 @@ YUI({ if (e.results.length == 0) { Y.one("#prod_comp_no_components").removeClass('bz_default_hidden'); } + else if (e.results.length + 1 > ProdCompSearch.max_results) { + Y.one("#prod_comp_too_many_components").removeClass('bz_default_hidden'); + } }, select: function(e) { // Only redirect if the script_name is a valid choice diff --git a/extensions/ProdCompSearch/web/styles/prod_comp_search.css b/extensions/ProdCompSearch/web/styles/prod_comp_search.css index a89856e22..ccb5887c4 100644 --- a/extensions/ProdCompSearch/web/styles/prod_comp_search.css +++ b/extensions/ProdCompSearch/web/styles/prod_comp_search.css @@ -15,6 +15,13 @@ width: 360px; } -#prod_comp_no_components, #prod_comp_error { +#prod_comp_search_form .yui3-aclist-content { + max-height: 500px; + overflow: auto; +} + +#prod_comp_no_components, +#prod_comp_error, +#prod_comp_too_many_components { color: red; } |