Skip to content

Commit

Permalink
bugfixes and small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
anatskiy committed Apr 8, 2017
1 parent ebcb262 commit ebf1f39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
12 changes: 6 additions & 6 deletions config/plugins/webhooks/demo/tour_generator/static/script.js
Expand Up @@ -9,21 +9,21 @@ $(document).ready(function() {
// Add attribute 'tour_id' to the execution button
$('#execute').attr('tour_id', 'execute');

var url = '/api/webhooks/tour_generator/get_data/' + JSON.stringify({
'tool_id': this.toolId
});

$.getJSON(url, function(obj) {
$.getJSON('/api/webhooks/tour_generator/get_data/', {
tool_id: this.toolId
})
.done(function(obj) {
if (obj.success) {
$('#history-refresh-button').click(); // Refresh history panel

// Create a tour only when the uploaded dataset is ready
// Add a delay because of the history panel refreshing
setTimeout(function() {
var dataset = Galaxy.currHistoryPanel.collection.where({
hid: obj.data.hid
})[0];

if (dataset) {
// Create a tour only when the uploaded dataset is ready
dataset.on('change:state', function(model) {
if (model.get('state') === 'ok') {
me._main(obj.data);
Expand Down
9 changes: 5 additions & 4 deletions lib/galaxy/webapps/galaxy/api/webhooks.py
Expand Up @@ -56,15 +56,16 @@ def get_all_by_type(self, trans, webhook_type, **kwd):
]

@expose_api_anonymous_and_sessionless
def get_data(self, trans, webhook_name, params, **kwd):
# def get_data(self, trans, webhook_name, params, **kwd):
def get_data(self, trans, webhook_name, **kwd):
"""
*GET /api/webhooks/{webhook_name}/get_data/{params}
Returns the result of executing helper function
"""
params = {}

# If params is not None, convert it into a dictionary
if params:
params = json.loads(params)
for key, value in kwd.items():
params[key] = value

webhook = [
webhook
Expand Down
7 changes: 0 additions & 7 deletions lib/galaxy/webapps/galaxy/buildapp.py
Expand Up @@ -598,13 +598,6 @@ def populate_api_routes( webapp, app ):
'/api/webhooks/{webhook_name}/get_data',
controller='webhooks',
action='get_data',
params=None,
conditions=dict( method=[ "GET" ] ) )

webapp.mapper.connect( 'get_data',
'/api/webhooks/{webhook_name}/get_data/{params}',
controller='webhooks',
action='get_data',
conditions=dict( method=[ "GET" ] ) )

# =======================
Expand Down

0 comments on commit ebf1f39

Please sign in to comment.