diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-11 10:47:29 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-11 10:47:41 +0200 |
commit | 8cd5036d05ee239a7419c2bd41084e66e00911d8 (patch) | |
tree | 8848cf1806e81931a8c11ca8488652e0076f18ba /plugins/sonar-core-plugin | |
parent | 3aac1c8b4df261c733fb967007839e5845a33d3a (diff) | |
download | sonarqube-8cd5036d05ee239a7419c2bd41084e66e00911d8.tar.gz sonarqube-8cd5036d05ee239a7419c2bd41084e66e00911d8.zip |
SONAR-5450 Add a Technical debt synopsis widget
Diffstat (limited to 'plugins/sonar-core-plugin')
4 files changed, 99 insertions, 1 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 484ff746d68..1c9bdcf3045 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 @@ -226,6 +226,7 @@ public final class CorePlugin extends SonarPlugin { MeasureFilterAsHistogramWidget.class, MeasureFilterAsBubbleChartWidget.class, ProjectFileCloudWidget.class, + DebtOverviewWidget.class, // dashboards ProjectDefaultDashboard.class, diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java index 7412127acf8..96799dfec2c 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java @@ -53,7 +53,7 @@ public final class ProjectDefaultDashboard extends DashboardTemplate { } private void addSecondColumn(Dashboard dashboard) { - dashboard.addWidget("technical_debt", 2); + dashboard.addWidget("debt_overview", 2); dashboard.addWidget("rules", 2); dashboard.addWidget("alerts", 2); dashboard.addWidget("file_design", 2); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DebtOverviewWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DebtOverviewWidget.java new file mode 100644 index 00000000000..9af75bbbdd3 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DebtOverviewWidget.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.sonar.api.web.UserRole; +import org.sonar.api.web.WidgetCategory; + +@UserRole(UserRole.USER) +@WidgetCategory("Technical Debt") +public final class DebtOverviewWidget extends CoreWidget { + + public DebtOverviewWidget() { + super("debt_overview", "Technical Debt Overview", "/org/sonar/plugins/core/widgets/debt_overview.erb"); + } +} diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb new file mode 100644 index 00000000000..77db77beb22 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb @@ -0,0 +1,64 @@ +<% + sqale_rating = @snapshot.measure('sqale_rating') + sqale_debt_ratio = @snapshot.measure('sqale_debt_ratio') + if sqale_rating && sqale_rating.text_value && sqale_debt_ratio +%> + <style> + .debt_overview .rating { + padding: 2px 5px; + color: #fff; + } + + .debt_overview .A { + background-color: #00AA00; + } + + .debt_overview .B { + background-color: #80CC00; + } + + .debt_overview .C { + background-color: #FFEE00; + } + + .debt_overview .D { + background-color: #F77700; + } + + .debt_overview .E { + background-color: #EE0000; + } + </style> + <% if sqale_rating && sqale_rating.text_value %> + <div class="widget-row"> + <div class="widget-span widget-span-6"> + <div class="widget-measure-container"> + <div class="widget-measure widget-measure-main"> + <span class="widget-label"><%= message('metric.sqale_rating.name') -%></span> + <span class="nowrap"> + <a href="<%= url_for_drilldown('sqale_rating') -%>" class="widget-link"> + <span class="rating <%= sqale_rating.text_value -%>"><%= sqale_rating.text_value -%></span> + </a> + <% unless dashboard_configuration.selected_period? %> + <%= trend_icon(sqale_rating) -%> + <% end %> + </span> + </div> + </div> + </div> + <% end %> + <% if sqale_debt_ratio %> + <div class="widget-span widget-span-6"> + <div class="widget-measure-container"> + <div class="widget-measure widget-measure-main"> + <span class="widget-label"><%= message('metric.sqale_debt_ratio.name') -%></span> + <span class="nowrap"> + <%= format_measure(sqale_debt_ratio, :url => url_for_drilldown(sqale_debt_ratio)) %> + <%= dashboard_configuration.selected_period? ? format_variation(sqale_debt_ratio) : trend_icon(sqale_debt_ratio) -%> + </span> + </div> + </div> + </div> + </div> + <% end %> +<% end %> |