aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2013-12-11 12:09:06 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2013-12-11 12:09:06 +0100
commita1f2499b07cab3fa7bbe09f1f9139b2bb16a8fa2 (patch)
treeb7ed61ad1a44d3b43023c4dfa32ac45458c10080
parent64cf3d0bf39b58267118b78f2fe2871ed3f9f2ad (diff)
downloadsonarqube-a1f2499b07cab3fa7bbe09f1f9139b2bb16a8fa2.tar.gz
sonarqube-a1f2499b07cab3fa7bbe09f1f9139b2bb16a8fa2.zip
SONAR-3762 SONAR-3113 Create skeletons for Histogram / Cloud widget
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java42
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java41
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties15
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb9
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb8
6 files changed, 117 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 02f48fa372f..e51be45c138 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
@@ -239,6 +239,8 @@ public final class CorePlugin extends SonarPlugin {
DuplicationsWidget.class,
TechnicalDebtPyramidWidget.class,
PieChartWidget.class,
+ CloudWidget.class,
+ HistogramWidget.class,
// dashboards
ProjectDefaultDashboard.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java
new file mode 100644
index 00000000000..5869e9434c5
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java
@@ -0,0 +1,42 @@
+/*
+ * 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.measures.CoreMetrics;
+import org.sonar.api.web.*;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory("Global")
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+ @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+ @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
+ @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+ @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
+})
+public class CloudWidget extends CoreWidget {
+
+ public CloudWidget() {
+ super("cloud", "Cloud", "/org/sonar/plugins/core/widgets/cloud.html.erb");
+ }
+
+}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java
new file mode 100644
index 00000000000..bc4c2f61ed3
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java
@@ -0,0 +1,41 @@
+/*
+ * 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.measures.CoreMetrics;
+import org.sonar.api.web.*;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory("Global")
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+ @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+ @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
+ @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+ @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
+})
+public class HistogramWidget extends CoreWidget {
+
+ public HistogramWidget() {
+ super("histogram", "Histogram", "/org/sonar/plugins/core/widgets/histogram.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 34acec19296..49b5eb0581f 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
@@ -1115,6 +1115,21 @@ widget.pie_chart.property.extraMetric1.name=Extra Metric 1
widget.pie_chart.property.extraMetric2.name=Extra Metric 2
widget.pie_chart.property.extraMetric3.name=Extra Metric 3
+widget.cloud.name=Measure Filter as Word Cloud
+widget.cloud.description=Displays the result of a pre-configured measure filter as a word cloud.
+widget.cloud.property.chartTitle.name=Chart Title
+widget.cloud.property.chartHeight.name=Chart Height
+widget.cloud.property.filter.name=Filter
+widget.cloud.property.colorMetric.name=Color Metric
+widget.cloud.property.sizeMetric.name=Size Metric
+
+widget.histogram.name=Measure Filter as Histogram
+widget.histogram.description=Displays the result of a pre-configured measure filter as a histogram.
+widget.histogram.property.chartTitle.name=Chart Title
+widget.histogram.property.chartHeight.name=Chart Height
+widget.histogram.property.filter.name=Filter
+widget.histogram.property.metric.name=Metric
+
widget.time_machine.name=History Table
widget.time_machine.description=Displays up to 10 metrics in a table, showing their value for a specified number of past snapshots.
widget.time_machine.property.title.name=Title
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb
new file mode 100644
index 00000000000..8d23d58102c
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb
@@ -0,0 +1,9 @@
+<script>
+ var filterId = <%= widget_properties['filter'].to_s %>;
+ var chartTitle = <%= widget_properties['chartTitle'].to_s %>;
+ var chartHeight = <%= widget_properties['chartHeight'].to_i %>;
+ var colorMetric = <%= widget_properties['colorMetric'].key.to_s %>;
+ var sizeMetric = <%= widget_properties['sizeMetric'].key.to_s %>;
+</script>
+
+
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb
new file mode 100644
index 00000000000..7a2951cd6c4
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb
@@ -0,0 +1,8 @@
+<script>
+ var filterId = <%= widget_properties['filter'].to_s %>;
+ var chartTitle = <%= widget_properties['chartTitle'].to_s %>;
+ var chartHeight = <%= widget_properties['chartHeight'].to_i %>;
+ var metric = <%= widget_properties['metric'].key.to_s %>;
+</script>
+
+