aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-10 17:21:38 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-10 17:21:47 +0200
commitab4f18fbeba4cc4a8db3371008e0dbb29c99f10b (patch)
treec871458807e114007e73970c6cd14d9e6bbcb1d9 /server
parentcbf5602a23ce9138b62c593d4e290566eaf97522 (diff)
downloadsonarqube-ab4f18fbeba4cc4a8db3371008e0dbb29c99f10b.tar.gz
sonarqube-ab4f18fbeba4cc4a8db3371008e0dbb29c99f10b.zip
improve code quality
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/.eslintrc2
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/search-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/groups-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/project-permissions/users-view.js10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/common/handlebars-extensions.js7
-rw-r--r--server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js21
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js34
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/base-filters.js24
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js24
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js30
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js24
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js22
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js24
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js24
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/range-filters.js26
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/string-filters.js26
-rw-r--r--server/sonar-web/src/main/js/components/workspace/models/items.js4
-rw-r--r--server/sonar-web/src/main/js/libs/application.js60
-rw-r--r--server/sonar-web/src/main/js/libs/recent-history.js28
-rw-r--r--server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js21
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/bubble-chart.js4
-rw-r--r--server/sonar-web/src/main/js/libs/widgets/timeline.js2
23 files changed, 103 insertions, 328 deletions
diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc
index e8523d53f38..95ac0b44959 100644
--- a/server/sonar-web/.eslintrc
+++ b/server/sonar-web/.eslintrc
@@ -106,7 +106,7 @@
"no-shadow-restricted-names": 1, // disallow shadowing of names such as arguments
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
"no-undef-init": 2, // disallow use of undefined when initializing variables
- "no-undefined": 2, // disallow use of undefined variable (off by default)
+ "no-undefined": 0, // disallow use of undefined variable (off by default)
"no-unused-vars": 2, // disallow declaration of variables that are not used in the code
"no-use-before-define": 0, // disallow use of variables before they are defined
diff --git a/server/sonar-web/src/main/js/apps/nav/global/search-view.js b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
index 2aaad79d8d3..e38787aba66 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/search-view.js
+++ b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
@@ -120,7 +120,7 @@ define([
that.favorite = r.map(function (f) {
var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + dashboardParameters(true),
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true),
name: isFile ? window.collapsedDirFromPath(f.lname) + window.fileFromPath(f.lname) : f.name,
icon: 'favorite'
};
@@ -132,8 +132,10 @@ define([
resetResultsToDefault: function () {
var recentHistory = JSON.parse(localStorage.getItem('sonar_recent_history')),
history = (recentHistory || []).map(function (historyItem, index) {
+ var url = baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
+ window.dashboardParameters(true);
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + dashboardParameters(true),
+ url: url,
name: historyItem.name,
q: historyItem.icon,
extra: index === 0 ? t('browsed_recently') : null
@@ -167,7 +169,7 @@ define([
collection.push(_.extend(item, {
q: domain.q,
extra: index === 0 ? domain.name : null,
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true)
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
}));
});
});
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
index 122a6a0ed20..e5315e5dd14 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
+++ b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js
@@ -39,7 +39,9 @@ define([
},
onDestroy: function () {
- this.options.refresh && this.options.refresh();
+ if (this.options.refresh) {
+ this.options.refresh();
+ }
this._super();
},
diff --git a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
index 5f54a1ad2a9..370db728ba1 100644
--- a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
+++ b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js
@@ -9,6 +9,8 @@ define([
onRender: function () {
this._super();
+ var searchUrl = baseUrl + '/api/permissions/users?ps=100&permission=' + this.options.permission +
+ '&projectId=' + this.options.project;
new window.SelectList({
el: this.$('#project-permissions-users'),
width: '100%',
@@ -18,7 +20,7 @@ define([
return item.name + '<br><span class="note">' + item.login + '</span>';
},
queryParam: 'q',
- searchUrl: baseUrl + '/api/permissions/users?ps=100&permission=' + this.options.permission + '&projectId=' + this.options.project,
+ searchUrl: searchUrl,
selectUrl: baseUrl + '/api/permissions/add_user',
deselectUrl: baseUrl + '/api/permissions/remove_user',
extra: {
@@ -35,14 +37,16 @@ define([
},
onDestroy: function () {
- this.options.refresh && this.options.refresh();
+ if (this.options.refresh) {
+ this.options.refresh();
+ }
this._super();
},
serializeData: function () {
return _.extend(Modal.prototype.serializeData.apply(this, arguments), {
projectName: this.options.projectName
- })
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
index bd223c261f3..2d39c14761c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js
@@ -27,7 +27,7 @@ define([
return ModalFormView.extend({
template: Templates['quality-profiles-restore-built-in-profiles'],
- onFormSubmit: function (e) {
+ onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
this.disableForm();
this.sendRequest();
diff --git a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
index c85329a0535..557e883f087 100644
--- a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
+++ b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js
@@ -19,6 +19,7 @@
*/
(function () {
Handlebars.registerHelper('log', function () {
+ /* eslint no-console: 0 */
var args = Array.prototype.slice.call(arguments, 0, -1);
console.log.apply(console, args);
});
@@ -198,12 +199,12 @@
});
Handlebars.registerHelper('eq', function (v1, v2, options) {
- // use `==` instead of `===` to ignore types
+ /* eslint eqeqeq: 0 */
return v1 == v2 ? options.fn(this) : options.inverse(this);
});
Handlebars.registerHelper('notEq', function (v1, v2, options) {
- // use `==` instead of `===` to ignore types
+ /* eslint eqeqeq: 0 */
return v1 != v2 ? options.fn(this) : options.inverse(this);
});
@@ -315,7 +316,7 @@
return ret;
});
- Handlebars.registerHelper('sum', function (a, b) {
+ Handlebars.registerHelper('sum', function () {
var args = Array.prototype.slice.call(arguments, 0, -1);
return args.reduce(function (p, c) {
return p + +c;
diff --git a/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js b/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js
index e65a9c61541..2733b2a7359 100644
--- a/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js
+++ b/server/sonar-web/src/main/js/components/common/jquery-isolated-scroll.js
@@ -1,23 +1,4 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-;(function ($) {
+(function ($) {
$.fn.isolatedScroll = function () {
this.on('wheel', function (e) {
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
index 36c07bbe947..c427c91102f 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js
@@ -1,27 +1,9 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, BaseFilters, ChoiceFilters) {
var PAGE_SIZE = 100;
@@ -247,7 +229,7 @@ define([
renderInput: function() {
var value = this.model.get('value') || [],
- input = $j('<input>')
+ input = $('<input>')
.prop('name', this.model.get('property'))
.prop('type', 'hidden')
.css('display', 'none')
@@ -337,7 +319,7 @@ define([
return that.createRequest(v);
});
- $j.when.apply($j, requests).done(function () {
+ $.when.apply($, requests).done(function () {
that.onRestore(value);
});
},
@@ -376,7 +358,7 @@ define([
createRequest: function(v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/resources',
type: 'GET',
@@ -407,7 +389,7 @@ define([
createRequest: function(v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/resources',
type: 'GET',
@@ -438,7 +420,7 @@ define([
createRequest: function(v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/users/search',
type: 'GET',
@@ -471,7 +453,7 @@ define([
createRequest: function(v) {
var that = this;
- return $j
+ return $
.ajax({
url: baseUrl + '/api/users/search',
type: 'GET',
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
index e4298597794..938b76028ee 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js
@@ -1,25 +1,7 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'../templates'
-], function () {
+], function ($) {
var Filter = Backbone.Model.extend({
@@ -95,7 +77,7 @@ define([
attachDetailsView: function() {
- this.detailsView.$el.detach().appendTo($j('body'));
+ this.detailsView.$el.detach().appendTo($('body'));
},
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
index 8c837802e24..964dfa1ff81 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js
@@ -1,26 +1,8 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
return BaseFilters.BaseFilterView.extend({
template: Templates['checkbox-filter'],
@@ -39,7 +21,7 @@ define([
renderInput: function() {
if (this.model.get('enabled')) {
- $j('<input>')
+ $('<input>')
.prop('name', this.model.get('property'))
.prop('type', 'checkbox')
.prop('value', 'true')
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
index 31fc08656ba..f65a5b58876 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
@@ -1,26 +1,8 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['choice-filter'],
@@ -116,12 +98,12 @@ define([
onShow: function() {
this.bindedOnKeyDown = _.bind(this.onKeyDown, this);
- $j('body').on('keydown', this.bindedOnKeyDown);
+ $('body').on('keydown', this.bindedOnKeyDown);
},
onHide: function() {
- $j('body').off('keydown', this.bindedOnKeyDown);
+ $('body').off('keydown', this.bindedOnKeyDown);
},
@@ -247,12 +229,12 @@ define([
renderInput: function() {
- var input = $j('<select>')
+ var input = $('<select>')
.prop('name', this.model.get('property'))
.prop('multiple', true)
.css('display', 'none');
this.choices.each(function(item) {
- var option = $j('<option>')
+ var option = $('<option>')
.prop('value', item.get('id'))
.prop('selected', item.get('checked'))
.text(item.get('text'));
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
index a787a89fece..e623a83b276 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js
@@ -1,27 +1,9 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, BaseFilters, ChoiceFilters) {
var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['favorite-details-filter'],
@@ -34,7 +16,7 @@ define([
applyFavorite: function(e) {
- var id = $j(e.target).data('id');
+ var id = $(e.target).data('id');
window.location = baseUrl + this.model.get('favoriteUrl') + '/' + id;
},
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
index 28ee2ceb836..f68c0e21fb2 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js
@@ -1,24 +1,6 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define(
[
+ 'jquery',
'./base-filters',
'./more-criteria-filters',
'./favorite-filters'
@@ -51,7 +33,7 @@ define(
Marionette.CompositeView.prototype.initialize.apply(this, arguments);
var that = this;
- $j('body').on('click', function () {
+ $('body').on('click', function () {
that.hideDetails();
});
this.addMoreCriteriaFilter();
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
index cef960f3238..a746e90f75e 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
@@ -1,26 +1,8 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['metric-filter'],
@@ -171,7 +153,7 @@ define([
v = '';
}
- $j('<input>')
+ $('<input>')
.prop('name', that.model.get('property') + '_' + key)
.prop('type', 'hidden')
.css('display', 'none')
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
index f2a39f9a218..ffb08db20f4 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js
@@ -1,27 +1,9 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'./choice-filters',
'../templates'
-], function (BaseFilters, ChoiceFilters) {
+], function ($, BaseFilters, ChoiceFilters) {
var DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({
template: Templates['more-criteria-details-filter'],
@@ -49,7 +31,7 @@ define([
enableFilter: function(e) {
- var id = $j(e.target).data('id');
+ var id = $(e.target).data('id');
this.enableById(id);
this.updateCurrent(0);
},
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
index e46d15594fd..09d1c447f11 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
@@ -1,26 +1,8 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['range-filter'],
@@ -94,14 +76,14 @@ define([
valueFrom = _.isObject(value) && value[propertyFrom],
valueTo = _.isObject(value) && value[propertyTo];
- $j('<input>')
+ $('<input>')
.prop('name', propertyFrom)
.prop('type', 'hidden')
.css('display', 'none')
.val(valueFrom || '')
.appendTo(this.$el);
- $j('<input>')
+ $('<input>')
.prop('name', propertyTo)
.prop('type', 'hidden')
.css('display', 'none')
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
index c667ccc73e6..20512c322dd 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js
@@ -1,26 +1,8 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
define([
+ 'jquery',
'./base-filters',
'../templates'
-], function (BaseFilters) {
+], function ($, BaseFilters) {
var DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({
template: Templates['string-filter'],
@@ -32,7 +14,7 @@ define([
change: function(e) {
- this.model.set('value', $j(e.target).val());
+ this.model.set('value', $(e.target).val());
},
@@ -67,7 +49,7 @@ define([
renderInput: function() {
- $j('<input>')
+ $('<input>')
.prop('name', this.model.get('property'))
.prop('type', 'hidden')
.css('display', 'none')
diff --git a/server/sonar-web/src/main/js/components/workspace/models/items.js b/server/sonar-web/src/main/js/components/workspace/models/items.js
index 2fa11670ed3..0a3f915234d 100644
--- a/server/sonar-web/src/main/js/components/workspace/models/items.js
+++ b/server/sonar-web/src/main/js/components/workspace/models/items.js
@@ -39,7 +39,9 @@ define(['./item'], function (Item) {
try {
var parsed = JSON.parse(dump);
this.reset(parsed);
- } catch (err) { }
+ } catch (err) {
+ // fail silently
+ }
}
},
diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js
index bc3fb63b444..bdbc78a7524 100644
--- a/server/sonar-web/src/main/js/libs/application.js
+++ b/server/sonar-web/src/main/js/libs/application.js
@@ -29,9 +29,9 @@
* @param {string} message
*/
window.showMessage = function (id, message) {
- $j('#' + id + 'msg').html(message);
- $j('#' + id).removeClass('hidden');
- $j('#messages-panel').removeClass('hidden');
+ jQuery('#' + id + 'msg').html(message);
+ jQuery('#' + id).removeClass('hidden');
+ jQuery('#messages-panel').removeClass('hidden');
};
/**
@@ -40,8 +40,8 @@
* @returns {boolean} always false
*/
window.hideMessage = function (id) {
- $j('#' + id).addClass('hidden');
- var messagePanel = $j('#messages-panel'),
+ jQuery('#' + id).addClass('hidden');
+ var messagePanel = jQuery('#messages-panel'),
isEmpty = messagePanel.children('*:not(.hidden)').length === 0;
messagePanel.toggleClass('hidden', isEmpty);
return false;
@@ -52,7 +52,7 @@
* @param {string} message
*/
window.error = function (message) {
- showMessage('error', message);
+ window.showMessage('error', message);
};
/**
@@ -60,7 +60,7 @@
* @param {string} message
*/
window.warning = function (message) {
- showMessage('warning', message);
+ window.showMessage('warning', message);
};
/**
@@ -68,7 +68,7 @@
* @param {string} message
*/
window.info = function (message) {
- showMessage('info', message);
+ window.showMessage('info', message);
};
/**
@@ -76,7 +76,7 @@
* @returns {boolean} always false
*/
window.hideError = function () {
- return hideMessage('error');
+ return window.hideMessage('error');
};
/**
@@ -84,7 +84,7 @@
* @returns {boolean} always false
*/
window.hideWarning = function () {
- return hideMessage('warning');
+ return window.hideMessage('warning');
};
/**
@@ -92,17 +92,17 @@
* @returns {boolean} always false
*/
window.hideInfo = function () {
- return hideMessage('info');
+ return window.hideMessage('info');
};
})();
function toggleFav (resourceId, elt) {
- $j.ajax({
+ jQuery.ajax({
type: 'POST', dataType: 'json', url: baseUrl + '/favourites/toggle/' + resourceId,
success: function (data) {
- var star = $j(elt);
+ var star = jQuery(elt);
star.removeClass('icon-favorite icon-not-favorite');
star.addClass(data.css);
star.attr('title', data.title);
@@ -115,7 +115,7 @@ function dashboardParameters (urlHasSomething) {
var parameters = [];
var matchDashboard = queryString.match(/did=\d+/);
- if (matchDashboard && $j('#is-project-dashboard').length === 1) {
+ if (matchDashboard && jQuery('#is-project-dashboard').length === 1) {
parameters.push(matchDashboard[0]);
}
@@ -137,11 +137,11 @@ function dashboardParameters (urlHasSomething) {
function openModalWindow (url, options) {
var width = (options && options.width) || 540;
- var $dialog = $j('#modal');
+ var $dialog = jQuery('#modal');
if (!$dialog.length) {
- $dialog = $j('<div id="modal" class="ui-widget-overlay ui-front"></div>').appendTo('body');
+ $dialog = jQuery('<div id="modal" class="ui-widget-overlay ui-front"></div>').appendTo('body');
}
- $j.get(url, function (html) {
+ jQuery.get(url, function (html) {
$dialog.removeClass('ui-widget-overlay');
$dialog.html(html);
$dialog
@@ -155,7 +155,7 @@ function openModalWindow (url, options) {
resizable: false,
title: null,
close: function () {
- $j('#modal').remove();
+ jQuery('#modal').remove();
}
});
$dialog.dialog('open');
@@ -165,18 +165,18 @@ function openModalWindow (url, options) {
return false;
}
-(function ($j) {
- $j.fn.extend({
+(function (jQuery) {
+ jQuery.fn.extend({
openModal: function () {
return this.each(function () {
- var obj = $j(this);
+ var obj = jQuery(this);
var url = obj.attr('modal-url') || obj.attr('href');
return openModalWindow(url, { 'width': obj.attr('modal-width') });
});
},
modal: function () {
return this.each(function () {
- var obj = $j(this);
+ var obj = jQuery(this);
obj.unbind('click');
var $link = obj.bind('click', function () {
$link.openModal();
@@ -186,10 +186,10 @@ function openModalWindow (url, options) {
},
modalForm: function (ajax_options) {
return this.each(function () {
- var obj = $j(this);
+ var obj = jQuery(this);
obj.submit(function () {
- $j('input[type=submit]', this).attr('disabled', 'disabled');
- $j.ajax($j.extend({
+ jQuery('input[type=submit]', this).attr('disabled', 'disabled');
+ jQuery.ajax(jQuery.extend({
type: 'POST',
url: obj.attr('action'),
data: obj.serialize(),
@@ -201,14 +201,14 @@ function openModalWindow (url, options) {
var errorElt = obj.find('.modal-error');
if (errorElt.length) {
// Hide all loading images
- $j('.loading-image').addClass('hidden');
+ jQuery('.loading-image').addClass('hidden');
// Re activate submit button
- $j('input[type=submit]', obj).removeAttr('disabled');
+ jQuery('input[type=submit]', obj).removeAttr('disabled');
errorElt.show();
- errorElt.html($j('<div/>').html(xhr.responseText).text());
+ errorElt.html(jQuery('<div/>').html(xhr.responseText).text());
} else {
// otherwise replace modal window by the returned text
- $j('#modal').html(xhr.responseText);
+ jQuery('#modal').html(xhr.responseText);
}
}
}, ajax_options));
@@ -220,7 +220,7 @@ function openModalWindow (url, options) {
})(jQuery);
function closeModalWindow () {
- $j('#modal').dialog('close');
+ jQuery('#modal').dialog('close');
return false;
}
diff --git a/server/sonar-web/src/main/js/libs/recent-history.js b/server/sonar-web/src/main/js/libs/recent-history.js
index f2c17912911..b9e54a7ccb6 100644
--- a/server/sonar-web/src/main/js/libs/recent-history.js
+++ b/server/sonar-web/src/main/js/libs/recent-history.js
@@ -1,22 +1,3 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
window.Sonar = {};
window.Sonar.RecentHistory = function () {
@@ -59,17 +40,18 @@ window.Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName,
};
window.Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () {
- var historyLinksList = $j('#recent-history-list');
+ var historyLinksList = jQuery('#recent-history-list');
historyLinksList.empty();
var recentHistory = this.getRecentHistory();
if (recentHistory.length === 0) {
- $j('#recent-history').hide();
+ jQuery('#recent-history').hide();
} else {
recentHistory.forEach(function (resource) {
historyLinksList.append('<li><i class="icon-qualifier-' + resource.icon + '"></i><a href="' +
- baseUrl + '/dashboard/index/' + resource.key + dashboardParameters() + '"> ' + resource.name + '</a></li>');
+ baseUrl + '/dashboard/index/' + resource.key + window.dashboardParameters() + '"> ' +
+ resource.name + '</a></li>');
});
- $j('#recent-history').show();
+ jQuery('#recent-history').show();
}
};
diff --git a/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js b/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
index b57d696ec65..eab60772b21 100644
--- a/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
+++ b/server/sonar-web/src/main/js/libs/select2-jquery-ui-fix.js
@@ -1,25 +1,6 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
/* https://github.com/ivaynberg/select2/issues/1246 */
-;(function($) {
+(function($) {
$.ui.dialog.prototype._allowInteraction = function(e) {
return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length;
diff --git a/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js b/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
index fc166404423..dba3c8f918e 100644
--- a/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
+++ b/server/sonar-web/src/main/js/libs/widgets/bubble-chart.js
@@ -220,8 +220,8 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
sizeMetricValue = d.measures[widget.sizeMetric].fval;
return '<div class="text-left">' +
- collapsedDirFromPath(d.longName) + '<br>' +
- fileFromPath(d.longName) + '<br>' + '<br>' +
+ window.collapsedDirFromPath(d.longName) + '<br>' +
+ window.fileFromPath(d.longName) + '<br>' + '<br>' +
xMetricName + ': ' + xMetricValue + '<br>' +
yMetricName + ': ' + yMetricValue + '<br>' +
sizeMetricName + ': ' + sizeMetricValue +
diff --git a/server/sonar-web/src/main/js/libs/widgets/timeline.js b/server/sonar-web/src/main/js/libs/widgets/timeline.js
index 5b871e5994e..4fa9c0123ac 100644
--- a/server/sonar-web/src/main/js/libs/widgets/timeline.js
+++ b/server/sonar-web/src/main/js/libs/widgets/timeline.js
@@ -310,7 +310,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
.attr('transform', function() { return trans(x, metricY); });
});
- if (metricY > -1) {
+ if (metricY > -1) {
metricY += 17;
}