From 978d830fe9b5c584c8ae0e0d97044498528dd8a9 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 22 Dec 2015 14:57:08 +0100 Subject: [PATCH] improve code quality --- .../src/main/js/apps/update-center/plugin-changelog-view.js | 5 ++--- server/sonar-web/src/main/js/apps/users/tokens-view.js | 4 ++-- server/sonar-web/src/main/js/helpers/handlebars/default.js | 2 +- .../sonar-web/src/main/js/helpers/handlebars/recursive.js | 2 +- server/sonar-web/src/main/js/main/app.js | 2 ++ server/sonar-web/src/main/js/widgets/old/pie-chart.js | 6 +++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js index fe9e1bbbaa6..eb78098ed3a 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js @@ -11,9 +11,8 @@ export default Popup.extend({ this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); }, - onClose: function () { - // TODO why onClose? why not onDestroy? - Popup.prototype.onClose.apply(this, arguments); + onDestroy: function () { + Popup.prototype.onDestroy.apply(this, arguments); this.$('[data-toggle="tooltip"]').tooltip('destroy'); }, diff --git a/server/sonar-web/src/main/js/apps/users/tokens-view.js b/server/sonar-web/src/main/js/apps/users/tokens-view.js index 4dc0b77bf0b..505a752c1f0 100644 --- a/server/sonar-web/src/main/js/apps/users/tokens-view.js +++ b/server/sonar-web/src/main/js/apps/users/tokens-view.js @@ -42,8 +42,8 @@ export default Modal.extend({ this.newToken = response.token; this.requestTokens(); }) - .catch(e => { - e.response.json().then(response => { + .catch(error => { + error.response.json().then(response => { this.errors = response.errors; this.render(); }); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/default.js b/server/sonar-web/src/main/js/helpers/handlebars/default.js index 56ea431ae77..0bfef262515 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/default.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/default.js @@ -3,4 +3,4 @@ module.exports = function () { return args.reduce(function (prev, current) { return prev != null ? prev : current; }, null); -} +}; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/recursive.js b/server/sonar-web/src/main/js/helpers/handlebars/recursive.js index c123d31416a..0d02840139a 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/recursive.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/recursive.js @@ -12,4 +12,4 @@ module.exports = function (children, options) { }); return out; -} +}; diff --git a/server/sonar-web/src/main/js/main/app.js b/server/sonar-web/src/main/js/main/app.js index ab58da869ab..a68bf42b4b0 100644 --- a/server/sonar-web/src/main/js/main/app.js +++ b/server/sonar-web/src/main/js/main/app.js @@ -66,5 +66,7 @@ window.require = (module) => { return Marionette; case 'moment': return moment; + default: + return null; } }; diff --git a/server/sonar-web/src/main/js/widgets/old/pie-chart.js b/server/sonar-web/src/main/js/widgets/old/pie-chart.js index 929eb6a08ba..81f6cd79009 100644 --- a/server/sonar-web/src/main/js/widgets/old/pie-chart.js +++ b/server/sonar-web/src/main/js/widgets/old/pie-chart.js @@ -288,8 +288,8 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; .on('mouseenter', function(d, i) { return enterHandler(d3.select(this), d.data, i, true); }) - .on('mouseleave', function(d, i) { - return leaveHandler(d3.select(this), d.data, i, true); + .on('mouseleave', function() { + return leaveHandler(d3.select(this)); }) .on('click', function(d) { return clickHandler(d.data); @@ -300,7 +300,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; return enterHandler(d3.select(widget.sectors[0][i]), d, i, false); }) .on('mouseleave', function(d, i) { - return leaveHandler(d3.select(widget.sectors[0][i]), d, i, false); + return leaveHandler(d3.select(widget.sectors[0][i])); }) .on('click', function(d) { return clickHandler(d); -- 2.39.5