1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/672987cdb4bf/ Changeset: 672987cdb4bf User: dannon Date: 2013-11-21 01:59:01 Summary: Swap impersonate to select2 deferred load w/ filter. This adds a 'f_email' filter parameter to the Users api collection -- we should revisit this before the next stable release to decide how we want API filtering to actually work down the road. Affected #: 2 files diff -r 7a882c5fdd34636ae5ca98f63709c13a6648c3cf -r 672987cdb4bf67ed14915d7997618bf008ce844e lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -14,7 +14,7 @@ class UserAPIController( BaseAPIController, UsesTagsMixin, CreatesUsersMixin, CreatesApiKeysMixin ): @web.expose_api - def index( self, trans, deleted='False', **kwd ): + def index( self, trans, deleted='False', f_email=None, **kwd ): """ GET /api/users GET /api/users/deleted @@ -23,6 +23,8 @@ rval = [] query = trans.sa_session.query( trans.app.model.User ) deleted = util.string_as_bool( deleted ) + if f_email: + query = query.filter(trans.app.model.User.email.like("%%%s%%" % f_email)) if deleted: query = query.filter( trans.app.model.User.table.c.deleted == True ) # only admins can see deleted users diff -r 7a882c5fdd34636ae5ca98f63709c13a6648c3cf -r 672987cdb4bf67ed14915d7997618bf008ce844e templates/admin/impersonate.mako --- a/templates/admin/impersonate.mako +++ b/templates/admin/impersonate.mako @@ -14,11 +14,8 @@ <label> User to impersonate: </label> - <select name="email" class='text-and-autocomplete-select'> - %for email in emails: - <option>${email}</option> - %endfor - </select> + <input type="hidden" id="email_select" name="email"> + </input></div><div class="form-row"><input type="submit" name="impersonate_button" value="Impersonate"/> @@ -26,4 +23,35 @@ </form></div></div> + <script type="text/javascript"> + /* This should be ripped out and made generic at some point for the + * various API bindings available, and once the API can filter list + * queries (term, below) */ + $("#email_select").select2({ + placeholder: "Select a user", + ajax: { + url: "/api/users/", + dataType: 'json', + quietMillis: 250, + matcher: function(term, text) { return text.toUpperCase().indexOf(term.toUpperCase())>=0; }, + data: function (term) { + return { + f_email: term + }; + }, + results: function (data) { + var results = []; + $.each(data, function(index, item){ + results.push({ + id: item.email, + text: item.email + }); + }); + return { + results: results + }; + } + } + }); + </script> %endif Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.