aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-05 14:25:49 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-03-05 14:25:49 +0100
commit8c4a3e08e10af7e82d9b3d1ebb461e87584bd17e (patch)
tree55d24b909393ad5d2566567b433b6528d984971a /plugins
parentd994dc9554266f57bf2f5f3bf8d3bce7e6cbb6ec (diff)
downloadsonarqube-8c4a3e08e10af7e82d9b3d1ebb461e87584bd17e.tar.gz
sonarqube-8c4a3e08e10af7e82d9b3d1ebb461e87584bd17e.zip
SONAR-6136 remove hardcoded Issues widgets
- Unresolved Issues by status - Unresolved Issues by assignee - False Positive Issues - My Unresolved Issues
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java4
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java8
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/FalsePositiveIssuesWidget.java36
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/MyUnresolvedIssuesWidget.java36
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java30
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesStatusesWidget.java30
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb14
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb18
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb84
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb58
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java2
11 files changed, 1 insertions, 319 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index 5edf693e8b6..fb064dc3486 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -256,11 +256,7 @@ public final class CorePlugin extends SonarPlugin {
// issues
CountUnresolvedIssuesDecorator.class,
CountFalsePositivesDecorator.class,
- MyUnresolvedIssuesWidget.class,
- FalsePositiveIssuesWidget.class,
ActionPlansWidget.class,
- UnresolvedIssuesPerAssigneeWidget.class,
- UnresolvedIssuesStatusesWidget.class,
IssueFilterWidget.class,
ProjectIssueFilterWidget.class,
IssueTagCloudWidget.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java
index 7eb982f3b07..1e7771eafb4 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java
@@ -40,19 +40,11 @@ public final class ProjectIssuesDashboard extends DashboardTemplate {
Dashboard dashboard = Dashboard.create();
dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
addFirstColumn(dashboard);
- addSecondColumn(dashboard);
return dashboard;
}
private void addFirstColumn(Dashboard dashboard) {
- dashboard.addWidget("unresolved_issues_statuses", 1);
dashboard.addWidget("action_plans", 1);
}
- private void addSecondColumn(Dashboard dashboard) {
- dashboard.addWidget("reviews_per_developer", 2);
- dashboard.addWidget("my_reviews", 2);
- dashboard.addWidget("false_positive_reviews", 2);
- }
-
}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/FalsePositiveIssuesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/FalsePositiveIssuesWidget.java
deleted file mode 100644
index a37203aef67..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/FalsePositiveIssuesWidget.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets.issues;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-@WidgetCategory({"Issues"})
-@WidgetProperties({
- @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5")
-})
-public class FalsePositiveIssuesWidget extends CoreWidget {
- public FalsePositiveIssuesWidget() {
- super("false_positive_reviews", "False positive open issues", "/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb");
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/MyUnresolvedIssuesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/MyUnresolvedIssuesWidget.java
deleted file mode 100644
index 5c212aee71f..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/MyUnresolvedIssuesWidget.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets.issues;
-
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Issues"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
- @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5")
-})
-public class MyUnresolvedIssuesWidget extends CoreWidget {
- public MyUnresolvedIssuesWidget() {
- super("my_reviews", "My unresolved issues", "/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb");
- }
-}
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
deleted file mode 100644
index a8f8e8d41e6..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets.issues;
-
-import org.sonar.api.web.WidgetCategory;
-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");
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesStatusesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesStatusesWidget.java
deleted file mode 100644
index d2ac0d22aa0..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesStatusesWidget.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets.issues;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-@WidgetCategory({"Issues"})
-public class UnresolvedIssuesStatusesWidget extends CoreWidget {
- public UnresolvedIssuesStatusesWidget() {
- super("unresolved_issues_statuses", "Unresolved issues by status", "/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb");
- }
-}
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
deleted file mode 100644
index bd32fb74fb9..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/false_positive_issues.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-<%
- if has_role?(:user, @project)
-
- search_options = {}
- search_options['componentUuids'] = @project.uuid
- search_options['resolutions'] = 'FALSE-POSITIVE'
- title = message('widget.false_positive_reviews.name')
-%>
-
- <%= render :partial => 'project/widgets/issues/issues_list_widget',
- :locals => {:search_options => search_options, :title => title,
- :widget_id => widget.id.to_s, :widget_properties => widget_properties} %>
-
-<% end %>
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
deleted file mode 100644
index c73cefa4d44..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/my_unresolved_issues.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%
- if current_user && (!@project || has_role?(:user, @project))
-
- search_options = {}
- if @project
- search_options['componentUuids'] = @project.uuid
- end
- search_options['resolved'] = 'false'
- search_options['assignees'] = current_user.login
-
- title = message('widget.my_reviews.name')
-%>
-
- <%= render :partial => 'project/widgets/issues/issues_list_widget',
- :locals => {:search_options => search_options, :title => title,
- :widget_id => widget.id.to_s, :widget_properties => widget_properties} %>
-
-<% end %>
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
deleted file mode 100644
index 1dcab1fbeae..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb
+++ /dev/null
@@ -1,84 +0,0 @@
-<%
- options = {}
- options['resolved'] = 'false'
- options['componentUuids'] = @project.uuid
- if @dashboard_configuration.selected_period?
- options['createdAfter'] = Api::Utils.format_datetime(@dashboard_configuration.from_datetime)
- options['createdBefore'] = Api::Utils.format_datetime(DateTime.now)
- end
- issues_by_assignee = Internal.issues.findIssueAssignees(options)
-
- unless issues_by_assignee.empty?
- users = Internal.users_api.find({'logins', issues_by_assignee.keySet(), 'includeDeactivated', true})
- users_by_login = {}
- users.each do |u|
- users_by_login[u.login()] = u
- end
-
- 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 = 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 issues_by_assignee.size ==0 %>
- <span class="empty_widget"><%= message('issue_filter.no_issues') -%></span>
-
-<% else %>
-<div id="<%= div_id -%>">
-
- <table class="data width100">
- <thead>
- <tr>
- <th coslpan="3">
- </th>
- </tr>
- </thead>
- <tbody>
- <%
- issues_by_assignee.each do |assignee, count|
- if assignee
- %>
- <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
- <td class="max-width">
- <%= link_to users_by_login[assignee].name(), url_for_component_issues(@project, options.merge(:assignees => assignee)) -%>
- </td>
- <td class="nowrap">
- <%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%>
- </td>
- <% if counter_max > 0 %>
- <td>
- <%= barchart(:width => 100, :percent => (100 * count / counter_max).to_i) %>
- </td>
- <% end %>
- </tr>
- <%
- # And now show the unassigned issues counter
- else
- %>
- <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
- <td class="max-width">
- <%= link_to message('widget.reviews_per_developer.not_assigned'), url_for_component_issues(@project, options.merge(:assigned => 'false')) -%>
- </td>
- <td class="nowrap">
- <%= '+' if @dashboard_configuration.selected_period? -%><%= counter_no_assignee.to_s -%>
- </td>
- <% if counter_max > 0 %>
- <td>
- <%= barchart(:width => 100, :percent => (100 * counter_no_assignee / counter_max).to_i) %>
- </td>
- <% end %>
- </tr>
- <% end
- end %>
- </tbody>
- </table>
-
-</div>
-
-<% end %>
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
deleted file mode 100644
index 782472f4575..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_statuses.html.erb
+++ /dev/null
@@ -1,58 +0,0 @@
-<%
- issues = @snapshot.measure('violations')
- open_issues = @snapshot.measure('open_issues')
- reopened_issues = @snapshot.measure('reopened_issues')
- confirmed_issues = @snapshot.measure('confirmed_issues')
-
- issues_search_options = {}
- issues_search_options['resolved'] = 'false'
- issues_search_options['componentUuids'] = @project.uuid
-%>
-<table width="100%">
- <tr>
- <td valign="top" width="25%">
- <div class="dashbox">
- <h3><%= message('issues') -%></h3>
- <div class="marginbottom10">
- <span class="big">
- <%= format_measure(issues, :url => url_for_component_issues(@project, issues_search_options)) -%>
- </span>
- <%= dashboard_configuration.selected_period? ? format_variation(issues) : trend_icon(issues) -%>
- </div>
- </div>
- </td>
- <td valign="top" width="25%">
- <div class="dashbox">
- <h3><%= message('issue.status.OPEN') -%></h3>
- <div class="marginbottom10">
- <span class="big">
- <%= format_measure(open_issues, :url => url_for_component_issues(@project, issues_search_options.merge(:statuses => 'OPEN'))) -%>
- </span>
- <%= dashboard_configuration.selected_period? ? format_variation(open_issues) : trend_icon(open_issues) -%>
- </div>
- </div>
- </td>
- <td valign="top" width="25%">
- <div class="dashbox">
- <h3><%= message('issue.status.REOPENED') -%></h3>
- <div class="marginbottom10">
- <span class="big">
- <%= format_measure(reopened_issues, :url => url_for_component_issues(@project, issues_search_options.merge(:statuses => 'REOPENED'))) -%>
- </span>
- <%= dashboard_configuration.selected_period? ? format_variation(reopened_issues) : trend_icon(reopened_issues) -%>
- </div>
- </div>
- </td>
- <td valign="top" width="25%">
- <div class="dashbox">
- <h3><%= message('issue.status.CONFIRMED') -%></h3>
- <div class="marginbottom10">
- <span class="big">
- <%= format_measure(confirmed_issues, :url => url_for_component_issues(@project, issues_search_options.merge(:statuses => 'CONFIRMED'))) -%>
- </span>
- <%= dashboard_configuration.selected_period? ? format_variation(confirmed_issues) : trend_icon(confirmed_issues) -%>
- </div>
- </div>
- </td>
- </tr>
-</table>
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java
index 364c0d8f1df..7aa7d11bae0 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java
@@ -46,7 +46,7 @@ public class ProjectIssuesDashboardTest {
Dashboard dashboard = template.createDashboard();
assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
- assertThat(dashboard.getWidgets()).hasSize(5);
+ assertThat(dashboard.getWidgets()).hasSize(1);
}
}