From: Julien Lancelot Date: Wed, 22 May 2013 14:26:23 +0000 (+0200) Subject: SONAR-4301 Display message and disable sort when issues results are higher than max... X-Git-Tag: 3.6~307 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe28ee821c1a09fed5ff31c32d28f6c234048d78;p=sonarqube.git SONAR-4301 Display message and disable sort when issues results are higher than max results authorized --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 6539383d1b6..c61d5133dbf 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -577,6 +577,7 @@ issue_filter.criteria.reporter=Reporter issue_filter.criteria.created_after=Created since issue_filter.criteria.created_before=Created before issue_filter.criteria.date_format=year-month-day (2013-01-31) +issue_filter.max_results_reached=Number of results are higher than {0}. Sort won't be available. #------------------------------------------------------------------------------ diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java index ed15bef6208..9d0727892ab 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java @@ -125,6 +125,8 @@ public class IssueDao implements BatchComponent, ServerComponent { IssueDto issueDto = (IssueDto) context.getResultObject(); if (authorizedRootProjectIds.contains(issueDto.getProjectId())) { issues.add(issueDto); + } else { + // reject because user not authorized } if (issues.size() >= maxResults) { context.stop(); diff --git a/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java b/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java index 1ce627cc59f..3736a6e3f49 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/DefaultIssueFinder.java @@ -156,7 +156,7 @@ public class DefaultIssueFinder implements IssueFinder { findUsers(users), paging, false, - authorizedIssues.size() != query.maxResults() + authorizedIssues.size() >= query.maxResults() // TODO // authorizedIssues.size() != allIssues.size() ); diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb index be7e09a7489..c954e70c7e3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb @@ -32,7 +32,7 @@ class IssuesController < ApplicationController @filter.criteria=criteria_params @filter.execute - @selected_project = @filter.issues_result.projects.first if !@filter.issues.isEmpty() && @filter.criteria('componentRoots') + @selected_project = @filter.issues_result.projects.first if @filter.issues && @filter.criteria('componentRoots') end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/issues_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/issues_helper.rb index fe629dc62da..fab4c9a0457 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/issues_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/issues_helper.rb @@ -22,9 +22,13 @@ module IssuesHelper def column_html(filter, column_label, column_tooltip, sort) filter_sort = filter.criteria[:sort] filter_asc = filter.criteria[:asc] == 'true' ? true : false - html = link_to_function(h(column_label), "refreshList('#{escape_javascript sort}',#{!filter_asc}, #{filter.criteria[:page]||1})", :title => h(column_tooltip)) - if sort == filter_sort - html << (filter_asc ? image_tag("asc12.png") : image_tag("desc12.png")) + if !filter.issues_result.maxResultsReached() + html = link_to_function(h(column_label), "refreshList('#{escape_javascript sort}',#{!filter_asc}, #{filter.criteria[:page]||1})", :title => h(column_tooltip)) + if sort == filter_sort + html << (filter_asc ? image_tag("asc12.png") : image_tag("desc12.png")) + end + else + html = h(column_label) end html end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb index 6cbf06e1571..379b85ba322 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb @@ -19,7 +19,7 @@ <% if @filter.issues && !@filter.issues.empty? - colspan = 8 + colspan = 9 %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb index ffc32f12e80..5c2e114c51a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb @@ -7,10 +7,14 @@
- <% if @filter.issues_result && @filter.issues_result.securityExclusions() %> -

<%= message('results_not_display_due_to_security') -%>

+ <% if @filter.issues_result %> + <% if @filter.issues_result.securityExclusions() %> +

<%= message('results_not_display_due_to_security') -%>

+ <% end %> + <% if @filter.issues_result.maxResultsReached() %> +

<%= message('issue_filter.max_results_reached', :params => @filter.paging.total()) -%>

+ <% end %> <% end %> - <%= render :partial => 'list' -%>