aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-03-08 17:58:09 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-03-08 17:58:09 +0100
commite3319fbcd51dc5a6372c74e0af2c850f0043f117 (patch)
tree467a6dbfb83ad1ae3f908644363448aaf8d943ae /plugins
parent7edc07604a25446f4b75726ae8fd72bc4277b160 (diff)
downloadsonarqube-e3319fbcd51dc5a6372c74e0af2c850f0043f117.tar.gz
sonarqube-e3319fbcd51dc5a6372c74e0af2c850f0043f117.zip
SONAR-3006 Make the TimeMachine service a dashboard page
=> New dashboard implemented, still need to remove the "old" time machine service when this new dashboard has been tested and validated.
Diffstat (limited to 'plugins')
-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/dashboards/TimeMachineDashboard.java110
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties1
3 files changed, 113 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 457850f7602..c690d8a5455 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
@@ -37,6 +37,7 @@ import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
import org.sonar.plugins.core.dashboards.DefaultDashboard;
import org.sonar.plugins.core.dashboards.HotspotsDashboard;
import org.sonar.plugins.core.dashboards.ReviewsDashboard;
+import org.sonar.plugins.core.dashboards.TimeMachineDashboard;
import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
import org.sonar.plugins.core.sensors.*;
import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition;
@@ -263,6 +264,7 @@ public class CorePlugin extends SonarPlugin {
extensions.add(DefaultDashboard.class);
extensions.add(HotspotsDashboard.class);
extensions.add(ReviewsDashboard.class);
+ extensions.add(TimeMachineDashboard.class);
// chart
extensions.add(XradarChart.class);
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/TimeMachineDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/TimeMachineDashboard.java
new file mode 100644
index 00000000000..f0f3d9b8fb5
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/TimeMachineDashboard.java
@@ -0,0 +1,110 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 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.dashboards;
+
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.Dashboard.Widget;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.api.web.DashboardTemplate;
+
+/**
+ * Time Machine dashboard for Sonar
+ *
+ * @since 2.15
+ */
+public final class TimeMachineDashboard extends DashboardTemplate {
+
+ @Override
+ public String getName() {
+ return "TimeMachine";
+ }
+
+ @Override
+ public Dashboard createDashboard() {
+ Dashboard dashboard = Dashboard.create();
+ dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
+ addFirstColumn(dashboard);
+ addSecondColumn(dashboard);
+ return dashboard;
+ }
+
+ private void addFirstColumn(Dashboard dashboard) {
+ Widget timelineWidget = dashboard.addWidget("timeline", 1);
+ timelineWidget.setProperty("metric1", "complexity");
+ timelineWidget.setProperty("metric2", "violations_density");
+ timelineWidget.setProperty("metric3", "coverage");
+
+ Widget sizeTimeMachineWidget = dashboard.addWidget("time_machine", 1);
+ sizeTimeMachineWidget.setProperty("displaySparkLine", "true");
+ sizeTimeMachineWidget.setProperty("metric1", "ncloc");
+ sizeTimeMachineWidget.setProperty("metric2", "lines");
+ sizeTimeMachineWidget.setProperty("metric3", "statements");
+ sizeTimeMachineWidget.setProperty("metric4", "files");
+ sizeTimeMachineWidget.setProperty("metric5", "classes");
+ sizeTimeMachineWidget.setProperty("metric6", "functions");
+ sizeTimeMachineWidget.setProperty("metric7", "accessors");
+
+ Widget commentsTimeMachineWidget = dashboard.addWidget("time_machine", 1);
+ commentsTimeMachineWidget.setProperty("displaySparkLine", "true");
+ commentsTimeMachineWidget.setProperty("metric1", "comment_lines_density");
+ commentsTimeMachineWidget.setProperty("metric2", "comment_lines");
+ commentsTimeMachineWidget.setProperty("metric3", "public_documented_api_density");
+ commentsTimeMachineWidget.setProperty("metric4", "public_undocumented_api");
+
+ Widget duplicationTimeMachineWidget = dashboard.addWidget("time_machine", 1);
+ duplicationTimeMachineWidget.setProperty("displaySparkLine", "true");
+ duplicationTimeMachineWidget.setProperty("metric1", "duplicated_lines_density");
+ duplicationTimeMachineWidget.setProperty("metric2", "duplicated_lines");
+ duplicationTimeMachineWidget.setProperty("metric3", "duplicated_blocks");
+ duplicationTimeMachineWidget.setProperty("metric4", "duplicated_files");
+ }
+
+ private void addSecondColumn(Dashboard dashboard) {
+ Widget rulesTimeMachineWidget = dashboard.addWidget("time_machine", 2);
+ rulesTimeMachineWidget.setProperty("displaySparkLine", "true");
+ rulesTimeMachineWidget.setProperty("metric1", "violations");
+ rulesTimeMachineWidget.setProperty("metric2", "violation_density");
+ rulesTimeMachineWidget.setProperty("metric3", "blocker_violations");
+ rulesTimeMachineWidget.setProperty("metric4", "critical_violations");
+ rulesTimeMachineWidget.setProperty("metric5", "major_violations");
+ rulesTimeMachineWidget.setProperty("metric6", "minor_violations");
+ rulesTimeMachineWidget.setProperty("metric7", "info_violations");
+ rulesTimeMachineWidget.setProperty("metric7", "weighted_violations");
+
+ Widget complexityTimeMachineWidget = dashboard.addWidget("time_machine", 2);
+ complexityTimeMachineWidget.setProperty("displaySparkLine", "true");
+ complexityTimeMachineWidget.setProperty("metric1", "complexity");
+ complexityTimeMachineWidget.setProperty("metric2", "function_complexity");
+ complexityTimeMachineWidget.setProperty("metric3", "class_complexity");
+ complexityTimeMachineWidget.setProperty("metric4", "file_complexity");
+
+ Widget testsTimeMachineWidget = dashboard.addWidget("time_machine", 2);
+ testsTimeMachineWidget.setProperty("displaySparkLine", "true");
+ testsTimeMachineWidget.setProperty("metric1", "coverage");
+ testsTimeMachineWidget.setProperty("metric2", "line_coverage");
+ testsTimeMachineWidget.setProperty("metric3", "branch_coverage");
+ testsTimeMachineWidget.setProperty("metric4", "test_success_density");
+ testsTimeMachineWidget.setProperty("metric5", "test_failures");
+ testsTimeMachineWidget.setProperty("metric6", "test_errors");
+ testsTimeMachineWidget.setProperty("metric7", "tests");
+ testsTimeMachineWidget.setProperty("metric7", "test_execution_time");
+ }
+
+} \ 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 b1ed986b7db..f5416c41594 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
@@ -557,6 +557,7 @@ property.category.server_id=Server ID
dashboard.Dashboard.name=Dashboard
dashboard.Hotspots.name=Hotspots
dashboard.Reviews.name=Reviews
+dashboard.TimeMachine.name=Time Machine
#------------------------------------------------------------------------------
#