aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-04-25 15:11:13 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-04-25 15:11:24 +0600
commit0ce9e9f82545e0ee3a01f59f7e9130ec5e790621 (patch)
tree11e3e98cc3462270630be7eea5719f4949daddfd
parent6c95411c7beea684ba428d44fbf0dbd967f96c0e (diff)
downloadsonarqube-0ce9e9f82545e0ee3a01f59f7e9130ec5e790621.tar.gz
sonarqube-0ce9e9f82545e0ee3a01f59f7e9130ec5e790621.zip
Fix quality flaws
-rw-r--r--sonar-server/src/main/js/common/select-list.js2
-rw-r--r--sonar-server/src/main/js/issues/extra.js38
-rw-r--r--sonar-server/src/main/js/navigator/filters/base-filters.js1
-rw-r--r--sonar-server/src/main/js/navigator/filters/checkbox-filters.js2
-rw-r--r--sonar-server/src/main/js/navigator/filters/metric-filters.js12
-rw-r--r--sonar-server/src/main/js/widgets/bubble-chart.js6
-rw-r--r--sonar-server/src/main/js/widgets/histogram.js3
-rw-r--r--sonar-server/src/main/js/widgets/pie-chart.js36
8 files changed, 47 insertions, 53 deletions
diff --git a/sonar-server/src/main/js/common/select-list.js b/sonar-server/src/main/js/common/select-list.js
index 36dd95cbab1..e19dea825ec 100644
--- a/sonar-server/src/main/js/common/select-list.js
+++ b/sonar-server/src/main/js/common/select-list.js
@@ -108,7 +108,7 @@ requirejs(['backbone'], function (Backbone) {
}
},
- toggle: function (e) {
+ toggle: function () {
var selected = this.model.get('selected'),
that = this,
url = selected ? this.settings.deselectUrl : this.settings.selectUrl,
diff --git a/sonar-server/src/main/js/issues/extra.js b/sonar-server/src/main/js/issues/extra.js
index 8ac8585d0d1..b2e3c025e79 100644
--- a/sonar-server/src/main/js/issues/extra.js
+++ b/sonar-server/src/main/js/issues/extra.js
@@ -424,6 +424,26 @@ define(
});
+
+ var IssuesFavoriteFilterView = FavoriteFiltersModule.FavoriteFilterView.extend({
+
+ initialize: function () {
+ BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ detailsView: IssuesDetailsFavoriteFilterView
+ });
+
+ this.listenTo(window.SS.appState, 'change:favorites', this.updateFavorites);
+ },
+
+
+ updateFavorites: function () {
+ this.model.set('choices', window.SS.appState.get('favorites'));
+ this.render();
+ }
+ });
+
+
+
var IssuesFilterBarView = FilterBarView.extend({
collectionEvents: {
@@ -603,24 +623,6 @@ define(
});
- var IssuesFavoriteFilterView = FavoriteFiltersModule.FavoriteFilterView.extend({
-
- initialize: function () {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
- detailsView: IssuesDetailsFavoriteFilterView
- });
-
- this.listenTo(window.SS.appState, 'change:favorites', this.updateFavorites);
- },
-
-
- updateFavorites: function () {
- this.model.set('choices', window.SS.appState.get('favorites'));
- this.render();
- }
- });
-
-
var IssuesRouter = Backbone.Router.extend({
routes: {
diff --git a/sonar-server/src/main/js/navigator/filters/base-filters.js b/sonar-server/src/main/js/navigator/filters/base-filters.js
index 09cccd3f8b8..ac8372585ea 100644
--- a/sonar-server/src/main/js/navigator/filters/base-filters.js
+++ b/sonar-server/src/main/js/navigator/filters/base-filters.js
@@ -104,7 +104,6 @@ define(['backbone', 'backbone.marionette', 'common/handlebars-extensions'], func
focus: function() {
this.render();
-// this.showDetails();
},
diff --git a/sonar-server/src/main/js/navigator/filters/checkbox-filters.js b/sonar-server/src/main/js/navigator/filters/checkbox-filters.js
index 33f0f38f5d9..49e3490309a 100644
--- a/sonar-server/src/main/js/navigator/filters/checkbox-filters.js
+++ b/sonar-server/src/main/js/navigator/filters/checkbox-filters.js
@@ -34,7 +34,7 @@ define([
renderValue: function() {
- return this.model.get('value') || false;
+ return this.model.get('value');
},
diff --git a/sonar-server/src/main/js/navigator/filters/metric-filters.js b/sonar-server/src/main/js/navigator/filters/metric-filters.js
index 6a3df26e49e..f2e7663b380 100644
--- a/sonar-server/src/main/js/navigator/filters/metric-filters.js
+++ b/sonar-server/src/main/js/navigator/filters/metric-filters.js
@@ -31,13 +31,11 @@ define(['navigator/filters/base-filters', 'common/handlebars-extensions'], funct
});
if (metric) {
this.$('[name=val]').data('type', metric.metric.val_type);
- switch (metric.metric.val_type) {
- case 'WORK_DUR':
- this.$('[name=val]').prop('placeholder', '1d 7h 59min');
- break;
- case 'RATING':
- this.$('[name=val]').prop('placeholder', 'A');
- break;
+ if (metric.metric.val_type === 'WORK_DUR') {
+ this.$('[name=val]').prop('placeholder', '1d 7h 59min');
+ }
+ if (metric.metric.val_type === 'RATING') {
+ this.$('[name=val]').prop('placeholder', 'A');
}
}
},
diff --git a/sonar-server/src/main/js/widgets/bubble-chart.js b/sonar-server/src/main/js/widgets/bubble-chart.js
index 43ef2b78f3c..edafc4c6f66 100644
--- a/sonar-server/src/main/js/widgets/bubble-chart.js
+++ b/sonar-server/src/main/js/widgets/bubble-chart.js
@@ -163,13 +163,11 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
.attr('r', function (d) {
return widget.size(widget.getSizeMetric(d));
})
- .style('fill', function (d) {
- // TODO widget.bubbleColorUndefined()
+ .style('fill', function () {
return widget.bubbleColor();
})
.style('fill-opacity', 0.2)
- .style('stroke', function (d) {
- // TODO widget.bubbleColorUndefined()
+ .style('stroke', function () {
return widget.bubbleColor();
})
.style('transition', 'all 0.2s ease');
diff --git a/sonar-server/src/main/js/widgets/histogram.js b/sonar-server/src/main/js/widgets/histogram.js
index 41080147690..3cce1220605 100644
--- a/sonar-server/src/main/js/widgets/histogram.js
+++ b/sonar-server/src/main/js/widgets/histogram.js
@@ -181,8 +181,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
// Update scales
var xDomain = d3.extent(this.components(), function(d) {
return widget.getMainMetric(d);
- }),
- metric = this.metrics()[this.mainMetric];
+ });
if (!this.options().relativeScale) {
if (this.metrics()[this.mainMetric].type === 'PERCENT') {
diff --git a/sonar-server/src/main/js/widgets/pie-chart.js b/sonar-server/src/main/js/widgets/pie-chart.js
index 50db9fec5fe..f28f61c6d28 100644
--- a/sonar-server/src/main/js/widgets/pie-chart.js
+++ b/sonar-server/src/main/js/widgets/pie-chart.js
@@ -259,7 +259,23 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
// Configure events
- var enterHandler = function(sector, d, i, showDetails) {
+ var updateMetrics = function(metrics) {
+ widget.detailsMetrics = widget.detailsWrap.selectAll('.details-metric')
+ .data(metrics);
+
+ widget.detailsMetrics.enter().append('text')
+ .classed('details-metric', true)
+ .classed('details-metric-main', function(d, i) { return i === 0; })
+ .attr('transform', function(d, i) { return trans(10, i * widget._lineHeight); })
+ .attr('dy', '1.2em');
+
+ widget.detailsMetrics
+ .text(function(d) { return d.name + (d.value ? ': ' + d.value : ''); })
+ .style('opacity', 1);
+
+ widget.detailsMetrics.exit().remove();
+ },
+ enterHandler = function(sector, d, i, showDetails) {
if (showDetails) {
var metrics = widget.metricsPriority().map(function(m) {
return {
@@ -323,24 +339,6 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
default:
window.location = widget.options().baseUrl + encodeURIComponent(d.key);
}
- },
-
- updateMetrics = function(metrics) {
-
- widget.detailsMetrics = widget.detailsWrap.selectAll('.details-metric')
- .data(metrics);
-
- widget.detailsMetrics.enter().append('text')
- .classed('details-metric', true)
- .classed('details-metric-main', function(d, i) { return i === 0; })
- .attr('transform', function(d, i) { return trans(10, i * widget._lineHeight); })
- .attr('dy', '1.2em');
-
- widget.detailsMetrics
- .text(function(d) { return d.name + (d.value ? ': ' + d.value : ''); })
- .style('opacity', 1);
-
- widget.detailsMetrics.exit().remove();
};
this.sectors