aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-09-27 15:01:03 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-09-27 15:04:51 +0200
commite20ef35aeadc8ca47bb139fd34fa0a6d2242f2fc (patch)
tree8bf33027a0ed411a96b86f1be64d21cdc932fe47 /plugins
parenta2b26d1aa01acdf090369ac451c464d50dbe430a (diff)
downloadsonarqube-e20ef35aeadc8ca47bb139fd34fa0a6d2242f2fc.tar.gz
sonarqube-e20ef35aeadc8ca47bb139fd34fa0a6d2242f2fc.zip
SONAR-4717 Offer a new "Technical Debt" widget
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java1
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java32
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties4
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb18
4 files changed, 55 insertions, 0 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 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
+%>
+ <h3><%= message('widget.technical_debt.name') -%></h3>
+ <span style="color: #777777; font-size: 93%; font-style:italic"><%= message('widget.technical_debt.no_info_available') -%></span>
+<%
+ else
+%>
+ <div class="dashbox marginright10">
+ <h3><%= message('widget.technical_debt.name') -%></h3>
+ <p>
+ <a href="<%= url_for_drilldown('sqale_index') -%>">
+ <span class="big"><%= number_with_precision(index.value, :precision => 1) -%></span>&nbsp;<%= message('widget.technical_debt.days') -%></a>
+ <%= dashboard_configuration.selected_period? ? format_variation(index) : trend_icon(index) -%>
+ </p>
+ </div>
+<% end %>