aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-10 16:22:04 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-10 16:24:35 +0200
commit66f00c2cfb074a72cbbd2c0c266437c43b6488e5 (patch)
tree28e8f94097a33804ce872ee0b6ff3beb4af73224
parentd716cb1dbbe8a57e5c659c8be3dc0a4dd47d160a (diff)
downloadsonarqube-66f00c2cfb074a72cbbd2c0c266437c43b6488e5.tar.gz
sonarqube-66f00c2cfb074a72cbbd2c0c266437c43b6488e5.zip
SONAR-6766 migrate to "flows"
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/issues.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/collections/issues.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/issue-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/main.js13
-rw-r--r--server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json63
5 files changed, 47 insertions, 37 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js
index aca2e2ac2bf..2b57399a5b5 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/issues.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js
@@ -41,8 +41,7 @@ define([
_prepareClosed: function (issue) {
if (issue.status === 'CLOSED') {
- issue.secondaryLocations = [];
- issue.executionFlows = [];
+ issue.flows = [];
delete issue.textRange;
}
return issue;
diff --git a/server/sonar-web/src/main/js/components/issue/collections/issues.js b/server/sonar-web/src/main/js/components/issue/collections/issues.js
index f40f9a30246..ecad7d8405f 100644
--- a/server/sonar-web/src/main/js/components/issue/collections/issues.js
+++ b/server/sonar-web/src/main/js/components/issue/collections/issues.js
@@ -41,8 +41,7 @@ define([
_prepareClosed: function (issue) {
if (issue.status === 'CLOSED') {
- issue.secondaryLocations = [];
- issue.executionFlows = [];
+ issue.flows = [];
delete issue.textRange;
}
return issue;
diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js
index 3a48d4e3dd2..614a8cb40fc 100644
--- a/server/sonar-web/src/main/js/components/issue/issue-view.js
+++ b/server/sonar-web/src/main/js/components/issue/issue-view.js
@@ -226,7 +226,7 @@ define([
var issueKey = encodeURIComponent(this.model.get('key'));
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
permalink: baseUrl + '/issues/search#issues=' + issueKey,
- hasSecondaryLocations: this.model.get('secondaryLocations').length || this.model.get('executionFlows').length
+ hasSecondaryLocations: this.model.get('flows').length
});
}
});
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js
index fca5c86eeeb..77d5c5ff8d2 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/main.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/main.js
@@ -752,12 +752,15 @@ define([
msg: issue.get('message'),
textRange: issue.get('textRange')
},
- secondaryLocations = issue.get('secondaryLocations'),
- _locations = [primaryLocation].concat(secondaryLocations);
- issue.get('executionFlows').forEach(function (flow) {
+ _locations = [primaryLocation];
+ issue.get('flows').forEach(function (flow) {
var flowLocationsCount = _.size(flow.locations);
- var flowLocations = flow.locations.map(function (loc, index) {
- return _.extend({ index: flowLocationsCount - index }, loc);
+ var flowLocations = flow.locations.map(function (location, index) {
+ var _location = _.extend({}, location);
+ if (flowLocationsCount > 1) {
+ _.extend(_location, { index: flowLocationsCount - index });
+ }
+ return _location;
});
_locations = [].concat(_locations, flowLocations);
});
diff --git a/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json b/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json
index 215ed12c651..895acb642a9 100644
--- a/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json
+++ b/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json
@@ -23,18 +23,21 @@
"startOffset": 24,
"endOffset": 29
},
- "secondaryLocations": [
+ "flows": [
{
- "textRange": {
- "startLine": 3,
- "endLine": 3,
- "startOffset": 15,
- "endOffset": 20
- },
- "msg": "Secondary Location #1"
+ "locations": [
+ {
+ "textRange": {
+ "startLine": 3,
+ "endLine": 3,
+ "startOffset": 15,
+ "endOffset": 20
+ },
+ "msg": "Secondary Location #1"
+ }
+ ]
}
],
- "executionFlows": [],
"status": "OPEN",
"message": "Identical sub-expressions on both sides of operator \"||\"",
"debt": "2min",
@@ -76,18 +79,21 @@
"startOffset": 6,
"endOffset": 10
},
- "secondaryLocations": [
+ "flows": [
{
- "textRange": {
- "startLine": 8,
- "endLine": 8,
- "startOffset": 6,
- "endOffset": 11
- },
- "msg": "Secondary Location #1"
+ "locations": [
+ {
+ "textRange": {
+ "startLine": 8,
+ "endLine": 8,
+ "startOffset": 6,
+ "endOffset": 11
+ },
+ "msg": "Secondary Location #1"
+ }
+ ]
}
],
- "executionFlows": [],
"status": "OPEN",
"message": "Identical sub-expressions on both sides of operator \"||\"",
"debt": "2min",
@@ -129,18 +135,21 @@
"startOffset": 13,
"endOffset": 9
},
- "secondaryLocations": [
+ "flows": [
{
- "textRange": {
- "startLine": 17,
- "endLine": 18,
- "startOffset": 15,
- "endOffset": 9
- },
- "msg": "Secondary Location #1"
+ "locations": [
+ {
+ "textRange": {
+ "startLine": 17,
+ "endLine": 18,
+ "startOffset": 15,
+ "endOffset": 9
+ },
+ "msg": "Secondary Location #1"
+ }
+ ]
}
],
- "executionFlows": [],
"status": "OPEN",
"message": "Identical sub-expressions on both sides of operator \"||\"",
"debt": "2min",