From: Fabrice Bellingard Date: Fri, 13 Jan 2012 11:16:16 +0000 (+0100) Subject: SONAR-3166 Provide by default a new "Reviews" page X-Git-Tag: 2.14~320 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5a5dd47664de293a1f31743fed7c14e4f649b72e;p=sonarqube.git SONAR-3166 Provide by default a new "Reviews" page --- 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 24319ea90df..0b78dedc83c 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 @@ -36,6 +36,7 @@ import org.sonar.plugins.core.charts.XradarChart; import org.sonar.plugins.core.colorizers.JavaColorizerFormat; import org.sonar.plugins.core.dashboards.HotspotsDashboard; import org.sonar.plugins.core.dashboards.DefaultDashboard; +import org.sonar.plugins.core.dashboards.ReviewsDashboard; import org.sonar.plugins.core.metrics.UserManagedMetrics; import org.sonar.plugins.core.security.ApplyProjectRolesDecorator; import org.sonar.plugins.core.sensors.*; @@ -254,6 +255,7 @@ public class CorePlugin extends SonarPlugin { // dashboards extensions.add(DefaultDashboard.class); extensions.add(HotspotsDashboard.class); + extensions.add(ReviewsDashboard.class); // chart extensions.add(XradarChart.class); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ReviewsDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ReviewsDashboard.java new file mode 100644 index 00000000000..7e7ff6eff0a --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ReviewsDashboard.java @@ -0,0 +1,61 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.core.dashboards; + +import org.sonar.api.web.Dashboard; +import org.sonar.api.web.DashboardLayout; +import org.sonar.api.web.DashboardTemplate; + +/** + * Reviews dashboard for Sonar + * + * @since 2.14 + */ +public final class ReviewsDashboard extends DashboardTemplate { + + @Override + public String getName() { + return "Reviews"; + } + + @Override + public Dashboard createDashboard() { + Dashboard dashboard = Dashboard.create(); + dashboard.setLayout(DashboardLayout.TWO_COLUMNS); + addFirstColumn(dashboard); + addSecondColumn(dashboard); + return dashboard; + } + + private void addFirstColumn(Dashboard dashboard) { + dashboard.addWidget("reviews_metrics", 1); + dashboard.addWidget("action_plans", 1); + dashboard.addWidget("planned_reviews", 1); + dashboard.addWidget("unplanned_reviews", 1); + } + + private void addSecondColumn(Dashboard dashboard) { + dashboard.addWidget("false_positive_reviews", 2); + dashboard.addWidget("reviews_per_developer", 2); + dashboard.addWidget("my_reviews", 2); + dashboard.addWidget("project_reviews", 2); + } + +} \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb index 74305c4dd88..301583d8b5d 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb @@ -36,7 +36,7 @@ %> <%= h(plan.name) -%> - <%= plan.dead_line ? plan.dead_line.strftime("%d %b %Y") : ' ' -%> + <%= plan.dead_line ? plan.dead_line.strftime("%d %b %Y") : ' ' -%> <% if plan.progress[:total]==0 %> <%= message('action_plans.no_reviews_linked_to_action_plan') -%> <% else %> diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 561eba8c647..520f66eb4b5 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -549,6 +549,7 @@ property.category.server_id=Server ID # Default dashboard dashboard.Dashboard.name=Dashboard dashboard.Hotspots.name=Hotspots +dashboard.Reviews.name=Reviews #------------------------------------------------------------------------------ #