aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-01 14:11:16 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-02 15:27:04 +0200
commitc7e2e99344f9ac49cd664a85193a260bdc37599e (patch)
treef3b3fdc652ed4f2c4ffee9e3048598d24cbe9214 /plugins/sonar-core-plugin
parent7b8464adf1bc41765efe1f582e7fef3ee7d9af48 (diff)
downloadsonarqube-c7e2e99344f9ac49cd664a85193a260bdc37599e.tar.gz
sonarqube-c7e2e99344f9ac49cd664a85193a260bdc37599e.zip
SONAR-5603 Get issues from E/S in Unresolved Issues per Assignee widget
Conflicts: server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexMediumTest.java
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb47
2 files changed, 22 insertions, 27 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java
index a8f8e8d41e6..2067c798b99 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java
@@ -25,6 +25,6 @@ import org.sonar.plugins.core.widgets.CoreWidget;
@WidgetCategory({"Issues"})
public class UnresolvedIssuesPerAssigneeWidget extends CoreWidget {
public UnresolvedIssuesPerAssigneeWidget() {
- super("reviews_per_developer", "Unresolved issues per assignee", "/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb");
+ super("reviews_per_developer", "Unresolved issues per assignee", "/Users/julienlancelot/Dev/Sources/sonarqube/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb");
}
}
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 5e1cadae3d9..fec0255334f 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,4 +1,4 @@
-<%
+<%
options = {}
options['resolved'] = 'false'
options['componentRoots'] = @project.key
@@ -6,35 +6,29 @@
options['createdAfter'] = Api::Utils.format_datetime(@dashboard_configuration.from_datetime)
options['createdBefore'] = Api::Utils.format_datetime(DateTime.now)
end
- results = Internal.issues.findIssueAssignees(options)
- assignees = results.results
+ issues_by_assignee = Internal.issues.findIssueAssignees(options)
- unless assignees.empty?
- issues_by_assignee = {}
- counter_no_assignee = 0
- assignees.each do |assignee|
- if assignee
- counter = issues_by_assignee[assignee]
- if counter
- issues_by_assignee[assignee] = counter+1
- else
- issues_by_assignee[assignee] = 1
- end
- else
- counter_no_assignee += 1
- end
+ unless issues_by_assignee.empty?
+ users = Internal.users_api.find({'logins', issues_by_assignee.keySet()})
+ users_by_login = {}
+ users.each do |u|
+ users_by_login[u.login()] = u
end
+
+ # puts "### " + users_by_login.inspect
+
+ counter_no_assignee = issues_by_assignee.get(nil)
counter_max = 0
- counter_max = issues_by_assignee.values.max unless issues_by_assignee.empty?
+ counter_max = issues_by_assignee.values().max unless issues_by_assignee.empty?
counter_max = counter_no_assignee if counter_no_assignee > counter_max
-
+
div_id = "unresolved-issues-per-assignee-widget-#{widget.id.to_s}"
end
%>
<h3><%= message('widget.reviews_per_developer.name') -%></h3>
-<% if assignees.size ==0 %>
+<% if issues_by_assignee.size ==0 %>
<span class="empty_widget"><%= message('issue_filter.no_issues') -%></span>
<% else %>
@@ -49,11 +43,12 @@
</thead>
<tbody>
<%
- issues_by_assignee.sort{|h1,h2| h2[1] <=> h1[1]}.each do |assignee, count|
+ issues_by_assignee.each do |assignee, count|
+ if assignee
%>
<tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
<td class="max-width">
- <%= link_to results.user(assignee).name, url_for_issues(options.merge(:assignees => assignee)) -%>
+ <%= link_to users_by_login[assignee].name(), url_for_issues(options.merge(:assignees => assignee)) -%>
</td>
<td class="nowrap">
<%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%>
@@ -65,9 +60,8 @@
<% end %>
</tr>
<%
- end
- # And now show the unassigned issues counter
- unless counter_no_assignee==0
+ # And now show the unassigned issues counter
+ else
%>
<tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
<td class="max-width">
@@ -82,7 +76,8 @@
</td>
<% end %>
</tr>
- <% end %>
+ <% end
+ end %>
</tbody>
</table>