summaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2015-12-11 08:01:20 +0100
committerJenkins CI <ci@sonarsource.com>2015-12-11 08:01:20 +0100
commitd547fdddf958c20cddd00cdbf7a280182400f595 (patch)
tree2ffb39ec347ad77c4a772c7fe0f7dfc49120c96d /server/sonar-web
parent39f16286bfcd6dc247352e34f0fb93cc202104c4 (diff)
parent56a4685a6061731fe701ea3ec8afbf9a8a1015f0 (diff)
downloadsonarqube-d547fdddf958c20cddd00cdbf7a280182400f595.tar.gz
sonarqube-d547fdddf958c20cddd00cdbf7a280182400f595.zip
Automatic merge from branch-5.3
* origin/branch-5.3: SONAR-6968 Bad error message when analyzer detects that no language plugins are installed SONAR-6905 Batch should dump analysis-related URL into a properties file fix displaying of the workspace on the overview pages SONAR-7030 Remove dashboards bundles Reactivate devcockpit in PluginsTest fix link to added issues from the debt overview respect precision of float metrics during web formatting
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/issue-measure.js4
-rw-r--r--server/sonar-web/src/main/js/components/workspace/main.js2
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.js4
-rw-r--r--server/sonar-web/tests/helpers/measures-test.js24
4 files changed, 26 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js b/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js
index 8387f2b6feb..a0f703d8026 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js
+++ b/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js
@@ -67,12 +67,14 @@ export const AddedRemovedMeasure = React.createClass({
let added = this.props.leak[this.props.leakMetric] || 0;
let removed = added - leak;
+ let createdAfter = moment(this.props.leakPeriodDate).format('YYYY-MM-DDTHH:mm:ssZZ');
+
return <div className="overview-detailed-measure-leak">
<ul>
<li style={{ display: 'flex', alignItems: 'baseline' }}>
<small className="flex-1 text-left">{window.t('overview.added')}</small>
<IssuesLink className="text-danger"
- component={this.props.component.key} params={{ resolved: 'false' }}>
+ component={this.props.component.key} params={{ resolved: 'false', createdAfter }}>
<span className="overview-detailed-measure-value">
{formatMeasure(added, getShortType(this.props.type))}
</span>
diff --git a/server/sonar-web/src/main/js/components/workspace/main.js b/server/sonar-web/src/main/js/components/workspace/main.js
index 3718625541e..6ae1dd2c3b4 100644
--- a/server/sonar-web/src/main/js/components/workspace/main.js
+++ b/server/sonar-web/src/main/js/components/workspace/main.js
@@ -5,6 +5,8 @@ import Items from './models/items';
import ItemsView from './views/items-view';
import ViewerView from './views/viewer-view';
import RuleView from './views/rule-view';
+import '../../helpers/handlebars-helpers';
+
var instance = null,
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js
index 2137e40c6b8..ffb6e576152 100644
--- a/server/sonar-web/src/main/js/helpers/measures.js
+++ b/server/sonar-web/src/main/js/helpers/measures.js
@@ -125,11 +125,11 @@ function shortIntVariationFormatter (value) {
}
function floatFormatter (value) {
- return numeral(value).format('0,0.0');
+ return numeral(value).format('0,0.0[0000]');
}
function floatVariationFormatter (value) {
- return value === 0 ? '+0.0' : numeral(value).format('+0,0.0');
+ return value === 0 ? '+0.0' : numeral(value).format('+0,0.0[0000]');
}
function percentFormatter (value) {
diff --git a/server/sonar-web/tests/helpers/measures-test.js b/server/sonar-web/tests/helpers/measures-test.js
index cc8e7a4a25c..2caabb3cdf5 100644
--- a/server/sonar-web/tests/helpers/measures-test.js
+++ b/server/sonar-web/tests/helpers/measures-test.js
@@ -68,14 +68,21 @@ describe('Measures', function () {
expect(formatMeasure(0.0, 'FLOAT')).to.equal('0.0');
expect(formatMeasure(1.0, 'FLOAT')).to.equal('1.0');
expect(formatMeasure(1.3, 'FLOAT')).to.equal('1.3');
- expect(formatMeasure(1.34, 'FLOAT')).to.equal('1.3');
- expect(formatMeasure(50.89, 'FLOAT')).to.equal('50.9');
+ expect(formatMeasure(1.34, 'FLOAT')).to.equal('1.34');
+ expect(formatMeasure(50.89, 'FLOAT')).to.equal('50.89');
expect(formatMeasure(100.0, 'FLOAT')).to.equal('100.0');
- expect(formatMeasure(123.456, 'FLOAT')).to.equal('123.5');
+ expect(formatMeasure(123.456, 'FLOAT')).to.equal('123.456');
expect(formatMeasure(123456.7, 'FLOAT')).to.equal('123,456.7');
expect(formatMeasure(1234567890.0, 'FLOAT')).to.equal('1,234,567,890.0');
});
+ it('should respect FLOAT precision', function () {
+ expect(formatMeasure(0.1, 'FLOAT')).to.equal('0.1');
+ expect(formatMeasure(0.12, 'FLOAT')).to.equal('0.12');
+ expect(formatMeasure(0.12345, 'FLOAT')).to.equal('0.12345');
+ expect(formatMeasure(0.123456, 'FLOAT')).to.equal('0.12346');
+ });
+
it('should format PERCENT', function () {
expect(formatMeasure(0.0, 'PERCENT')).to.equal('0.0%');
expect(formatMeasure(1.0, 'PERCENT')).to.equal('1.0%');
@@ -180,8 +187,15 @@ describe('Measures', function () {
expect(formatMeasureVariation(0.0, 'FLOAT')).to.equal('+0.0');
expect(formatMeasureVariation(1.0, 'FLOAT')).to.equal('+1.0');
expect(formatMeasureVariation(-1.0, 'FLOAT')).to.equal('-1.0');
- expect(formatMeasureVariation(50.89, 'FLOAT')).to.equal('+50.9');
- expect(formatMeasureVariation(-50.89, 'FLOAT')).to.equal('-50.9');
+ expect(formatMeasureVariation(50.89, 'FLOAT')).to.equal('+50.89');
+ expect(formatMeasureVariation(-50.89, 'FLOAT')).to.equal('-50.89');
+ });
+
+ it('should respect FLOAT precision', function () {
+ expect(formatMeasureVariation(0.1, 'FLOAT')).to.equal('+0.1');
+ expect(formatMeasureVariation(0.12, 'FLOAT')).to.equal('+0.12');
+ expect(formatMeasureVariation(0.12345, 'FLOAT')).to.equal('+0.12345');
+ expect(formatMeasureVariation(0.123456, 'FLOAT')).to.equal('+0.12346');
});
it('should format PERCENT', function () {