Skip to content

Commit

Permalink
Use client side grid builder for openids table
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Dec 12, 2017
1 parent 7f30028 commit 364804f
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 21 deletions.
10 changes: 10 additions & 0 deletions client/galaxy/scripts/apps/analysis.js
Expand Up @@ -47,6 +47,7 @@ window.app = function app(options, bootstrapped) {
"(/)tours(/)(:tour_id)": "show_tours",
"(/)user(/)": "show_user",
"(/)user(/)(:form_id)": "show_user_form",
"(/)openids(/)list": "show_openids",
"(/)pages(/)create(/)": "show_pages_create",
"(/)pages(/)edit(/)": "show_pages_edit",
"(/)pages(/)(:action_id)": "show_pages",
Expand Down Expand Up @@ -157,6 +158,15 @@ window.app = function app(options, bootstrapped) {
);
},

show_openids: function() {
this.page.display(
new GridView({
url_base: `${Galaxy.root}user/openids_list`,
dict_format: true
})
);
},

show_datasets: function() {
this.page.display(
new GridView({
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/user/user-preferences.js
Expand Up @@ -62,7 +62,7 @@ var Model = Backbone.Model.extend({
description: _l("Associate OpenIDs with your account."),
icon: "fa-openid",
onclick: function() {
window.location.href = `${Galaxy.root}user/openid_manage?cntrller=user&use_panels=True`;
window.location.href = `${Galaxy.root}openids/list`;
}
},
custom_builds: {
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Expand Up @@ -106,6 +106,7 @@ def app_factory(global_conf, load_app_kwds={}, **kwargs):
webapp.add_client_route('/tours/{tour_id}')
webapp.add_client_route('/user')
webapp.add_client_route('/user/{form_id}')
webapp.add_client_route('/openids/list')
webapp.add_client_route('/visualizations/list_published')
webapp.add_client_route('/visualizations/list')
webapp.add_client_route('/visualizations/edit')
Expand Down
31 changes: 15 additions & 16 deletions lib/galaxy/webapps/galaxy/controllers/user.py
Expand Up @@ -62,10 +62,8 @@


class UserOpenIDGrid(grids.Grid):
use_panels = False
title = "OpenIDs linked to your account"
model_class = model.UserOpenID
template = '/user/openid_manage.mako'
default_filter = {"openid": "All"}
default_sort_key = "-create_time"
columns = [
Expand Down Expand Up @@ -427,22 +425,23 @@ def openid_disassociate(self, trans, **kwd):
message=message,
status=status))

@web.expose
@web.expose_api
@web.require_login('manage OpenIDs')
def openid_manage(self, trans, **kwd):
def openids_list(self, trans, **kwd):
'''Manage OpenIDs for user'''
if not trans.app.config.enable_openid:
return trans.show_error_message('OpenID authentication is not enabled in this instance of Galaxy')
use_panels = kwd.get('use_panels', False)
if 'operation' in kwd:
operation = kwd['operation'].lower()
if operation == "delete":
return trans.response.send_redirect(url_for(controller='user',
action='openid_disassociate',
use_panels=use_panels,
id=kwd['id']))
kwd['redirect'] = kwd.get('redirect', url_for(controller='user', action='openid_manage', use_panels=True)).strip()
kwd['openid_providers'] = trans.app.openid_providers
#if not trans.app.config.enable_openid:
# return trans.show_error_message('OpenID authentication is not enabled in this instance of Galaxy')
#use_panels = kwd.get('use_panels', False)
#if 'operation' in kwd:
# operation = kwd['operation'].lower()
# if operation == "delete":
# return trans.response.send_redirect(url_for(controller='user',
# action='openid_disassociate',
# use_panels=use_panels,
# id=kwd['id']))
#kwd['redirect'] = kwd.get('redirect', url_for(controller='user', action='openid_manage', use_panels=True)).strip()
#kwd['openid_providers'] = trans.app.openid_providers
kwd['dict_format'] = True
return self.user_openid_grid(trans, **kwd)

@web.expose
Expand Down
2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/mvc/user/user-preferences.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions templates/user/openid_manage.mako
@@ -1,7 +1,27 @@
## Template generates a grid that enables user to select items.
<%inherit file="../grid_base.mako" />

<%namespace file="login.mako" import="render_openid_form" />
<%def name="render_openid_form( redirect, auto_associate, openid_providers )">
<div class="toolForm">
<div class="toolFormTitle">OpenID Login</div>
<form name="openid" id="openid" action="${h.url_for( controller='user', action='openid_auth' )}" method="post" target="_parent" >
<div class="form-row">
<label>OpenID URL:</label>
<input type="text" name="openid_url" size="60" style="background-image:url('${h.url_for( '/static/images/openid-16x16.gif' )}' ); background-repeat: no-repeat; padding-right: 20px; background-position: 99% 50%;"/>
<input type="hidden" name="redirect" value="${redirect | h}" size="40"/>
</div>
<div class="form-row">
Or, authenticate with your <select name="openid_provider">
%for provider in openid_providers:
<option value="${provider.id}">${provider.name}</option>
%endfor
</select> account.
</div>
<div class="form-row">
<input type="submit" name="login_button" value="Login"/>
</div>
</form>
</div>
</%def>

<%def name="load()">
<h2>Associate more OpenIDs</h2>
Expand Down

0 comments on commit 364804f

Please sign in to comment.