Merge lp:~ben-hutchings/ensoft-sextant/autocomplete-box-fix into lp:ensoft-sextant

Proposed by Ben Hutchings
Status: Merged
Approved by: Robert
Approved revision: 63
Merged at revision: 35
Proposed branch: lp:~ben-hutchings/ensoft-sextant/autocomplete-box-fix
Merge into: lp:ensoft-sextant
Prerequisite: lp:~ben-hutchings/ensoft-sextant/rel-merge
Diff against target: 46 lines (+12/-4)
3 files modified
resources/sextant/web/interface.html (+2/-2)
resources/sextant/web/queryjavascript.js (+6/-0)
src/sextant/web/server.py (+4/-2)
To merge this branch: bzr merge lp:~ben-hutchings/ensoft-sextant/autocomplete-box-fix
Reviewer Review Type Date Requested Status
Robert Approve
Review via email: mp+242645@code.launchpad.net

Commit message

Autocomplete boxes now update when program name is changed.

Description of the change

Autocomplete boxes now update when program name is changed.

To post a comment you must log in.
Revision history for this message
Robert (rjwills) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'resources/sextant/web/interface.html'
2--- resources/sextant/web/interface.html 2014-11-24 11:23:25 +0000
3+++ resources/sextant/web/interface.html 2014-11-24 11:23:25 +0000
4@@ -17,8 +17,8 @@
5 <div class="toolbar">
6 <div>
7 Program:
8- <input list="program_names" id="program_name" class="textbox" style="width: 150px" />
9- <!-- onblur="get_names_for_autocomplete('funcs')" -->
10+ <input list="program_names" id="program_name" class="textbox" style="width: 150px"
11+ onchange="get_names_for_autocomplete('funcs_both')"/>
12 <datalist id="program_names"></datalist>
13
14 <select id="query_list" class="dropdown" onchange="display_when();">
15
16=== modified file 'resources/sextant/web/queryjavascript.js'
17--- resources/sextant/web/queryjavascript.js 2014-11-24 11:23:25 +0000
18+++ resources/sextant/web/queryjavascript.js 2014-11-24 11:23:25 +0000
19@@ -36,6 +36,12 @@
20 add_options("function_names_2", values_list);
21 do_timeout = true;
22 }
23+ if (info_needed == 'funcs_both') {
24+ add_options("function_names_1", values_list);
25+ add_options("function_names_2", values_list);
26+ do_timeout = false;
27+ }
28+
29 }
30 }
31 }
32
33=== modified file 'src/sextant/web/server.py'
34--- src/sextant/web/server.py 2014-11-24 11:23:25 +0000
35+++ src/sextant/web/server.py 2014-11-24 11:23:25 +0000
36@@ -237,8 +237,10 @@
37 # the maximum so that we know if the maximum was exceeded rather
38 # than only met.
39 max_funcs = AUTOCOMPLETE_NAMES_LIMIT + 1
40- programs = CONNECTION.programs_with_metadata()
41- result = CONNECTION.get_function_names(program_name, search, max_funcs)
42+ get_names = CONNECTION.get_function_names
43+ # If the query fails then None will be returned. Use or set
44+ # to ensure we can use len on the next line.
45+ result = get_names(program_name, search, max_funcs) or set()
46 return result if len(result) < max_funcs else set()
47
48

Subscribers

People subscribed via source and target branches