aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-03 11:21:23 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-03 11:21:33 +0200
commitad2a3d41e24fd99b452d6d6d9481829c0a5928d8 (patch)
treef9666820162a9b534abfb14db33f256c13a6309b /server
parentfa5e4667fa79a61a14157a03c68548307f0b8f54 (diff)
downloadsonarqube-ad2a3d41e24fd99b452d6d6d9481829c0a5928d8.tar.gz
sonarqube-ad2a3d41e24fd99b452d6d6d9481829c0a5928d8.zip
SONAR-6582 do not rely on "projects" and "actionPlanName"
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/controller.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/project-facet.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/issues.js38
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-home-view.js2
-rw-r--r--server/sonar-web/src/main/js/components/issue/collections/issues.js28
-rw-r--r--server/sonar-web/src/main/js/components/issue/models/issue.js9
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search-changed.json18
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues-severities.json10
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues.json10
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search-reopened.json26
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search-with-tags.json10
-rw-r--r--server/sonar-web/src/test/json/issues-spec/search.json18
-rw-r--r--server/sonar-web/src/test/json/issues-spec/show-with-tags.json2
13 files changed, 20 insertions, 155 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js
index c707a4c08ee..78c46469942 100644
--- a/server/sonar-web/src/main/js/apps/issues/controller.js
+++ b/server/sonar-web/src/main/js/apps/issues/controller.js
@@ -8,7 +8,7 @@ define([
FIELDS = 'component,componentId,project,subProject,rule,status,resolution,author,reporter,assignee,debt,line,' +
'message,severity,actionPlan,creationDate,updateDate,closeDate,tags,comments,attr,actions,transitions,' +
'actionPlanName',
- FACET_DATA_FIELDS = ['components', 'projects', 'users', 'rules', 'actionPlans', 'languages'];
+ FACET_DATA_FIELDS = ['components', 'users', 'rules', 'actionPlans', 'languages'];
return Controller.extend({
_facetsFromServer: function () {
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
index ad7126b427d..429d9e876c2 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
@@ -58,7 +58,7 @@ define([
getValuesWithLabels: function () {
var values = this.model.getValues(),
- projects = this.options.app.facets.projects;
+ projects = this.options.app.facets.components;
values.forEach(function (v) {
var uuid = v.val,
label = '';
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 06abb122653..5a5a8f3ec8b 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
@@ -27,43 +27,15 @@ define([
parseIssues: function (r) {
var that = this;
- var find = function (source, key, keyField) {
- var searchDict = {};
- searchDict[keyField || 'key'] = key;
- return _.findWhere(source, searchDict) || key;
- };
return r.issues.map(function (issue, index) {
- var component = find(r.components, issue.component),
- project = find(r.projects, issue.project),
- subProject = find(r.components, issue.subProject),
- rule = find(r.rules, issue.rule);
_.extend(issue, { index: index });
- if (component) {
- _.extend(issue, {
- componentUuid: component.uuid,
- componentLongName: component.longName,
- componentQualifier: component.qualifier
- });
- }
- if (project) {
- _.extend(issue, {
- projectLongName: project.longName,
- projectUuid: project.uuid
- });
- }
- if (subProject) {
- _.extend(issue, {
- subProjectLongName: subProject.longName,
- subProjectUuid: subProject.uuid
- });
- }
- if (rule) {
- _.extend(issue, {
- ruleName: rule.name
- });
- }
+ issue = that._injectRelational(issue, r.components, 'component', 'key');
+ issue = that._injectRelational(issue, r.components, 'project', 'key');
+ issue = that._injectRelational(issue, r.components, 'subProject', 'key');
+ issue = that._injectRelational(issue, r.rules, 'rule', 'key');
issue = that._injectRelational(issue, r.users, 'assignee', 'login');
issue = that._injectRelational(issue, r.users, 'reporter', 'login');
+ issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
return issue;
});
},
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
index 414570895ca..942e86e4ba7 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js
@@ -41,7 +41,7 @@ define([
if (projectFacet != null) {
var values = _.head(projectFacet.values, 3);
values.forEach(function (v) {
- var project = _.findWhere(r.projects, { uuid: v.val });
+ var project = _.findWhere(r.components, { uuid: v.val });
v.label = project.longName;
});
return values;
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 13c8a616dd1..248ec44971a 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
@@ -27,11 +27,6 @@ define([
parse: function (r) {
var that = this;
- function find (source, key, keyField) {
- var searchDict = {};
- searchDict[keyField || 'key'] = key;
- return _.findWhere(source, searchDict) || key;
- }
this.paging = {
p: r.p,
@@ -41,26 +36,13 @@ define([
};
return r.issues.map(function (issue) {
- var component = find(r.components, issue.component),
- project = find(r.projects, issue.project),
- rule = find(r.rules, issue.rule);
- if (component) {
- _.extend(issue, {
- componentLongName: component.longName,
- componentQualifier: component.qualifier
- });
- }
- if (project) {
- _.extend(issue, {
- projectLongName: project.longName,
- projectUuid: project.uuid
- });
- }
- if (rule) {
- _.extend(issue, { ruleName: rule.name });
- }
+ issue = that._injectRelational(issue, r.components, 'component', 'key');
+ issue = that._injectRelational(issue, r.components, 'project', 'key');
+ issue = that._injectRelational(issue, r.components, 'subProject', 'key');
+ issue = that._injectRelational(issue, r.rules, 'rule', 'key');
issue = that._injectRelational(issue, r.users, 'assignee', 'login');
issue = that._injectRelational(issue, r.users, 'reporter', 'login');
+ issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
return issue;
});
}
diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js
index 31ad3f3e5bf..4df45a2ea82 100644
--- a/server/sonar-web/src/main/js/components/issue/models/issue.js
+++ b/server/sonar-web/src/main/js/components/issue/models/issue.js
@@ -13,10 +13,13 @@ define(function () {
parse: function (r) {
if (r.issue) {
- var issue = this._injectRelational(r.issue, r.users, 'assignee', 'login');
- issue = this._injectRelational(issue, r.users, 'reporter', 'login');
- issue = this._injectRelational(issue, r.components, 'component', 'key');
+ var issue = this._injectRelational(r.issue, r.components, 'component', 'key');
issue = this._injectRelational(issue, r.components, 'project', 'key');
+ issue = this._injectRelational(issue, r.components, 'subProject', 'key');
+ issue = this._injectRelational(issue, r.rules, 'rule', 'key');
+ issue = this._injectRelational(issue, r.users, 'assignee', 'login');
+ issue = this._injectRelational(issue, r.users, 'reporter', 'login');
+ issue = this._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
return issue;
} else {
return r;
diff --git a/server/sonar-web/src/test/json/issues-spec/search-changed.json b/server/sonar-web/src/test/json/issues-spec/search-changed.json
index 7b1f3639b09..851daf3659f 100644
--- a/server/sonar-web/src/test/json/issues-spec/search-changed.json
+++ b/server/sonar-web/src/test/json/issues-spec/search-changed.json
@@ -2,24 +2,6 @@
"total": 4623,
"p": 1,
"ps": 50,
- "projects": [
- {
- "uuid": "015c6451-1709-4360-b4fa-e4508e13082d",
- "key": "org.codehaus.sonar-plugins.xml:xml",
- "id": 17156,
- "qualifier": "TRK",
- "name": "XML",
- "longName": "XML"
- },
- {
- "uuid": "071bdfec-a244-444d-877e-772a68973e18",
- "key": "com.sonarsource.plugins.vb:vb",
- "id": 28554,
- "qualifier": "TRK",
- "name": "SonarSource :: Visual Basic",
- "longName": "SonarSource :: Visual Basic"
- }
- ],
"components": [
{
"uuid": "367350ce-00c7-461b-8348-c64138515ef9",
diff --git a/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues-severities.json b/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues-severities.json
index 7d9399f428e..3e19d6807ad 100644
--- a/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues-severities.json
+++ b/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues-severities.json
@@ -9,16 +9,6 @@
"fTotal": "1",
"pages": 1
},
- "projects": [
- {
- "uuid": "69e57151-be0d-4157-adff-c06741d88879",
- "key": "org.codehaus.sonar:sonar",
- "id": 2865,
- "qualifier": "TRK",
- "name": "SonarQube",
- "longName": "SonarQube"
- }
- ],
"components": [
{
"uuid": "7feef7c3-11b9-4175-b5a7-527ca3c75cb7",
diff --git a/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues.json b/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues.json
index aaf6889b47b..43501b00118 100644
--- a/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues.json
+++ b/server/sonar-web/src/test/json/issues-spec/search-filter-similar-issues.json
@@ -9,16 +9,6 @@
"fTotal": "1",
"pages": 1
},
- "projects": [
- {
- "uuid": "69e57151-be0d-4157-adff-c06741d88879",
- "key": "org.codehaus.sonar:sonar",
- "id": 2865,
- "qualifier": "TRK",
- "name": "SonarQube",
- "longName": "SonarQube"
- }
- ],
"components": [
{
"uuid": "7feef7c3-11b9-4175-b5a7-527ca3c75cb7",
diff --git a/server/sonar-web/src/test/json/issues-spec/search-reopened.json b/server/sonar-web/src/test/json/issues-spec/search-reopened.json
index efd73bce04a..e0defa923fd 100644
--- a/server/sonar-web/src/test/json/issues-spec/search-reopened.json
+++ b/server/sonar-web/src/test/json/issues-spec/search-reopened.json
@@ -2,32 +2,6 @@
"total": 4,
"p": 1,
"ps": 50,
- "projects": [
- {
- "uuid": "06a742ea-5c55-4c7e-a2b4-8747c163cb40",
- "key": "org.codehaus.sonar-plugins:sonar-issues-report-plugin",
- "id": 17637,
- "qualifier": "TRK",
- "name": "Sonar :: Issues Report :: Plugin",
- "longName": "Sonar :: Issues Report :: Plugin"
- },
- {
- "uuid": "69e57151-be0d-4157-adff-c06741d88879",
- "key": "org.codehaus.sonar:sonar",
- "id": 2865,
- "qualifier": "TRK",
- "name": "SonarQube",
- "longName": "SonarQube"
- },
- {
- "uuid": "963cefe8-9128-475f-8d39-636685195e43",
- "key": "com.sonarsource.rpg:rpg",
- "id": 27165,
- "qualifier": "TRK",
- "name": "SonarSource :: RPG",
- "longName": "SonarSource :: RPG"
- }
- ],
"components": [
{
"uuid": "f62c3080-6e75-4940-ae95-7dae743bcac3",
diff --git a/server/sonar-web/src/test/json/issues-spec/search-with-tags.json b/server/sonar-web/src/test/json/issues-spec/search-with-tags.json
index 442b1de359a..101cd38fb6f 100644
--- a/server/sonar-web/src/test/json/issues-spec/search-with-tags.json
+++ b/server/sonar-web/src/test/json/issues-spec/search-with-tags.json
@@ -2,16 +2,6 @@
"total": 1,
"p": 1,
"ps": 50,
- "projects": [
- {
- "uuid": "015c6451-1709-4360-b4fa-e4508e13082d",
- "key": "org.codehaus.sonar-plugins.xml:xml",
- "id": 17156,
- "qualifier": "TRK",
- "name": "XML",
- "longName": "XML"
- }
- ],
"components": [
{
"uuid": "639e257b-d3fb-4d10-b94a-31079b71532d",
diff --git a/server/sonar-web/src/test/json/issues-spec/search.json b/server/sonar-web/src/test/json/issues-spec/search.json
index 3dbc631468b..eb66a695d5a 100644
--- a/server/sonar-web/src/test/json/issues-spec/search.json
+++ b/server/sonar-web/src/test/json/issues-spec/search.json
@@ -2,24 +2,6 @@
"total": 4623,
"p": 1,
"ps": 50,
- "projects": [
- {
- "uuid": "015c6451-1709-4360-b4fa-e4508e13082d",
- "key": "org.codehaus.sonar-plugins.xml:xml",
- "id": 17156,
- "qualifier": "TRK",
- "name": "XML",
- "longName": "XML"
- },
- {
- "uuid": "071bdfec-a244-444d-877e-772a68973e18",
- "key": "com.sonarsource.plugins.vb:vb",
- "id": 28554,
- "qualifier": "TRK",
- "name": "SonarSource :: Visual Basic",
- "longName": "SonarSource :: Visual Basic"
- }
- ],
"components": [
{
"uuid": "367350ce-00c7-461b-8348-c64138515ef9",
diff --git a/server/sonar-web/src/test/json/issues-spec/show-with-tags.json b/server/sonar-web/src/test/json/issues-spec/show-with-tags.json
index 6eb9475a066..273f4079bdb 100644
--- a/server/sonar-web/src/test/json/issues-spec/show-with-tags.json
+++ b/server/sonar-web/src/test/json/issues-spec/show-with-tags.json
@@ -19,7 +19,7 @@
"plan",
"set_severity"
],
- "tags": ["security", "cwe"]
+ "tags": ["security", "cwe"],
"transitions": [
"unconfirm",
"resolve",