diff --git a/config/plugins/webhooks/demo/tour_generator/static/script.js b/config/plugins/webhooks/demo/tour_generator/static/script.js index a7f2bd99e92..6171a2af550 100644 --- a/config/plugins/webhooks/demo/tour_generator/static/script.js +++ b/config/plugins/webhooks/demo/tour_generator/static/script.js @@ -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); diff --git a/lib/galaxy/webapps/galaxy/api/webhooks.py b/lib/galaxy/webapps/galaxy/api/webhooks.py index 8d5ccbc6c00..1ec2e8e07d8 100644 --- a/lib/galaxy/webapps/galaxy/api/webhooks.py +++ b/lib/galaxy/webapps/galaxy/api/webhooks.py @@ -56,15 +56,16 @@ class WebhooksController(BaseAPIController): ] @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 diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 132ab82a8c9..946054c9a7b 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -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" ] ) ) # =======================