diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-20 11:48:15 +0100 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-20 17:13:03 +0100 |
commit | 604ec306443465b67ac40423921d04e5d1bc169e (patch) | |
tree | c67790485286a254ccfe412bb89b850c40ceb99f | |
parent | 75d1edc0513cefcd7359196ffa7b09ef04d6418a (diff) | |
download | sonarqube-604ec306443465b67ac40423921d04e5d1bc169e.tar.gz sonarqube-604ec306443465b67ac40423921d04e5d1bc169e.zip |
SONAR-2662 Add action plan widget
11 files changed, 218 insertions, 5 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 58b343aeb46..22e2ccd4b8f 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 @@ -42,10 +42,13 @@ import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition; import org.sonar.plugins.core.timemachine.*; import org.sonar.plugins.core.web.Lcom4Viewer; import org.sonar.plugins.core.widgets.*; +import org.sonar.plugins.core.widgets.actionPlans.ActionPlansWidget; import org.sonar.plugins.core.widgets.reviews.FalsePositiveReviewsWidget; import org.sonar.plugins.core.widgets.reviews.MyReviewsWidget; +import org.sonar.plugins.core.widgets.reviews.PlannedReviewsWidget; import org.sonar.plugins.core.widgets.reviews.ProjectReviewsWidget; import org.sonar.plugins.core.widgets.reviews.ReviewsPerDeveloperWidget; +import org.sonar.plugins.core.widgets.reviews.UnplannedReviewsWidget; import java.util.List; @@ -248,6 +251,9 @@ public class CorePlugin extends SonarPlugin { extensions.add(ProjectReviewsWidget.class); extensions.add(FalsePositiveReviewsWidget.class); extensions.add(ReviewsPerDeveloperWidget.class); + extensions.add(PlannedReviewsWidget.class); + extensions.add(UnplannedReviewsWidget.class); + extensions.add(ActionPlansWidget.class); // dashboards extensions.add(DefaultDashboard.class); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/actionPlans/ActionPlansWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/actionPlans/ActionPlansWidget.java new file mode 100644 index 00000000000..4950c877018 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/actionPlans/ActionPlansWidget.java @@ -0,0 +1,40 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 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.widgets.actionPlans; + +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetCategory; + +@WidgetCategory({ "Action plans", "Reviews" }) +public class ActionPlansWidget extends AbstractRubyTemplate implements RubyRailsWidget { + public String getId() { + return "action_plans"; + } + + public String getTitle() { + return "Action plans"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb"; + } +}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/PlannedReviewsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/PlannedReviewsWidget.java new file mode 100644 index 00000000000..9299e693a94 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/PlannedReviewsWidget.java @@ -0,0 +1,49 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 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.widgets.reviews; + +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetCategory; +import org.sonar.api.web.WidgetProperties; +import org.sonar.api.web.WidgetProperty; +import org.sonar.api.web.WidgetPropertyType; + +@WidgetCategory({ "Action plans", "Reviews" }) +@WidgetProperties( + { + @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5", + description="Maximum number of reviews displayed at the same time.") + } +) +public class PlannedReviewsWidget extends AbstractRubyTemplate implements RubyRailsWidget { + public String getId() { + return "planned_reviews"; + } + + public String getTitle() { + return "Planned reviews"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb"; + } +}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/UnplannedReviewsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/UnplannedReviewsWidget.java new file mode 100644 index 00000000000..dbe1fc99740 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/reviews/UnplannedReviewsWidget.java @@ -0,0 +1,49 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 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.widgets.reviews; + +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetCategory; +import org.sonar.api.web.WidgetProperties; +import org.sonar.api.web.WidgetProperty; +import org.sonar.api.web.WidgetPropertyType; + +@WidgetCategory({ "Action plans", "Reviews" }) +@WidgetProperties( + { + @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5", + description="Maximum number of reviews displayed at the same time.") + } +) +public class UnplannedReviewsWidget extends AbstractRubyTemplate implements RubyRailsWidget { + public String getId() { + return "unplanned_reviews"; + } + + public String getTitle() { + return "Unplanned reviews"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/core/widgets/reviews/unplanned_reviews.html.erb"; + } +}
\ 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 new file mode 100644 index 00000000000..e3788735a8d --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb @@ -0,0 +1,53 @@ +<% + if has_role?(:user, @project) + action_plans = ActionPlan.find(:all, :conditions => ['status= ? AND project_id=?', ActionPlan::STATUS_OPEN, @project.id], + :include => 'reviews', :order => 'dead_line ASC') + + div_id = "action-plan-widget-#{widget.id.to_s}" +%> + +<div class="line-block"> + <div style="float:right"> + <a href="<%= url_for :controller => 'action_plans', :action => 'index', :id => @project.id -%>"> + <%= message('widgets.more') -%> + </a> + </div> + <h3><%= message('widget.action_plans.title') -%></h3> +</div> + +<% if action_plans.size ==0 %> + <span class="empty_widget"><%= message('widget.action_plans.no_action_plan') -%></span> +<% else %> + +<div id="<%= div_id -%>"> + <table class="width100 data actionPlans"> + <thead> + <tr> + <th colspan="3"></th> + </tr> + </thead> + <tbody> + <% + action_plans.each do |plan| + %> + <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>"> + <td class="thin nowrap"><%= h(plan.name) -%></td> + <td class="thin nowrap <%= 'over-due' if plan.over_due? -%>" align="right" x="<%= plan.dead_line ? plan.dead_line.tv_sec : '' -%>"><%= plan.dead_line ? plan.dead_line.strftime("%d %b %Y") : ' ' -%></td> + <% if plan.progress[:total]==0 %> + <td class="noprogress thin nowrap"><%= message('action_plans.no_reviews_linked_to_action_plan') -%></td> + <% else %> + <td class="progress thin"> + <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%> + </td> + <% end %> + </tr> + <% + end + %> + </tbody> + </table> +</div> + +<% end %> + +<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb new file mode 100644 index 00000000000..a81fe827804 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb @@ -0,0 +1 @@ +<b> Under construction ;-) </b> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/unplanned_reviews.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/unplanned_reviews.html.erb new file mode 100644 index 00000000000..1fcfa839580 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/unplanned_reviews.html.erb @@ -0,0 +1 @@ +<b> Under construction ;-) </b>
\ No newline at end of file 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 a4c273918e9..ac7dbbf6775 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 @@ -654,6 +654,18 @@ widget.reviews_per_developer.name=Open reviews per developer widget.reviews_per_developer.description=Shows the number of open/reopened reviews per developer. widget.reviews_per_developer.not_assigned=Not assigned +widget.action_plans.name=Action plans +widget.action_plans.description=Shows all the open action plans of the project +widget.action_plans.title=Open action plans +widget.action_plans.no_action_plan=No action plan + +widget.planned_reviews.name=Planned reviews +widget.planned_reviews.description=Shows all the planned reviews of the project, gathered by action plan + +widget.unplanned_reviews.name=Unplanned reviews +widget.unplanned_reviews.description=Shows all the reviews of the project that are not planned yet in an action plan + + #------------------------------------------------------------------------------ # diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb index 60fda96d531..38ecf0abd7e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb @@ -8,7 +8,7 @@ <h1><%= message('action_plans.page_title') -%></h1> </div> -<table class="width100 data sortable" id="actionPlans"> +<table class="width100 data sortable actionPlans" id="actionPlans"> <thead> <tr> <th class="thin nowrap"><%= message('action_plans.col.status') -%></th> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index d88104aad2f..fec76547b34 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -71,8 +71,10 @@ <li class="h2"><%= message('sidebar.project_settings') -%></li> <li class="<%= 'selected' if request.request_uri.include?('/manual_measures') -%>"> <a href="<%= ApplicationController.root_context -%>/manual_measures/index/<%= @project.id -%>"><%= message('manual_measures.page') -%></a></li> + <% if (@project.project?) %> <li class="<%= 'selected' if request.request_uri.include?('/action_plans') -%>"> <a href="<%= ApplicationController.root_context -%>/action_plans/index/<%= @project.id -%>"><%= message('action_plans.page') -%></a></li> + <% end %> <% if (@project.project? || @project.module?) %> <li class="<%= 'selected' if request.request_uri.include?('/project/settings') -%>"> <a href="<%= ApplicationController.root_context -%>/project/settings/<%= @project.id -%>"><%= message('project_settings.page') -%></a></li> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index bd9622f7ab3..06e96e8e81c 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -1228,23 +1228,23 @@ div.comment-excerpt { } /* ACTION PLANS */ -#actionPlans td { +table.actionPlans td { vertical-align: top; } -#actionPlans td.progress { +table.actionPlans td.progress { width: 300px; padding: 0px 40px; } -#actionPlans td.noprogress { +table.actionPlans td.noprogress { color: #777777; font-size: 93%; padding-left: 40px; padding-right: 40px; } -#actionPlans td.over-due { +table.actionPlans td.over-due { color: #CC0000; font-weight: bold; } |