aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-03 16:23:05 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-03-04 13:09:21 +0100
commit29bc3c690a0d29d157042477ead84b5abeda3a1d (patch)
treece66362782d20ad41d5e61cdd8831a99af28a3ed /plugins
parentb4b22ba0850e889e4087f2e58f530848d2484474 (diff)
downloadsonarqube-29bc3c690a0d29d157042477ead84b5abeda3a1d.tar.gz
sonarqube-29bc3c690a0d29d157042477ead84b5abeda3a1d.zip
SONAR-5726 add global issue filter widget
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java6
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb49
2 files changed, 35 insertions, 20 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java
index a8baf1053ac..f02fda9677d 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java
@@ -28,13 +28,15 @@ import static org.sonar.api.web.WidgetScope.GLOBAL;
@WidgetScope(GLOBAL)
@WidgetProperties({
@WidgetProperty(key = IssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
- @WidgetProperty(key = IssueFilterWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30"),
+ @WidgetProperty(key = IssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
+ options = {"severities", "resolutions", "statuses", "rules", "tags", "projectUuids", "assignees", "reporters",
+ "authors", "languages", "actionPlans", "createdAt"}),
@WidgetProperty(key = IssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
})
public class IssueFilterWidget extends CoreWidget {
public static final String FILTER_PROPERTY = "filter";
- public static final String PAGE_SIZE_PROPERTY = "numberOfLines";
+ public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
public static final String ID = "issue_filter";
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb
index 9f0dfa07851..0836a22ad9d 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb
@@ -1,25 +1,38 @@
<%
+ container_id = 'widget-issue-filter-' + widget.id.to_s
filter_id = widget_properties['filter']
filter = Internal.issues.findIssueFilterById(filter_id.to_i)
- if filter
- if Internal.issues.isUserAuthorized(filter)
- search_options = {}
- search_options['filter'] = filter_id
- @widget_title = link_to h(filter.name), {:controller => 'issues', :action => 'filter', :id => filter.id}
+ distribution_axis = widget_properties['distributionAxis']
%>
+
+<% if filter %>
+ <% if Internal.issues.isUserAuthorized(filter) %>
+
+ <% @widget_title = "<a href=\"#{url_for({:controller => 'issues', :action => 'index'})}#id=#{filter.id}\">#{h(filter.name)}</a>" %>
<% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
- <div style="padding-bottom: 5px">
- <span class="note"><%= h filter.description -%></span>
- </div>
+ <p class="note spacer-bottom"><%= h filter.description -%></p>
<% end %>
- <%= render :partial => 'project/widgets/issues/issues_list_widget',
- :locals => {:search_options => search_options, :widget_id => widget.id.to_s, :widget_properties => widget_properties} %>
- <%
- end
- else
- %>
- <p><%= image_tag 'warning.png' %> <%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
-<%
- end
-%>
+ <div id="<%= container_id -%>"></div>
+ <script>
+ require(['widgets/issue-filter'], function (IssueFilter) {
+ window.requestMessages().done(function () {
+ new IssueFilter({
+ el: '#<%= container_id -%>',
+ query: '<%= filter.data -%>',
+ distributionAxis: '<%= distribution_axis -%>'
+ });
+ });
+ });
+ </script>
+
+ <% else %>
+
+ <p class="message-alert"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
+
+ <% end %>
+<% else %>
+
+ <p class="message-alert"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
+
+<% end %>