From 8338c86d2fc5d50f2058d1fc00b536c821c263c8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 7 Jan 2015 17:34:55 +0100 Subject: [PATCH] SONAR-5893 Add component tag cloud widget --- .../org/sonar/plugins/core/CorePlugin.java | 2 + .../widgets/issues/IssueTagCloudWidget.java | 42 ++++++++++++++++++ .../widgets/issues/issue_tag_cloud.html.erb | 44 +++++++++++++++++++ .../resources/org/sonar/l10n/core.properties | 5 +++ 4 files changed, 93 insertions(+) create mode 100644 plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java create mode 100644 plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb 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 9b996f16161..f15d9ba34e2 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 @@ -98,6 +98,7 @@ import org.sonar.plugins.core.widgets.WelcomeWidget; import org.sonar.plugins.core.widgets.issues.ActionPlansWidget; import org.sonar.plugins.core.widgets.issues.FalsePositiveIssuesWidget; import org.sonar.plugins.core.widgets.issues.IssueFilterWidget; +import org.sonar.plugins.core.widgets.issues.IssueTagCloudWidget; import org.sonar.plugins.core.widgets.issues.IssuesWidget; import org.sonar.plugins.core.widgets.issues.MyUnresolvedIssuesWidget; import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesPerAssigneeWidget; @@ -343,6 +344,7 @@ public final class CorePlugin extends SonarPlugin { UnresolvedIssuesPerAssigneeWidget.class, UnresolvedIssuesStatusesWidget.class, IssueFilterWidget.class, + IssueTagCloudWidget.class, org.sonar.api.issue.NoSonarFilter.class, // issue notifications diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java new file mode 100644 index 00000000000..cba0aa3f835 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java @@ -0,0 +1,42 @@ +/* + * 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.api.web.WidgetScope; +import org.sonar.plugins.core.widgets.CoreWidget; + +import static org.sonar.api.web.WidgetScope.PROJECT; + +@WidgetCategory({"Issues"}) +@WidgetScope(PROJECT) +@WidgetProperties({ + @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100") +}) +public class IssueTagCloudWidget extends CoreWidget { + + public IssueTagCloudWidget() { + super("issue_tag_cloud", "Issue Tag Cloud", "/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb"); + } + +} diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb new file mode 100644 index 00000000000..871b6b69db4 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb @@ -0,0 +1,44 @@ +<% + containerId = 'issue-tag-cloud' + widget.id.to_s + maxItems = widget_properties['maxItems'].to_i + + if current_user && has_role?(:user, @project) + search_options = {} + if @project + search_options['componentUuids'] = @project.uuid + end + search_options['resolved'] = 'false' + + title = message('widget.issue_tag_cloud.name') +%> + +
+ +
+ + + + +<% end %> 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 764a0571b11..23eef2e3bd0 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1296,6 +1296,11 @@ widget.issue_filter.property.numberOfLines.name=Page size widget.issue_filter.property.displayFilterDescription.name=Display Filter Description widget.issue_filter.unknown_filter_warning=This widget is configured to display an issue filter that doesn't exist anymore. +widget.issue_tag_cloud.name=Issue Tag Cloud +widget.issue_tag_cloud.description=Displays the cloud of tags associated to unresolved issues. +widget.issue_tag_cloud.property.maxItems.name=Max Tags +widget.issue_tag_cloud.property.maxItems.desc=Maximum number of tags to show + widget.treemap-widget.name=Treemap of Components widget.treemap-widget.description=Displays a treemap of all direct components of the selected resource. widget.treemap-widget.property.sizeMetric.name=Size Metric -- 2.39.5