Provide Galaxy.config var to indicate whether onload webhooks should kick off; use it. Fixes shed/reports use of them.

This commit is contained in:
Dannon Baker
2017-12-07 15:58:01 -05:00
parent 30196f5941
commit 3dfbbc7e08
2 changed files with 17 additions and 13 deletions
+16 -13
View File
@@ -204,20 +204,23 @@ $(document).ready(() => {
}
function onloadWebhooks() {
if (Galaxy.root !== undefined) {
// Load all webhooks with the type 'onload'
$.getJSON(`${Galaxy.root}api/webhooks/onload/all`, webhooks => {
_.each(webhooks, webhook => {
if (webhook.activate && webhook.script) {
$("<script/>", { type: "text/javascript" })
.text(webhook.script)
.appendTo("head");
$("<style/>", { type: "text/css" })
.text(webhook.styles)
.appendTo("head");
}
// Wait until Galaxy.config is loaded.
if (Galaxy.config) {
if (Galaxy.config.enable_webhooks){
// Load all webhooks with the type 'onload'
$.getJSON(`${Galaxy.root}api/webhooks/onload/all`, webhooks => {
_.each(webhooks, webhook => {
if (webhook.activate && webhook.script) {
$("<script/>", { type: "text/javascript" })
.text(webhook.script)
.appendTo("head");
$("<style/>", { type: "text/css" })
.text(webhook.styles)
.appendTo("head");
}
});
});
});
}
} else {
setTimeout(onloadWebhooks, 100);
}
@@ -52,6 +52,7 @@ class RootController(controller.JSAppLauncher, UsesAnnotations):
config = {
'active_view' : 'analysis',
'enable_cloud_launch' : app.config.get_bool('enable_cloud_launch', False),
'enable_webhooks' : True if app.webhooks_registry.webhooks else False,
# TODO: next two should be redundant - why can't we build one from the other?
'toolbox' : app.toolbox.to_dict(trans, in_panel=False),
'toolbox_in_panel' : app.toolbox.to_dict(trans),