aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-11-06 12:24:44 +0100
committerStas Vilchik <vilchiks@gmail.com>2014-11-06 12:24:52 +0100
commit6deae83daebb117e8ae49b58c72fb0ce8d0043b7 (patch)
tree56d52e5f48b6f0bb2996175b38dc8302c7d8c54c
parentb7e3c205a224d06c418f1975693df36867684091 (diff)
downloadsonarqube-6deae83daebb117e8ae49b58c72fb0ce8d0043b7.tar.gz
sonarqube-6deae83daebb117e8ae49b58c72fb0ce8d0043b7.zip
SONAR-5718 Add module criteria, update widgets
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb12
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb6
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb6
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb6
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb6
-rw-r--r--server/sonar-web/src/main/coffee/issues/controller.coffee4
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets-view.coffee3
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets/module-facet.coffee39
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb7
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
10 files changed, 82 insertions, 8 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb
index dab39e4846f..18fe4e3c186 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb
@@ -67,7 +67,17 @@
<% if unresolved_issues_size == 0 %>
<%= unresolved_issues_size -%>
<% else %>
- <a href="<%= url_for_issues({:actionPlans => plan.key, :resolved => 'false', :componentRoots => u(@project.key)}) -%>"
+ <%
+ search_options = {}
+ search_options['actionPlans'] = plan.key
+ search_options['resolved'] = false
+ if @project.qualifier == 'TRK'
+ search_options['projectUuids'] = @project.uuid
+ else
+ search_options['componentRootUuids'] = @project.uuid
+ end
+ %>
+ <a href="<%= url_for_issues(search_options) -%>"
title="<%= message('widget.action_plans.x_unresolved_issues', :params => unresolved_issues_size.to_s) -%>"><%= unresolved_issues_size -%></a>
<% end %>
</td>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb
index cf6c4661fcc..0a33fb66901 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb
@@ -2,7 +2,11 @@
if has_role?(:user, @project)
search_options = {}
- search_options['componentRoots'] = @project.key
+ if @project.qualifier == 'TRK'
+ search_options['projectUuids'] = @project.uuid
+ else
+ search_options['componentRootUuids'] = @project.uuid
+ end
search_options['resolutions'] = 'FALSE-POSITIVE'
title = message('widget.false_positive_reviews.name')
%>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb
index 8dd860ff7ac..5cf9c869f61 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb
@@ -2,7 +2,11 @@
if current_user && (!@project || has_role?(:user, @project))
search_options = {}
- search_options['projectUuids'] = @project.uuid if @project
+ if @project.qualifier == 'TRK'
+ search_options['projectUuids'] = @project.uuid
+ else
+ search_options['componentRootUuids'] = @project.uuid
+ end
search_options['resolved'] = 'false'
search_options['assignees'] = current_user.login
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb
index f7b61a024b3..bfae944e337 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb
@@ -1,7 +1,11 @@
<%
options = {}
options['resolved'] = 'false'
- options['projectUuids'] = @project.uuid
+ if @project.qualifier == 'TRK'
+ options['projectUuids'] = @project.uuid
+ else
+ options['componentRootUuids'] = @project.uuid
+ end
if @dashboard_configuration.selected_period?
options['createdAfter'] = Api::Utils.format_datetime(@dashboard_configuration.from_datetime)
options['createdBefore'] = Api::Utils.format_datetime(DateTime.now)
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb
index 0cd1a8d10ee..f620dcbe4e9 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb
@@ -6,7 +6,11 @@
issues_search_options = {}
issues_search_options['resolved'] = 'false'
- issues_search_options['projectUuids'] = @project.uuid
+ if @project.qualifier == 'TRK'
+ issues_search_options['projectUuids'] = @project.uuid
+ else
+ issues_search_options['componentRootUuids'] = @project.uuid
+ end
%>
<table width="100%">
<tr>
diff --git a/server/sonar-web/src/main/coffee/issues/controller.coffee b/server/sonar-web/src/main/coffee/issues/controller.coffee
index d98bda0b9dc..e7855174cc7 100644
--- a/server/sonar-web/src/main/coffee/issues/controller.coffee
+++ b/server/sonar-web/src/main/coffee/issues/controller.coffee
@@ -13,8 +13,8 @@ define [
$ = jQuery
EXTRA_FIELDS = 'actions,transitions,assigneeName,reporterName,actionPlanName'
PAGE_SIZE = 50
- ALL_FACETS = ['severities', 'statuses', 'resolutions', 'projectUuids', 'assignees', 'reporters', 'rules',
- 'languages', 'actionPlans', 'componentUuids', 'creationDate']
+ ALL_FACETS = ['severities', 'statuses', 'resolutions', 'projectUuids', 'componentRootUuids', 'componentUuids', 'assignees', 'reporters', 'rules',
+ 'languages', 'actionPlans', 'creationDate']
FACET_DATA_FIELDS = ['components', 'projects', 'users', 'rules', 'actionPlans', 'languages']
FACETS_FROM_SERVER = ['severities', 'statuses', 'resolutions', 'actionPlans', 'projectUuids', 'rules',
'assignees', 'reporters', 'componentUuids', 'languages']
diff --git a/server/sonar-web/src/main/coffee/issues/facets-view.coffee b/server/sonar-web/src/main/coffee/issues/facets-view.coffee
index 6ffd106f947..9ebd69988de 100644
--- a/server/sonar-web/src/main/coffee/issues/facets-view.coffee
+++ b/server/sonar-web/src/main/coffee/issues/facets-view.coffee
@@ -5,6 +5,7 @@ define [
'issues/facets/severity-facet'
'issues/facets/status-facet'
'issues/facets/project-facet'
+ 'issues/facets/module-facet'
'issues/facets/assignee-facet'
'issues/facets/rule-facet'
'issues/facets/resolution-facet'
@@ -19,6 +20,7 @@ define [
SeverityFacet
StatusFacet
ProjectFacet
+ ModuleFacet
AssigneeFacet
RuleFacet
ResolutionFacet
@@ -41,6 +43,7 @@ define [
when 'resolutions' then ResolutionFacet
when 'creationDate' then CreationDateFacet
when 'projectUuids' then ProjectFacet
+ when 'componentRootUuids' then ModuleFacet
when 'rules' then RuleFacet
when 'actionPlans' then ActionPlanFacet
when 'componentUuids' then ComponentFacet
diff --git a/server/sonar-web/src/main/coffee/issues/facets/module-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/module-facet.coffee
new file mode 100644
index 00000000000..66d1a9ea1e8
--- /dev/null
+++ b/server/sonar-web/src/main/coffee/issues/facets/module-facet.coffee
@@ -0,0 +1,39 @@
+define [
+ 'issues/facets/custom-values-facet'
+], (
+ CustomValuesFacet
+) ->
+
+
+ class extends CustomValuesFacet
+
+ getUrl: ->
+ "#{baseUrl}/api/resources/search?f=s2&q=BRC&display_uuid=true"
+
+
+ getValues: ->
+ componentRoots = @options.app.state.get('query').componentRootUuids
+ componentRoots = '' unless typeof componentRoots == typeof ''
+ if componentRoots.length > 0
+ componentRoots = componentRoots.split ','
+ componentRoots.map (c) ->
+ { val: c, count: null }
+ else []
+
+
+ getValuesWithLabels: ->
+ values = @getValues()
+ components = @options.app.facets.components
+ values.forEach (v) =>
+ uuid = v.val
+ label = uuid
+ if uuid
+ component = _.findWhere components, uuid: uuid
+ label = component.longName if component?
+ v.label = label
+ values
+
+
+ serializeData: ->
+ _.extend super,
+ values: @getValuesWithLabels()
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb
index 590e0a24ece..1df18ad0fdc 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb
@@ -2,7 +2,12 @@
unless action_plan.totalIssues()==0
project = @project
project = @resource if project.nil?
- options = {:actionPlans => action_plan.key, :componentRoots => u(project.key)}
+ options = {:actionPlans => action_plan.key}
+ if @project.qualifier == 'TRK'
+ options['projectUuids'] = @project.uuid
+ else
+ options['componentRootUuids'] = @project.uuid
+ end
resolved_issues_link = action_plan.resolvedIssues().to_s
resolved_issues_link = link_to action_plan.resolvedIssues().to_s, url_for_issues(options.merge(:resolved => 'true')) unless action_plan.resolvedIssues()==0
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index b1f1549dbf0..6305917cf8c 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -779,6 +779,7 @@ issues.facet.statuses=Status
issues.facet.actionPlans=Action Plan
issues.facet.assignees=Assignee
issues.facet.componentUuids=File
+issues.facet.componentRootUuids=Module
issues.facet.rules=Rule
issues.facet.resolutions=Resolution
issues.facet.languages=Language