From: Julien Lancelot Date: Fri, 27 Sep 2013 13:01:03 +0000 (+0200) Subject: SONAR-4717 Offer a new "Technical Debt" widget X-Git-Tag: 4.0~289 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e20ef35aeadc8ca47bb139fd34fa0a6d2242f2fc;p=sonarqube.git SONAR-4717 Offer a new "Technical Debt" widget --- 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 d0315062434..57caf621863 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 @@ -237,6 +237,7 @@ public final class CorePlugin extends SonarPlugin { WelcomeWidget.class, DocumentationCommentsWidget.class, DuplicationsWidget.class, + TechnicalDebtWidget.class, // dashboards ProjectDefaultDashboard.class, diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java new file mode 100644 index 00000000000..6c977cb0705 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java @@ -0,0 +1,32 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 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 TechnicalDebtWidget extends CoreWidget { + + public TechnicalDebtWidget() { + super("technicalDebt", "Technical Debt", "/org/sonar/plugins/core/widgets/technical_debt.html.erb"); + } +} diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 3f4bd1b2a96..8f5ac70a871 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -1143,6 +1143,10 @@ widget.measure_filter_treemap.property.heightInPercents.name=Height widget.measure_filter_treemap.property.heightInPercents.description=Height in percents of width widget.measure_filter_treemap.property.displayFilterDescription.name=Display filter description +widget.technical_debt.name=Technical Debt +widget.technical_debt.days=days +widget.technical_debt.no_info_available=No information available. + # Below are labels used in widget edition pages widget.image.name=Image widget.image.description=Shows an image with a link diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb new file mode 100644 index 00000000000..49ba547be7b --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb @@ -0,0 +1,18 @@ +<% + index = measure('technical_debt') + unless index +%> +

<%= message('widget.technical_debt.name') -%>

+ <%= message('widget.technical_debt.no_info_available') -%> +<% + else +%> +
+

<%= message('widget.technical_debt.name') -%>

+

+ + <%= number_with_precision(index.value, :precision => 1) -%> <%= message('widget.technical_debt.days') -%> + <%= dashboard_configuration.selected_period? ? format_variation(index) : trend_icon(index) -%> +

+
+<% end %>