diff --git a/client/galaxy/scripts/layout/masthead.js b/client/galaxy/scripts/layout/masthead.js index 527ce3f8b46..d6b9aaad59e 100644 --- a/client/galaxy/scripts/layout/masthead.js +++ b/client/galaxy/scripts/layout/masthead.js @@ -1,7 +1,7 @@ -import Utils from "utils/utils"; import Menu from "layout/menu"; import Scratchbook from "layout/scratchbook"; import QuotaMeter from "mvc/user/user-quotameter"; + /** Masthead **/ var View = Backbone.View.extend({ initialize: function(options) { @@ -62,7 +62,9 @@ var View = Backbone.View.extend({ var text = ""; self.collection.each(model => { var q = model.get("onbeforeunload") && model.get("onbeforeunload")(); - q && (text += `${q} `); + if (q) { + text += `${q} `; + } }); if (text !== "") { return text; diff --git a/client/galaxy/scripts/layout/page.js b/client/galaxy/scripts/layout/page.js index 35777d09039..a2ce69c1655 100644 --- a/client/galaxy/scripts/layout/page.js +++ b/client/galaxy/scripts/layout/page.js @@ -2,6 +2,7 @@ import Masthead from "layout/masthead"; import Panel from "layout/panel"; import Modal from "mvc/ui/ui-modal"; import Utils from "utils/utils"; + var View = Backbone.View.extend({ el: "body", className: "full-content", diff --git a/client/galaxy/scripts/mvc/webhooks.js b/client/galaxy/scripts/mvc/webhooks.js index ef6c2d00ea5..c1f2400fcf5 100644 --- a/client/galaxy/scripts/mvc/webhooks.js +++ b/client/galaxy/scripts/mvc/webhooks.js @@ -19,8 +19,9 @@ const WebhookView = Backbone.View.extend({ const webhooks = new Webhooks(); webhooks.fetch({ success: data => { - data.reset(filterType(data, options.type)); - + if (options.type) { + data.reset(filterType(data, options.type)); + } if (data.length > 0) { this.render(weightedRandomPick(data)); } @@ -50,7 +51,14 @@ const load = options => { }; function filterType(data, type) { - return data.models.filter(item => item.get("type").indexOf(type) !== -1); + return data.models.filter(item => { + let itype = item.get("type"); + if (itype) { + return itype.indexOf(type) !== -1; + } else { + return false; + } + }); } function weightedRandomPick(data) { diff --git a/client/galaxy/scripts/qunit/test-app.js b/client/galaxy/scripts/qunit/test-app.js index c1f6991aba7..155eb38627c 100644 --- a/client/galaxy/scripts/qunit/test-app.js +++ b/client/galaxy/scripts/qunit/test-app.js @@ -1,4 +1,6 @@ /** Creates a generic/global Galaxy environment, loads shared libraries and a fake server */ +/* global define */ + define( [ "jquery",