]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6370 move server extensions out of core plugin
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 26 May 2015 21:24:27 +0000 (23:24 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 May 2015 07:29:03 +0000 (09:29 +0200)
184 files changed:
plugins/sonar-core-plugin/pom.xml
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboard.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboard.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilter.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/ProjectFilter.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/AlertsWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/BubbleChartWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ComplexityWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoverageWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DebtOverviewWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DescriptionWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DuplicationsWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/EventsWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ItCoverageWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ProjectFileCloudWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/SizeWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtPyramidWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WelcomeWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WidgetConstants.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ActionPlansWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ProjectIssueFilterWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsBubbleChartWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsTreemapWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterListWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/package-info.java [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_complexity_chart.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/events.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/project_issue_filter.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_bubble_chart.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_treemap.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/project_file_cloud.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt_pyramid.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/welcome.html.erb [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/AbstractChartTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionAreaChartTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionBarChartTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboardTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboardTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboardTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilterTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/ProjectFilterTest.java [deleted file]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/widgets/CoreWidgetsTest.java [deleted file]
plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest/filters.xml [deleted file]
server/sonar-server/pom.xml
server/sonar-server/src/main/java/org/sonar/server/charts/DistributionAreaChart.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/charts/DistributionBarChart.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/db/DashboardDao.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/db/WidgetDao.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/db/WidgetPropertyDao.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/db/package-info.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/package-info.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/GlobalDefaultDashboard.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/package-info.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/AlertsWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/BubbleChartWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ComplexityWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoreWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoverageWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CustomMeasuresWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DebtOverviewWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DescriptionWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DocumentationCommentsWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DuplicationsWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/EventsWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/HotspotMetricWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueFilterWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueTagCloudWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssuesWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ItCoverageWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsBubbleChartWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsCloudWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsHistogramWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsPieChartWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterListWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectFileCloudWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectIssueFilterWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/SizeWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TechnicalDebtPyramidWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimeMachineWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimelineWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WelcomeWidget.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WidgetConstants.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/package-info.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/package-info.java
server/sonar-server/src/main/java/org/sonar/server/measure/template/MyFavouritesFilter.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/measure/template/ProjectFilter.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/measure/template/package-info.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/_complexity_chart.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/alerts.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/bubbleChart.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/complexity.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/coverage.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/debt_overview.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/description.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/documentation_comments_widget.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/duplications_widget.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/events.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/hotspot_metric.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_filter.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_tag_cloud.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issues.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/it_coverage.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_bubble_chart.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_cloud.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_histogram.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_list.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_pie_chart.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_treemap.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_file_cloud.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_issue_filter.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/size.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/technical_debt_pyramid.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/time_machine.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/timeline.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/treemap.html.erb [new file with mode: 0644]
server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/welcome.html.erb [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/charts/AbstractChartTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/charts/DistributionAreaChartTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/charts/DistributionBarChartTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/GlobalDefaultDashboardTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/dashboard/widget/CoreWidgetsTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/measure/template/MyFavouritesFilterTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/measure/template/ProjectFilterTest.java [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml [new file with mode: 0644]

index f81408953c112333f067e78ae5ac7808e9a1f9a2..3df82a925398606a62ff297fddadd8fffee00c40 100644 (file)
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.reflections</groupId>
-      <artifactId>reflections</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.dbunit</groupId>
       <artifactId>dbunit</artifactId>
   </dependencies>
 
   <build>
-    <testResources>
-      <testResource>
-        <directory>${basedir}/src/main/resources</directory>
-      </testResource>
-      <testResource>
-        <directory>${basedir}/src/test/resources</directory>
-      </testResource>
-    </testResources>
-
     <plugins>
-      <plugin>
-        <groupId>org.codehaus.sonar</groupId>
-        <artifactId>sonar-dev-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>trim</id>
-            <phase>process-resources</phase>
-            <goals>
-              <goal>trim</goal>
-            </goals>
-            <configuration>
-              <directory>${project.build.outputDirectory}</directory>
-              <includes>
-                <include>**/*.erb</include>
-              </includes>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <groupId>org.codehaus.sonar</groupId>
         <artifactId>sonar-packaging-maven-plugin</artifactId>
index 7a6fdb979a2e40316a2f322e48006d534d87c284..0b1883d954b953d7914169b4a1c0329c41c0e993 100644 (file)
 package org.sonar.plugins.core;
 
 import com.google.common.collect.ImmutableList;
+import java.util.List;
 import org.sonar.api.CoreProperties;
 import org.sonar.api.Properties;
 import org.sonar.api.Property;
 import org.sonar.api.PropertyType;
 import org.sonar.api.SonarPlugin;
-import org.sonar.plugins.core.charts.DistributionAreaChart;
-import org.sonar.plugins.core.charts.DistributionBarChart;
-import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard;
-import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard;
 import org.sonar.plugins.core.issue.CountFalsePositivesDecorator;
 import org.sonar.plugins.core.issue.CountUnresolvedIssuesDecorator;
-import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
-import org.sonar.plugins.core.measurefilters.ProjectFilter;
 import org.sonar.plugins.core.notifications.alerts.NewAlerts;
 import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
 import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
@@ -57,38 +50,6 @@ import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer;
 import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer;
 import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister;
 import org.sonar.plugins.core.timemachine.VariationDecorator;
-import org.sonar.plugins.core.widgets.AlertsWidget;
-import org.sonar.plugins.core.widgets.BubbleChartWidget;
-import org.sonar.plugins.core.widgets.ComplexityWidget;
-import org.sonar.plugins.core.widgets.CoverageWidget;
-import org.sonar.plugins.core.widgets.CustomMeasuresWidget;
-import org.sonar.plugins.core.widgets.DebtOverviewWidget;
-import org.sonar.plugins.core.widgets.DescriptionWidget;
-import org.sonar.plugins.core.widgets.DocumentationCommentsWidget;
-import org.sonar.plugins.core.widgets.DuplicationsWidget;
-import org.sonar.plugins.core.widgets.EventsWidget;
-import org.sonar.plugins.core.widgets.HotspotMetricWidget;
-import org.sonar.plugins.core.widgets.ItCoverageWidget;
-import org.sonar.plugins.core.widgets.ProjectFileCloudWidget;
-import org.sonar.plugins.core.widgets.SizeWidget;
-import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget;
-import org.sonar.plugins.core.widgets.TimeMachineWidget;
-import org.sonar.plugins.core.widgets.TimelineWidget;
-import org.sonar.plugins.core.widgets.TreemapWidget;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.issues.ActionPlansWidget;
-import org.sonar.plugins.core.widgets.issues.IssueFilterWidget;
-import org.sonar.plugins.core.widgets.issues.IssueTagCloudWidget;
-import org.sonar.plugins.core.widgets.issues.IssuesWidget;
-import org.sonar.plugins.core.widgets.issues.ProjectIssueFilterWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsBubbleChartWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsCloudWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsHistogramWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsPieChartWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsTreemapWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget;
-
-import java.util.List;
 
 @Properties({
   @Property(
@@ -258,55 +219,9 @@ public final class CorePlugin extends SonarPlugin {
       DefaultResourceTypes.class,
       UserManagedMetrics.class,
 
-      // measure filters
-      ProjectFilter.class,
-      MyFavouritesFilter.class,
-
-      // widgets
-      AlertsWidget.class,
-      CoverageWidget.class,
-      ItCoverageWidget.class,
-      DescriptionWidget.class,
-      ComplexityWidget.class,
-      IssuesWidget.class,
-      SizeWidget.class,
-      EventsWidget.class,
-      CustomMeasuresWidget.class,
-      TimelineWidget.class,
-      BubbleChartWidget.class,
-      TimeMachineWidget.class,
-      HotspotMetricWidget.class,
-      TreemapWidget.class,
-      MeasureFilterListWidget.class,
-      MeasureFilterAsTreemapWidget.class,
-      WelcomeWidget.class,
-      DocumentationCommentsWidget.class,
-      DuplicationsWidget.class,
-      TechnicalDebtPyramidWidget.class,
-      MeasureFilterAsPieChartWidget.class,
-      MeasureFilterAsCloudWidget.class,
-      MeasureFilterAsHistogramWidget.class,
-      MeasureFilterAsBubbleChartWidget.class,
-      ProjectFileCloudWidget.class,
-      DebtOverviewWidget.class,
-
-      // dashboards
-      ProjectDefaultDashboard.class,
-      ProjectIssuesDashboard.class,
-      ProjectTimeMachineDashboard.class,
-      GlobalDefaultDashboard.class,
-
-      // chart
-      DistributionBarChart.class,
-      DistributionAreaChart.class,
-
       // issues
       CountUnresolvedIssuesDecorator.class,
       CountFalsePositivesDecorator.class,
-      ActionPlansWidget.class,
-      IssueFilterWidget.class,
-      ProjectIssueFilterWidget.class,
-      IssueTagCloudWidget.class,
 
       // batch
       UnitTestDecorator.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java
deleted file mode 100644 (file)
index 3687c85..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.charts;
-
-import org.apache.commons.lang.StringUtils;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.Plot;
-import org.jfree.chart.renderer.category.AreaRenderer;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.sonar.api.charts.AbstractChart;
-import org.sonar.api.charts.ChartParameters;
-
-import java.text.NumberFormat;
-
-public class DistributionAreaChart extends AbstractChart {
-  private static final String PARAM_COLORS = "c";
-
-  @Override
-  public String getKey() {
-    return "distarea";
-  }
-
-  @Override
-  protected Plot getPlot(ChartParameters params) {
-    DefaultCategoryDataset dataset = createDataset(params);
-
-    CategoryAxis domainAxis = new CategoryAxis();
-    domainAxis.setCategoryMargin(0.0);
-    domainAxis.setLowerMargin(0.0);
-    domainAxis.setUpperMargin(0.0);
-
-    NumberAxis rangeAxis = new NumberAxis();
-    rangeAxis.setNumberFormatOverride(NumberFormat.getIntegerInstance(params.getLocale()));
-    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
-
-    AreaRenderer renderer = new AreaRenderer();
-    CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
-    plot.setForegroundAlpha(0.5f);
-    plot.setDomainGridlinesVisible(true);
-    configureColors(dataset, plot, params.getValues(PARAM_COLORS, ","));
-    return plot;
-  }
-
-  private DefaultCategoryDataset createDataset(ChartParameters params) {
-    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-
-    String[] series = params.getValues("v", "|", true);
-    int index = 0;
-    while (index < series.length) {
-      String[] pairs = StringUtils.split(series[index], ";");
-      if (pairs.length == 0) {
-        dataset.addValue((Number)0.0, index, "0");
-
-      } else {
-        for (String pair : pairs) {
-          String[] keyValue = StringUtils.split(pair, "=");
-          double val = Double.parseDouble(keyValue[1]);
-          dataset.addValue((Number) val, index, keyValue[0]);
-        }
-      }
-      index++;
-    }
-    return dataset;
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java
deleted file mode 100644 (file)
index ef02113..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.charts;
-
-import org.apache.commons.lang.StringUtils;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.Plot;
-import org.jfree.chart.renderer.category.BarRenderer;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.sonar.api.charts.AbstractChart;
-import org.sonar.api.charts.ChartParameters;
-
-import java.awt.*;
-import java.text.DecimalFormat;
-
-public class DistributionBarChart extends AbstractChart {
-
-
-  public static final String PARAM_VALUES = "v";
-  public static final String PARAM_COLORS = "c";
-  public static final String PARAM_Y_SUFFIX = "ysuf";
-  public static final String PARAM_X_SUFFIX = "xsuf";
-  public static final String PARAM_FONT_SIZE = "fs";
-
-  @Override
-  public String getKey() {
-    return "distbar";
-  }
-
-  @Override
-  public Plot getPlot(ChartParameters params) {
-    CategoryPlot plot = generateJFreeChart(params);
-    plot.setOutlinePaint(OUTLINE_COLOR);
-    plot.setDomainGridlinePaint(GRID_COLOR);
-    plot.setRangeGridlinePaint(GRID_COLOR);
-    return plot;
-  }
-
-  private CategoryPlot generateJFreeChart(ChartParameters params) {
-    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-    CategoryPlot plot = new CategoryPlot();
-
-    Font font = getFont(params.getValue(PARAM_FONT_SIZE));
-    configureDomainAxis(plot, font);
-    configureRangeAxis(plot, params.getValue(PARAM_Y_SUFFIX, "", true), font);
-    configureRenderer(plot);
-    configureValues(dataset, params.getValues(PARAM_VALUES, "|", true), params.getValue(PARAM_X_SUFFIX, "", true));
-    configureColors(dataset, plot, params.getValues(PARAM_COLORS, ","));
-
-    plot.setDataset(dataset);
-    return plot;
-  }
-
-  static void configureValues(DefaultCategoryDataset dataset, String[] series, String xSuffix) {
-    int index = 0;
-    while (index < series.length) {
-      String[] pairs = StringUtils.split(series[index], ";");
-      if (pairs.length == 0) {
-        dataset.addValue((Number) 0.0, index, "0");
-
-      } else {
-        for (String pair : pairs) {
-          String[] keyValue = StringUtils.split(pair, "=");
-          double val = Double.parseDouble(keyValue[1]);
-          dataset.addValue((Number) val, index, keyValue[0] + xSuffix);
-        }
-      }
-      index++;
-    }
-
-  }
-
-  private void configureRenderer(CategoryPlot plot) {
-    BarRenderer renderer = new BarRenderer();
-    renderer.setDrawBarOutline(true);
-    renderer.setSeriesItemLabelsVisible(0, true);
-    renderer.setItemMargin(0);
-    plot.setRenderer(renderer);
-  }
-
-  private void configureDomainAxis(CategoryPlot plot, Font font) {
-    CategoryAxis categoryAxis = new CategoryAxis();
-    categoryAxis.setTickMarksVisible(true);
-    categoryAxis.setTickLabelFont(font);
-    categoryAxis.setTickLabelPaint(OUTLINE_COLOR);
-    plot.setDomainAxis(categoryAxis);
-    plot.setDomainGridlinesVisible(false);
-  }
-
-  private Font getFont(String fontSize) {
-    int size = FONT_SIZE;
-    if (!StringUtils.isBlank(fontSize)) {
-      size = Integer.parseInt(fontSize);
-    }
-    return new Font("SansSerif", Font.PLAIN, size);
-  }
-
-  private void configureRangeAxis(CategoryPlot plot, String valueLabelSuffix, Font font) {
-    NumberAxis numberAxis = new NumberAxis();
-    numberAxis.setUpperMargin(0.3);
-    numberAxis.setTickLabelFont(font);
-    numberAxis.setTickLabelPaint(OUTLINE_COLOR);
-    String suffix = "";
-    if (valueLabelSuffix != null && !"".equals(valueLabelSuffix)) {
-      suffix = new StringBuilder().append("'").append(valueLabelSuffix).append("'").toString();
-    }
-    numberAxis.setNumberFormatOverride(new DecimalFormat("0" + suffix));
-    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
-    plot.setRangeAxis(numberAxis);
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/package-info.java
deleted file mode 100644 (file)
index 6d9fc80..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.charts;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboard.java
deleted file mode 100644 (file)
index 5e204b1..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.api.web.DashboardTemplate;
-import org.sonar.core.measure.db.MeasureFilterDao;
-import org.sonar.core.measure.db.MeasureFilterDto;
-import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
-import org.sonar.plugins.core.measurefilters.ProjectFilter;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsTreemapWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget;
-
-/**
- * Projects global dashboard for Sonar
- *
- * @since 3.1
- */
-public final class GlobalDefaultDashboard extends DashboardTemplate {
-
-  private MeasureFilterDao filterDao;
-
-  public GlobalDefaultDashboard(MeasureFilterDao filterDao) {
-    this.filterDao = filterDao;
-  }
-
-  @Override
-  public Dashboard createDashboard() {
-    Dashboard dashboard = Dashboard.create()
-      .setGlobal(true)
-      .setLayout(DashboardLayout.TWO_COLUMNS);
-
-    dashboard.addWidget(WelcomeWidget.ID, 1);
-    addMyFavouritesWidget(dashboard);
-    addProjectsWidgets(dashboard);
-
-    return dashboard;
-  }
-
-  private void addMyFavouritesWidget(Dashboard dashboard) {
-    MeasureFilterDto filter = findSystemFilter(MyFavouritesFilter.NAME);
-    if (filter != null) {
-      dashboard
-        .addWidget(MeasureFilterListWidget.ID, 1)
-        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
-        .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "50");
-    }
-  }
-
-  private void addProjectsWidgets(Dashboard dashboard) {
-    MeasureFilterDto filter = findSystemFilter(ProjectFilter.NAME);
-    if (filter != null) {
-      dashboard
-        .addWidget(MeasureFilterListWidget.ID, 2)
-        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
-        .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "20");
-
-      dashboard
-        .addWidget(MeasureFilterAsTreemapWidget.ID, 2)
-        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
-        .setProperty(MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, "ncloc")
-        .setProperty(MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, "coverage");
-    }
-  }
-
-  @Override
-  public String getName() {
-    return "Home";
-  }
-
-  private MeasureFilterDto findSystemFilter(String name) {
-    return filterDao.findSystemFilterByName(name);
-  }
-}
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
deleted file mode 100644 (file)
index 61d88fa..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.api.web.DashboardTemplate;
-
-/**
- * Default dashboard
- *
- * @since 2.13
- */
-public final class ProjectDefaultDashboard extends DashboardTemplate {
-
-  @Override
-  public String getName() {
-    return "Dashboard";
-  }
-
-  @Override
-  public Dashboard createDashboard() {
-    Dashboard dashboard = Dashboard.create();
-    dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
-    addFirstColumn(dashboard);
-    addSecondColumn(dashboard);
-    return dashboard;
-  }
-
-  private void addFirstColumn(Dashboard dashboard) {
-    dashboard.addWidget("size", 1);
-    dashboard.addWidget("duplications", 1);
-    dashboard.addWidget("complexity", 1);
-    dashboard.addWidget("events", 1);
-    dashboard.addWidget("description", 1);
-  }
-
-  private void addSecondColumn(Dashboard dashboard) {
-    dashboard.addWidget("debt_overview", 2);
-    dashboard.addWidget("rules", 2);
-    dashboard.addWidget("alerts", 2);
-    dashboard.addWidget("code_coverage", 2);
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboard.java
deleted file mode 100644 (file)
index 8102117..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.dashboards;
-
-import com.google.common.base.Preconditions;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.api.web.DashboardTemplate;
-import org.sonar.core.issue.db.IssueFilterDao;
-import org.sonar.core.issue.db.IssueFilterDto;
-import org.sonar.plugins.core.widgets.issues.ProjectIssueFilterWidget;
-
-/**
- * Issues dashboard for Sonar
- *
- * @since 3.6
- */
-public final class ProjectIssuesDashboard extends DashboardTemplate {
-
-  private final IssueFilterDao issueFilterDao;
-
-  public ProjectIssuesDashboard(IssueFilterDao issueFilterDao) {
-    this.issueFilterDao = issueFilterDao;
-  }
-
-  @Override
-  public String getName() {
-    return "Issues";
-  }
-
-  @Override
-  public Dashboard createDashboard() {
-    Dashboard dashboard = Dashboard.create();
-    dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
-
-    IssueFilterDto unresolvedIssues = getIssueFilterByName("Unresolved Issues");
-    IssueFilterDto hiddenDebt = getIssueFilterByName("False Positive and Won't Fix Issues");
-    IssueFilterDto myUnresolvedIssues = getIssueFilterByName("My Unresolved Issues");
-
-    addFirstColumn(dashboard, unresolvedIssues);
-    addSecondColumn(dashboard, unresolvedIssues, hiddenDebt, myUnresolvedIssues);
-    return dashboard;
-  }
-
-  private IssueFilterDto getIssueFilterByName(String name) {
-    IssueFilterDto filter = issueFilterDao.selectProvidedFilterByName(name);
-    Preconditions.checkState(filter != null, String.format("Could not find a provided issue filter with name '%s'", name));
-    return filter;
-  }
-
-  private void addFirstColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues) {
-    // Unresolved issues by status
-    dashboard.addWidget(ProjectIssueFilterWidget.ID, 1)
-      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId()))
-      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "statuses");
-    // Action plans
-    dashboard.addWidget("action_plans", 1);
-  }
-
-  private void addSecondColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues, IssueFilterDto hiddenDebt, IssueFilterDto myUnresolvedIssues) {
-    // Unresolved issues by assignee
-    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
-      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId()))
-      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "assignees");
-    // My unresolved issues
-    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
-      .setProperty("filter", Long.toString(myUnresolvedIssues.getId()));
-    // False positive and won't fix issues by resolution
-    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
-      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(hiddenDebt.getId()))
-      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "resolutions");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboard.java
deleted file mode 100644 (file)
index e0024db..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.sonar.api.measures.CoreMetrics;
-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 3.0
- */
-public final class ProjectTimeMachineDashboard extends DashboardTemplate {
-
-  private static final String METRIC1 = "metric1";
-  private static final String METRIC2 = "metric2";
-  private static final String METRIC3 = "metric3";
-  private static final String METRIC4 = "metric4";
-  private static final String METRIC5 = "metric5";
-  private static final String METRIC6 = "metric6";
-  private static final String METRIC7 = "metric7";
-  private static final String METRIC8 = "metric8";
-
-  @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, CoreMetrics.COMPLEXITY_KEY);
-    timelineWidget.setProperty(METRIC2, CoreMetrics.TECHNICAL_DEBT_KEY);
-    timelineWidget.setProperty(METRIC3, CoreMetrics.COVERAGE_KEY);
-
-    Widget sizeTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
-    sizeTimeMachineWidget.setProperty(METRIC1, CoreMetrics.NCLOC_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINES_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC3, CoreMetrics.STATEMENTS_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILES_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC5, CoreMetrics.CLASSES_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC6, CoreMetrics.FUNCTIONS_KEY);
-    sizeTimeMachineWidget.setProperty(METRIC7, CoreMetrics.ACCESSORS_KEY);
-
-    Widget commentsTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
-    commentsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMMENT_LINES_DENSITY_KEY);
-    commentsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.COMMENT_LINES_KEY);
-    commentsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY_KEY);
-    commentsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.PUBLIC_UNDOCUMENTED_API_KEY);
-
-    Widget duplicationTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
-    duplicationTimeMachineWidget.setProperty(METRIC1, CoreMetrics.DUPLICATED_LINES_DENSITY_KEY);
-    duplicationTimeMachineWidget.setProperty(METRIC2, CoreMetrics.DUPLICATED_LINES_KEY);
-    duplicationTimeMachineWidget.setProperty(METRIC3, CoreMetrics.DUPLICATED_BLOCKS_KEY);
-    duplicationTimeMachineWidget.setProperty(METRIC4, CoreMetrics.DUPLICATED_FILES_KEY);
-  }
-
-  private void addSecondColumn(Dashboard dashboard) {
-    Widget rulesTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
-    rulesTimeMachineWidget.setProperty(METRIC1, CoreMetrics.VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC2, CoreMetrics.BLOCKER_VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CRITICAL_VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC4, CoreMetrics.MAJOR_VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC5, CoreMetrics.MINOR_VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC6, CoreMetrics.INFO_VIOLATIONS_KEY);
-    rulesTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TECHNICAL_DEBT_KEY);
-
-    Widget complexityTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
-    complexityTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMPLEXITY_KEY);
-    complexityTimeMachineWidget.setProperty(METRIC2, CoreMetrics.FUNCTION_COMPLEXITY_KEY);
-    complexityTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CLASS_COMPLEXITY_KEY);
-    complexityTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILE_COMPLEXITY_KEY);
-
-    Widget testsTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
-    testsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COVERAGE_KEY);
-    testsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINE_COVERAGE_KEY);
-    testsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.BRANCH_COVERAGE_KEY);
-    testsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.TEST_SUCCESS_DENSITY_KEY);
-    testsTimeMachineWidget.setProperty(METRIC5, CoreMetrics.TEST_FAILURES_KEY);
-    testsTimeMachineWidget.setProperty(METRIC6, CoreMetrics.TEST_ERRORS_KEY);
-    testsTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TESTS_KEY);
-    testsTimeMachineWidget.setProperty(METRIC8, CoreMetrics.TEST_EXECUTION_TIME_KEY);
-  }
-
-  private Widget addTimeMachineWidgetOnFirstColumn(Dashboard dashboard) {
-    return addTimeMachineWidget(dashboard, 1);
-  }
-
-  private Widget addTimeMachineWidgetOnSecondColumn(Dashboard dashboard) {
-    return addTimeMachineWidget(dashboard, 2);
-  }
-
-  private Widget addTimeMachineWidget(Dashboard dashboard, int columnIndex) {
-    Widget widget = dashboard.addWidget("time_machine", columnIndex);
-    widget.setProperty("displaySparkLine", "true");
-    return widget;
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/package-info.java
deleted file mode 100644 (file)
index d901586..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.dashboards;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilter.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilter.java
deleted file mode 100644 (file)
index f5fb03f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.measurefilters;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.Filter;
-import org.sonar.api.web.FilterColumn;
-import org.sonar.api.web.FilterTemplate;
-
-/**
- * Default filter for looking for user favourite resources.
- *
- * @since 3.1
- */
-public class MyFavouritesFilter extends FilterTemplate {
-  public static final String NAME = "My favourites";
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public Filter createFilter() {
-    return Filter.create()
-      .setDisplayAs(Filter.LIST)
-      .setFavouritesOnly(true)
-      .add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false))
-      .add(FilterColumn.create("name", null, FilterColumn.ASC, false))
-      .add(FilterColumn.create("date", null, FilterColumn.DESC, false));
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/ProjectFilter.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/ProjectFilter.java
deleted file mode 100644 (file)
index 19e33ac..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.measurefilters;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.Criterion;
-import org.sonar.api.web.Filter;
-import org.sonar.api.web.FilterColumn;
-import org.sonar.api.web.FilterTemplate;
-
-/**
- * Default projects filter.
- *
- * @since 3.1
- */
-public class ProjectFilter extends FilterTemplate {
-  public static final String NAME = "Projects";
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public Filter createFilter() {
-    return Filter.create()
-        .setDisplayAs(Filter.LIST)
-        .add(Criterion.createForQualifier(Qualifiers.PROJECT))
-        .add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false))
-        .add(FilterColumn.create("name", null, FilterColumn.ASC, false))
-        .add(FilterColumn.create("version", null, FilterColumn.DESC, false))
-        .add(FilterColumn.create("metric", CoreMetrics.NCLOC_KEY, FilterColumn.DESC, false))
-        .add(FilterColumn.create("metric", CoreMetrics.TECHNICAL_DEBT_KEY, FilterColumn.DESC, false))
-        .add(FilterColumn.create("date", null, FilterColumn.DESC, false));
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/measurefilters/package-info.java
deleted file mode 100644 (file)
index 4700c0a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.plugins.core.measurefilters;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/AlertsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/AlertsWidget.java
deleted file mode 100644 (file)
index c794e89..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.*;
-
-@WidgetProperties({
-  @WidgetProperty(key = "show_ok", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
-})
-@WidgetLayout(WidgetLayoutType.NONE)
-public class AlertsWidget extends CoreWidget {
-
-  public AlertsWidget() {
-    super("alerts", "Alerts", "/org/sonar/plugins/core/widgets/alerts.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/BubbleChartWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/BubbleChartWidget.java
deleted file mode 100644 (file)
index f583d6e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
-  @WidgetProperty(key = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
-  @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN)
-})
-public class BubbleChartWidget extends CoreWidget {
-  public BubbleChartWidget() {
-    super("bubble_chart", "Project File Bubble Chart", "/org/sonar/plugins/core/widgets/bubbleChart.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ComplexityWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ComplexityWidget.java
deleted file mode 100644 (file)
index d04a79d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-public class ComplexityWidget extends CoreWidget {
-
-  public ComplexityWidget() {
-    super("complexity", "Complexity", "/org/sonar/plugins/core/widgets/complexity.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java
deleted file mode 100644 (file)
index f01a23a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.AbstractRubyTemplate;
-import org.sonar.api.web.RubyRailsWidget;
-
-public abstract class CoreWidget extends AbstractRubyTemplate implements RubyRailsWidget {
-  private String id, title, templatePath;
-
-  protected CoreWidget(String id, String title, String templatePath) {
-    this.id = id;
-    this.title = title;
-    this.templatePath = templatePath;
-  }
-
-  @Override
-  public String getId() {
-    return id;
-  }
-
-  @Override
-  public String getTitle() {
-    return title;
-  }
-
-  @Override
-  protected String getTemplatePath() {
-    return templatePath;
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoverageWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoverageWidget.java
deleted file mode 100644 (file)
index 273487d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-@WidgetCategory("Tests")
-@UserRole(UserRole.USER)
-public class CoverageWidget extends CoreWidget {
-
-  public CoverageWidget() {
-    super("code_coverage", "Code coverage", "/org/sonar/plugins/core/widgets/coverage.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java
deleted file mode 100644 (file)
index d8b149c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
-  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC),
-  @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC)
-})
-public class CustomMeasuresWidget extends CoreWidget {
-  public CustomMeasuresWidget() {
-    super("custom_measures", "Custom Measures", "/org/sonar/plugins/core/widgets/custom_measures.html.erb");
-  }
-}
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
deleted file mode 100644 (file)
index 9af75bb..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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/java/org/sonar/plugins/core/widgets/DescriptionWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DescriptionWidget.java
deleted file mode 100644 (file)
index 89baad4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.WidgetLayout;
-import org.sonar.api.web.WidgetLayoutType;
-
-@WidgetLayout(WidgetLayoutType.NONE)
-public class DescriptionWidget extends CoreWidget {
-
-  public DescriptionWidget() {
-    super("description", "Description", "/org/sonar/plugins/core/widgets/description.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java
deleted file mode 100644 (file)
index 38a6a50..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-
-
-public class DocumentationCommentsWidget extends CoreWidget {
-
-  public DocumentationCommentsWidget() {
-    super("documentation_comments", "Documentation Metrics", "/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DuplicationsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DuplicationsWidget.java
deleted file mode 100644 (file)
index 30371c0..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-/**
- * @author Patroklos PAPAPETROU
- */
-
-public class DuplicationsWidget extends CoreWidget {
-
-  public DuplicationsWidget() {
-    super("duplications", "Duplications", "/org/sonar/plugins/core/widgets/duplications_widget.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/EventsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/EventsWidget.java
deleted file mode 100644 (file)
index 8cf081d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-public class EventsWidget extends CoreWidget {
-
-  public EventsWidget() {
-    super("events", "Events", "/org/sonar/plugins/core/widgets/events.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java
deleted file mode 100644 (file)
index 11986e6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory({ "Hotspots" })
-@WidgetProperties({
-        @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
-        @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-        @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5")
-})
-public class HotspotMetricWidget extends CoreWidget {
-  public HotspotMetricWidget() {
-    super("hotspot_metric", "Metric hotspot", "/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ItCoverageWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ItCoverageWidget.java
deleted file mode 100644 (file)
index 98f4387..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-@WidgetCategory("Tests")
-@UserRole(UserRole.USER)
-public class ItCoverageWidget extends CoreWidget {
-
-  public ItCoverageWidget() {
-    super("it-coverage", "Integration Test Coverage", "/org/sonar/plugins/core/widgets/it_coverage.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ProjectFileCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/ProjectFileCloudWidget.java
deleted file mode 100644 (file)
index f712e68..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, options = "type:PERCENT"),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class ProjectFileCloudWidget extends CoreWidget {
-  public ProjectFileCloudWidget() {
-    super("project_file_cloud", "Project File Word Cloud", "/org/sonar/plugins/core/widgets/project_file_cloud.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/SizeWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/SizeWidget.java
deleted file mode 100644 (file)
index b3330c7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-public class SizeWidget extends CoreWidget {
-
-  public SizeWidget() {
-    super("size", "Size metrics", "/org/sonar/plugins/core/widgets/size.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtPyramidWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtPyramidWidget.java
deleted file mode 100644 (file)
index d1c2bcf..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 TechnicalDebtPyramidWidget extends CoreWidget {
-
-  public TechnicalDebtPyramidWidget() {
-    super("technical_debt_pyramid", "Technical Debt Pyramid", "/org/sonar/plugins/core/widgets/technical_debt_pyramid.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java
deleted file mode 100644 (file)
index 7a494b4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory("History")
-@WidgetProperties({
-  @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"),
-  @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN),
-  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
-})
-public class TimeMachineWidget extends CoreWidget {
-  public TimeMachineWidget() {
-    super("time_machine", "History Table", "/org/sonar/plugins/core/widgets/time_machine.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
deleted file mode 100644 (file)
index 26533d2..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory("History")
-@WidgetProperties({
-    @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-    @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-    @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-    @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-    @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN),
-    @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "180")
-})
-public class TimelineWidget extends CoreWidget {
-  public TimelineWidget() {
-    super("timeline", "Timeline", "/org/sonar/plugins/core/widgets/timeline.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java
deleted file mode 100644 (file)
index e0787c4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.measures.CoreMetrics;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
-    options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
-  @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55"),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class TreemapWidget extends CoreWidget {
-  public TreemapWidget() {
-    super("treemap-widget", "Treemap of Components", "/org/sonar/plugins/core/widgets/treemap.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WelcomeWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WelcomeWidget.java
deleted file mode 100644 (file)
index 936e8cd..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.WidgetScope;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetScope(GLOBAL)
-public class WelcomeWidget extends CoreWidget {
-
-  public static final String ID = "welcome";
-
-  public WelcomeWidget() {
-    super(ID, "Welcome", "/org/sonar/plugins/core/widgets/welcome.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WidgetConstants.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WidgetConstants.java
deleted file mode 100644 (file)
index 0a74fa3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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;
-
-/**
- * Constants shared accross multiple widgets
- */
-public interface WidgetConstants {
-
-  /**
-   * Widget property option used to filter out all the metrics which keys start with "new_".
-   *
-   * @see org.sonar.api.web.WidgetProperty#options()
-   */
-  String FILTER_OUT_NEW_METRICS = "key:^(?!new_).*";
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ActionPlansWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ActionPlansWidget.java
deleted file mode 100644 (file)
index e2bee01..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.issues;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-@WidgetCategory({"Issues"})
-@WidgetProperties({
-  @WidgetProperty(key = "showResolvedIssues", type = WidgetPropertyType.BOOLEAN, defaultValue = "true")
-})
-public class ActionPlansWidget extends CoreWidget {
-  public ActionPlansWidget() {
-    super("action_plans", "Issues action plans", "/org/sonar/plugins/core/widgets/issues/action_plans.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueFilterWidget.java
deleted file mode 100644 (file)
index f02fda9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.issues;
-
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters", "Issues"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = IssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
-  @WidgetProperty(key = IssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
-          options = {"severities", "resolutions", "statuses", "rules", "tags", "projectUuids", "assignees", "reporters",
-                  "authors", "languages", "actionPlans", "createdAt"}),
-  @WidgetProperty(key = IssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class IssueFilterWidget extends CoreWidget {
-
-  public static final String FILTER_PROPERTY = "filter";
-  public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
-  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
-  public static final String ID = "issue_filter";
-
-  public IssueFilterWidget() {
-    super(ID, "Issue Filter", "/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssueTagCloudWidget.java
deleted file mode 100644 (file)
index cba0aa3..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.issues;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-import static org.sonar.api.web.WidgetScope.PROJECT;
-
-@WidgetCategory({"Issues"})
-@WidgetScope(PROJECT)
-@WidgetProperties({
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class IssueTagCloudWidget extends CoreWidget {
-
-  public IssueTagCloudWidget() {
-    super("issue_tag_cloud", "Issue Tag Cloud", "/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java
deleted file mode 100644 (file)
index f92d9ab..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.issues;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-@WidgetCategory({"Issues", "Technical Debt"})
-public class IssuesWidget extends CoreWidget {
-
-  public IssuesWidget() {
-    super("rules", "Issues and Technical Debt", "/org/sonar/plugins/core/widgets/issues/issues.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ProjectIssueFilterWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/ProjectIssueFilterWidget.java
deleted file mode 100644 (file)
index 5e45af9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.issues;
-
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-import static org.sonar.api.web.WidgetScope.PROJECT;
-
-@WidgetCategory({"Filters", "Issues"})
-@WidgetScope(PROJECT)
-@WidgetProperties({
-  @WidgetProperty(key = ProjectIssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
-  @WidgetProperty(key = ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
-          options = {"severities", "resolutions", "statuses", "rules", "tags", "assignees", "reporters", "authors",
-                  "languages", "actionPlans", "createdAt"}),
-  @WidgetProperty(key = ProjectIssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class ProjectIssueFilterWidget extends CoreWidget {
-
-  public static final String FILTER_PROPERTY = "filter";
-  public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
-  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
-  public static final String ID = "project_issue_filter";
-
-  public ProjectIssueFilterWidget() {
-    super(ID, "Project Issue Filter", "/org/sonar/plugins/core/widgets/issues/project_issue_filter.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/package-info.java
deleted file mode 100644 (file)
index 528f5fa..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.widgets.issues;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsBubbleChartWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsBubbleChartWidget.java
deleted file mode 100644 (file)
index bac5091..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-import org.sonar.plugins.core.widgets.WidgetConstants;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@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 = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
-  @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER)
-})
-public class MeasureFilterAsBubbleChartWidget extends CoreWidget {
-
-  public MeasureFilterAsBubbleChartWidget() {
-    super("measure_filter_bubble_chart", "Measure Filter as Bubble Chart", "/org/sonar/plugins/core/widgets/measures/measure_filter_bubble_chart.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java
deleted file mode 100644 (file)
index 9bb13aa..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-import org.sonar.plugins.core.widgets.WidgetConstants;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
-    options = { WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT" }),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
-})
-public class MeasureFilterAsCloudWidget extends CoreWidget {
-
-  public MeasureFilterAsCloudWidget() {
-    super("measure_filter_cloud", "Measure Filter as Cloud", "/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java
deleted file mode 100644 (file)
index 8dafd42..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-import org.sonar.plugins.core.widgets.WidgetConstants;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @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}),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "40"),
-  @WidgetProperty(key = "reverseOrder", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
-  @WidgetProperty(key = "relativeScale", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class MeasureFilterAsHistogramWidget extends CoreWidget {
-
-  public MeasureFilterAsHistogramWidget() {
-    super("measure_filter_histogram", "Measure Filter as Histogram", "/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java
deleted file mode 100644 (file)
index f3a057b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-import org.sonar.plugins.core.widgets.WidgetConstants;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@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 = "mainMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "extraMetric1", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "extraMetric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "20")
-})
-public class MeasureFilterAsPieChartWidget extends CoreWidget {
-
-  public MeasureFilterAsPieChartWidget() {
-    super("measure_filter_pie_chart", "Measure Filter as Donut Chart", "/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsTreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsTreemapWidget.java
deleted file mode 100644 (file)
index ba0c06d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-import org.sonar.api.web.WidgetScope;
-import org.sonar.plugins.core.widgets.CoreWidget;
-import org.sonar.plugins.core.widgets.WidgetConstants;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER,
-    optional = false),
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.CHART_TITLE_PROPERTY, type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
-    defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
-    defaultValue = CoreMetrics.COVERAGE_KEY,
-    options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER,
-    optional = true, defaultValue = "55", description = "Height in percents of width"),
-  @WidgetProperty(key = MeasureFilterAsTreemapWidget.MAX_ITEMS_PROPERTY, type = WidgetPropertyType.INTEGER,
-    defaultValue = "30")
-})
-public class MeasureFilterAsTreemapWidget extends CoreWidget {
-  public static final String FILTER_PROPERTY = "filter";
-  public static final String SIZE_METRIC_PROPERTY = "sizeMetric";
-  public static final String COLOR_METRIC_PROPERTY = "colorMetric";
-  public static final String HEIGHT_PERCENTS_PROPERTY = "heightInPercents";
-  public static final String CHART_TITLE_PROPERTY = "chartTitle";
-  public static final String MAX_ITEMS_PROPERTY = "maxItems";
-  public static final String ID = "measure_filter_treemap";
-
-  public MeasureFilterAsTreemapWidget() {
-    super(ID, "Measure Filter as Treemap", "/org/sonar/plugins/core/widgets/measures/measure_filter_treemap.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterListWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterListWidget.java
deleted file mode 100644 (file)
index e8b3eaf..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.measures;
-
-import org.sonar.api.web.*;
-import org.sonar.plugins.core.widgets.CoreWidget;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory({"Filters"})
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = MeasureFilterListWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false),
-  @WidgetProperty(key = MeasureFilterListWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30"),
-  @WidgetProperty(key = MeasureFilterListWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
-})
-public class MeasureFilterListWidget extends CoreWidget {
-  public static final String FILTER_PROPERTY = "filter";
-  public static final String PAGE_SIZE_PROPERTY = "pageSize";
-  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
-  public static final String ID = "measure_filter_list";
-
-  public MeasureFilterListWidget() {
-    super(ID, "Measure Filter as List", "/org/sonar/plugins/core/widgets/measure_filter_list.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/package-info.java
deleted file mode 100644 (file)
index d781bea..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.widgets.measures;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/package-info.java
deleted file mode 100644 (file)
index dc52f47..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.widgets;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_complexity_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_complexity_chart.html.erb
deleted file mode 100644 (file)
index b75db5d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<% dist_measure = measure(metric)
-   if dist_measure && !dist_measure.data.blank?
-%>
-<div id="chart_<%=metric -%>" class="chart" style="display: <%= visible ? "block" : "none" %>">
-<%
-   query="ck=distbar&c=777777&v=" + u(dist_measure.data)
-   small_size_query=query + '&w=220&h=100&fs=8&bgc=ffffff'
-   big_size_query=query + '&w=300&h=150&fs=12&bgc=CAE3F2'
-%><%= chart(small_size_query, :id => 'chart_img_' + metric, :alt => title) -%>
-
-  <script type='text/javascript'>
-  //<![CDATA[
-  new Tip('chart_img_<%=metric-%>', '<div style="width:300px;"><b><%= title -%></b><br>'+
-    '<%= chart(big_size_query, :id => 'chart_img_' + metric, :alt => title) -%></div>');
-  //]]>
-  </script>
-</div>
-<% end %>
\ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb
deleted file mode 100644 (file)
index d50c712..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<% m=measure(Metric::QUALITY_GATE_DETAILS)
-   if m && !m.data.blank?
-     details = JSON.parse m.data
-     m.alert_status = details['level']
-     raw_conditions = details['conditions']
-     conditions = []
-     missing_metric = false
-     raw_conditions.each do |condition|
-       if metric(condition['metric']).nil?
-         missing_metric = true
-       else
-         conditions << condition
-       end
-     end
-     alert_metric = metric(Metric::ALERT_STATUS)
-
-     warn_message = message('measure_filter.criteria.alert.warn')
-     error_message = message('measure_filter.criteria.alert.error')
-
-     css_class = "color_#{m.alert_status}"
-     if m.alert_status==Metric::TYPE_LEVEL_OK
-       label = "#{message('widget.alerts.no_alert')}."
-     elsif m.alert_status==Metric::TYPE_LEVEL_WARN
-       label = "#{message('widget.alerts.warnings')}"
-     else
-       label = "#{message('widget.alerts.errors')}"
-     end
--%><div class="widget <%= css_class -%>" style="color: black !important" id="quality_gate_widget_<%= widget.id -%>">
-  <div><%= format_measure(measure(Metric::ALERT_STATUS)) -%> <%= label -%></div>
-  <% if conditions.any? {|condition| condition['level'] != 'OK'} || widget_properties['show_ok'] && !conditions.empty? -%>
-    <% conditions.sort_by {|condition| [ -condition['level'].length, metric(condition['metric']).short_name] }.each do |condition|
-
-      level = condition['level']
-      condition_metric = metric(condition['metric'])
-      operator = message("quality_gates.operator.#{condition['op']}.short")
-      period = condition['period']
-      warning_value = condition['warning']
-      error_value = condition['error']
-      actual_value = condition['actual']
-
-      detail_measure = ProjectMeasure.new :metric => alert_metric, :alert_status => level
-
-      drilldown_url = period.blank? ? url_for_drilldown(condition_metric) : url_for_drilldown(condition_metric, :period => period)
-
-      actual_measure = ProjectMeasure.new :metric => condition_metric, :value => actual_value, :alert_status => level
-      warning_measure = ProjectMeasure.new :metric => condition_metric, :value => warning_value
-      error_measure = ProjectMeasure.new :metric => condition_metric, :value => error_value
-
-      is_difference_measure = condition_metric.name.start_with?('new_')
-      is_issue_measure = get_issue_metrics.include? condition_metric.name
-      is_not_difference_measure_with_period = !is_difference_measure && !period.blank? && !is_issue_measure
-
-      tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
-
-
-      unless level == 'OK' && !widget_properties['show_ok']
-      -%>
-      <div class="dashbox" style="margin: 10px; vertical-align: baseline">
-        <p class="title"><%= condition_metric.short_name -%></p>
-        <% if is_not_difference_measure_with_period %>
-          <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure) -%></span>
-        <% else %>
-          <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure, :url => drilldown_url) -%></span>
-        <% end %>
-        <% if level == 'WARN' -%><%= operator -%> <%= format_measure(warning_measure) -%><% end -%>
-        <% if level == 'ERROR' -%><%= operator -%> <%= format_measure(error_measure) -%><% end -%>
-        <% if level == 'OK' -%>
-          <% unless warning_value.blank? -%><%= warn_message -%> <%= operator -%> <%= format_measure(warning_measure) -%> <%= '|' unless error_value.blank? -%><% end -%>
-          <% unless error_value.blank? -%><%= error_message -%> <%= operator -%> <%= format_measure(error_measure) -%><% end -%>
-        <% end -%>
-        <p><%= period_label(@snapshot, period) unless period.blank? -%></p>
-      </div>
-    <% end
-     end
-   end
-   if missing_metric -%>
-   <div class="warning" style="clear: left"><%= message('widget.alerts.missing_metric') -%></div>
-   <% end -%>
-</div>
-<% else -%>
-<% m=measure(Metric::ALERT_STATUS)
-   if m && !m.alert_status.blank?
-     css_class = "widget color_#{m.alert_status}"
-     if m.alert_status==Metric::TYPE_LEVEL_OK
-       label = "<b>#{message('widget.alerts.no_alert')}</b>."
-     elsif m.alert_status==Metric::TYPE_LEVEL_WARN
-       label = "<b>#{message('widget.alerts.warnings')}</b>#{h(m.alert_text)}."
-     else
-       label = "<b>#{message('widget.alerts.errors')}</b>#{h(m.alert_text)}."
-     end
--%><div class="<%= css_class -%>" id="alerts_widget">
-  <div><%= format_measure(m) -%> <%= label -%></div>
-</div>
-<% end
-end -%>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb
deleted file mode 100644 (file)
index e018819..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<%
-   containerId = 'bubble-chart-widget' + widget.id.to_s
-   xMetric = widget_properties["xMetric"]
-   yMetric = widget_properties["yMetric"]
-   sizeMetric = widget_properties["sizeMetric"]
-   xLog = !!widget_properties["xLogarithmic"]
-   yLog = !!widget_properties["yLogarithmic"]
-   chartHeight = widget_properties["chartHeight"]
-   chartTitle = widget_properties["chartTitle"]
-%>
-
-<div class="bubble-chart-widget" id="<%= containerId %>">
-    <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-    <!--[if (gte IE 9)|!(IE)]><!-->
-    <% if chartTitle %>
-      <h3><%= h(chartTitle) -%></h3>
-    <% end %>
-    <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    <%
-       filter = MeasureFilter.new
-       # Test files should not be returned
-       qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
-       filter.criteria = {:qualifiers => qualifiers, :base => @project.key}
-       filter.metrics = [xMetric.name, yMetric.name, sizeMetric.name]
-       filter.execute(self, :user => current_user)
-    %>
-
-    var data = {
-          metrics: {
-            <%= xMetric.name -%>: {
-              name: '<%= xMetric.short_name -%>'
-            },
-            <%= yMetric.name -%>: {
-              name: '<%= yMetric.short_name -%>'
-            },
-            <%= sizeMetric.name -%>: {
-              name: '<%= sizeMetric.short_name -%>'
-            }
-          },
-          components: [
-            <%
-            filter.rows.each  do |row|
-              x = row.measure(xMetric)
-              y = row.measure(yMetric)
-              size = row.measure(sizeMetric)
-            %>
-            {
-              key: '<%= escape_javascript row.resource.key -%>',
-              name: '<%= escape_javascript row.resource.name -%>',
-              longName: '<%= escape_javascript row.resource.long_name -%>',
-              qualifier: '<%= escape_javascript row.resource.qualifier -%>',
-              measures: {
-                <%= xMetric.name -%>: { val: <%= x ? x.value : 0 -%>, fval: '<%= x ? x.formatted_value : "-" -%>' },
-                <%= yMetric.name -%>: { val: <%= y ? y.value : 0 -%>, fval: '<%= y ? y.formatted_value : "-" -%>' },
-                <%= sizeMetric.name -%>: { val: <%= size ? size.value : 0 -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
-              }
-            },
-            <% end %>
-          ]
-        },
-        widget = new SonarWidgets.BubbleChart();
-
-    widget
-      .metrics(data.metrics)
-      .metricsPriority(['<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'])
-      .components(data.components)
-      .height(<%= chartHeight -%>)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index',
-        xLog: <%= xLog -%>,
-        yLog: <%= yLog -%>,
-        noData: '<%= message('no_data') -%>',
-        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb
deleted file mode 100644 (file)
index 62832d2..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<%
-   file_complexity=measure('file_complexity')
-   function_complexity=measure('function_complexity')
-   class_complexity=measure('class_complexity')
-
-   if file_complexity || function_complexity || class_complexity
-     complexity=measure('complexity')
-%>
-
-  <div class="widget-row">
-    <div class="widget-span widget-span-5">
-      <div class="widget-measure-container">
-        <% if complexity %>
-          <p class="widget-measure widget-measure-main">
-            <span class="widget-label"><%= message('metric.complexity.name') %></span>
-            <span class="nowrap">
-              <%= format_measure(complexity, :url => url_for_drilldown(complexity)) %>
-              <%= format_variation(complexity) if dashboard_configuration.selected_period? -%>
-            </span>
-          </p>
-        <% end %>
-        <% if function_complexity %>
-          <p class="widget-measure">
-            <span class="widget-label"><%= message('widget.complexity.per_method.suffix') %></span>
-            <span class="nowrap">
-              <%= format_measure(function_complexity, :url => url_for_drilldown(function_complexity)) %>
-              <%= format_variation(function_complexity) if dashboard_configuration.selected_period? -%>
-            </span>
-          </p>
-        <% end %>
-        <% if class_complexity %>
-          <p class="widget-measure">
-            <span class="widget-label"><%= message('widget.complexity.per_class.suffix') %></span>
-            <span class="nowrap">
-              <%= format_measure(class_complexity, :url => url_for_drilldown(class_complexity)) %>
-                <%= format_variation(class_complexity) if dashboard_configuration.selected_period? -%>
-            </span>
-          </p>
-        <% end %>
-        <% if file_complexity %>
-          <p class="widget-measure">
-            <span class="widget-label"><%= message('widget.complexity.per_file.suffix') %></span>
-            <span class="nowrap">
-              <%= format_measure(file_complexity, :url => url_for_drilldown(file_complexity)) %>
-                <%= format_variation(file_complexity) if dashboard_configuration.selected_period? -%>
-            </span>
-          </p>
-        <% end %>
-      </div>
-    </div>
-
-    <div class="widget-span widget-span-7">
-      <%
-         function_distribution=measure('function_complexity_distribution')
-         class_distribution=measure('class_complexity_distribution')
-         file_distribution=measure('file_complexity_distribution')
-         distributions=[function_distribution, class_distribution, file_distribution].compact
-         selected_distribution=nil
-         if distributions.size>0
-           selected_distribution=distributions.first
-         end
-         if selected_distribution
-      %>
-        <div class="dashbox" id="cmp_charts">
-          <script type='text/javascript'>
-            //<![CDATA[
-            function selectComplexity(metric) {
-              $j('#cmp_charts .chart').hide();
-              $j('#chart_' + metric).show();
-            }
-          </script>
-          <style>
-            #cmp_charts form {
-              font-size: 93%; padding-left: 30px;
-            }
-
-            #cmp_charts form label {
-              padding-right: 5px;
-            }
-          </style>
-          <% distributions.each do |distribution_measure| %>
-            <%= render :partial => 'project/widgets/complexity_chart', :locals => {:metric => distribution_measure.metric.key, :title => distribution_measure.metric.description, :visible => (selected_distribution==distribution_measure)} %>
-          <% end %>
-
-          <form>
-            <%
-               count_dist=0
-               if function_distribution
-                 count_dist+=1
-            %>
-              <input type="radio" name="cmp_dist" value="function_complexity_distribution" id="cmp_dist_function_complexity_distribution" onClick="selectComplexity('function_complexity_distribution');" <%= 'checked' if function_distribution==selected_distribution -%>/>
-              <label for="cmp_dist_function_complexity_distribution"><%= message('metric.functions.name') -%></label>
-            <%
-               end
-               if class_distribution
-                 count_dist+=1
-            %>
-              <input type="radio" name="cmp_dist" value="class_complexity_distribution" id="cmp_dist_class_complexity_distribution" onClick="selectComplexity('class_complexity_distribution');" <%= 'checked' if class_distribution==selected_distribution -%>/>
-              <label for="cmp_dist_class_complexity_distribution"><%= message('metric.classes.name') -%></label><%= '<br/>' if count_dist==2 %>
-            <%
-               end
-               if file_distribution
-                 count_dist+=1
-            %>
-              <input type="radio" name="cmp_dist" value="file_complexity_distribution" id="cmp_dist_file_complexity_distribution" onClick="selectComplexity('file_complexity_distribution');" <%= 'checked' if file_distribution==selected_distribution -%>/>
-              <label for="cmp_dist_file_complexity_distribution"><%= message('metric.files.name') -%></label>
-            <% end %>
-
-          </form>
-
-        </div>
-      <% end %>
-    </div>
-  </div>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb
deleted file mode 100644 (file)
index e293cfa..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<%
-   code_coverage_measure=measure('coverage')
-   tests_measure=measure('tests')
-   execution_time=measure('test_execution_time')
-   success_percentage=measure('test_success_density')
-
-   if code_coverage_measure || tests_measure
-%>
-  <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('widget.code_coverage.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown('coverage'), :default => '-') %>
-            <%= format_variation(code_coverage_measure) if dashboard_configuration.selected_period? -%>
-          </span>
-        </div>
-        <%
-           line_coverage=measure('line_coverage')
-           if line_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
-            <span class="nowrap">
-              <%= format_measure(line_coverage, :url => url_for_drilldown('uncovered_lines', :highlight => 'line_coverage')) %>
-              <%= format_variation(line_coverage) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-        <% end %>
-        <%
-           branch_coverage=measure('branch_coverage')
-           if branch_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
-            <span class="nowrap">
-              <%= format_measure(branch_coverage, :url => url_for_drilldown('uncovered_conditions', :highlight => 'branch_coverage')) %>
-              <%= format_variation(branch_coverage) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-        <% end %>
-
-        <%
-           if dashboard_configuration.selected_period?
-             new_lines_to_cover_measure=measure('new_lines_to_cover')
-             if new_lines_to_cover_measure
-               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
-               if new_lines
-                 new_coverage=measure('new_coverage') if variation_value('new_coverage')
-                 new_line_coverage=measure('new_line_coverage') if variation_value('new_line_coverage')
-                 new_branch_coverage=measure('new_branch_coverage') if variation_value('new_branch_coverage')
-        %>
-              <% if new_lines.to_i==0 %>
-                <div class="widget-measure widget-measure-main">
-                  <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
-                  <p><%= message('widget.code_coverage.no_new_lines_to_cover') -%></p>
-                </div>
-               <% else %>
-                <% if new_coverage %>
-                  <div class="widget-measure widget-measure-main">
-                    <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
-                    <%= format_measure(new_coverage,
-                                       :period => dashboard_configuration.period_index,
-                                       :url => url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index)) %>
-                  </div>
-                <% end %>
-                <% if new_line_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
-                    <%= format_measure(new_line_coverage,
-                                       :period => dashboard_configuration.period_index,
-                                       :url => url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index),
-                                       :default => '-') %>
-                  </div>
-                <% end %>
-                <% if new_branch_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
-                    <%= format_measure(new_branch_coverage,
-                                       :period => dashboard_configuration.period_index,
-                                       :url => url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index),
-                                       :default => '-') %>
-                  </div>
-                <% end %>
-              <% end %>
-            <%
-               end
-               end
-               end
-            %>
-      </div>
-    </div>
-    <div class="widget-span widget-span-6">
-      <%
-         if tests_measure
-      %>
-        <div class="widget-measure-container">
-          <div class="widget-measure widget-measure-main">
-            <span class="widget-label"><%= message('widget.code_coverage.test_success') -%></span>
-            <span class="nowrap">
-              <%= format_measure(success_percentage, :url => url_for_drilldown(success_percentage)) %>
-              <%= format_variation(success_percentage) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.failures.suffix') -%></span>
-            <span class="nowrap">
-              <%= format_measure(Metric::TEST_FAILURES, :url => url_for_drilldown(Metric::TEST_FAILURES)) %>
-              <%= format_variation(Metric::TEST_FAILURES) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.errors.suffix') -%></span>
-            <span class="nowrap">
-              <%= format_measure(Metric::TEST_ERRORS, :url => url_for_drilldown(Metric::TEST_ERRORS)) %>
-              <%= format_variation(Metric::TEST_ERRORS) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.tests.suffix') -%></span>
-            <span class="nowrap">
-              <%= format_measure(tests_measure, :url => url_for_drilldown('tests')) %>
-              <%= format_variation(tests_measure) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-
-          <% skipped_measure=measure(Metric::SKIPPED_TESTS)
-             if dashboard_configuration.selected_period? || (skipped_measure && skipped_measure.value && skipped_measure.value>0)
-          %>
-            <div class="widget-measure">
-              <span class="widget-label"><%= message('widget.code_coverage.skipped.suffix') -%></span>
-              <span class="nowrap">
-                <%= format_measure(skipped_measure, :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %>
-                <%= format_variation(skipped_measure) if dashboard_configuration.selected_period? -%>
-              </span>
-            </div>
-          <% end %>
-
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.code_coverage.execution_time') -%></span>
-            <span class="nowrap">
-              <%= format_measure(execution_time, :url => url_for_drilldown('test_execution_time')) %>
-              <%= format_variation(execution_time) if dashboard_configuration.selected_period? -%>
-            </span>
-          </div>
-        </div>
-      <% end %>
-    </div>
-  </div>
-<% end %>
-
-
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
deleted file mode 100644 (file)
index c817403..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<%
-   measures=[]
-   (1..10).each do |index|
-     metric=widget_properties["metric#{index}"]
-     m=(metric ? measure(metric) : nil)
-     measures << m if m
-   end
-   period = params[:period]
-   unless measures.empty? || measures.none? { |measure| measure.visible?(period.to_i) }
-%>
-  <div class="widget-row">
-    <%
-       measures.each do |measure|
-         if measure.visible?(period.to_i)
-    -%>
-        <div class="widget-span widget-span-3">
-          <div class="widget-measure-container">
-            <p class="widget-measure widget-measure-main">
-              <span class="widget-label"><%= measure.metric.short_name -%></span>
-              <span class="nowrap">
-                <% if measure.value.nil? && measure.text_value.nil? -%>
-                  <%= format_measure(measure, :url => url_for_drilldown(measure, :period => period), :period => period) -%>
-                <% else %>
-                  <%= format_measure(measure, :url => url_for_drilldown(measure)) -%>
-                  <%= format_variation(measure) if dashboard_configuration.selected_period? -%>
-                <% end -%>
-              </span>
-            </p>
-          </div>
-        </div>
-      <%
-         end
-         end
-      -%>
-  </div>
-<% end %>
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
deleted file mode 100644 (file)
index 87cceb5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<%
-   sqale_rating = @snapshot.measure('sqale_rating')
-   sqale_debt_ratio = @snapshot.measure('sqale_debt_ratio')
-   if sqale_rating && sqale_rating.text_value && sqale_debt_ratio
-%>
-  <% 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">
-              <%= format_measure(sqale_rating, :url => url_for_drilldown(sqale_rating)) %>
-            </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)) %>
-            <%= format_variation(sqale_debt_ratio) if dashboard_configuration.selected_period? -%>
-          </span>
-        </div>
-      </div>
-    </div>
-    </div>
-  <% end %>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb
deleted file mode 100644 (file)
index 6d58779..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<div class="widget">
-  <h3 class="description-widget-project">
-    <i class="icon-qualifier-<%= @project.qualifier.downcase -%>"></i>
-    <%= @project.name -%>
-  </h3>
-  <span class="description-widget-key"><%= h @project.key -%></span>
-
-  <% if @project.description.present? %>
-    <p class="description-widget-description"><%= h @project.description -%></p>
-  <% end %>
-
-  <%
-     qprofiles_measure = measure(Metric::QUALITY_PROFILES)
-     if qprofiles_measure && !qprofiles_measure.data.blank?
-       qprofiles = JSON.parse qprofiles_measure.data
-       if qprofiles.size>0
-  %>
-    <p class="description-widget-description">
-      <%= message('widget.description.profiles') -%>:
-      <% qprofiles.each_with_index do |profile, i| %>
-        <span class="nowrap">
-          <span id="resource_profile">
-           <%= link_to profile['name'], {:controller => 'profiles', :action => 'show', :key => profile['key']}, :class => 'widget-link', :id => profile['language'] + '_profile_link' -%>
-          </span>
-          <span class="subtitle">
-            (<%= Api::Utils.language_name(profile['language']) -%>)
-          </span>
-          <% if i < (qprofiles.size - 1) %>,<% end %>
-        </span>
-      <%   end
-         end %>
-    </p>
-  <%
-     else
-       profile_measure=@snapshot.measure('profile')
-       if profile_measure
-  %>
-      <p class="description-widget-description">
-        <%= message('widget.description.profile') -%>:
-        <span id="resource_profile">
-          <%= link_to profile_measure.data, {:controller => 'profiles', :action => 'show', :id => profile_measure.value.to_i}, :class => 'widget-link', :id => 'profile_link' -%>
-        </span>
-      </p>
-    <% end
-       end %>
-
-  <%
-     unless @resource.qualifier == 'DEV' or @resource.qualifier == 'VW' or @resource.qualifier == 'SVW'
-       using_default=false
-       quality_gate=Property.value('sonar.qualitygate', @resource && @resource.id, nil)
-       unless quality_gate
-         quality_gate=Property.value('sonar.qualitygate', nil, nil)
-         using_default=false || quality_gate
-       end
-       if quality_gate
-         qgate = Internal.quality_gates.get(quality_gate.to_i)
-  %>
-    <p class="description-widget-description">
-      <span id="resource_qgate">
-        <%= message('widget.description.qualitygate') -%>:
-        <%= link_to qgate.getName(), (url_for :controller => '/quality_gates') + '#show/' + quality_gate, :class => 'widget-link', :id => 'qgate_link' -%>
-        <% if using_default %>
-          <span class="subtitle">(<%= message('default') -%>)</span>
-        <% end %>
-      </span>
-    </p>
-  <% end end %>
-
-  <% unless @project.project_links.empty? %>
-    <ul class="description-widget-links">
-      <% @project.project_links.sort.each do |link| %>
-        <li>
-          <% if link.href.starts_with?('http') %>
-            <a class="widget-link link-<%= h link.link_type -%>" target="_blank" href="<%= link.href -%>">
-              <i class="icon-<%= h link.link_type -%>"></i>
-              <%= h link.name -%>
-            </a>
-          <% else %>
-            <a class="widget-link link-<%= h link.link_type -%>" href="#" onclick="$j('#link_<%= link.id -%>').toggle();return false;">
-              <i class="icon-<%= h link.link_type -%>"></i>
-              <%= h(link.name) -%>
-            </a>
-
-            <div class="description-widget-link-data" id="link_<%= link.id -%>" style="display:none"><%= h(link.href) -%></div>
-          <% end %>
-        </li>
-      <% end %>
-    </ul>
-  <% end %>
-</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
deleted file mode 100644 (file)
index 06423d5..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<%
-  if measure(Metric::LINES) || measure(Metric::NCLOC)
-    public_api=measure('public_api')
-    public_documented_api_density=measure('public_documented_api_density')
-    public_undocumented_api=measure('public_undocumented_api')
-    comment_lines=measure('comment_lines')
-    comment_lines_density=measure('comment_lines_density')
-%>
-<div class="widget-row">
-  <div class="widget-span widget-span-6">
-    <% if public_documented_api_density || public_api || public_undocumented_api %>
-    <div class="widget-measure-container">
-      <%
-        if public_documented_api_density
-      %>
-      <div class="widget-measure widget-measure-main">
-        <span class="widget-label"><%= message('widget.documentation_comments.documentation') -%></span>
-        <span class="nowrap">
-          <%= format_measure(public_documented_api_density, :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) %>
-          <%= format_variation('public_documented_api_density') if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-      <% end %>
-      <div class="widget-measure">
-        <span class="widget-label"><%= message('metric.public_api.name') -%></span>
-        <span class="nowrap">
-          <%= format_measure(public_api,:url => url_for_drilldown(public_api)) %>
-          <%= format_variation(public_api) if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-      <div class="widget-measure">
-        <span class="widget-label"><%= message('metric.public_undocumented_api.abbreviation') -%></span>
-        <span class="nowrap">
-          <%= format_measure(public_undocumented_api,:url => url_for_drilldown(public_undocumented_api)) %>
-          <%= format_variation(public_undocumented_api) if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-    </div>
-    <% end %>
-  </div>
-
-  <div class="widget-span widget-span-6">
-    <div class="widget-measure-container">
-      <div class="widget-measure widget-measure-main">
-        <span class="widget-label"><%= message('widget.documentation_comments.comments') -%></span>
-        <span class="nowrap">
-          <%= format_measure(comment_lines_density,:url => url_for_drilldown(comment_lines_density))%>
-          <%= format_variation(comment_lines_density) if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-      <div class="widget-measure">
-        <span class="widget-label"><%= message('metric.comment_lines.name') -%></span>
-        <span class="nowrap">
-          <%= format_measure(comment_lines,:url => url_for_drilldown(comment_lines)) %>
-          <%= format_variation(comment_lines) if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-    </div>
-  </div>
-</div>
-<%
-  end
-%>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb
deleted file mode 100644 (file)
index 99b487a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<%
-  duplicated_lines_density=measure('duplicated_lines_density')
-  if duplicated_lines_density
-%>
-<div class="widget-row">
-  <div class="widget-span widget-span-12">
-    <div class="widget-measure widget-measure-main">
-      <span class="widget-label"><%= message('widget.duplications.duplications') -%></span>
-      <span class="nowrap">
-        <%= format_measure(duplicated_lines_density, :url => url_for_drilldown('duplicated_lines', :highlight =>  'duplicated_lines_density')) %>
-        <%= format_variation('duplicated_lines_density') if dashboard_configuration.selected_period? -%>
-      </span>
-    </div>
-
-    <div class="widget-measure">
-      <span class="widget-label"><%= message('widget.duplications.lines.suffix') -%></span>
-      <span class="nowrap">
-        <%= format_measure(measure('duplicated_lines'), :url => url_for_drilldown('duplicated_lines'))%>
-        <%= format_variation('duplicated_lines') if dashboard_configuration.selected_period? -%>
-      </span>
-    </div>
-
-    <div class="widget-measure">
-      <span class="widget-label"><%= message('widget.duplications.blocks.suffix') -%></span>
-      <span class="nowrap">
-        <%= format_measure(measure('duplicated_blocks'), :url => url_for_drilldown('duplicated_blocks'))%>
-        <%= format_variation('duplicated_blocks') if dashboard_configuration.selected_period? -%>
-      </span>
-    </div>
-
-    <div class="widget-measure">
-      <span class="widget-label"><%= message('widget.duplications.files.suffix') -%></span>
-      <span class="nowrap">
-        <%= format_measure(measure('duplicated_files'), :url => url_for_drilldown('duplicated_files'))%>
-        <%= format_variation('duplicated_files') if dashboard_configuration.selected_period? -%>
-      </span>
-    </div>
-
-  </div>
-</div>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/events.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/events.html.erb
deleted file mode 100644 (file)
index d6be1d2..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<% 
-  if @resource.scope=='PRJ'
-
-    conditions = "component_uuid=:component_uuid"
-    values = {:component_uuid => @resource.uuid}
-    # in order to not display events linked to deleted snapshot, we build the SQL request with 'NOT IN' as most of the time, there won't be unprocessed snapshots
-    snapshots_to_be_deleted = Snapshot.find(:all, :conditions => ["status='U' AND project_id=?", @resource.id])
-    unless snapshots_to_be_deleted.empty?
-      conditions << " AND snapshot_id NOT IN (:sids)"
-      values[:sids] = snapshots_to_be_deleted.map { |s| s.id }
-    end
-
-    events=Event.find(:all, :conditions => [conditions, values], :order => 'event_date desc')
-    
-    categories = EventCategory.categories(true)
-%>
-
-<script type="text/javascript">
-  function changeCategory(categoryId, widgetId) {
-    var eventTableMaxSize = 8;
-    $j('#events_' + widgetId + ' tr.event').hide();
-    var elements;
-    if (categoryId=='all') {
-      elements = $j('#events_' + widgetId + ' tr.event');
-    } else {
-      elements = $j('#events_' + widgetId + ' tr.cat_' + categoryId);
-    }
-    var elementsToDisplay = elements.slice(0,eventTableMaxSize);
-    if (elementsToDisplay.size()==0) {
-      $j('#events_' + widgetId).hide();
-      $j('#show_more_events_' + widgetId).hide();
-      $j('#no_event_message_' + widgetId).show();
-    } else {
-      $j('#events_' + widgetId).show();
-      $j('#no_event_message_' + widgetId).hide();
-      elementsToDisplay.show();
-      if (elements.size() > eventTableMaxSize) {
-        $j('#show_more_events_' + widgetId).show();
-      } else {
-        $j('#show_more_events_' + widgetId).hide();
-      }
-    }
-  }
-
-  function showAllEvents(widgetId) {
-    var selectedCategory = $j('#select_category_' + widgetId).val();
-    if (selectedCategory=='all') {
-      $j('#events_' + widgetId + ' tr.event').show();
-    } else {
-      $j('#events_' + widgetId + ' tr.cat_' + selectedCategory).show();
-    }
-    $j('#show_more_events_' + widgetId).hide();
-  }
-</script>
-
-
-<h3><%= message('widget.events.title') -%> &nbsp;&nbsp;
-
-  <select class="small" id="select_category_<%= widget.id -%>" onchange="changeCategory(this.value, <%= widget.id -%>);">
-    <option value="all"><%= message('widget.events.all') -%></option>
-    <% categories.each do |categ| %>
-    <option value="<%= categ.name.parameterize -%>"><%= h message('event.category.' + categ.name, :default => categ.name) %></option>
-    <% end %>
-  </select>
-
-  <script>
-    $j(function() {
-      $j('#select_category_<%= widget.id -%>').select2({ width: '150px' });
-    });
-  </script>
-
-</h3>
-
-<table id="events_<%= widget.id -%>" class="spaced data">
-  <thead>
-    <tr>
-      <th colspan="4"></th>
-    </tr>
-  </thead>
-  
-  <tbody>
-<%
-   events.each do |event|
-     categ = event.category
-     profile_data={}
-     if categ=='Profile' && event.event_data
-       profile_data=Hash[*(event.event_data.split(';').map { |elt| elt.split('=') }.flatten)]
-     end
-%>
-<tr class="<%= cycle 'even','odd' -%> event cat_<%= categ.parameterize -%>">
-    <td x="<%= event.event_date -%>"><%= l(event.event_date.to_date) %></td>
-    <td><%= h message('event.category.' + categ, :default => categ) %></td>
-    <td>
-      <%= link_to_if profile_data['key'] && profile_data['from'] && profile_data['to'], event.name,
-                             :controller => 'profiles', :action => 'changelog', :key => profile_data['key'],
-                             :since =>  profile_data['from'], :to => profile_data['to'] -%>
-    </td>
-    <td>
-      <% unless event.description.blank? %>
-        <i class="icon-info" title="<%= h event.description -%>"></i>
-      <% end %>
-    </td>
-</tr>
-<%
-   end
-%>
-  </tbody>
-</table>
-
-<div id="no_event_message_<%= widget.id -%>" style="margin: 5px">
-  <span class="empty_widget"><%= message('widget.events.no_event') -%></span>
-</div>
-
-<a href="#" onclick="showAllEvents(<%= widget.id -%>);return false;" id="show_more_events_<%= widget.id -%>" class="action"><%= message('widget.events.show_all') -%></a>
-
-<script type="text/javascript">
-  changeCategory('all', <%= widget.id -%>);
-</script>
-
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb
deleted file mode 100644 (file)
index bf28727..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<%
-   metric = widget_properties["metric"] || Metric.by_key('ncloc')
-
-   if measure(metric)
-
-     limit = widget_properties["numberOfLines"]
-     title = widget_properties["title"]
-     title = message('widget.hotspot_metric.hotspots_by_x', :params => metric.short_name) if title.blank?
-
-     snapshots = nil
-     if metric.numeric? && !@snapshot.leaves_qualifiers.empty?
-       snapshots_conditions=["snapshots.qualifier in (:qualifiers)", "snapshots.islast=:islast", "snapshots.status = 'P'"]
-       snapshots_values={:qualifiers => @snapshot.leaves_qualifiers, :islast => true}
-       snapshots_conditions << '(snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path)'
-       snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id)
-       snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%"
-
-       measures_conditions = ["project_measures.rule_id IS NULL", "project_measures.characteristic_id IS NULL", "project_measures.person_id IS NULL"]
-       measures_values = {}
-       measures_conditions << "project_measures.metric_id = :m_id"
-       measures_values[:m_id] = metric.id
-
-       measures=ProjectMeasure.find(:all,
-                                    :joins => :snapshot,
-                                    :conditions => [(snapshots_conditions + measures_conditions).join(' AND '), snapshots_values.merge(measures_values)],
-                                    :order => "project_measures.value #{'DESC' if metric.direction<0}",
-                                    :limit => limit)
-
-       snapshots=Snapshot.find(measures.map { |m| m.snapshot_id }, :include => 'project')
-       snapshots_by_id = {}
-       snapshots.each do |s|
-         snapshots_by_id[s.id]=s
-       end
-     end
-
-     unless snapshots && !snapshots.empty? %>
-    <h3><%= title -%></h3>
-    <span class="empty_widget"><%= message('no_results') -%></span>
-  <% else %>
-
-    <div class="line-block">
-      <div style="float:right">
-        <a class="underlined-link" href="<%= url_for_drilldown(metric) -%>"><%= message('widget.hotspot_metric.more') -%></a>
-      </div>
-      <h3><%= title -%></h3>
-    </div>
-
-    <table id="hotspots-<%= metric.name -%>-<%= widget.id -%>" class="data">
-      <thead>
-      <tr>
-        <th colspan="3"/>
-      </tr>
-      </thead>
-      <tbody>
-      <%
-         if metric.direction > 0
-           metric_max_value = measures.last.value
-         else
-           metric_max_value = measures.first.value
-         end
-         measures.each do |measure|
-           resource = snapshots_by_id[measure.snapshot_id].resource
-      %>
-        <tr class="<%= cycle 'even', 'odd', :name => ('hotspot_metric' + widget.id.to_s) -%>">
-          <td>
-            <%= link_to_resource(resource, h(resource.name), {:metric => metric.name, :class => 'underlined-link'}) -%>
-          </td>
-          <td class="right nowrap">
-            <%= format_measure(measure) -%>
-          </td>
-          <td class="barchart">
-            <div class="barchart" style="width: <%= (measure.value*100/metric_max_value).round.to_i -%>%">
-              <div style="width: 100%;"></div>
-            </div>
-          </td>
-        </tr>
-      <%
-         end
-      %>
-      </tbody>
-    </table>
-
-  <% end %>
-
-<% end %>
\ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb
deleted file mode 100644 (file)
index 75553d3..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<%
-   # This widget should only be display on root projects
-   if @project.qualifier == 'TRK' && has_role?(:user, @project)
-     action_plans = Internal.issues.findActionPlanStats(@resource.key)
-     open_action_plans = action_plans.select {|plan| plan.isOpen()}
-
-     div_id = "issues-action-plan-widget-#{widget.id.to_s}"
-%>
-
-<div class="line-block">
-  <% if has_role?(:admin, @project) %>
-  <div style="float:right">
-    <a href="<%= url_for :controller => 'action_plans', :action => 'index', :id => @project.id -%>">
-      <%= message('widgets.more') -%>
-    </a>
-  </div>
-  <% end %>
-
-  <h3><%= message('widget.action_plans.title') -%></h3>
-</div>
-
-
-<div id="<%= div_id -%>">
-
-<% if open_action_plans.size ==0 %>
-
-  <span class="empty_widget"><%= message('widget.action_plans.no_action_plan') -%></span>
-
-<%
-   else
-     show_resolved_issues = widget_properties["showResolvedIssues"]
-     if show_resolved_issues
-       line_class = "top"
-     else
-       line_class = "middle"
-       max_unresolved_issues = open_action_plans.map {|plan| plan.unresolvedIssues()}.max
-     end
-%>
-
-  <table class="width100 <%= show_resolved_issues ? 'actionPlans' : 'data' -%>">
-    <thead>
-    <tr>
-      <th colspan="<%= show_resolved_issues ? '3' : '4' %>"></th>
-    </tr>
-    </thead>
-    <tbody>
-      <%
-         open_action_plans.each do |plan|
-      %>
-      <tr class="<%= show_resolved_issues ? '' : cycle("even", "odd", :name => "action_plan_" + widget.id.to_s) -%>">
-        <td class="nowrap <%= line_class -%>"><%= h(plan.name) -%></td>
-        <td class="nowrap small <%= line_class -%> <%= 'over-due' if plan.overDue() -%>" style="text-align: right; padding-left:10px"><%= format_date(plan.deadLine())  -%></td>
-
-        <% if show_resolved_issues %>
-          <% if plan.totalIssues()==0 %>
-            <td class="noprogress nowrap <%= line_class -%>"><%= message('action_plans.no_issues_linked_to_action_plan') -%></td>
-          <% else %>
-            <td class="progress <%= line_class -%>">
-              <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%>
-            </td>
-          <% end %>
-        <%
-           else
-             unresolved_issues_size = plan.unresolvedIssues()
-        %>
-          <td class="right <%= line_class -%>" style="padding-left:20px">
-            <% if unresolved_issues_size == 0 %>
-              <%= unresolved_issues_size -%>
-            <% else %>
-                <%
-                   search_options = {}
-                   search_options['actionPlans'] = plan.key
-                   search_options['resolved'] = false
-                %>
-              <a href="<%= url_for_component_issues(@project, search_options) -%>"
-                 title="<%= message('widget.action_plans.x_unresolved_issues', :params => unresolved_issues_size.to_s) -%>"><%= unresolved_issues_size -%></a>
-            <% end %>
-          </td>
-          <td class="<%= line_class -%>" style="padding: 0 40px 0 10px; width: 300px;">
-            <div class="barchart" style="width: 100%">
-              <div style="width: <%= max_unresolved_issues > 0 ? 100 * unresolved_issues_size / max_unresolved_issues : 0 -%>%;background-color:#777;"></div>
-            </div>
-          </td>
-        <% end %>
-
-      </tr>
-      <%
-         end
-      %>
-    </tbody>
-  </table>
-
-<% end %>
-
-</div>
-
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_filter.html.erb
deleted file mode 100644 (file)
index f70e79e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<%
-   container_id = 'widget-issue-filter-' + widget.id.to_s
-   filter_id = widget_properties['filter']
-   filter = Internal.issues.findIssueFilterById(filter_id.to_i)
-   distribution_axis = widget_properties['distributionAxis']
-   is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
-%>
-
-<% if filter %>
-
-  <% if is_enough_permissions %>
-
-    <% @widget_title = "<a href=\"#{url_for({:controller => 'issues', :action => 'index'})}#id=#{filter.id}\">#{h(filter.name)}</a>" %>
-    <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
-      <p class="note spacer-bottom"><%= h filter.description -%></p>
-    <% end %>
-
-    <div id="<%= container_id -%>"></div>
-    <script>
-      (function () {
-        var query = '<%= filter.data -%>';
-
-        // do not show widget if the filter contains "my" criterion,
-        // and a user is not authenticated
-        if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
-          jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
-          return;
-        }
-
-        require(['widgets/issue-filter/widget'], function (IssueFilter) {
-          window.requestMessages().done(function () {
-            new IssueFilter({
-              el: '#<%= container_id -%>',
-              query: query,
-              distributionAxis: '<%= distribution_axis -%>'
-            });
-          });
-        });
-      })();
-    </script>
-
-  <% else %>
-
-    <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
-
-  <% end %>
-
-<% else %>
-
-  <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
-
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issue_tag_cloud.html.erb
deleted file mode 100644 (file)
index 99012a2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<%
-  containerId = 'issue-tag-cloud' + widget.id.to_s
-  maxItems = widget_properties['maxItems'].to_i
-
-  if has_role?(:user, @project) && !Internal.issues.listTagsForComponent(@project.uuid, maxItems).isEmpty()
-    search_options = {
-      'resolved' => 'false'
-    }
-    if @project
-      search_options['componentUuids'] = @project.uuid
-    end
-    if @dashboard_configuration.selected_period?
-      search_options['createdAfter'] = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
-    end
-
-    title = message('widget.issue_tag_cloud.title')
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <h3 style="margin-bottom: 5px;"><%= title -%></h3>
-  <!--<![endif]-->
-
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var createdAfter = '';
-    <% if @dashboard_configuration.selected_period? -%>
-    createdAfter = moment('<%= search_options['createdAfter'] -%>').format('YYYY-MM-DD');
-    <% end -%>
-
-    var queryParams = [
-          'componentUuid=<%= @project.uuid() -%>',
-          'ps=<%= maxItems -%>',
-          'createdAfter=' + createdAfter
-        ],
-        query = queryParams.join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('TagCloud')
-      .source(baseUrl + '/api/issues/component_tags?' + query)
-      .options({
-        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
-        baseUrl: baseUrl + '/component_issues/index?id=<%= @project.key -%>#resolved=false',
-        noData: '<%= message('no_data') -%>',
-        createdAfter: createdAfter
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
deleted file mode 100644 (file)
index 0b2fe0c..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-<%
-   issues = @snapshot.measure('violations')
-   blocker_issues = @snapshot.measure('blocker_violations')
-   critical_issues = @snapshot.measure('critical_violations')
-   major_issues = @snapshot.measure('major_violations')
-   minor_issues = @snapshot.measure('minor_violations')
-   info_issues = @snapshot.measure('info_violations')
-
-   new_issues = @snapshot.measure('new_violations')
-   new_blocker_issues = @snapshot.measure('new_blocker_violations')
-   new_critical_issues = @snapshot.measure('new_critical_violations')
-   new_major_issues = @snapshot.measure('new_major_violations')
-   new_minor_issues = @snapshot.measure('new_minor_violations')
-   new_info_issues = @snapshot.measure('new_info_violations')
-
-   technical_debt = @snapshot.measure('sqale_index')
-   new_technical_debt = @snapshot.measure('new_technical_debt')
-
-   if @dashboard_configuration.selected_period?
-     period_date = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
-   end
-
-   tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
-%>
-
-<div class="widget-row">
-
-  <% if technical_debt %>
-    <div class="widget-span widget-span-3">
-      <div class="widget-measure-container">
-        <div class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('metric.sqale_index.short_name') -%></span>
-          <a href="<%= url_for_drilldown('sqale_index') -%>" class="widget-link link-<%= widget.key %>-debt"
-             title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(technical_debt) -%>
-          </a>
-          <%= format_variation(technical_debt) if dashboard_configuration.selected_period? -%>
-        </div>
-        <div class="widget-measure-delta">
-          <%
-             if @dashboard_configuration.selected_period?
-               technical_debt_variation = variation_value(technical_debt)
-               new_technical_debt_variation = variation_value(new_technical_debt)
-               estimated_cleared_technical_debt = (new_technical_debt_variation - technical_debt_variation).to_i if technical_debt_variation && new_technical_debt_variation
-          %>
-            <% if new_technical_debt_variation && new_technical_debt_variation > 0 %>
-              <p class="small">
-                <%= message('widget.rules.added') %>
-                <a href="<%= url_for_drilldown('new_technical_debt', :period => @dashboard_configuration.period_index) -%>"
-                   class="varw widget-link widget-link-red link-<%= widget.key %>-new-debt"
-                   title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_technical_debt, :style => 'none', :default => '-') -%></a>
-              </p>
-            <% end %>
-            <% if estimated_cleared_technical_debt && estimated_cleared_technical_debt > 0 %>
-              <p class="small">
-                <%= message('widget.rules.removed') %>
-                <span class="varb">-<%= Internal.i18n.formatLongDuration(estimated_cleared_technical_debt, 'SHORT') -%></span>
-              </p>
-            <% end %>
-          <% end %>
-        </div>
-      </div>
-    </div>
-  <% end %>
-
-  <div class="widget-span widget-span-3">
-    <div class="widget-measure-container">
-      <div class="widget-measure widget-measure-main">
-        <span class="widget-label"><%= message('widget.rules.issues') -%></span>
-        <span class="nowrap">
-          <span class="link-<%= widget.key %>-issues">
-            <a href="<%= "#{url_for(:controller => 'component_issues', :action => 'index')}?id=#{url_encode(@project.key)}" -%>" class="widget-link link-<%= widget.key %>-debt"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-              <%= format_measure(issues) -%>
-            </a>
-          </span>
-          <%= format_variation(issues) if dashboard_configuration.selected_period? -%>
-        </span>
-      </div>
-      <div class="widget-measure-delta">
-        <%
-           if @dashboard_configuration.selected_period?
-             issues_variation = variation_value(issues)
-             new_issues_variation = variation_value(new_issues)
-             estimated_cleared_issues = (new_issues_variation - issues_variation).to_i if issues_variation && new_issues_variation
-        %>
-          <% if new_issues_variation && new_issues_variation > 0 %>
-            <p class="small">
-              <%= message('widget.rules.added') %>
-              <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|createdAfter=<%= period_date -%>"
-                 class="varw widget-link widget-link-red link-<%= widget.key %>-new-issues"
-                 title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_issues, :style => 'none', :default => '-') -%></a>
-            </p>
-          <% end %>
-          <% if estimated_cleared_issues && estimated_cleared_issues > 0 %>
-            <p class="small">
-              <%= message('widget.rules.removed') %>
-              <span class="varb">-<%= number_with_precision(estimated_cleared_issues, :precision => 0) -%></span>
-            </p>
-          <% end %>
-        <% end %>
-      </div>
-    </div>
-  </div>
-
-  <div class="widget-span widget-span-4">
-    <table class="data widget-barchar">
-      <tr>
-        <td class="thin nowrap">
-          <i class="icon-severity-blocker"></i>
-          <%= message('blocker') -%>
-        </td>
-        <td class="thin right nowrap">
-          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER"
-             class="widget-link drilldown_BLOCKER" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(blocker_issues) -%>
-          </a>
-        </td>
-        <td class="thin nowrap">
-          <% if @dashboard_configuration.selected_period? %>
-            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER|createdAfter=<%= url_encode(period_date) -%>"
-               class="widget-link <% if variation_value(new_blocker_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-blocker-issues"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_blocker_issues, :style => 'none', :default => '-') -%></a>
-          <% end %>
-        </td>
-      </tr>
-      <tr>
-        <td class="thin nowrap">
-          <i class="icon-severity-critical"></i>
-          <%= message('critical') -%>
-        </td>
-        <td class="thin right nowrap">
-          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL"
-             class="widget-link drilldown_CRITICAL" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(critical_issues) -%>
-          </a>
-        </td>
-        <td class="thin nowrap">
-          <% if @dashboard_configuration.selected_period? %>
-            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL|createdAfter=<%= url_encode(period_date) -%>"
-               class="widget-link <% if variation_value(new_critical_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-critical-issues"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_critical_issues, :style => 'none', :default => '-') -%></a>
-          <% end %>
-        </td>
-      </tr>
-      <tr>
-        <td class="thin nowrap">
-          <i class="icon-severity-major"></i>
-          <%= message('major') -%>
-        </td>
-        <td class="thin right nowrap">
-          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR"
-             class="widget-link drilldown_MAJOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(major_issues) -%>
-          </a>
-        </td>
-        <td class="thin nowrap">
-          <% if @dashboard_configuration.selected_period? %>
-            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR|createdAfter=<%= url_encode(period_date) -%>"
-               class="widget-link <% if variation_value(new_major_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-major-issues"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_major_issues, :style => 'none', :default => '-') -%></a>
-          <% end %>
-        </td>
-      </tr>
-      <tr>
-        <td class="thin nowrap">
-          <i class="icon-severity-minor"></i>
-          <%= message('minor') -%>
-        </td>
-        <td class="thin right nowrap">
-          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR"
-             class="widget-link drilldown_MINOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(minor_issues) -%>
-          </a>
-        </td>
-        <td class="thin nowrap">
-          <% if @dashboard_configuration.selected_period? %>
-            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR|createdAfter=<%= url_encode(period_date) -%>"
-               class="widget-link <% if variation_value(new_minor_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-minor-issues"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_minor_issues, :style => 'none', :default => '-') -%></a>
-          <% end %>
-        </td>
-      </tr>
-      <tr>
-        <td class="thin nowrap">
-          <i class="icon-severity-info"></i>
-          <%= message('info') -%>
-        </td>
-        <td class="thin right nowrap">
-          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO"
-             class="widget-link drilldown_INFO" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
-            <%= format_measure(info_issues) -%>
-          </a>
-        </td>
-        <td class="thin nowrap">
-          <% if @dashboard_configuration.selected_period? %>
-            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO|createdAfter=<%= url_encode(period_date) -%>"
-               class="widget-link <% if variation_value(new_info_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-info-issues"
-               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_info_issues, :style => 'none', :default => '-') -%></a>
-          <% end %>
-        </td>
-      </tr>
-    </table>
-  </div>
-</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/project_issue_filter.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/project_issue_filter.html.erb
deleted file mode 100644 (file)
index 16edb81..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<%
-   container_id = 'widget-issue-filter-' + widget.id.to_s
-   filter_id = widget_properties['filter']
-   filter = Internal.issues.findIssueFilterById(filter_id.to_i)
-   distribution_axis = widget_properties['distributionAxis']
-   is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
-
-   if @dashboard_configuration.selected_period?
-     period_date = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
-   else
-     period_date = nil
-   end
-%>
-
-<% if filter %>
-
-  <% if is_enough_permissions %>
-
-    <% @widget_title = "<a href=\"#{url_for({:controller => 'component_issues', :action => 'index'})}?id=#{u(@project.key)}##{filter.data}\">#{h(filter.name)}</a>" %>
-    <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
-      <p class="note spacer-bottom"><%= h filter.description -%></p>
-    <% end %>
-
-    <div id="<%= container_id -%>"></div>
-    <script>
-      (function () {
-        var query = '<%= filter.data -%>';
-
-        // do not show widget if the filter contains "my" criterion,
-        // and a user is not authenticated
-        if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
-          jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
-          return;
-        }
-
-        require(['widgets/issue-filter/widget'], function (IssueFilter) {
-          window.requestMessages().done(function () {
-            new IssueFilter({
-              el: '#<%= container_id -%>',
-              query: query,
-              distributionAxis: '<%= distribution_axis -%>',
-              <% if period_date %>
-              periodDate: '<%= period_date -%>',
-              <% end %>
-              componentUuid: '<%= @project.uuid -%>',
-              componentKey: '<%= @project.key -%>'
-            });
-          });
-        });
-      })();
-    </script>
-
-  <% else %>
-
-    <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
-
-  <% end %>
-
-<% else %>
-
-  <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
-
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb
deleted file mode 100644 (file)
index 52c01fe..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<%
-   it_coverage=measure('it_coverage')
-   overall_coverage=measure('overall_coverage')
-
-   if it_coverage || overall_coverage
--%>
-  <div class="widget-row">
-
-  <% if it_coverage -%>
-    <div class="widget-span widget-span-6">
-      <div class="widget-measure-container">
-
-        <div class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('widget.it-coverage.name') -%></span>
-            <span class="nowrap">
-              <%= format_measure(it_coverage, :url => url_for_drilldown('it_coverage'), :default => '-') %>
-              <%= format_variation(it_coverage) if dashboard_configuration.selected_period? -%>
-            </span>
-        </div>
-
-        <%
-           it_line_coverage=measure('it_line_coverage')
-           if it_line_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
-              <span class="nowrap">
-                <%= format_measure(it_line_coverage, :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %>
-                <%= format_variation(it_line_coverage) if dashboard_configuration.selected_period? -%>
-              </span>
-          </div>
-        <% end %>
-
-        <%
-           it_branch_coverage=measure('it_branch_coverage')
-           if it_branch_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
-              <span class="nowrap">
-                <%= format_measure(it_branch_coverage, :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %>
-                <%= format_variation(it_branch_coverage) if dashboard_configuration.selected_period? -%>
-              </span>
-          </div>
-        <% end %>
-
-        <%
-           if dashboard_configuration.selected_period?
-             new_lines_to_cover_measure=measure('new_it_lines_to_cover')
-             if new_lines_to_cover_measure
-               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
-               if new_lines
-                 new_coverage=measure('new_it_coverage')
-                 new_line_coverage=measure('new_it_line_coverage')
-                 new_branch_coverage=measure('new_it_branch_coverage')
-        %>
-              <% if new_lines.to_i==0 %>
-                <div class="widget-measure widget-measure-main">
-                  <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
-
-                  <p><%= message('widget.it-coverage.no_new_lines_to_cover') -%></p>
-                </div>
-              <% else %>
-
-                <% if new_coverage %>
-                  <div class="widget-measure widget-measure-main">
-                    <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_coverage, :period => dashboard_configuration.period_index),
-                                           :default => '-') %>
-                      </span>
-                  </div>
-                <% end %>
-
-                <% if new_line_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_line_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_line_coverage, :period => dashboard_configuration.period_index)) %>
-                      </span>
-                  </div>
-                <% end %>
-
-                <% if new_branch_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_branch_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_branch_coverage, :period => dashboard_configuration.period_index)) %>
-                      </span>
-                  </div>
-                <% end %>
-
-              <% end %>
-
-            <% end %>
-          <% end %>
-        <% end %>
-
-      </div>
-    </div>
-  <% end %>
-
-  <% if overall_coverage -%>
-    <div class="widget-span widget-span-6">
-      <div class="widget-measure-container">
-
-        <div class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('widget.overall-coverage.name') -%></span>
-            <span class="nowrap">
-              <%= format_measure(overall_coverage, :url => url_for_drilldown('overall_coverage'), :default => '-') %>
-              <%= format_variation(overall_coverage) if dashboard_configuration.selected_period? -%>
-            </span>
-        </div>
-
-        <%
-           overall_line_coverage=measure('overall_line_coverage')
-           if overall_line_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
-              <span class="nowrap">
-                <%= format_measure(overall_line_coverage, :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
-                <%= format_variation(overall_line_coverage) if dashboard_configuration.selected_period? -%>
-              </span>
-          </div>
-        <% end %>
-
-        <%
-           overall_branch_coverage=measure('overall_branch_coverage')
-           if overall_branch_coverage
-        %>
-          <div class="widget-measure">
-            <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
-              <span class="nowrap">
-                <%= format_measure(overall_branch_coverage, :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
-                <%= format_variation(overall_branch_coverage) if dashboard_configuration.selected_period? -%>
-              </span>
-          </div>
-        <% end %>
-
-        <%
-           if dashboard_configuration.selected_period?
-             new_lines_to_cover_measure=measure('new_overall_lines_to_cover')
-             if new_lines_to_cover_measure
-               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
-               if new_lines
-                 new_coverage=measure('new_overall_coverage')
-                 new_line_coverage=measure('new_overall_line_coverage')
-                 new_branch_coverage=measure('new_overall_branch_coverage')
-        %>
-              <% if new_lines.to_i==0 %>
-                <div class="widget-measure widget-measure-main">
-                  <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
-
-                  <p><%= message('widget.overall-coverage.no_new_lines_to_cover') -%></p>
-                </div>
-              <% else %>
-
-                <% if new_coverage %>
-                  <div class="widget-measure widget-measure-main">
-                    <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_coverage, :period => dashboard_configuration.period_index),
-                                           :default => '-') %>
-                        <%= format_variation(new_coverage) if dashboard_configuration.selected_period? -%>
-                      </span>
-                  </div>
-                <% end %>
-
-                <% if new_line_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_line_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_line_coverage, :period => dashboard_configuration.period_index)) %>
-                        <%= format_variation(new_line_coverage) if dashboard_configuration.selected_period? -%>
-                      </span>
-                  </div>
-                <% end %>
-
-                <% if new_branch_coverage %>
-                  <div class="widget-measure">
-                    <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
-                      <span class="nowrap">
-                        <%= format_measure(new_branch_coverage,
-                                           :period => dashboard_configuration.period_index,
-                                           :url => url_for_drilldown(new_branch_coverage, :period => dashboard_configuration.period_index)) %>
-                        <%= format_variation(new_branch_coverage) if dashboard_configuration.selected_period? -%>
-                      </span>
-                  </div>
-                <% end %>
-
-              <% end %>
-
-            <% end %>
-          <% end %>
-        <% end %>
-
-      </div>
-    </div>
-  <% end %>
-
-  </div>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb
deleted file mode 100644 (file)
index 438c7f4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<%
-   filter_id = widget_properties['filter']
-   page_size = widget_properties['pageSize']
-   filter = MeasureFilter.find_by_id(filter_id.to_i) if filter_id
-   if filter
-     filter.load_criteria_from_data
-     if !filter.require_authentication? || logged_in?
-       filter.set_criteria_value('display', 'list')
-       filter.set_criteria_value('pageSize', page_size)
-       filter.execute(self, :user => current_user)
-       @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id}
-%>
-
-  <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
-    <div style="padding-bottom: 5px">
-      <span class="note"><%= h filter.description -%></span>
-    </div>
-  <% end %>
-
-    <%= render :partial => 'measures/display_list', :locals => {:edit_mode => false, :filter => filter, :widget_id => widget.id} -%>
-<%
-     end
-   else
-%>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<%
-   end
-%>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_bubble_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_bubble_chart.html.erb
deleted file mode 100644 (file)
index c5a2302..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<%
-   containerId = 'bubble-chart-widget' + widget.id.to_s
-   chartTitle = widget_properties["chartTitle"]
-   chartHeight = widget_properties["chartHeight"]
-   filterId = widget_properties["filter"].to_i
-   xMetric = widget_properties["xMetric"]
-   yMetric = widget_properties["yMetric"]
-   sizeMetric = widget_properties["sizeMetric"]
-   xLog = !!widget_properties["xLogarithmic"]
-   yLog = !!widget_properties["yLogarithmic"]
-   maxItems = widget_properties["maxItems"].to_i
-
-   filter = MeasureFilter.find_by_id(filterId.to_i)
-   if filter
-     @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="bubble-chart-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,longName,qualifier',
-          <% if (maxItems > 0) %>
-          'pageSize=<%= maxItems -%>',
-          <% end %>
-          'page=1',
-          'sort=metric:' + metrics[0]
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('BubbleChart')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .height(<%= chartHeight -%>)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index',
-        xLog: <%= xLog -%>,
-        yLog: <%= yLog -%>,
-        noData: '<%= message('no_data') -%>',
-        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% else %>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb
deleted file mode 100644 (file)
index c45bb01..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<%
-  containerId = 'word-cloud' + widget.id.to_s
-  chartTitle = widget_properties['chartTitle']
-  filterId = widget_properties['filter'].to_i
-  maxItems = widget_properties['maxItems'].to_i
-
-  filter = MeasureFilter.find_by_id(filterId.to_i)
-  if filter
-    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties['colorMetric'].name -%>',
-          '<%= widget_properties['sizeMetric'].name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,longName,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[1],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('WordCloud')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .options({
-        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
-        baseUrl: baseUrl + '/dashboard/index',
-        noData: '<%= message('no_data') -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% else %>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb
deleted file mode 100644 (file)
index 9884207..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<%
-  containerId = 'histogram-widget' + widget.id.to_s
-  chartTitle = widget_properties["chartTitle"]
-  filterId = widget_properties["filter"].to_i
-  maxItems = widget_properties["maxItems"].to_i
-  reverseOrder = widget_properties["reverseOrder"]
-  relativeScale = widget_properties["relativeScale"]
-
-  filter = MeasureFilter.find_by_id(filterId.to_i)
-  if filter
-    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties["metric"].name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,longName,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[0],
-          'asc=<%= reverseOrder -%>'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('Histogram')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index',
-        relativeScale: <%= relativeScale -%>,
-        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
-        noData: '<%= message('no_data') -%>',
-        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% else %>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb
deleted file mode 100644 (file)
index c011ede..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<%
-  containerId = 'pie-chart-widget' + widget.id.to_s
-  chartHeight = widget_properties["chartHeight"]
-  chartTitle = widget_properties["chartTitle"]
-  filterId = widget_properties["filter"].to_i
-  maxItems = widget_properties["maxItems"].to_i
-
-  filter = MeasureFilter.find_by_id(filterId.to_i)
-  if filter
-    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="pie-chart-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties["mainMetric"].name -%>',
-          '<%= widget_properties["extraMetric1"].name -%>'
-          <% if (widget_properties["extraMetric2"]) %>
-          , '<%= widget_properties["extraMetric2"].name -%>'
-          <% end %>
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[0],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('PieChart')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .height(<%= chartHeight %>)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index',
-        noData: '<%= message('no_data') -%>',
-        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% else %>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_treemap.html.erb
deleted file mode 100644 (file)
index 48c08f8..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<%
-   containerId = 'treemap-widget' + widget.id.to_s
-   chartTitle = widget_properties['chartTitle']
-   filterId = widget_properties['filter'].to_i
-   maxItems = widget_properties['maxItems'].to_i
-
-   # SONAR-2456
-   # When metrics are removed, we have to manually set them to the default ones
-   colorMetric = widget_properties['colorMetric'] || Metric.by_key('coverage')
-   sizeMetric = widget_properties['sizeMetric'] || Metric.by_key('ncloc')
-
-   filter = MeasureFilter.find_by_id(filterId.to_i)
-   if filter
-     @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
-%>
-
-<div class="treemap-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= colorMetric.name -%>',
-          '<%= sizeMetric.name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,longName,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[1],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-        .type('Treemap')
-        .source(baseUrl + '/measures/search_filter?' + query)
-        .metricsPriority(metrics)
-        .options({
-          heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
-          maxItems: <%= maxItems -%>,
-          maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
-          baseUrl: baseUrl + '/dashboard/index',
-          noData: '<%= message('no_data') -%>',
-          resource: '<%= filter.name -%>'
-        })
-        .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-<% else %>
-  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/project_file_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/project_file_cloud.html.erb
deleted file mode 100644 (file)
index 8cb1c02..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<%
-  containerId = 'project-file-widget' + widget.id.to_s
-  colorMetric = widget_properties['colorMetric']
-  sizeMetric = widget_properties['sizeMetric']
-  chartTitle = widget_properties['chartTitle']
-  maxItems = widget_properties['maxItems'].to_i
-%>
-
-<div class="word-cloud-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    <%
-      filter = MeasureFilter.new
-      # Test files should not be returned
-      qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
-      filter.criteria = {:qualifiers => qualifiers, :base => @project.key, :pageSize => maxItems, :sort => 'metric:' + sizeMetric.name, :asc => false}
-      filter.metrics = [colorMetric.name, sizeMetric.name]
-      filter.execute(self, :user => current_user)
-    %>
-
-    var data = {
-          metrics: {
-            <%= colorMetric.name -%>: {
-              name: '<%= colorMetric.short_name -%>',
-              direction: <%= colorMetric.direction -%>
-            },
-            <%= sizeMetric.name -%>: {
-              name: '<%= sizeMetric.short_name -%>'
-            }
-          },
-          components: [
-            <%
-            filter.rows.each  do |row|
-              color = row.measure(colorMetric)
-              size = row.measure(sizeMetric)
-            %>
-            {
-              key: '<%= escape_javascript row.resource.key -%>',
-              name: '<%= escape_javascript row.resource.name -%>',
-              longName: '<%= escape_javascript row.resource.long_name -%>',
-              qualifier: '<%= escape_javascript row.resource.qualifier -%>',
-              measures: {
-                <%= colorMetric.name -%>: { val: <%= color ? color.value : "null" -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
-                <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
-              }
-            },
-            <% end %>
-          ]
-        },
-        widget = new SonarWidgets.WordCloud();
-
-    widget
-        .metrics(data.metrics)
-        .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
-        .components(data.components)
-        .options({
-          baseUrl: baseUrl + '/dashboard/index/'
-        })
-        .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb
deleted file mode 100644 (file)
index 1a4387b..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-<%
-  lines=measure('lines')
-  ncloc=measure('ncloc')
-  ncloc_language_distribution = measure('ncloc_language_distribution')
-  ncloc_language_dist_hash = Hash[*(ncloc_language_distribution.data.split(';').map { |elt| elt.split('=') }.flatten)] if ncloc && ncloc_language_distribution
-  generated_ncloc=measure('generated_ncloc')
-  generated_lines=measure('generated_lines')
-  accessors=measure('accessors')
-  classes=measure('classes')
-  files=measure('files')
-  directories=measure('directories')
-  functions=measure('functions')
-  projects=measure('projects')
-  if measure('lines') || ncloc
-    files=measure('files')
-    statements=measure('statements')
-    languages = Api::Utils.java_facade.getLanguages()
-%>
-
-<div class="widget-row widget-row-x">
-
-  <div class="widget-span widget-span-3-5">
-    <div class="widget-measure-container">
-      <% if ncloc %>
-        <p class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('metric.ncloc.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(ncloc, :url => url_for_drilldown(ncloc)) %>
-            <%= format_variation(ncloc) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-        <%  if generated_ncloc && generated_ncloc.value>0 %>
-          <p class="widget-label nowrap" style="margin-bottom: 7px">
-            <%= message('including_abbreviated') -%>
-            <%= format_measure(generated_ncloc, :url => url_for_drilldown(generated_ncloc)) -%> <%= format_variation(generated_ncloc) if dashboard_configuration.selected_period? -%>
-            <%= message('metric.generated_ncloc.name.suffix') -%>
-          </p>
-        <% end %>
-
-        <% if ncloc_language_dist_hash %>
-          <% if ncloc_language_dist_hash.size > 1 %>
-            <table class="data widget-barchar" id="size-widget-language-dist">
-              <%
-                 max = Math.sqrt(ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i)
-
-                 # Sort lines language distribution by lines count
-                 languages_by_key = Hash[languages.collect { |l| [l.getKey(), l.getName] }]
-                 ncloc_language_dist_hash.sort {|v1,v2| v2[1].to_i <=> v1[1].to_i }.each do |language_key, language_ncloc|
-              %>
-                <tr>
-                  <td>
-                    <% if  language_key.eql? '<null>' %>
-                      <%= message('unknown') -%>
-                    <% else %>
-                      <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
-                      <%= language ? language.getName() : language_key -%>
-                    <% end %>
-                  </td>
-                  <td class="thin right nowrap">
-                    <%= ncloc.format_numeric_value(language_ncloc) %>
-                  </td>
-                </tr>
-              <% end %>
-            </table>
-            <script>
-              jQuery(function () {
-                var chart = jQuery('#size-widget-language-dist'),
-                    count = chart.find('tr').length;
-                if (count > 3) {
-                  chart.find('tr:gt(2)').hide();
-                  var moreLinkBox = jQuery('<div></div>').addClass('widget-barchart-more').insertAfter(chart),
-                      moreLink = jQuery('<a><%= message('more') -%></a>').appendTo(moreLinkBox).on('click', function () {
-                    jQuery(this).hide();
-                    chart.find('tr').show();
-                  });
-                }
-              });
-            </script>
-          <% else %>
-            <% 
-              language_key = ncloc_language_dist_hash.first[0]
-              if  language_key.eql? '<null>' %>
-              <%= message('unknown') -%>
-            <% else %>
-              <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
-              <%= language ? language.getName() : language_key -%>
-            <% end %>
-          <% end %>
-        <% end %>
-      <% else %>
-        <p class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('metric.lines.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(lines, :url => url_for_drilldown(ncloc)) %>
-            <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-    </div>
-  </div>
-
-  <div class="widget-span widget-span-3-5">
-    <div class="widget-measure-container">
-      <p class="widget-measure widget-measure-main">
-        <span class="widget-label"><%= message('metric.files.name') -%></span>
-        <span class="nowrap">
-          <%= format_measure(files, :url => url_for_drilldown(files)) %>
-          <%= format_variation(files) if dashboard_configuration.selected_period? -%>
-        </span>
-      </p>
-
-      <% if directories %>
-        <p class="widget-measure">
-          <span class="widget-label"><%= message('metric.directories.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(directories, :url => url_for_drilldown(directories)) %>
-            <%= format_variation(directories) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-
-      <p class="widget-measure">
-        <span class="widget-label"><%= message('metric.lines.name') -%></span>
-        <span class="nowrap">
-          <%= format_measure(lines, :url => url_for_drilldown(lines)) %>
-          <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
-        </span>
-      </p>
-
-      <%  if generated_lines && generated_lines.value>0 %>
-        <p class="widget-label nowrap" style="margin-bottom: 7px">
-          <%= message('including_abbreviated') -%>
-          <%= format_measure(generated_lines, :url => url_for_drilldown(generated_lines)) -%> <%= format_variation(generated_lines) if dashboard_configuration.selected_period? -%>
-          <%= message('metric.generated_lines.name.suffix') -%>
-        </p>
-      <% end %>
-
-      <% if projects %>
-        <p class="widget-measure">
-          <span class="widget-label"><%= message('projects') -%></span>
-          <span class="nowrap">
-            <span class="widget-number"><%= format_measure(projects) %></span>
-            <%= format_variation(projects) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-    </div>
-  </div>
-
-  <div class="widget-span widget-span-5">
-    <div class="widget-measure-container">
-      <% if functions %>
-        <p class="widget-measure widget-measure-main">
-          <span class="widget-label"><%= message('metric.functions.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(functions, :url => url_for_drilldown(functions)) %>
-            <%= format_variation(functions) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-
-      <% if classes %>
-        <p class="widget-measure">
-          <span class="widget-label"><%= message('metric.classes.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(classes, :url => url_for_drilldown(classes)) %>
-            <%= format_variation(classes) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-
-      <% if statements %>
-        <p class="widget-measure">
-          <span class="widget-label"><%= message('metric.statements.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(statements, :url => url_for_drilldown(statements)) %>
-            <%= format_variation(statements) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-
-      <% if accessors %>
-        <p class="widget-measure">
-          <span class="widget-label"><%= message('metric.accessors.name') -%></span>
-          <span class="nowrap">
-            <%= format_measure(accessors, :url => url_for_drilldown(accessors)) %>
-            <%= format_variation(accessors) if dashboard_configuration.selected_period? -%>
-          </span>
-        </p>
-      <% end %>
-    </div>
-  </div>
-
-</div>
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt_pyramid.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt_pyramid.html.erb
deleted file mode 100644 (file)
index 6f5464e..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<%
-   technical_debt = measure('sqale_index')
-
-   root_characteristics = Internal.debt.characteristics().to_a
-
-   should_display_diff_measures = dashboard_configuration.selected_period? && technical_debt.variation(dashboard_configuration.period_index)!=nil
-   if technical_debt.nil? || root_characteristics.empty?
-%>
-
-  <h3><%= message('widget.technical_debt_pyramid.name') -%></h3>
-  <span style="color: #777777; font-size: 93%; font-style:italic"><%= message('widget.technical_debt_pyramid.no_info_available') -%></span>
-
-<%
-   else
-%>
-  <style>
-    table.technicalDebtPyramid td {
-      padding: 4px 10px 4px 0;
-    }
-
-    table.technicalDebtPyramid td.label {
-      width: 1%;
-      white-space: nowrap;
-      text-align: left;
-      padding: 5px 10px 5px 0;
-    }
-
-    table.technicalDebtPyramid th.val {
-      width: 1%;
-      white-space: nowrap;
-      text-align: right;
-      padding: 0 0 0 10px;
-    }
-
-    table.technicalDebtPyramid td.val {
-      width: 1%;
-      white-space: nowrap;
-      text-align: right;
-      padding: 0 0 0 10px;
-    }
-
-    table.technicalDebtPyramid td.bar {
-      width: 97%;
-    }
-
-    table.technicalDebtPyramid .legendValue {
-      width: 10px;
-      height: 10px;
-      background-color: #4b9fd5;
-      display: inline-block;
-      zoom: 1; /* IE hack to trigger hasLayout */
-      *display: inline; /* IE hack to achieve inline-block behavior */
-    }
-
-    table.technicalDebtPyramid .legendTotal {
-      width: 10px;
-      height: 10px;
-      background-color: #cae3f2;
-      display: inline-block;
-      zoom: 1; /* IE hack to trigger hasLayout */
-      *display: inline; /* IE hack to achieve inline-block behavior */
-    }
-
-    table.technicalDebtPyramid td.bar>a>div>div {
-      float: right;
-    }
-  </style>
-
-  <table class="technicalDebtPyramid">
-    <thead>
-    <tr>
-      <th colspan="2"><div class="marginbottom10">
-        <h3><%= message('widget.technical_debt_pyramid.name') -%></h3>
-      </div></th>
-      <th class="val"><div class="marginbottom10">
-        <h3><div class="legendValue"></div>&nbsp;<%= message('widget.technical_debt_pyramid.technical_debt') -%></h3>
-      </div></th>
-      <th class="val"><div class="marginbottom10">
-        <h3><%= message('widget.technical_debt_pyramid.total') -%></h3>
-      </div></th>
-    </tr>
-    </thead>
-    <tbody>
-    <%
-       measures_by_characteristic_id={}
-       ProjectMeasure.find(:all,
-                           :conditions => ['characteristic_id IN (?) AND snapshot_id=? AND metric_id=?',
-                                           root_characteristics.map{|c| c.id}, @snapshot.id, technical_debt.metric().id]).each do |measure|
-         measures_by_characteristic_id[measure.characteristic_id]=measure
-       end
-
-       total = technical_debt.value
-       cumulated=total
-
-       if should_display_diff_measures
-         diff_by_characteristic_id={}
-         total_diff = 0;
-         root_characteristics.each do |c|
-           measure = measures_by_characteristic_id[c.id]
-           if measure && measure.variation(dashboard_configuration.period_index)
-             diff_by_characteristic_id[c.id] = measure.variation(dashboard_configuration.period_index)
-             total_diff += measure.variation(dashboard_configuration.period_index)
-           end
-         end
-       end
-
-       root_characteristics.sort_by {|characteristic| characteristic.order}.each do |characteristic|
-         measure=measures_by_characteristic_id[characteristic.id]
-         value=(measure && measure.value ? measure.value : 0)
-         total_size=(total>0 ? (100*cumulated/total).round(3): 0)
-         value_size=(cumulated>0 ? (100*value/cumulated).round(3): 100)
-         drilldown_url = url_for_drilldown('sqale_index', :characteristic => characteristic.key)
-    %>
-      <tr>
-        <td class="label"><%= h(characteristic.name) -%></td>
-        <td class="bar">
-          <a href="<%= drilldown_url -%>">
-            <div style="width: <%=total_size-%>%; height: 17px;background-color: #cae3f2;">
-              <div style="width: <%=value_size-%>%; height: 17px;background-color: #4b9fd5;"></div>
-            </div>
-          </a>
-        </td>
-        <td class="val value-debt-<%= h(characteristic.key) -%>">
-          <a href="<%= drilldown_url -%>" class="underlined-link link-debt-<%= h(characteristic.key) -%>"><%= Internal.i18n.formatLongDuration(value.to_i, 'SHORT') -%></a>
-          <% if should_display_diff_measures %>
-            <% if diff_by_characteristic_id[characteristic.id] %>
-              <%= format_variation(measure) -%>
-            <% else %>
-              <span class="var"><b>(+0)</b></span>
-            <% end %>
-          <% end %>
-        </td>
-        <td class="val value-total-<%= h(characteristic.key) -%>">
-          <%= Internal.i18n.formatLongDuration(cumulated.to_i, 'SHORT') -%>
-          <%
-             if should_display_diff_measures
-               css_style = 'var'
-               css_style += 'b' if total_diff < 0
-               css_style += 'w' if total_diff > 0
-               diff_to_display = (total_diff < 0 ? '' : '+') + Internal.i18n.formatLongDuration(total_diff.to_i, 'SHORT')
-          %>
-            <span class="<%= css_style -%>"><b>(<%= diff_to_display -%>)</b></span>
-          <%
-             total_diff -= diff_by_characteristic_id[characteristic.id] if diff_by_characteristic_id[characteristic.id]
-             end
-          %>
-        </td>
-      </tr>
-    <%
-       cumulated-=value
-       end
-    %>
-    </tbody>
-  </table>
-
-<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb
deleted file mode 100644 (file)
index 3c00988..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<%
-   rows_by_metric_id={}
-   
-   # Retrieve widget settings
-   metric_ids = []
-   (1..10).each do |index|
-     metric=widget_properties["metric#{index}"]
-     if metric
-       metric_ids << metric.id
-       row=Sonar::TimemachineRow.new(metric)
-       rows_by_metric_id[metric.id]=row
-     end
-   end
-   if metric_ids.empty?
-     # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
-     ncloc = Metric.find(:first, :conditions => "name = 'ncloc'")
-     metric_ids << ncloc.id
-   end
-   number_of_columns = widget_properties["numberOfColumns"]
-
-   # Retrieve the measures for each metric on each snapshot
-   options = {}
-   from_date = dashboard_configuration.from_datetime
-   if from_date
-     options[:from] = from_date
-   end
-   snapshots=Snapshot.for_timemachine_widget(@resource, number_of_columns, options)
-   sids = snapshots.collect { |s| s.id }.uniq
-   measures=ProjectMeasure.find(:all,
-                                :conditions =>
-                                    ["snapshot_id IN (:snapshot_id) AND metric_id IN (:metric_id) AND rule_id IS NULL AND characteristic_id IS NULL AND person_id IS NULL",
-                                     {:snapshot_id => sids, :metric_id => metric_ids}
-                                    ]
-   )
-
-   
-   # Prepare the rows to display
-   snapshot_by_id={}
-   snapshots.each do |s|
-     snapshot_by_id[s.id]=s
-   end
-   measures.each do |measure|
-     next unless measure.metric
-
-     if measure.metric.timemachine? && (measure.value || measure.text_value)
-       row=rows_by_metric_id[measure.metric_id]
-       
-       #optimization : avoid eager loading of snapshots
-       measure.snapshot=snapshot_by_id[measure.snapshot_id]
-       row.add_measure(measure)
-     end
-   end
-
-   # Create the list of rows to display in the same order as defined by the user
-   rows=[]
-   metric_ids.each do |metric_id|
-     row = rows_by_metric_id[metric_id]
-     if row
-       rows<<row
-     end
-   end
-
-   # Should display the sparkline?
-   sparkline_urls_by_row = {}
-   if widget_properties["displaySparkLine"]
-     rows.each do |row|
-       sparkline_url = row.sparkline_url
-       sparkline_urls_by_row[row] = sparkline_url if sparkline_url
-     end
-   end
-   display_sparkline = !sparkline_urls_by_row.empty?
-%>
-
-<% if widget_properties["title"] %>
-  <div style="position: absolute">
-    <h3><%= h(widget_properties["title"]) -%></h3>
-  </div>
-<% end %>
-
-<div style="overflow: auto;font-size: 12px;padding: 1px;">
-  <table class="table table-bordered">
-
-    <thead>
-    <tr>
-      <th></th>
-      <%
-         snapshots.each do |snapshot|
-           event = snapshot.event('Version')
-      %>
-        <th nowrap="nowrap" style="vertical-align:top;text-align: right;font-size: 10px">
-          <%= l snapshot.created_at.to_date -%>
-          <br/>
-          <%= event.name unless event==nil -%>
-        </th>
-      <% end %>
-      <% if display_sparkline %>
-        <th></th>
-      <% end %>
-    </tr>
-    </thead>
-
-    <tbody>
-    <%
-       rows.select { |row| row.metric.val_type != Metric::VALUE_TYPE_DISTRIB }.each do |row|
-    %>
-      <tr class="<%= cycle 'even', 'odd', :name => ('time_machine' + widget.id.to_s) -%>">
-        <td width="1%" nowrap="nowrap" class="left text">
-          <%= row.metric.short_name %>
-        </td>
-        <%
-           snapshots.each do |snapshot|
-             measure=row.measure(snapshot)
-        %>
-          <td width="1%" nowrap="nowrap" class="right"><%= format_measure(measure, :skip_span_id => true) %></td>
-        <% end %>
-        <%
-           if display_sparkline
-             sparkline_url = sparkline_urls_by_row[row]
-        %>
-          <td width="1%">
-            <%= image_tag(sparkline_url) if sparkline_url %>
-          </td>
-        <% end %>
-      </tr>
-    <% end %>
-    </tbody>
-
-  </table>
-
-</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
deleted file mode 100644 (file)
index 7e7ad6e..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-<%
-   # Retrieve widget settings
-   metric_data_map = {}
-   metric_map = {}
-   metrics_specified = false
-   (1..3).each do |index|
-     metric=widget_properties["metric#{index}"]
-     # we check that the current resource has the selected metric on the last snapshot
-     # => if not, we do not display this metric at all
-     if metric
-       metrics_specified = true
-       if measure(metric)
-         metric_data_map[metric.id] = []
-         metric_map[metric.id] = metric
-       end
-     end
-   end
-   unless metrics_specified
-     # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
-     ncloc = Metric.by_name('ncloc')
-     metric_data_map[ncloc.id] = []
-     metric_map[ncloc.id] = ncloc
-   end
-   chartHeight = widget_properties["chartHeight"]
-
-  unless metric_data_map.values.empty?
-     # Retrieve metric trend information
-     options = {}
-     from_date = dashboard_configuration.from_datetime
-     if from_date
-       options[:from] = from_date
-     end
-     metric_count_per_snapshot_id = {}
-     TrendsChart.time_machine_measures(@resource, metric_data_map.keys, options).each() do |trend_item|
-       sid = trend_item["sid"]
-       if metric_count_per_snapshot_id[sid]
-         metric_count_per_snapshot_id[sid] += 1
-       else
-         metric_count_per_snapshot_id[sid] = 1
-       end
-       metric_data_map[trend_item["metric_id"].to_i] << {:date => Time.at(trend_item["created_at"].to_i/1000), :value => trend_item["value"], :sid => trend_item["sid"]}
-     end
-
-     # Create JS structures to print out in the HTML page
-     js_data = "["
-     js_snapshots = "["
-     js_metrics = "["
-     total_number_of_metrics = metric_map.keys.size()
-     metric_data_map.keys.each_with_index() do |metric_id, index|
-       unless metric_data_map[metric_id].empty?
-         js_metrics += "\"" + metric_map[metric_id].short_name + "\","
-         js_data += "["
-         metric_data_map[metric_id].each() do |metric_data|
-           # for every metric value, we need to check that the corresponding snapshot has values for each metric
-           if metric_count_per_snapshot_id[metric_data[:sid]]==total_number_of_metrics
-             m_date = metric_data[:date]
-             m_value = sprintf("%0.02f", metric_data[:value])
-             m_value_localized = ProjectMeasure.new(:metric => metric_map[metric_id]).format_numeric_value(metric_data[:value], {})
-             js_data += "{x:d("
-             js_data += m_date.year.to_s
-             js_data += ","
-             # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
-             js_data += (m_date.month - 1).to_s
-             js_data += ","
-             js_data += m_date.day.to_s
-             js_data += ","
-             js_data += m_date.hour.to_s
-             js_data += ","
-             js_data += m_date.min.to_s
-             js_data += ","
-             js_data += m_date.sec.to_s
-             js_data += "),y:"
-             js_data += m_value
-             js_data += ",yl:\""
-             js_data += m_value_localized
-             js_data += "\"},"
-             if index == 0
-               # we fill the js_snapshots array (no need to do this more than once)
-               js_snapshots += "{sid:"
-               js_snapshots += metric_data[:sid].to_s
-               js_snapshots += ",d:\""
-               js_snapshots += human_short_date m_date
-               js_snapshots += "\"},"
-             end
-           end
-         end
-         js_data = js_data.chomp(',') + "],"
-       end
-     end
-     js_data = js_data.chomp(',') + "]"
-     js_snapshots = js_snapshots.chomp(',') + "]"
-     js_metrics = js_metrics.chomp(',') + "]"
-
-     # Prepare also event structure if required
-     unless widget_properties["hideEvents"]
-       events = {}
-       unless from_date
-         # find the oldest date
-         metric_data_map.values.each() do |metric_data_array|
-           first_date = metric_data_array[0][:date]
-           from_date = first_date if !from_date || from_date > first_date
-         end
-       end
-       Event.find(:all, :conditions => ["component_uuid=? AND event_date>=?", @resource.uuid, from_date.to_i*1000], :order => 'event_date').each() do |event|
-         if events[event.event_date]
-           events[event.event_date] << event
-         else
-           date_entry = [event]
-           events[event.event_date] = date_entry
-         end
-       end
-       js_events = "["
-       events.keys().sort.each() do |e_date|
-         e_details = events[e_date]
-         js_events += "{sid:"
-         js_events += e_details[0].snapshot_id.to_s
-         js_events += ",d:d("
-         js_events += e_date.year.to_s
-         js_events += ","
-         # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
-         js_events += (e_date.month - 1).to_s
-         js_events += ","
-         js_events += e_date.day.to_s
-         js_events += ","
-         js_events += e_date.hour.to_s
-         js_events += ","
-         js_events += e_date.min.to_s
-         js_events += ","
-         js_events += e_date.sec.to_s
-         js_events += "),l:["
-         e_details.each() do |e|
-           js_events += "{n:\""
-           js_events += json_escape(e.name)
-           js_events += "\"},"
-         end
-         js_events = js_events.chomp(',') + "]},"
-       end
-       js_events = js_events.chomp(',') + "]"
-     end
-  end
-
-
-%>
-
-<!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<% if widget_properties["chartTitle"] %>
-  <h3 style="margin-bottom: 10px"><%= h(widget_properties["chartTitle"]) -%></h3>
-<% end %>
-<!--<![endif]-->
-
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<%
-   unless metric_data_map.values.empty?
-
-     if metric_data_map.values[0].size == 1
-%>
-
-  <span class="empty_widget"><%= message('widget.timeline.timeline_not_displayed') -%></span>
-
-<%   else %>
-  <% timeline = 'timeline' + widget.id.to_s %>
-
-  <div id="timeline-chart-<%= widget.id -%>"></div>
-  <script>
-    function d(y, m, d, h, min, s) {
-      return new Date(y, m, d, h, min, s);
-    }
-    var data = <%= js_data -%>;
-    var snapshots = <%= js_snapshots -%>;
-    var metrics = <%= js_metrics -%>;
-    var events = <%= js_events ? js_events : "[]" -%>;
-    var <%= timeline -%> = new SonarWidgets.Timeline('timeline-chart-<%= widget.id -%>')
-      .height(<%= chartHeight -%>)
-      .data(data)
-      .snapshots(snapshots)
-      .metrics(metrics)
-      .events(events);
-    <%= timeline -%>.limitedHistoricalData = '<%= message('widget.timeline.limited_histortical_data') -%>';
-    <%= timeline -%>.render();
-
-    autoResize(200, function() {
-      <%= timeline -%>.update();
-    });
-  </script>
-
-<%
-     end
-   end
-%>
-<!--<![endif]-->
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb
deleted file mode 100644 (file)
index f6a1fbc..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<%
-   containerId = 'project-file-widget' + widget.id.to_s
-   colorMetric = widget_properties['colorMetric']
-   sizeMetric = widget_properties['sizeMetric']
-   chartTitle = widget_properties['chartTitle']
-   maxItems = widget_properties['maxItems'].to_i
-%>
-
-<div class="treemap-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    <%
-      filter = MeasureFilter.new
-      filter.set_criteria_value(:base, @resource.key)
-      filter.set_criteria_value(:onBaseComponents, 'true')
-      filter.set_criteria_value(:pageSize, 100)
-      filter.set_criteria_value(:page, 1)
-      filter.set_criteria_value(:sort, 'metric:' + sizeMetric.name)
-      filter.set_criteria_value(:asc, false)
-      filter.metrics=([sizeMetric, colorMetric].compact)
-      filter.execute(self, :user => current_user)
-    %>
-
-    var data = {
-      metrics: {
-        <%= colorMetric.name -%>: {
-          name: '<%= colorMetric.short_name -%>',
-          direction: <%= colorMetric.direction -%>,
-          type: '<%= colorMetric.val_type -%>'
-        },
-        <%= sizeMetric.name -%>: {
-          name: '<%= sizeMetric.short_name -%>'
-        }
-      },
-      components: [
-        <%
-        filter.rows.each  do |row|
-          color = row.measure(colorMetric)
-          size = row.measure(sizeMetric)
-        %>
-          {
-            key: '<%= escape_javascript row.resource.key -%>',
-            name: '<%= escape_javascript row.resource.name -%>',
-            longName: '<%= escape_javascript row.resource.long_name -%>',
-            qualifier: '<%= escape_javascript row.resource.qualifier -%>',
-            measures: {
-              <%= colorMetric.name -%>: { val: <%= color ? color.value : "null" -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
-              <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
-            }
-          },
-        <% end %>
-      ]
-    },
-    widget = new SonarWidgets.Treemap();
-
-    widget
-      .metrics(data.metrics)
-      .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
-      .components(data.components)
-      .options({
-        heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
-        maxItems: <%= maxItems -%>,
-        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
-        baseUrl: baseUrl + '/dashboard/index',
-        noData: '<%= message('no_data') -%>',
-        resource: '<%= @resource.name -%>'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/welcome.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/welcome.html.erb
deleted file mode 100644 (file)
index a3e651d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<%= message('widget.welcome.html') -%>
\ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/AbstractChartTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/AbstractChartTest.java
deleted file mode 100644 (file)
index 31223db..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.charts;
-
-import org.apache.commons.io.FileUtils;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.ui.ApplicationFrame;
-import org.jfree.ui.RefineryUtilities;
-
-import javax.swing.JPanel;
-
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractChartTest {
-  protected void assertChartSizeGreaterThan(BufferedImage img, int size) throws IOException {
-    ByteArrayOutputStream output = new ByteArrayOutputStream();
-    ChartUtilities.writeBufferedImageAsPNG(output, img);
-    assertTrue("PNG size in bits=" + output.size(), output.size() > size);
-  }
-
-  protected void assertChartSizeLesserThan(BufferedImage img, int size) throws IOException {
-    ByteArrayOutputStream output = new ByteArrayOutputStream();
-    ChartUtilities.writeBufferedImageAsPNG(output, img);
-    assertTrue("PNG size in bits=" + output.size(), output.size() < size);
-  }
-
-  protected void saveChart(BufferedImage img, String name) throws IOException {
-    File target = new File("target/tmp-chart", name);
-    FileUtils.forceMkdir(target.getParentFile());
-    ByteArrayOutputStream imgOutput = new ByteArrayOutputStream();
-    ChartUtilities.writeBufferedImageAsPNG(imgOutput, img);
-    OutputStream out = new FileOutputStream(target);
-    out.write(imgOutput.toByteArray());
-    out.close();
-
-  }
-
-  protected static void displayTestPanel(BufferedImage image) {
-    ApplicationFrame frame = new ApplicationFrame("testframe");
-    BufferedPanel imgPanel = new BufferedPanel(image);
-    frame.setContentPane(imgPanel);
-    frame.pack();
-    RefineryUtilities.centerFrameOnScreen(frame);
-    frame.setVisible(true);
-  }
-
-  protected static Date stringToDate(String sDate) throws ParseException {
-    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy hh'h'mm");
-    return sdf.parse(sDate);
-  }
-
-  private static class BufferedPanel extends JPanel {
-    private final BufferedImage chartImage;
-
-    public BufferedPanel(BufferedImage chartImage) {
-      this.chartImage = chartImage;
-    }
-
-    @Override
-    protected void paintComponent(Graphics graphics) {
-      super.paintComponent(graphics);
-      graphics.drawImage(chartImage, 0, 0, null);
-    }
-
-    @Override
-    public Dimension getPreferredSize() {
-      return new Dimension(chartImage.getWidth(), chartImage.getHeight());
-    }
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionAreaChartTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionAreaChartTest.java
deleted file mode 100644 (file)
index 6a535ab..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.charts;
-
-import org.junit.Test;
-import org.sonar.api.charts.ChartParameters;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-
-public class DistributionAreaChartTest extends AbstractChartTest {
-
-  @Test
-  public void oneSerie() throws IOException {
-    DistributionAreaChart chart = new DistributionAreaChart();
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionAreaChartTest/oneSerie.png");
-  }
-
-  @Test
-  public void manySeries() throws IOException {
-    DistributionAreaChart chart = new DistributionAreaChart();
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionAreaChartTest/manySeries.png");
-  }
-
-  @Test
-  public void manySeriesWithDifferentCategories() throws IOException {
-    DistributionAreaChart chart = new DistributionAreaChart();
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|2%3D7%3B4%3D15%3B9%3D4"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionAreaChartTest/manySeriesWithDifferentCategories.png");
-  }
-
-  @Test
-  public void manySeriesIncludingAnEmptySerie() throws IOException {
-    // the third serie should not have the second default color, but the third one !
-    DistributionAreaChart chart = new DistributionAreaChart();
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2||2%3D7%3B4%3D15%3B9%3D4"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionAreaChartTest/manySeriesIncludingAnEmptySerie.png");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionBarChartTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/DistributionBarChartTest.java
deleted file mode 100644 (file)
index 8e50f49..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.charts;
-
-import org.junit.Test;
-import org.sonar.api.charts.ChartParameters;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-
-public class DistributionBarChartTest extends AbstractChartTest {
-  DistributionBarChart chart = new DistributionBarChart();
-
-  @Test
-  public void simpleSample() throws IOException {
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/simpleSample.png");
-  }
-
-  @Test
-  public void addXSuffix() throws IOException {
-    // should suffix x labels with +
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&xsuf=%2B"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/addXSuffix.png");
-  }
-
-  @Test
-  public void addYSuffix() throws IOException {
-    // should suffix y labels with %
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&ysuf=%25"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/addYSuffix.png");
-  }
-
-  @Test
-  public void manySeries() throws IOException {
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/manySeries.png");
-  }
-
-  @Test
-  public void manySeriesIncludingAnEmptySerie() throws IOException {
-    // the third serie should not have the second default color, but the third one !
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2||0%3D7%3B1%3D15%3B2%3D4"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/manySeriesIncludingAnEmptySerie.png");
-  }
-
-  @Test
-  public void overridenSize() throws IOException {
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4&w=500&h=200"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/overridenSize.png");
-  }
-
-  @Test
-  public void changeColor() throws IOException {
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&c=777777&bgc=777777"));
-    assertChartSizeGreaterThan(image, 1000);
-    saveChart(image, "DistributionBarChartTest/changeColor.png");
-  }
-
-  @Test
-  public void smallSize() throws IOException {
-    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2%3B4%3D22%3B5%3D22%3B6%3D22&c=777777&w=120&h=80&fs=8"));
-    assertChartSizeGreaterThan(image, 500);
-    saveChart(image, "DistributionBarChartTest/smallSize.png");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDefaultDashboardTest.java
deleted file mode 100644 (file)
index a89ebdb..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.Dashboard.Widget;
-import org.sonar.core.measure.db.MeasureFilterDao;
-import org.sonar.core.measure.db.MeasureFilterDto;
-import org.sonar.plugins.core.CorePlugin;
-import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
-import org.sonar.plugins.core.measurefilters.ProjectFilter;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsTreemapWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class GlobalDefaultDashboardTest {
-  GlobalDefaultDashboard template;
-  MeasureFilterDao dao;
-
-  @Before
-  public void init() {
-    dao = mock(MeasureFilterDao.class);
-    template = new GlobalDefaultDashboard(dao);
-  }
-
-  @Test
-  public void should_have_a_name() {
-    assertThat(template.getName()).isEqualTo("Home");
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(template.getClass());
-  }
-
-  @Test
-  public void should_create_global_dashboard_with_four_widgets() {
-    when(dao.findSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(
-      new MeasureFilterDto().setId(100L)
-    );
-    when(dao.findSystemFilterByName(ProjectFilter.NAME)).thenReturn(
-      new MeasureFilterDto().setId(101L)
-    );
-    Dashboard dashboard = template.createDashboard();
-    List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
-    assertThat(firstColumn).hasSize(2);
-    assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
-    assertThat(firstColumn.get(1).getId()).isEqualTo(MeasureFilterListWidget.ID);
-    assertThat(firstColumn.get(1).getProperty("filter")).isEqualTo("100");
-
-    List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
-    assertThat(secondColumn).hasSize(2);
-    assertThat(secondColumn.get(0).getId()).isEqualTo(MeasureFilterListWidget.ID);
-    assertThat(secondColumn.get(0).getProperty("filter")).isEqualTo("101");
-    assertThat(secondColumn.get(1).getId()).isEqualTo(MeasureFilterAsTreemapWidget.ID);
-    assertThat(secondColumn.get(1).getProperty("filter")).isEqualTo("101");
-  }
-
-  @Test
-  public void should_not_fail_if_filter_widgets_not_found() {
-    when(dao.findSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(null);
-    when(dao.findSystemFilterByName(ProjectFilter.NAME)).thenReturn(null);
-
-    Dashboard dashboard = template.createDashboard();
-    List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
-    assertThat(firstColumn).hasSize(1);
-    assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
-
-    List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
-    assertThat(secondColumn).isEmpty();
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboardTest.java
deleted file mode 100644 (file)
index a516888..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.junit.Test;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.plugins.core.CorePlugin;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectDefaultDashboardTest {
-  ProjectDefaultDashboard template = new ProjectDefaultDashboard();
-
-  @Test
-  public void should_have_a_name() {
-    assertThat(template.getName()).isEqualTo("Dashboard");
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(template.getClass());
-  }
-
-  @Test
-  public void should_create_dashboard() {
-    Dashboard dashboard = template.createDashboard();
-
-    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
-    assertThat(dashboard.getWidgets()).hasSize(9);
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java
deleted file mode 100644 (file)
index 716a438..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.core.issue.db.IssueFilterDao;
-import org.sonar.core.persistence.DbTester;
-import org.sonar.plugins.core.CorePlugin;
-import org.sonar.test.DbTests;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@Category(DbTests.class)
-public class ProjectIssuesDashboardTest {
-
-  @ClassRule
-  public static final DbTester dbTester = new DbTester();
-
-  ProjectIssuesDashboard template;
-
-  @Before
-  public void setUp() {
-    IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis());
-    template = new ProjectIssuesDashboard(issueFilterDao);
-  }
-
-  @Test
-  public void should_have_a_name() {
-    assertThat(template.getName()).isEqualTo("Issues");
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(template.getClass());
-  }
-
-  @Test
-  public void should_create_dashboard() {
-    dbTester.prepareDbUnit(getClass(), "filters.xml");
-    Dashboard dashboard = template.createDashboard();
-
-    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
-    assertThat(dashboard.getWidgets()).hasSize(5);
-  }
-
-  @Test
-  public void should_provide_clean_error_message_on_failure() {
-    try {
-      template.createDashboard();
-    } catch (IllegalStateException illegalState) {
-      assertThat(illegalState).hasMessage("Could not find a provided issue filter with name 'Unresolved Issues'");
-    }
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectTimeMachineDashboardTest.java
deleted file mode 100644 (file)
index e207bfe..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.dashboards;
-
-import org.junit.Test;
-import org.sonar.api.web.Dashboard;
-import org.sonar.api.web.Dashboard.Widget;
-import org.sonar.api.web.DashboardLayout;
-import org.sonar.plugins.core.CorePlugin;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectTimeMachineDashboardTest {
-  ProjectTimeMachineDashboard template = new ProjectTimeMachineDashboard();
-
-  @Test
-  public void should_have_a_name() {
-    assertThat(template.getName()).isEqualTo("TimeMachine");
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(template.getClass());
-  }
-
-  @Test
-  public void should_create_dashboard() {
-    Dashboard dashboard = template.createDashboard();
-
-    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
-    assertThat(dashboard.getWidgets()).hasSize(7);
-
-    for (Widget widget : dashboard.getWidgets()) {
-      if (widget.getId().equals("time_machine")) {
-        assertThat(widget.getProperty("displaySparkLine")).isEqualTo("true");
-      }
-    }
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilterTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/MyFavouritesFilterTest.java
deleted file mode 100644 (file)
index 3c894cd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.measurefilters;
-
-import org.junit.Test;
-import org.sonar.api.web.Filter;
-import org.sonar.plugins.core.CorePlugin;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class MyFavouritesFilterTest {
-  @Test
-  public void should_create_filter() {
-    MyFavouritesFilter template = new MyFavouritesFilter();
-
-    Filter filter = template.createFilter();
-
-    assertThat(template.getName()).isEqualTo("My favourites");
-    assertThat(filter).isNotNull();
-    assertThat(filter.isFavouritesOnly()).isTrue();
-    assertThat(filter.getCriteria()).isEmpty();
-    assertThat(filter.getColumns()).hasSize(3);
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(MyFavouritesFilter.class);
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/ProjectFilterTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/measurefilters/ProjectFilterTest.java
deleted file mode 100644 (file)
index 9e7a96a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.measurefilters;
-
-import org.junit.Test;
-import org.sonar.api.web.Filter;
-import org.sonar.plugins.core.CorePlugin;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectFilterTest {
-  @Test
-  public void should_create_filter() {
-    ProjectFilter template = new ProjectFilter();
-
-    Filter filter = template.createFilter();
-
-    assertThat(template.getName()).isEqualTo("Projects");
-    assertThat(filter).isNotNull();
-    assertThat(filter.getCriteria()).hasSize(1);
-    assertThat(filter.getColumns()).hasSize(6);
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    assertThat(new CorePlugin().getExtensions()).contains(ProjectFilter.class);
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/widgets/CoreWidgetsTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/widgets/CoreWidgetsTest.java
deleted file mode 100644 (file)
index 0cf8aeb..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import org.junit.Test;
-import org.reflections.Reflections;
-import org.sonar.plugins.core.CorePlugin;
-
-import javax.annotation.Nullable;
-
-import java.util.Collection;
-import java.util.Set;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CoreWidgetsTest {
-
-  @Test
-  public void widget_ids_should_be_unique() {
-    Collection<CoreWidget> widgets = widgets();
-    Collection<String> widgetIds = Collections2.transform(widgets, new Function<CoreWidget, String>() {
-      public String apply(@Nullable CoreWidget widget) {
-        return widget.getId();
-      }
-    });
-    assertThat(widgetIds).hasSize(Sets.newHashSet(widgetIds).size());
-  }
-
-  @Test
-  public void widget_templates_should_be_unique() {
-    Collection<CoreWidget> widgets = widgets();
-    Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
-      public String apply(@Nullable CoreWidget widget) {
-        return widget.getTemplatePath();
-      }
-    });
-    assertThat(templates).hasSize(Sets.newHashSet(templates).size());
-  }
-
-  @Test
-  public void widget_titles_should_be_unique() {
-    Collection<CoreWidget> widgets = widgets();
-    Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
-      public String apply(@Nullable CoreWidget widget) {
-        return widget.getTitle();
-      }
-    });
-    assertThat(templates).hasSize(Sets.newHashSet(templates).size());
-  }
-
-  @Test
-  public void should_find_templates() {
-    for (CoreWidget widget : widgets()) {
-      assertThat(widget.getClass().getResource(widget.getTemplatePath()))
-        .as("Template not found: " + widget.getTemplatePath())
-        .isNotNull();
-    }
-  }
-
-  @Test
-  public void should_be_registered_as_an_extension() {
-    for (CoreWidget widget : widgets()) {
-      assertThat(new CorePlugin().getExtensions()).contains(widget.getClass());
-    }
-  }
-
-  @Test
-  public void should_find_core_widgets() {
-    assertThat(widgets().size()).isGreaterThan(23);
-  }
-
-  private Set<Class<? extends CoreWidget>> widgetClasses() {
-    String[] packages = {"org.sonar.plugins.core.widgets", "org.sonar.plugins.core.widgets.issues"};
-    return new Reflections(packages).getSubTypesOf(CoreWidget.class);
-  }
-
-  private Collection<CoreWidget> widgets() {
-    return newArrayList(Iterables.transform(widgetClasses(), new Function<Class<? extends CoreWidget>, CoreWidget>() {
-      public CoreWidget apply(@Nullable Class<? extends CoreWidget> aClass) {
-        try {
-          return aClass.newInstance();
-        } catch (Exception e) {
-          throw Throwables.propagate(e);
-        }
-      }
-    }));
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest/filters.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest/filters.xml
deleted file mode 100644 (file)
index 8ec92dd..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<dataset>
-
-  <issue_filters
-      id="1"
-      name="Unresolved Issues"
-      user_login="[null]"
-      shared="[true]"
-      description="[null]"
-      data="resolved=false"
-      created_at="2011-04-25 01:15:00"
-      updated_at="2011-04-25 01:15:00" />
-
-  <issue_filters
-      id="2"
-      name="False Positive and Won't Fix Issues"
-      user_login="[null]"
-      shared="[true]"
-      description="[null]"
-      data="resolutions=FALSE-POSITIVE,WONTFIX"
-      created_at="2011-04-25 01:15:00"
-      updated_at="2011-04-25 01:15:00" />
-
-  <issue_filters
-      id="3"
-      name="My Unresolved Issues"
-      user_login="[null]"
-      shared="[true]"
-      description="[null]"
-      data="resolved=false|assignees=__me__"
-      created_at="2011-04-25 01:15:00"
-      updated_at="2011-04-25 01:15:00" />
-
-</dataset>
index d7eee268b0c4a89e5f3283ab049ec55a45d5dcba..00b38ab56749a6d2d0f15ad79aa3d6f8a3fee7e8 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.codehaus.sonar</groupId>
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.reflections</groupId>
+      <artifactId>reflections</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
       <resource>
         <directory>src/main/resources</directory>
         <filtering>true</filtering>
+        <includes>
+          <include>build.properties</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+        <excludes>
+          <exclude>build.properties</exclude>
+        </excludes>
       </resource>
-
     </resources>
     <testResources>
       <testResource>
diff --git a/server/sonar-server/src/main/java/org/sonar/server/charts/DistributionAreaChart.java b/server/sonar-server/src/main/java/org/sonar/server/charts/DistributionAreaChart.java
new file mode 100644 (file)
index 0000000..31e02d1
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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.server.charts;
+
+import org.apache.commons.lang.StringUtils;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.Plot;
+import org.jfree.chart.renderer.category.AreaRenderer;
+import org.jfree.data.category.DefaultCategoryDataset;
+import org.sonar.api.charts.AbstractChart;
+import org.sonar.api.charts.ChartParameters;
+
+import java.text.NumberFormat;
+
+public class DistributionAreaChart extends AbstractChart {
+  private static final String PARAM_COLORS = "c";
+
+  @Override
+  public String getKey() {
+    return "distarea";
+  }
+
+  @Override
+  protected Plot getPlot(ChartParameters params) {
+    DefaultCategoryDataset dataset = createDataset(params);
+
+    CategoryAxis domainAxis = new CategoryAxis();
+    domainAxis.setCategoryMargin(0.0);
+    domainAxis.setLowerMargin(0.0);
+    domainAxis.setUpperMargin(0.0);
+
+    NumberAxis rangeAxis = new NumberAxis();
+    rangeAxis.setNumberFormatOverride(NumberFormat.getIntegerInstance(params.getLocale()));
+    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+
+    AreaRenderer renderer = new AreaRenderer();
+    CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
+    plot.setForegroundAlpha(0.5f);
+    plot.setDomainGridlinesVisible(true);
+    configureColors(dataset, plot, params.getValues(PARAM_COLORS, ","));
+    return plot;
+  }
+
+  private DefaultCategoryDataset createDataset(ChartParameters params) {
+    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+
+    String[] series = params.getValues("v", "|", true);
+    int index = 0;
+    while (index < series.length) {
+      String[] pairs = StringUtils.split(series[index], ";");
+      if (pairs.length == 0) {
+        dataset.addValue((Number)0.0, index, "0");
+
+      } else {
+        for (String pair : pairs) {
+          String[] keyValue = StringUtils.split(pair, "=");
+          double val = Double.parseDouble(keyValue[1]);
+          dataset.addValue((Number) val, index, keyValue[0]);
+        }
+      }
+      index++;
+    }
+    return dataset;
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/charts/DistributionBarChart.java b/server/sonar-server/src/main/java/org/sonar/server/charts/DistributionBarChart.java
new file mode 100644 (file)
index 0000000..80cfb64
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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.server.charts;
+
+import org.apache.commons.lang.StringUtils;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.Plot;
+import org.jfree.chart.renderer.category.BarRenderer;
+import org.jfree.data.category.DefaultCategoryDataset;
+import org.sonar.api.charts.AbstractChart;
+import org.sonar.api.charts.ChartParameters;
+
+import java.awt.*;
+import java.text.DecimalFormat;
+
+public class DistributionBarChart extends AbstractChart {
+
+
+  public static final String PARAM_VALUES = "v";
+  public static final String PARAM_COLORS = "c";
+  public static final String PARAM_Y_SUFFIX = "ysuf";
+  public static final String PARAM_X_SUFFIX = "xsuf";
+  public static final String PARAM_FONT_SIZE = "fs";
+
+  @Override
+  public String getKey() {
+    return "distbar";
+  }
+
+  @Override
+  public Plot getPlot(ChartParameters params) {
+    CategoryPlot plot = generateJFreeChart(params);
+    plot.setOutlinePaint(OUTLINE_COLOR);
+    plot.setDomainGridlinePaint(GRID_COLOR);
+    plot.setRangeGridlinePaint(GRID_COLOR);
+    return plot;
+  }
+
+  private CategoryPlot generateJFreeChart(ChartParameters params) {
+    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+    CategoryPlot plot = new CategoryPlot();
+
+    Font font = getFont(params.getValue(PARAM_FONT_SIZE));
+    configureDomainAxis(plot, font);
+    configureRangeAxis(plot, params.getValue(PARAM_Y_SUFFIX, "", true), font);
+    configureRenderer(plot);
+    configureValues(dataset, params.getValues(PARAM_VALUES, "|", true), params.getValue(PARAM_X_SUFFIX, "", true));
+    configureColors(dataset, plot, params.getValues(PARAM_COLORS, ","));
+
+    plot.setDataset(dataset);
+    return plot;
+  }
+
+  static void configureValues(DefaultCategoryDataset dataset, String[] series, String xSuffix) {
+    int index = 0;
+    while (index < series.length) {
+      String[] pairs = StringUtils.split(series[index], ";");
+      if (pairs.length == 0) {
+        dataset.addValue((Number) 0.0, index, "0");
+
+      } else {
+        for (String pair : pairs) {
+          String[] keyValue = StringUtils.split(pair, "=");
+          double val = Double.parseDouble(keyValue[1]);
+          dataset.addValue((Number) val, index, keyValue[0] + xSuffix);
+        }
+      }
+      index++;
+    }
+
+  }
+
+  private void configureRenderer(CategoryPlot plot) {
+    BarRenderer renderer = new BarRenderer();
+    renderer.setDrawBarOutline(true);
+    renderer.setSeriesItemLabelsVisible(0, true);
+    renderer.setItemMargin(0);
+    plot.setRenderer(renderer);
+  }
+
+  private void configureDomainAxis(CategoryPlot plot, Font font) {
+    CategoryAxis categoryAxis = new CategoryAxis();
+    categoryAxis.setTickMarksVisible(true);
+    categoryAxis.setTickLabelFont(font);
+    categoryAxis.setTickLabelPaint(OUTLINE_COLOR);
+    plot.setDomainAxis(categoryAxis);
+    plot.setDomainGridlinesVisible(false);
+  }
+
+  private Font getFont(String fontSize) {
+    int size = FONT_SIZE;
+    if (!StringUtils.isBlank(fontSize)) {
+      size = Integer.parseInt(fontSize);
+    }
+    return new Font("SansSerif", Font.PLAIN, size);
+  }
+
+  private void configureRangeAxis(CategoryPlot plot, String valueLabelSuffix, Font font) {
+    NumberAxis numberAxis = new NumberAxis();
+    numberAxis.setUpperMargin(0.3);
+    numberAxis.setTickLabelFont(font);
+    numberAxis.setTickLabelPaint(OUTLINE_COLOR);
+    String suffix = "";
+    if (valueLabelSuffix != null && !"".equals(valueLabelSuffix)) {
+      suffix = new StringBuilder().append("'").append(valueLabelSuffix).append("'").toString();
+    }
+    numberAxis.setNumberFormatOverride(new DecimalFormat("0" + suffix));
+    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+    plot.setRangeAxis(numberAxis);
+  }
+}
index 3869ffb3b87d61660fed6f5a62a46f5f260580f7..127aeac10ce97564e0445ad6d84f8360c3dd804a 100644 (file)
  */
 package org.sonar.server.dashboard.db;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
 import org.sonar.core.dashboard.DashboardDto;
 import org.sonar.core.dashboard.DashboardMapper;
 import org.sonar.core.persistence.DaoComponent;
 import org.sonar.core.persistence.DbSession;
 
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
 public class DashboardDao implements DaoComponent {
 
   @CheckForNull
index 3b3c6476fbd2862ae4c1f95084850fdbdc42fce4..5bc77ce1fe383ae7eac6602204843b86151e1c8e 100644 (file)
  */
 package org.sonar.server.dashboard.db;
 
+import java.util.Collection;
 import org.sonar.core.dashboard.WidgetDto;
 import org.sonar.core.dashboard.WidgetMapper;
 import org.sonar.core.persistence.DaoComponent;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 
-import java.util.Collection;
-
 public class WidgetDao implements DaoComponent {
 
   private MyBatis myBatis;
index 46ec46113b8dba4544b676aabaf9cae7b13bc572..9ac498ebc248c32d341e7350b08e02dad851ec08 100644 (file)
@@ -20,6 +20,9 @@
 package org.sonar.server.dashboard.db;
 
 import com.google.common.base.Function;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
 import org.sonar.core.dashboard.WidgetPropertyDto;
 import org.sonar.core.dashboard.WidgetPropertyMapper;
 import org.sonar.core.persistence.DaoComponent;
@@ -27,10 +30,6 @@ import org.sonar.core.persistence.DaoUtils;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
 public class WidgetPropertyDao implements DaoComponent {
 
   private final MyBatis myBatis;
index ce41e8799be0e036d705dc6f7e690392261fe146..ab56dedec78deb400c6216c8dc3a0b73e18347f2 100644 (file)
@@ -21,3 +21,4 @@
 package org.sonar.server.dashboard.db;
 
 import javax.annotation.ParametersAreNonnullByDefault;
+
index 93024b8dc6d8bc8d72c9a5a419df30039727a0b4..2343d18367d9e5b565d392f24892820d3196dd4d 100644 (file)
@@ -21,3 +21,4 @@
 package org.sonar.server.dashboard;
 
 import javax.annotation.ParametersAreNonnullByDefault;
+
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/GlobalDefaultDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/GlobalDefaultDashboard.java
new file mode 100644 (file)
index 0000000..708b45e
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.api.web.DashboardTemplate;
+import org.sonar.core.measure.db.MeasureFilterDao;
+import org.sonar.core.measure.db.MeasureFilterDto;
+import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
+import org.sonar.server.dashboard.widget.WelcomeWidget;
+import org.sonar.server.measure.template.MyFavouritesFilter;
+import org.sonar.server.measure.template.ProjectFilter;
+
+/**
+ * Projects global dashboard for Sonar
+ *
+ * @since 3.1
+ */
+public final class GlobalDefaultDashboard extends DashboardTemplate {
+
+  private MeasureFilterDao filterDao;
+
+  public GlobalDefaultDashboard(MeasureFilterDao filterDao) {
+    this.filterDao = filterDao;
+  }
+
+  @Override
+  public Dashboard createDashboard() {
+    Dashboard dashboard = Dashboard.create()
+      .setGlobal(true)
+      .setLayout(DashboardLayout.TWO_COLUMNS);
+
+    dashboard.addWidget(WelcomeWidget.ID, 1);
+    addMyFavouritesWidget(dashboard);
+    addProjectsWidgets(dashboard);
+
+    return dashboard;
+  }
+
+  private void addMyFavouritesWidget(Dashboard dashboard) {
+    MeasureFilterDto filter = findSystemFilter(MyFavouritesFilter.NAME);
+    if (filter != null) {
+      dashboard
+        .addWidget(MeasureFilterListWidget.ID, 1)
+        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
+        .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "50");
+    }
+  }
+
+  private void addProjectsWidgets(Dashboard dashboard) {
+    MeasureFilterDto filter = findSystemFilter(ProjectFilter.NAME);
+    if (filter != null) {
+      dashboard
+        .addWidget(MeasureFilterListWidget.ID, 2)
+        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
+        .setProperty(MeasureFilterListWidget.PAGE_SIZE_PROPERTY, "20");
+
+      dashboard
+        .addWidget(MeasureFilterAsTreemapWidget.ID, 2)
+        .setProperty(MeasureFilterListWidget.FILTER_PROPERTY, filter.getId().toString())
+        .setProperty(MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, "ncloc")
+        .setProperty(MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, "coverage");
+    }
+  }
+
+  @Override
+  public String getName() {
+    return "Home";
+  }
+
+  private MeasureFilterDto findSystemFilter(String name) {
+    return filterDao.findSystemFilterByName(name);
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java
new file mode 100644 (file)
index 0000000..7f022ea
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.api.web.DashboardTemplate;
+
+/**
+ * Default dashboard
+ *
+ * @since 2.13
+ */
+public final class ProjectDefaultDashboard extends DashboardTemplate {
+
+  @Override
+  public String getName() {
+    return "Dashboard";
+  }
+
+  @Override
+  public Dashboard createDashboard() {
+    Dashboard dashboard = Dashboard.create();
+    dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
+    addFirstColumn(dashboard);
+    addSecondColumn(dashboard);
+    return dashboard;
+  }
+
+  private void addFirstColumn(Dashboard dashboard) {
+    dashboard.addWidget("size", 1);
+    dashboard.addWidget("duplications", 1);
+    dashboard.addWidget("complexity", 1);
+    dashboard.addWidget("events", 1);
+    dashboard.addWidget("description", 1);
+  }
+
+  private void addSecondColumn(Dashboard dashboard) {
+    dashboard.addWidget("debt_overview", 2);
+    dashboard.addWidget("rules", 2);
+    dashboard.addWidget("alerts", 2);
+    dashboard.addWidget("code_coverage", 2);
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java
new file mode 100644 (file)
index 0000000..405098f
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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.server.dashboard.template;
+
+import com.google.common.base.Preconditions;
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.api.web.DashboardTemplate;
+import org.sonar.core.issue.db.IssueFilterDao;
+import org.sonar.core.issue.db.IssueFilterDto;
+import org.sonar.server.dashboard.widget.ProjectIssueFilterWidget;
+
+/**
+ * Issues dashboard for Sonar
+ *
+ * @since 3.6
+ */
+public final class ProjectIssuesDashboard extends DashboardTemplate {
+
+  private final IssueFilterDao issueFilterDao;
+
+  public ProjectIssuesDashboard(IssueFilterDao issueFilterDao) {
+    this.issueFilterDao = issueFilterDao;
+  }
+
+  @Override
+  public String getName() {
+    return "Issues";
+  }
+
+  @Override
+  public Dashboard createDashboard() {
+    Dashboard dashboard = Dashboard.create();
+    dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
+
+    IssueFilterDto unresolvedIssues = getIssueFilterByName("Unresolved Issues");
+    IssueFilterDto hiddenDebt = getIssueFilterByName("False Positive and Won't Fix Issues");
+    IssueFilterDto myUnresolvedIssues = getIssueFilterByName("My Unresolved Issues");
+
+    addFirstColumn(dashboard, unresolvedIssues);
+    addSecondColumn(dashboard, unresolvedIssues, hiddenDebt, myUnresolvedIssues);
+    return dashboard;
+  }
+
+  private IssueFilterDto getIssueFilterByName(String name) {
+    IssueFilterDto filter = issueFilterDao.selectProvidedFilterByName(name);
+    Preconditions.checkState(filter != null, String.format("Could not find a provided issue filter with name '%s'", name));
+    return filter;
+  }
+
+  private void addFirstColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues) {
+    // Unresolved issues by status
+    dashboard.addWidget(ProjectIssueFilterWidget.ID, 1)
+      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId()))
+      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "statuses");
+    // Action plans
+    dashboard.addWidget("action_plans", 1);
+  }
+
+  private void addSecondColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues, IssueFilterDto hiddenDebt, IssueFilterDto myUnresolvedIssues) {
+    // Unresolved issues by assignee
+    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
+      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId()))
+      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "assignees");
+    // My unresolved issues
+    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
+      .setProperty("filter", Long.toString(myUnresolvedIssues.getId()));
+    // False positive and won't fix issues by resolution
+    dashboard.addWidget(ProjectIssueFilterWidget.ID, 2)
+      .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(hiddenDebt.getId()))
+      .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "resolutions");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java
new file mode 100644 (file)
index 0000000..f34b456
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.sonar.api.measures.CoreMetrics;
+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
+ *
+ * @since 3.0
+ */
+public final class ProjectTimeMachineDashboard extends DashboardTemplate {
+
+  private static final String METRIC1 = "metric1";
+  private static final String METRIC2 = "metric2";
+  private static final String METRIC3 = "metric3";
+  private static final String METRIC4 = "metric4";
+  private static final String METRIC5 = "metric5";
+  private static final String METRIC6 = "metric6";
+  private static final String METRIC7 = "metric7";
+  private static final String METRIC8 = "metric8";
+
+  @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, CoreMetrics.COMPLEXITY_KEY);
+    timelineWidget.setProperty(METRIC2, CoreMetrics.TECHNICAL_DEBT_KEY);
+    timelineWidget.setProperty(METRIC3, CoreMetrics.COVERAGE_KEY);
+
+    Widget sizeTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
+    sizeTimeMachineWidget.setProperty(METRIC1, CoreMetrics.NCLOC_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINES_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC3, CoreMetrics.STATEMENTS_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILES_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC5, CoreMetrics.CLASSES_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC6, CoreMetrics.FUNCTIONS_KEY);
+    sizeTimeMachineWidget.setProperty(METRIC7, CoreMetrics.ACCESSORS_KEY);
+
+    Widget commentsTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
+    commentsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMMENT_LINES_DENSITY_KEY);
+    commentsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.COMMENT_LINES_KEY);
+    commentsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY_KEY);
+    commentsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.PUBLIC_UNDOCUMENTED_API_KEY);
+
+    Widget duplicationTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard);
+    duplicationTimeMachineWidget.setProperty(METRIC1, CoreMetrics.DUPLICATED_LINES_DENSITY_KEY);
+    duplicationTimeMachineWidget.setProperty(METRIC2, CoreMetrics.DUPLICATED_LINES_KEY);
+    duplicationTimeMachineWidget.setProperty(METRIC3, CoreMetrics.DUPLICATED_BLOCKS_KEY);
+    duplicationTimeMachineWidget.setProperty(METRIC4, CoreMetrics.DUPLICATED_FILES_KEY);
+  }
+
+  private void addSecondColumn(Dashboard dashboard) {
+    Widget rulesTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
+    rulesTimeMachineWidget.setProperty(METRIC1, CoreMetrics.VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC2, CoreMetrics.BLOCKER_VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CRITICAL_VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC4, CoreMetrics.MAJOR_VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC5, CoreMetrics.MINOR_VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC6, CoreMetrics.INFO_VIOLATIONS_KEY);
+    rulesTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TECHNICAL_DEBT_KEY);
+
+    Widget complexityTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
+    complexityTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMPLEXITY_KEY);
+    complexityTimeMachineWidget.setProperty(METRIC2, CoreMetrics.FUNCTION_COMPLEXITY_KEY);
+    complexityTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CLASS_COMPLEXITY_KEY);
+    complexityTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILE_COMPLEXITY_KEY);
+
+    Widget testsTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard);
+    testsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COVERAGE_KEY);
+    testsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINE_COVERAGE_KEY);
+    testsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.BRANCH_COVERAGE_KEY);
+    testsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.TEST_SUCCESS_DENSITY_KEY);
+    testsTimeMachineWidget.setProperty(METRIC5, CoreMetrics.TEST_FAILURES_KEY);
+    testsTimeMachineWidget.setProperty(METRIC6, CoreMetrics.TEST_ERRORS_KEY);
+    testsTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TESTS_KEY);
+    testsTimeMachineWidget.setProperty(METRIC8, CoreMetrics.TEST_EXECUTION_TIME_KEY);
+  }
+
+  private Widget addTimeMachineWidgetOnFirstColumn(Dashboard dashboard) {
+    return addTimeMachineWidget(dashboard, 1);
+  }
+
+  private Widget addTimeMachineWidgetOnSecondColumn(Dashboard dashboard) {
+    return addTimeMachineWidget(dashboard, 2);
+  }
+
+  private Widget addTimeMachineWidget(Dashboard dashboard, int columnIndex) {
+    Widget widget = dashboard.addWidget("time_machine", columnIndex);
+    widget.setProperty("displaySparkLine", "true");
+    return widget;
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/package-info.java
new file mode 100644 (file)
index 0000000..0326d78
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.dashboard.template;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java
new file mode 100644 (file)
index 0000000..cd42eae
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetCategory({"Issues"})
+@WidgetProperties({
+  @WidgetProperty(key = "showResolvedIssues", type = WidgetPropertyType.BOOLEAN, defaultValue = "true")
+})
+public class ActionPlansWidget extends CoreWidget {
+  public ActionPlansWidget() {
+    super("action_plans", "Issues action plans", "/org/sonar/server/dashboard/widget/action_plans.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/AlertsWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/AlertsWidget.java
new file mode 100644 (file)
index 0000000..2394a05
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetLayout;
+import org.sonar.api.web.WidgetLayoutType;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetProperties({
+  @WidgetProperty(key = "show_ok", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
+})
+@WidgetLayout(WidgetLayoutType.NONE)
+public class AlertsWidget extends CoreWidget {
+
+  public AlertsWidget() {
+    super("alerts", "Alerts", "/org/sonar/server/dashboard/widget/alerts.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/BubbleChartWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/BubbleChartWidget.java
new file mode 100644 (file)
index 0000000..dbab080
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
+  @WidgetProperty(key = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN)
+})
+public class BubbleChartWidget extends CoreWidget {
+  public BubbleChartWidget() {
+    super("bubble_chart", "Project File Bubble Chart", "/org/sonar/server/dashboard/widget/bubbleChart.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ComplexityWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ComplexityWidget.java
new file mode 100644 (file)
index 0000000..84c51bf
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.server.dashboard.widget;
+
+public class ComplexityWidget extends CoreWidget {
+
+  public ComplexityWidget() {
+    super("complexity", "Complexity", "/org/sonar/server/dashboard/widget/complexity.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoreWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoreWidget.java
new file mode 100644 (file)
index 0000000..7db3f47
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public abstract class CoreWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+  private String id, title, templatePath;
+
+  protected CoreWidget(String id, String title, String templatePath) {
+    this.id = id;
+    this.title = title;
+    this.templatePath = templatePath;
+  }
+
+  @Override
+  public String getId() {
+    return id;
+  }
+
+  @Override
+  public String getTitle() {
+    return title;
+  }
+
+  @Override
+  protected String getTemplatePath() {
+    return templatePath;
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoverageWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CoverageWidget.java
new file mode 100644 (file)
index 0000000..951f96e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.UserRole;
+import org.sonar.api.web.WidgetCategory;
+
+@WidgetCategory("Tests")
+@UserRole(UserRole.USER)
+public class CoverageWidget extends CoreWidget {
+
+  public CoverageWidget() {
+    super("code_coverage", "Code coverage", "/org/sonar/server/dashboard/widget/coverage.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CustomMeasuresWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/CustomMeasuresWidget.java
new file mode 100644 (file)
index 0000000..9ab2e89
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetProperties({
+  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC),
+  @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC)
+})
+public class CustomMeasuresWidget extends CoreWidget {
+  public CustomMeasuresWidget() {
+    super("custom_measures", "Custom Measures", "/org/sonar/server/dashboard/widget/custom_measures.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DebtOverviewWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DebtOverviewWidget.java
new file mode 100644 (file)
index 0000000..ea7ff61
--- /dev/null
@@ -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.server.dashboard.widget;
+
+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/server/dashboard/widget/debt_overview.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DescriptionWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DescriptionWidget.java
new file mode 100644 (file)
index 0000000..4f96895
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetLayout;
+import org.sonar.api.web.WidgetLayoutType;
+
+@WidgetLayout(WidgetLayoutType.NONE)
+public class DescriptionWidget extends CoreWidget {
+
+  public DescriptionWidget() {
+    super("description", "Description", "/org/sonar/server/dashboard/widget/description.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DocumentationCommentsWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DocumentationCommentsWidget.java
new file mode 100644 (file)
index 0000000..40d71e2
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.server.dashboard.widget;
+
+public class DocumentationCommentsWidget extends CoreWidget {
+
+  public DocumentationCommentsWidget() {
+    super("documentation_comments", "Documentation Metrics", "/org/sonar/server/dashboard/widget/documentation_comments_widget.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DuplicationsWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/DuplicationsWidget.java
new file mode 100644 (file)
index 0000000..de161b8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.server.dashboard.widget;
+
+/**
+ * @author Patroklos PAPAPETROU
+ */
+
+public class DuplicationsWidget extends CoreWidget {
+
+  public DuplicationsWidget() {
+    super("duplications", "Duplications", "/org/sonar/server/dashboard/widget/duplications_widget.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/EventsWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/EventsWidget.java
new file mode 100644 (file)
index 0000000..c9a8b39
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.server.dashboard.widget;
+
+public class EventsWidget extends CoreWidget {
+
+  public EventsWidget() {
+    super("events", "Events", "/org/sonar/server/dashboard/widget/events.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/HotspotMetricWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/HotspotMetricWidget.java
new file mode 100644 (file)
index 0000000..a13cb4d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetCategory({"Hotspots"})
+@WidgetProperties({
+  @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5")
+})
+public class HotspotMetricWidget extends CoreWidget {
+  public HotspotMetricWidget() {
+    super("hotspot_metric", "Metric hotspot", "/org/sonar/server/dashboard/widget/hotspot_metric.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueFilterWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueFilterWidget.java
new file mode 100644 (file)
index 0000000..d3bc92a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters", "Issues"})
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = IssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
+  @WidgetProperty(key = IssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
+    options = {"severities", "resolutions", "statuses", "rules", "tags", "projectUuids", "assignees", "reporters",
+      "authors", "languages", "actionPlans", "createdAt"}),
+  @WidgetProperty(key = IssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class IssueFilterWidget extends CoreWidget {
+
+  public static final String FILTER_PROPERTY = "filter";
+  public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
+  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
+  public static final String ID = "issue_filter";
+
+  public IssueFilterWidget() {
+    super(ID, "Issue Filter", "/org/sonar/server/dashboard/widget/issue_filter.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueTagCloudWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssueTagCloudWidget.java
new file mode 100644 (file)
index 0000000..60fde54
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.PROJECT;
+
+@WidgetCategory({"Issues"})
+@WidgetScope(PROJECT)
+@WidgetProperties({
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
+})
+public class IssueTagCloudWidget extends CoreWidget {
+
+  public IssueTagCloudWidget() {
+    super("issue_tag_cloud", "Issue Tag Cloud", "/org/sonar/server/dashboard/widget/issue_tag_cloud.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssuesWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/IssuesWidget.java
new file mode 100644 (file)
index 0000000..9b03564
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+
+@WidgetCategory({"Issues", "Technical Debt"})
+public class IssuesWidget extends CoreWidget {
+
+  public IssuesWidget() {
+    super("rules", "Issues and Technical Debt", "/org/sonar/server/dashboard/widget/issues.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ItCoverageWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ItCoverageWidget.java
new file mode 100644 (file)
index 0000000..cb3b0ee
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.UserRole;
+import org.sonar.api.web.WidgetCategory;
+
+@WidgetCategory("Tests")
+@UserRole(UserRole.USER)
+public class ItCoverageWidget extends CoreWidget {
+
+  public ItCoverageWidget() {
+    super("it-coverage", "Integration Test Coverage", "/org/sonar/server/dashboard/widget/it_coverage.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsBubbleChartWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsBubbleChartWidget.java
new file mode 100644 (file)
index 0000000..9d8f1ce
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@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 = "xMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "yMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "xLogarithmic", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "yLogarithmic", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER)
+})
+public class MeasureFilterAsBubbleChartWidget extends CoreWidget {
+
+  public MeasureFilterAsBubbleChartWidget() {
+    super("measure_filter_bubble_chart", "Measure Filter as Bubble Chart", "/org/sonar/server/dashboard/widget/measure_filter_bubble_chart.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsCloudWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsCloudWidget.java
new file mode 100644 (file)
index 0000000..c148c4a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
+    options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT"}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
+})
+public class MeasureFilterAsCloudWidget extends CoreWidget {
+
+  public MeasureFilterAsCloudWidget() {
+    super("measure_filter_cloud", "Measure Filter as Cloud", "/org/sonar/server/dashboard/widget/measure_filter_cloud.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsHistogramWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsHistogramWidget.java
new file mode 100644 (file)
index 0000000..6341a1e
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @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}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "40"),
+  @WidgetProperty(key = "reverseOrder", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
+  @WidgetProperty(key = "relativeScale", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class MeasureFilterAsHistogramWidget extends CoreWidget {
+
+  public MeasureFilterAsHistogramWidget() {
+    super("measure_filter_histogram", "Measure Filter as Histogram", "/org/sonar/server/dashboard/widget/measure_filter_histogram.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsPieChartWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsPieChartWidget.java
new file mode 100644 (file)
index 0000000..c32565f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@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 = "mainMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "extraMetric1", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "extraMetric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "20")
+})
+public class MeasureFilterAsPieChartWidget extends CoreWidget {
+
+  public MeasureFilterAsPieChartWidget() {
+    super("measure_filter_pie_chart", "Measure Filter as Donut Chart", "/org/sonar/server/dashboard/widget/measure_filter_pie_chart.html.erb");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java
new file mode 100644 (file)
index 0000000..3eb4c9f
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER,
+    optional = false),
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.CHART_TITLE_PROPERTY, type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
+    defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC,
+    defaultValue = CoreMetrics.COVERAGE_KEY,
+    options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER,
+    optional = true, defaultValue = "55", description = "Height in percents of width"),
+  @WidgetProperty(key = MeasureFilterAsTreemapWidget.MAX_ITEMS_PROPERTY, type = WidgetPropertyType.INTEGER,
+    defaultValue = "30")
+})
+public class MeasureFilterAsTreemapWidget extends CoreWidget {
+  public static final String FILTER_PROPERTY = "filter";
+  public static final String SIZE_METRIC_PROPERTY = "sizeMetric";
+  public static final String COLOR_METRIC_PROPERTY = "colorMetric";
+  public static final String HEIGHT_PERCENTS_PROPERTY = "heightInPercents";
+  public static final String CHART_TITLE_PROPERTY = "chartTitle";
+  public static final String MAX_ITEMS_PROPERTY = "maxItems";
+  public static final String ID = "measure_filter_treemap";
+
+  public MeasureFilterAsTreemapWidget() {
+    super(ID, "Measure Filter as Treemap", "/org/sonar/server/dashboard/widget/measure_filter_treemap.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterListWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterListWidget.java
new file mode 100644 (file)
index 0000000..24d4a18
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetCategory({"Filters"})
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = MeasureFilterListWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false),
+  @WidgetProperty(key = MeasureFilterListWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30"),
+  @WidgetProperty(key = MeasureFilterListWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class MeasureFilterListWidget extends CoreWidget {
+  public static final String FILTER_PROPERTY = "filter";
+  public static final String PAGE_SIZE_PROPERTY = "pageSize";
+  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
+  public static final String ID = "measure_filter_list";
+
+  public MeasureFilterListWidget() {
+    super(ID, "Measure Filter as List", "/org/sonar/server/dashboard/widget/measure_filter_list.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectFileCloudWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectFileCloudWidget.java
new file mode 100644 (file)
index 0000000..616267d
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, options = "type:PERCENT"),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
+})
+public class ProjectFileCloudWidget extends CoreWidget {
+  public ProjectFileCloudWidget() {
+    super("project_file_cloud", "Project File Word Cloud", "/org/sonar/server/dashboard/widget/project_file_cloud.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectIssueFilterWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ProjectIssueFilterWidget.java
new file mode 100644 (file)
index 0000000..3f4f1ff
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.PROJECT;
+
+@WidgetCategory({"Filters", "Issues"})
+@WidgetScope(PROJECT)
+@WidgetProperties({
+  @WidgetProperty(key = ProjectIssueFilterWidget.FILTER_PROPERTY, type = WidgetPropertyType.ISSUE_FILTER, optional = false),
+  @WidgetProperty(key = ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "severities",
+    options = {"severities", "resolutions", "statuses", "rules", "tags", "assignees", "reporters", "authors",
+      "languages", "actionPlans", "createdAt"}),
+  @WidgetProperty(key = ProjectIssueFilterWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class ProjectIssueFilterWidget extends CoreWidget {
+
+  public static final String FILTER_PROPERTY = "filter";
+  public static final String DISTRIBUTION_AXIS_PROPERTY = "distributionAxis";
+  public static final String DISPLAY_FILTER_DESCRIPTION = "displayFilterDescription";
+  public static final String ID = "project_issue_filter";
+
+  public ProjectIssueFilterWidget() {
+    super(ID, "Project Issue Filter", "/org/sonar/server/dashboard/widget/project_issue_filter.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/SizeWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/SizeWidget.java
new file mode 100644 (file)
index 0000000..e5b0db1
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.server.dashboard.widget;
+
+public class SizeWidget extends CoreWidget {
+
+  public SizeWidget() {
+    super("size", "Size metrics", "/org/sonar/server/dashboard/widget/size.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TechnicalDebtPyramidWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TechnicalDebtPyramidWidget.java
new file mode 100644 (file)
index 0000000..1eb36c5
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.UserRole;
+import org.sonar.api.web.WidgetCategory;
+
+@UserRole(UserRole.USER)
+@WidgetCategory("Technical Debt")
+public final class TechnicalDebtPyramidWidget extends CoreWidget {
+
+  public TechnicalDebtPyramidWidget() {
+    super("technical_debt_pyramid", "Technical Debt Pyramid", "/org/sonar/server/dashboard/widget/technical_debt_pyramid.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimeMachineWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimeMachineWidget.java
new file mode 100644 (file)
index 0000000..73f96bb
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetCategory("History")
+@WidgetProperties({
+  @WidgetProperty(key = "title", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"),
+  @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
+})
+public class TimeMachineWidget extends CoreWidget {
+  public TimeMachineWidget() {
+    super("time_machine", "History Table", "/org/sonar/server/dashboard/widget/time_machine.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimelineWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TimelineWidget.java
new file mode 100644 (file)
index 0000000..afe5c9e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetCategory;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetCategory("History")
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN),
+  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "180")
+})
+public class TimelineWidget extends CoreWidget {
+  public TimelineWidget() {
+    super("timeline", "Timeline", "/org/sonar/server/dashboard/widget/timeline.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java
new file mode 100644 (file)
index 0000000..e70a341
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.WidgetProperties;
+import org.sonar.api.web.WidgetProperty;
+import org.sonar.api.web.WidgetPropertyType;
+
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
+    options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}),
+  @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55"),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100")
+})
+public class TreemapWidget extends CoreWidget {
+  public TreemapWidget() {
+    super("treemap-widget", "Treemap of Components", "/org/sonar/server/dashboard/widget/treemap.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WelcomeWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WelcomeWidget.java
new file mode 100644 (file)
index 0000000..743f44f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.server.dashboard.widget;
+
+import org.sonar.api.web.WidgetScope;
+
+import static org.sonar.api.web.WidgetScope.GLOBAL;
+
+@WidgetScope(GLOBAL)
+public class WelcomeWidget extends CoreWidget {
+
+  public static final String ID = "welcome";
+
+  public WelcomeWidget() {
+    super(ID, "Welcome", "/org/sonar/server/dashboard/widget/welcome.html.erb");
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WidgetConstants.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/WidgetConstants.java
new file mode 100644 (file)
index 0000000..55f6efe
--- /dev/null
@@ -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.server.dashboard.widget;
+
+/**
+ * Constants shared accross multiple widgets
+ */
+public interface WidgetConstants {
+
+  /**
+   * Widget property option used to filter out all the metrics which keys start with "new_".
+   *
+   * @see org.sonar.api.web.WidgetProperty#options()
+   */
+  String FILTER_OUT_NEW_METRICS = "key:^(?!new_).*";
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/package-info.java
new file mode 100644 (file)
index 0000000..2e21d54
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.dashboard.widget;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
index 354239cf75600f0e6d9e6ded39955a340d738685..49ed5a377863d65e7ae345043d88da10fcba8c99 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.dashboard.ws;
 
 import com.google.common.collect.ListMultimap;
+import java.util.Collection;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -33,8 +34,6 @@ import org.sonar.server.db.DbClient;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.user.UserSession;
 
-import java.util.Collection;
-
 public class ShowAction implements DashboardsWsAction {
 
   private static final String PARAM_KEY = "key";
index d7b36f91de191c1f98bd5faac3192aa7e70b4f93..df3059cd05f551dc7833066286bc241001dc7b04 100644 (file)
@@ -21,3 +21,4 @@
 package org.sonar.server.dashboard.ws;
 
 import javax.annotation.ParametersAreNonnullByDefault;
+
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/template/MyFavouritesFilter.java b/server/sonar-server/src/main/java/org/sonar/server/measure/template/MyFavouritesFilter.java
new file mode 100644 (file)
index 0000000..96e0e7e
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.server.measure.template;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.web.Filter;
+import org.sonar.api.web.FilterColumn;
+import org.sonar.api.web.FilterTemplate;
+
+/**
+ * Default filter for looking for user favourite resources.
+ *
+ * @since 3.1
+ */
+public class MyFavouritesFilter extends FilterTemplate {
+  public static final String NAME = "My favourites";
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  @Override
+  public Filter createFilter() {
+    return Filter.create()
+      .setDisplayAs(Filter.LIST)
+      .setFavouritesOnly(true)
+      .add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false))
+      .add(FilterColumn.create("name", null, FilterColumn.ASC, false))
+      .add(FilterColumn.create("date", null, FilterColumn.DESC, false));
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/template/ProjectFilter.java b/server/sonar-server/src/main/java/org/sonar/server/measure/template/ProjectFilter.java
new file mode 100644 (file)
index 0000000..a82ae69
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.server.measure.template;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.resources.Qualifiers;
+import org.sonar.api.web.Criterion;
+import org.sonar.api.web.Filter;
+import org.sonar.api.web.FilterColumn;
+import org.sonar.api.web.FilterTemplate;
+
+/**
+ * Default projects filter.
+ *
+ * @since 3.1
+ */
+public class ProjectFilter extends FilterTemplate {
+  public static final String NAME = "Projects";
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  @Override
+  public Filter createFilter() {
+    return Filter.create()
+        .setDisplayAs(Filter.LIST)
+        .add(Criterion.createForQualifier(Qualifiers.PROJECT))
+        .add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false))
+        .add(FilterColumn.create("name", null, FilterColumn.ASC, false))
+        .add(FilterColumn.create("version", null, FilterColumn.DESC, false))
+        .add(FilterColumn.create("metric", CoreMetrics.NCLOC_KEY, FilterColumn.DESC, false))
+        .add(FilterColumn.create("metric", CoreMetrics.TECHNICAL_DEBT_KEY, FilterColumn.DESC, false))
+        .add(FilterColumn.create("date", null, FilterColumn.DESC, false));
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/template/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/measure/template/package-info.java
new file mode 100644 (file)
index 0000000..4a9c1cd
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+@javax.annotation.ParametersAreNonnullByDefault
+package org.sonar.server.measure.template;
index 2bf4c9ca845700210a06968d4a69c77c7e2ba7b2..59f0cc900fc8fd7e3815a6caa7dd1598ee938a35 100644 (file)
@@ -58,6 +58,8 @@ import org.sonar.server.activity.ws.ActivityMapping;
 import org.sonar.server.authentication.ws.AuthenticationWs;
 import org.sonar.server.batch.BatchWsModule;
 import org.sonar.server.charts.ChartFactory;
+import org.sonar.server.charts.DistributionAreaChart;
+import org.sonar.server.charts.DistributionBarChart;
 import org.sonar.server.component.ComponentCleanerService;
 import org.sonar.server.component.ComponentService;
 import org.sonar.server.component.DefaultComponentFinder;
@@ -72,6 +74,40 @@ import org.sonar.server.computation.ws.HistoryAction;
 import org.sonar.server.computation.ws.IsQueueEmptyWs;
 import org.sonar.server.computation.ws.QueueAction;
 import org.sonar.server.config.ws.PropertiesWs;
+import org.sonar.server.dashboard.template.GlobalDefaultDashboard;
+import org.sonar.server.dashboard.template.ProjectDefaultDashboard;
+import org.sonar.server.dashboard.template.ProjectIssuesDashboard;
+import org.sonar.server.dashboard.template.ProjectTimeMachineDashboard;
+import org.sonar.server.dashboard.widget.ActionPlansWidget;
+import org.sonar.server.dashboard.widget.AlertsWidget;
+import org.sonar.server.dashboard.widget.BubbleChartWidget;
+import org.sonar.server.dashboard.widget.ComplexityWidget;
+import org.sonar.server.dashboard.widget.CoverageWidget;
+import org.sonar.server.dashboard.widget.CustomMeasuresWidget;
+import org.sonar.server.dashboard.widget.DebtOverviewWidget;
+import org.sonar.server.dashboard.widget.DescriptionWidget;
+import org.sonar.server.dashboard.widget.DocumentationCommentsWidget;
+import org.sonar.server.dashboard.widget.DuplicationsWidget;
+import org.sonar.server.dashboard.widget.EventsWidget;
+import org.sonar.server.dashboard.widget.HotspotMetricWidget;
+import org.sonar.server.dashboard.widget.IssueFilterWidget;
+import org.sonar.server.dashboard.widget.IssueTagCloudWidget;
+import org.sonar.server.dashboard.widget.IssuesWidget;
+import org.sonar.server.dashboard.widget.ItCoverageWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterAsBubbleChartWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterAsCloudWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterAsHistogramWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterAsPieChartWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
+import org.sonar.server.dashboard.widget.ProjectFileCloudWidget;
+import org.sonar.server.dashboard.widget.ProjectIssueFilterWidget;
+import org.sonar.server.dashboard.widget.SizeWidget;
+import org.sonar.server.dashboard.widget.TechnicalDebtPyramidWidget;
+import org.sonar.server.dashboard.widget.TimeMachineWidget;
+import org.sonar.server.dashboard.widget.TimelineWidget;
+import org.sonar.server.dashboard.widget.TreemapWidget;
+import org.sonar.server.dashboard.widget.WelcomeWidget;
 import org.sonar.server.dashboard.ws.DashboardsWs;
 import org.sonar.server.debt.DebtCharacteristicsXMLImporter;
 import org.sonar.server.debt.DebtModelBackup;
@@ -126,6 +162,8 @@ import org.sonar.server.language.ws.LanguageWs;
 import org.sonar.server.measure.MeasureFilterEngine;
 import org.sonar.server.measure.MeasureFilterExecutor;
 import org.sonar.server.measure.MeasureFilterFactory;
+import org.sonar.server.measure.template.MyFavouritesFilter;
+import org.sonar.server.measure.template.ProjectFilter;
 import org.sonar.server.measure.ws.ManualMeasuresWs;
 import org.sonar.server.measure.ws.TimeMachineWs;
 import org.sonar.server.metric.ws.MetricsWs;
@@ -298,6 +336,8 @@ public class PlatformLevel4 extends PlatformLevel {
     add(
       PluginDownloader.class,
       ChartFactory.class,
+      DistributionBarChart.class,
+      DistributionAreaChart.class,
       Views.class,
       ResourceTypes.class,
       SettingsChangeNotifier.class,
@@ -321,6 +361,40 @@ public class PlatformLevel4 extends PlatformLevel {
       // Dashboard
       DashboardsWs.class,
       org.sonar.server.dashboard.ws.ShowAction.class,
+      ProjectDefaultDashboard.class,
+      ProjectIssuesDashboard.class,
+      ProjectTimeMachineDashboard.class,
+      GlobalDefaultDashboard.class,
+      AlertsWidget.class,
+      CoverageWidget.class,
+      ItCoverageWidget.class,
+      DescriptionWidget.class,
+      ComplexityWidget.class,
+      IssuesWidget.class,
+      SizeWidget.class,
+      EventsWidget.class,
+      CustomMeasuresWidget.class,
+      TimelineWidget.class,
+      BubbleChartWidget.class,
+      TimeMachineWidget.class,
+      HotspotMetricWidget.class,
+      TreemapWidget.class,
+      MeasureFilterListWidget.class,
+      MeasureFilterAsTreemapWidget.class,
+      WelcomeWidget.class,
+      DocumentationCommentsWidget.class,
+      DuplicationsWidget.class,
+      TechnicalDebtPyramidWidget.class,
+      MeasureFilterAsPieChartWidget.class,
+      MeasureFilterAsCloudWidget.class,
+      MeasureFilterAsHistogramWidget.class,
+      MeasureFilterAsBubbleChartWidget.class,
+      ProjectFileCloudWidget.class,
+      DebtOverviewWidget.class,
+      ActionPlansWidget.class,
+      IssueFilterWidget.class,
+      ProjectIssueFilterWidget.class,
+      IssueTagCloudWidget.class,
 
       // update center
       UpdateCenterClient.class,
@@ -412,6 +486,8 @@ public class PlatformLevel4 extends PlatformLevel {
       MeasureFilterFactory.class,
       MeasureFilterExecutor.class,
       MeasureFilterEngine.class,
+      ProjectFilter.class,
+      MyFavouritesFilter.class,
       DefaultMetricFinder.class,
       ServerLifecycleNotifier.class,
       TimeMachineWs.class,
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/_complexity_chart.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/_complexity_chart.html.erb
new file mode 100644 (file)
index 0000000..b75db5d
--- /dev/null
@@ -0,0 +1,18 @@
+<% dist_measure = measure(metric)
+   if dist_measure && !dist_measure.data.blank?
+%>
+<div id="chart_<%=metric -%>" class="chart" style="display: <%= visible ? "block" : "none" %>">
+<%
+   query="ck=distbar&c=777777&v=" + u(dist_measure.data)
+   small_size_query=query + '&w=220&h=100&fs=8&bgc=ffffff'
+   big_size_query=query + '&w=300&h=150&fs=12&bgc=CAE3F2'
+%><%= chart(small_size_query, :id => 'chart_img_' + metric, :alt => title) -%>
+
+  <script type='text/javascript'>
+  //<![CDATA[
+  new Tip('chart_img_<%=metric-%>', '<div style="width:300px;"><b><%= title -%></b><br>'+
+    '<%= chart(big_size_query, :id => 'chart_img_' + metric, :alt => title) -%></div>');
+  //]]>
+  </script>
+</div>
+<% end %>
\ No newline at end of file
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb
new file mode 100644 (file)
index 0000000..75553d3
--- /dev/null
@@ -0,0 +1,97 @@
+<%
+   # This widget should only be display on root projects
+   if @project.qualifier == 'TRK' && has_role?(:user, @project)
+     action_plans = Internal.issues.findActionPlanStats(@resource.key)
+     open_action_plans = action_plans.select {|plan| plan.isOpen()}
+
+     div_id = "issues-action-plan-widget-#{widget.id.to_s}"
+%>
+
+<div class="line-block">
+  <% if has_role?(:admin, @project) %>
+  <div style="float:right">
+    <a href="<%= url_for :controller => 'action_plans', :action => 'index', :id => @project.id -%>">
+      <%= message('widgets.more') -%>
+    </a>
+  </div>
+  <% end %>
+
+  <h3><%= message('widget.action_plans.title') -%></h3>
+</div>
+
+
+<div id="<%= div_id -%>">
+
+<% if open_action_plans.size ==0 %>
+
+  <span class="empty_widget"><%= message('widget.action_plans.no_action_plan') -%></span>
+
+<%
+   else
+     show_resolved_issues = widget_properties["showResolvedIssues"]
+     if show_resolved_issues
+       line_class = "top"
+     else
+       line_class = "middle"
+       max_unresolved_issues = open_action_plans.map {|plan| plan.unresolvedIssues()}.max
+     end
+%>
+
+  <table class="width100 <%= show_resolved_issues ? 'actionPlans' : 'data' -%>">
+    <thead>
+    <tr>
+      <th colspan="<%= show_resolved_issues ? '3' : '4' %>"></th>
+    </tr>
+    </thead>
+    <tbody>
+      <%
+         open_action_plans.each do |plan|
+      %>
+      <tr class="<%= show_resolved_issues ? '' : cycle("even", "odd", :name => "action_plan_" + widget.id.to_s) -%>">
+        <td class="nowrap <%= line_class -%>"><%= h(plan.name) -%></td>
+        <td class="nowrap small <%= line_class -%> <%= 'over-due' if plan.overDue() -%>" style="text-align: right; padding-left:10px"><%= format_date(plan.deadLine())  -%></td>
+
+        <% if show_resolved_issues %>
+          <% if plan.totalIssues()==0 %>
+            <td class="noprogress nowrap <%= line_class -%>"><%= message('action_plans.no_issues_linked_to_action_plan') -%></td>
+          <% else %>
+            <td class="progress <%= line_class -%>">
+              <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%>
+            </td>
+          <% end %>
+        <%
+           else
+             unresolved_issues_size = plan.unresolvedIssues()
+        %>
+          <td class="right <%= line_class -%>" style="padding-left:20px">
+            <% if unresolved_issues_size == 0 %>
+              <%= unresolved_issues_size -%>
+            <% else %>
+                <%
+                   search_options = {}
+                   search_options['actionPlans'] = plan.key
+                   search_options['resolved'] = false
+                %>
+              <a href="<%= url_for_component_issues(@project, search_options) -%>"
+                 title="<%= message('widget.action_plans.x_unresolved_issues', :params => unresolved_issues_size.to_s) -%>"><%= unresolved_issues_size -%></a>
+            <% end %>
+          </td>
+          <td class="<%= line_class -%>" style="padding: 0 40px 0 10px; width: 300px;">
+            <div class="barchart" style="width: 100%">
+              <div style="width: <%= max_unresolved_issues > 0 ? 100 * unresolved_issues_size / max_unresolved_issues : 0 -%>%;background-color:#777;"></div>
+            </div>
+          </td>
+        <% end %>
+
+      </tr>
+      <%
+         end
+      %>
+    </tbody>
+  </table>
+
+<% end %>
+
+</div>
+
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/alerts.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/alerts.html.erb
new file mode 100644 (file)
index 0000000..d50c712
--- /dev/null
@@ -0,0 +1,95 @@
+<% m=measure(Metric::QUALITY_GATE_DETAILS)
+   if m && !m.data.blank?
+     details = JSON.parse m.data
+     m.alert_status = details['level']
+     raw_conditions = details['conditions']
+     conditions = []
+     missing_metric = false
+     raw_conditions.each do |condition|
+       if metric(condition['metric']).nil?
+         missing_metric = true
+       else
+         conditions << condition
+       end
+     end
+     alert_metric = metric(Metric::ALERT_STATUS)
+
+     warn_message = message('measure_filter.criteria.alert.warn')
+     error_message = message('measure_filter.criteria.alert.error')
+
+     css_class = "color_#{m.alert_status}"
+     if m.alert_status==Metric::TYPE_LEVEL_OK
+       label = "#{message('widget.alerts.no_alert')}."
+     elsif m.alert_status==Metric::TYPE_LEVEL_WARN
+       label = "#{message('widget.alerts.warnings')}"
+     else
+       label = "#{message('widget.alerts.errors')}"
+     end
+-%><div class="widget <%= css_class -%>" style="color: black !important" id="quality_gate_widget_<%= widget.id -%>">
+  <div><%= format_measure(measure(Metric::ALERT_STATUS)) -%> <%= label -%></div>
+  <% if conditions.any? {|condition| condition['level'] != 'OK'} || widget_properties['show_ok'] && !conditions.empty? -%>
+    <% conditions.sort_by {|condition| [ -condition['level'].length, metric(condition['metric']).short_name] }.each do |condition|
+
+      level = condition['level']
+      condition_metric = metric(condition['metric'])
+      operator = message("quality_gates.operator.#{condition['op']}.short")
+      period = condition['period']
+      warning_value = condition['warning']
+      error_value = condition['error']
+      actual_value = condition['actual']
+
+      detail_measure = ProjectMeasure.new :metric => alert_metric, :alert_status => level
+
+      drilldown_url = period.blank? ? url_for_drilldown(condition_metric) : url_for_drilldown(condition_metric, :period => period)
+
+      actual_measure = ProjectMeasure.new :metric => condition_metric, :value => actual_value, :alert_status => level
+      warning_measure = ProjectMeasure.new :metric => condition_metric, :value => warning_value
+      error_measure = ProjectMeasure.new :metric => condition_metric, :value => error_value
+
+      is_difference_measure = condition_metric.name.start_with?('new_')
+      is_issue_measure = get_issue_metrics.include? condition_metric.name
+      is_not_difference_measure_with_period = !is_difference_measure && !period.blank? && !is_issue_measure
+
+      tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
+
+
+      unless level == 'OK' && !widget_properties['show_ok']
+      -%>
+      <div class="dashbox" style="margin: 10px; vertical-align: baseline">
+        <p class="title"><%= condition_metric.short_name -%></p>
+        <% if is_not_difference_measure_with_period %>
+          <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure) -%></span>
+        <% else %>
+          <span class="big" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom"><%= format_measure(actual_measure, :url => drilldown_url) -%></span>
+        <% end %>
+        <% if level == 'WARN' -%><%= operator -%> <%= format_measure(warning_measure) -%><% end -%>
+        <% if level == 'ERROR' -%><%= operator -%> <%= format_measure(error_measure) -%><% end -%>
+        <% if level == 'OK' -%>
+          <% unless warning_value.blank? -%><%= warn_message -%> <%= operator -%> <%= format_measure(warning_measure) -%> <%= '|' unless error_value.blank? -%><% end -%>
+          <% unless error_value.blank? -%><%= error_message -%> <%= operator -%> <%= format_measure(error_measure) -%><% end -%>
+        <% end -%>
+        <p><%= period_label(@snapshot, period) unless period.blank? -%></p>
+      </div>
+    <% end
+     end
+   end
+   if missing_metric -%>
+   <div class="warning" style="clear: left"><%= message('widget.alerts.missing_metric') -%></div>
+   <% end -%>
+</div>
+<% else -%>
+<% m=measure(Metric::ALERT_STATUS)
+   if m && !m.alert_status.blank?
+     css_class = "widget color_#{m.alert_status}"
+     if m.alert_status==Metric::TYPE_LEVEL_OK
+       label = "<b>#{message('widget.alerts.no_alert')}</b>."
+     elsif m.alert_status==Metric::TYPE_LEVEL_WARN
+       label = "<b>#{message('widget.alerts.warnings')}</b>#{h(m.alert_text)}."
+     else
+       label = "<b>#{message('widget.alerts.errors')}</b>#{h(m.alert_text)}."
+     end
+-%><div class="<%= css_class -%>" id="alerts_widget">
+  <div><%= format_measure(m) -%> <%= label -%></div>
+</div>
+<% end
+end -%>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/bubbleChart.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/bubbleChart.html.erb
new file mode 100644 (file)
index 0000000..e018819
--- /dev/null
@@ -0,0 +1,88 @@
+<%
+   containerId = 'bubble-chart-widget' + widget.id.to_s
+   xMetric = widget_properties["xMetric"]
+   yMetric = widget_properties["yMetric"]
+   sizeMetric = widget_properties["sizeMetric"]
+   xLog = !!widget_properties["xLogarithmic"]
+   yLog = !!widget_properties["yLogarithmic"]
+   chartHeight = widget_properties["chartHeight"]
+   chartTitle = widget_properties["chartTitle"]
+%>
+
+<div class="bubble-chart-widget" id="<%= containerId %>">
+    <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+    <!--[if (gte IE 9)|!(IE)]><!-->
+    <% if chartTitle %>
+      <h3><%= h(chartTitle) -%></h3>
+    <% end %>
+    <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    <%
+       filter = MeasureFilter.new
+       # Test files should not be returned
+       qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
+       filter.criteria = {:qualifiers => qualifiers, :base => @project.key}
+       filter.metrics = [xMetric.name, yMetric.name, sizeMetric.name]
+       filter.execute(self, :user => current_user)
+    %>
+
+    var data = {
+          metrics: {
+            <%= xMetric.name -%>: {
+              name: '<%= xMetric.short_name -%>'
+            },
+            <%= yMetric.name -%>: {
+              name: '<%= yMetric.short_name -%>'
+            },
+            <%= sizeMetric.name -%>: {
+              name: '<%= sizeMetric.short_name -%>'
+            }
+          },
+          components: [
+            <%
+            filter.rows.each  do |row|
+              x = row.measure(xMetric)
+              y = row.measure(yMetric)
+              size = row.measure(sizeMetric)
+            %>
+            {
+              key: '<%= escape_javascript row.resource.key -%>',
+              name: '<%= escape_javascript row.resource.name -%>',
+              longName: '<%= escape_javascript row.resource.long_name -%>',
+              qualifier: '<%= escape_javascript row.resource.qualifier -%>',
+              measures: {
+                <%= xMetric.name -%>: { val: <%= x ? x.value : 0 -%>, fval: '<%= x ? x.formatted_value : "-" -%>' },
+                <%= yMetric.name -%>: { val: <%= y ? y.value : 0 -%>, fval: '<%= y ? y.formatted_value : "-" -%>' },
+                <%= sizeMetric.name -%>: { val: <%= size ? size.value : 0 -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
+              }
+            },
+            <% end %>
+          ]
+        },
+        widget = new SonarWidgets.BubbleChart();
+
+    widget
+      .metrics(data.metrics)
+      .metricsPriority(['<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'])
+      .components(data.components)
+      .height(<%= chartHeight -%>)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index',
+        xLog: <%= xLog -%>,
+        yLog: <%= yLog -%>,
+        noData: '<%= message('no_data') -%>',
+        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/complexity.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/complexity.html.erb
new file mode 100644 (file)
index 0000000..62832d2
--- /dev/null
@@ -0,0 +1,115 @@
+<%
+   file_complexity=measure('file_complexity')
+   function_complexity=measure('function_complexity')
+   class_complexity=measure('class_complexity')
+
+   if file_complexity || function_complexity || class_complexity
+     complexity=measure('complexity')
+%>
+
+  <div class="widget-row">
+    <div class="widget-span widget-span-5">
+      <div class="widget-measure-container">
+        <% if complexity %>
+          <p class="widget-measure widget-measure-main">
+            <span class="widget-label"><%= message('metric.complexity.name') %></span>
+            <span class="nowrap">
+              <%= format_measure(complexity, :url => url_for_drilldown(complexity)) %>
+              <%= format_variation(complexity) if dashboard_configuration.selected_period? -%>
+            </span>
+          </p>
+        <% end %>
+        <% if function_complexity %>
+          <p class="widget-measure">
+            <span class="widget-label"><%= message('widget.complexity.per_method.suffix') %></span>
+            <span class="nowrap">
+              <%= format_measure(function_complexity, :url => url_for_drilldown(function_complexity)) %>
+              <%= format_variation(function_complexity) if dashboard_configuration.selected_period? -%>
+            </span>
+          </p>
+        <% end %>
+        <% if class_complexity %>
+          <p class="widget-measure">
+            <span class="widget-label"><%= message('widget.complexity.per_class.suffix') %></span>
+            <span class="nowrap">
+              <%= format_measure(class_complexity, :url => url_for_drilldown(class_complexity)) %>
+                <%= format_variation(class_complexity) if dashboard_configuration.selected_period? -%>
+            </span>
+          </p>
+        <% end %>
+        <% if file_complexity %>
+          <p class="widget-measure">
+            <span class="widget-label"><%= message('widget.complexity.per_file.suffix') %></span>
+            <span class="nowrap">
+              <%= format_measure(file_complexity, :url => url_for_drilldown(file_complexity)) %>
+                <%= format_variation(file_complexity) if dashboard_configuration.selected_period? -%>
+            </span>
+          </p>
+        <% end %>
+      </div>
+    </div>
+
+    <div class="widget-span widget-span-7">
+      <%
+         function_distribution=measure('function_complexity_distribution')
+         class_distribution=measure('class_complexity_distribution')
+         file_distribution=measure('file_complexity_distribution')
+         distributions=[function_distribution, class_distribution, file_distribution].compact
+         selected_distribution=nil
+         if distributions.size>0
+           selected_distribution=distributions.first
+         end
+         if selected_distribution
+      %>
+        <div class="dashbox" id="cmp_charts">
+          <script type='text/javascript'>
+            //<![CDATA[
+            function selectComplexity(metric) {
+              $j('#cmp_charts .chart').hide();
+              $j('#chart_' + metric).show();
+            }
+          </script>
+          <style>
+            #cmp_charts form {
+              font-size: 93%; padding-left: 30px;
+            }
+
+            #cmp_charts form label {
+              padding-right: 5px;
+            }
+          </style>
+          <% distributions.each do |distribution_measure| %>
+            <%= render :partial => 'project/widgets/complexity_chart', :locals => {:metric => distribution_measure.metric.key, :title => distribution_measure.metric.description, :visible => (selected_distribution==distribution_measure)} %>
+          <% end %>
+
+          <form>
+            <%
+               count_dist=0
+               if function_distribution
+                 count_dist+=1
+            %>
+              <input type="radio" name="cmp_dist" value="function_complexity_distribution" id="cmp_dist_function_complexity_distribution" onClick="selectComplexity('function_complexity_distribution');" <%= 'checked' if function_distribution==selected_distribution -%>/>
+              <label for="cmp_dist_function_complexity_distribution"><%= message('metric.functions.name') -%></label>
+            <%
+               end
+               if class_distribution
+                 count_dist+=1
+            %>
+              <input type="radio" name="cmp_dist" value="class_complexity_distribution" id="cmp_dist_class_complexity_distribution" onClick="selectComplexity('class_complexity_distribution');" <%= 'checked' if class_distribution==selected_distribution -%>/>
+              <label for="cmp_dist_class_complexity_distribution"><%= message('metric.classes.name') -%></label><%= '<br/>' if count_dist==2 %>
+            <%
+               end
+               if file_distribution
+                 count_dist+=1
+            %>
+              <input type="radio" name="cmp_dist" value="file_complexity_distribution" id="cmp_dist_file_complexity_distribution" onClick="selectComplexity('file_complexity_distribution');" <%= 'checked' if file_distribution==selected_distribution -%>/>
+              <label for="cmp_dist_file_complexity_distribution"><%= message('metric.files.name') -%></label>
+            <% end %>
+
+          </form>
+
+        </div>
+      <% end %>
+    </div>
+  </div>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/coverage.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/coverage.html.erb
new file mode 100644 (file)
index 0000000..e293cfa
--- /dev/null
@@ -0,0 +1,156 @@
+<%
+   code_coverage_measure=measure('coverage')
+   tests_measure=measure('tests')
+   execution_time=measure('test_execution_time')
+   success_percentage=measure('test_success_density')
+
+   if code_coverage_measure || tests_measure
+%>
+  <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('widget.code_coverage.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown('coverage'), :default => '-') %>
+            <%= format_variation(code_coverage_measure) if dashboard_configuration.selected_period? -%>
+          </span>
+        </div>
+        <%
+           line_coverage=measure('line_coverage')
+           if line_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
+            <span class="nowrap">
+              <%= format_measure(line_coverage, :url => url_for_drilldown('uncovered_lines', :highlight => 'line_coverage')) %>
+              <%= format_variation(line_coverage) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+        <% end %>
+        <%
+           branch_coverage=measure('branch_coverage')
+           if branch_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
+            <span class="nowrap">
+              <%= format_measure(branch_coverage, :url => url_for_drilldown('uncovered_conditions', :highlight => 'branch_coverage')) %>
+              <%= format_variation(branch_coverage) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+        <% end %>
+
+        <%
+           if dashboard_configuration.selected_period?
+             new_lines_to_cover_measure=measure('new_lines_to_cover')
+             if new_lines_to_cover_measure
+               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
+               if new_lines
+                 new_coverage=measure('new_coverage') if variation_value('new_coverage')
+                 new_line_coverage=measure('new_line_coverage') if variation_value('new_line_coverage')
+                 new_branch_coverage=measure('new_branch_coverage') if variation_value('new_branch_coverage')
+        %>
+              <% if new_lines.to_i==0 %>
+                <div class="widget-measure widget-measure-main">
+                  <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
+                  <p><%= message('widget.code_coverage.no_new_lines_to_cover') -%></p>
+                </div>
+               <% else %>
+                <% if new_coverage %>
+                  <div class="widget-measure widget-measure-main">
+                    <span class="widget-label"><%= message('widget.code_coverage.on_new_code') -%></span>
+                    <%= format_measure(new_coverage,
+                                       :period => dashboard_configuration.period_index,
+                                       :url => url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index)) %>
+                  </div>
+                <% end %>
+                <% if new_line_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
+                    <%= format_measure(new_line_coverage,
+                                       :period => dashboard_configuration.period_index,
+                                       :url => url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index),
+                                       :default => '-') %>
+                  </div>
+                <% end %>
+                <% if new_branch_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
+                    <%= format_measure(new_branch_coverage,
+                                       :period => dashboard_configuration.period_index,
+                                       :url => url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index),
+                                       :default => '-') %>
+                  </div>
+                <% end %>
+              <% end %>
+            <%
+               end
+               end
+               end
+            %>
+      </div>
+    </div>
+    <div class="widget-span widget-span-6">
+      <%
+         if tests_measure
+      %>
+        <div class="widget-measure-container">
+          <div class="widget-measure widget-measure-main">
+            <span class="widget-label"><%= message('widget.code_coverage.test_success') -%></span>
+            <span class="nowrap">
+              <%= format_measure(success_percentage, :url => url_for_drilldown(success_percentage)) %>
+              <%= format_variation(success_percentage) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.failures.suffix') -%></span>
+            <span class="nowrap">
+              <%= format_measure(Metric::TEST_FAILURES, :url => url_for_drilldown(Metric::TEST_FAILURES)) %>
+              <%= format_variation(Metric::TEST_FAILURES) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.errors.suffix') -%></span>
+            <span class="nowrap">
+              <%= format_measure(Metric::TEST_ERRORS, :url => url_for_drilldown(Metric::TEST_ERRORS)) %>
+              <%= format_variation(Metric::TEST_ERRORS) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.tests.suffix') -%></span>
+            <span class="nowrap">
+              <%= format_measure(tests_measure, :url => url_for_drilldown('tests')) %>
+              <%= format_variation(tests_measure) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+
+          <% skipped_measure=measure(Metric::SKIPPED_TESTS)
+             if dashboard_configuration.selected_period? || (skipped_measure && skipped_measure.value && skipped_measure.value>0)
+          %>
+            <div class="widget-measure">
+              <span class="widget-label"><%= message('widget.code_coverage.skipped.suffix') -%></span>
+              <span class="nowrap">
+                <%= format_measure(skipped_measure, :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %>
+                <%= format_variation(skipped_measure) if dashboard_configuration.selected_period? -%>
+              </span>
+            </div>
+          <% end %>
+
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.code_coverage.execution_time') -%></span>
+            <span class="nowrap">
+              <%= format_measure(execution_time, :url => url_for_drilldown('test_execution_time')) %>
+              <%= format_variation(execution_time) if dashboard_configuration.selected_period? -%>
+            </span>
+          </div>
+        </div>
+      <% end %>
+    </div>
+  </div>
+<% end %>
+
+
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb
new file mode 100644 (file)
index 0000000..c817403
--- /dev/null
@@ -0,0 +1,36 @@
+<%
+   measures=[]
+   (1..10).each do |index|
+     metric=widget_properties["metric#{index}"]
+     m=(metric ? measure(metric) : nil)
+     measures << m if m
+   end
+   period = params[:period]
+   unless measures.empty? || measures.none? { |measure| measure.visible?(period.to_i) }
+%>
+  <div class="widget-row">
+    <%
+       measures.each do |measure|
+         if measure.visible?(period.to_i)
+    -%>
+        <div class="widget-span widget-span-3">
+          <div class="widget-measure-container">
+            <p class="widget-measure widget-measure-main">
+              <span class="widget-label"><%= measure.metric.short_name -%></span>
+              <span class="nowrap">
+                <% if measure.value.nil? && measure.text_value.nil? -%>
+                  <%= format_measure(measure, :url => url_for_drilldown(measure, :period => period), :period => period) -%>
+                <% else %>
+                  <%= format_measure(measure, :url => url_for_drilldown(measure)) -%>
+                  <%= format_variation(measure) if dashboard_configuration.selected_period? -%>
+                <% end -%>
+              </span>
+            </p>
+          </div>
+        </div>
+      <%
+         end
+         end
+      -%>
+  </div>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/debt_overview.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/debt_overview.erb
new file mode 100644 (file)
index 0000000..87cceb5
--- /dev/null
@@ -0,0 +1,33 @@
+<%
+   sqale_rating = @snapshot.measure('sqale_rating')
+   sqale_debt_ratio = @snapshot.measure('sqale_debt_ratio')
+   if sqale_rating && sqale_rating.text_value && sqale_debt_ratio
+%>
+  <% 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">
+              <%= format_measure(sqale_rating, :url => url_for_drilldown(sqale_rating)) %>
+            </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)) %>
+            <%= format_variation(sqale_debt_ratio) if dashboard_configuration.selected_period? -%>
+          </span>
+        </div>
+      </div>
+    </div>
+    </div>
+  <% end %>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/description.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/description.html.erb
new file mode 100644 (file)
index 0000000..6d58779
--- /dev/null
@@ -0,0 +1,90 @@
+<div class="widget">
+  <h3 class="description-widget-project">
+    <i class="icon-qualifier-<%= @project.qualifier.downcase -%>"></i>
+    <%= @project.name -%>
+  </h3>
+  <span class="description-widget-key"><%= h @project.key -%></span>
+
+  <% if @project.description.present? %>
+    <p class="description-widget-description"><%= h @project.description -%></p>
+  <% end %>
+
+  <%
+     qprofiles_measure = measure(Metric::QUALITY_PROFILES)
+     if qprofiles_measure && !qprofiles_measure.data.blank?
+       qprofiles = JSON.parse qprofiles_measure.data
+       if qprofiles.size>0
+  %>
+    <p class="description-widget-description">
+      <%= message('widget.description.profiles') -%>:
+      <% qprofiles.each_with_index do |profile, i| %>
+        <span class="nowrap">
+          <span id="resource_profile">
+           <%= link_to profile['name'], {:controller => 'profiles', :action => 'show', :key => profile['key']}, :class => 'widget-link', :id => profile['language'] + '_profile_link' -%>
+          </span>
+          <span class="subtitle">
+            (<%= Api::Utils.language_name(profile['language']) -%>)
+          </span>
+          <% if i < (qprofiles.size - 1) %>,<% end %>
+        </span>
+      <%   end
+         end %>
+    </p>
+  <%
+     else
+       profile_measure=@snapshot.measure('profile')
+       if profile_measure
+  %>
+      <p class="description-widget-description">
+        <%= message('widget.description.profile') -%>:
+        <span id="resource_profile">
+          <%= link_to profile_measure.data, {:controller => 'profiles', :action => 'show', :id => profile_measure.value.to_i}, :class => 'widget-link', :id => 'profile_link' -%>
+        </span>
+      </p>
+    <% end
+       end %>
+
+  <%
+     unless @resource.qualifier == 'DEV' or @resource.qualifier == 'VW' or @resource.qualifier == 'SVW'
+       using_default=false
+       quality_gate=Property.value('sonar.qualitygate', @resource && @resource.id, nil)
+       unless quality_gate
+         quality_gate=Property.value('sonar.qualitygate', nil, nil)
+         using_default=false || quality_gate
+       end
+       if quality_gate
+         qgate = Internal.quality_gates.get(quality_gate.to_i)
+  %>
+    <p class="description-widget-description">
+      <span id="resource_qgate">
+        <%= message('widget.description.qualitygate') -%>:
+        <%= link_to qgate.getName(), (url_for :controller => '/quality_gates') + '#show/' + quality_gate, :class => 'widget-link', :id => 'qgate_link' -%>
+        <% if using_default %>
+          <span class="subtitle">(<%= message('default') -%>)</span>
+        <% end %>
+      </span>
+    </p>
+  <% end end %>
+
+  <% unless @project.project_links.empty? %>
+    <ul class="description-widget-links">
+      <% @project.project_links.sort.each do |link| %>
+        <li>
+          <% if link.href.starts_with?('http') %>
+            <a class="widget-link link-<%= h link.link_type -%>" target="_blank" href="<%= link.href -%>">
+              <i class="icon-<%= h link.link_type -%>"></i>
+              <%= h link.name -%>
+            </a>
+          <% else %>
+            <a class="widget-link link-<%= h link.link_type -%>" href="#" onclick="$j('#link_<%= link.id -%>').toggle();return false;">
+              <i class="icon-<%= h link.link_type -%>"></i>
+              <%= h(link.name) -%>
+            </a>
+
+            <div class="description-widget-link-data" id="link_<%= link.id -%>" style="display:none"><%= h(link.href) -%></div>
+          <% end %>
+        </li>
+      <% end %>
+    </ul>
+  <% end %>
+</div>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/documentation_comments_widget.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/documentation_comments_widget.html.erb
new file mode 100644 (file)
index 0000000..06423d5
--- /dev/null
@@ -0,0 +1,63 @@
+<%
+  if measure(Metric::LINES) || measure(Metric::NCLOC)
+    public_api=measure('public_api')
+    public_documented_api_density=measure('public_documented_api_density')
+    public_undocumented_api=measure('public_undocumented_api')
+    comment_lines=measure('comment_lines')
+    comment_lines_density=measure('comment_lines_density')
+%>
+<div class="widget-row">
+  <div class="widget-span widget-span-6">
+    <% if public_documented_api_density || public_api || public_undocumented_api %>
+    <div class="widget-measure-container">
+      <%
+        if public_documented_api_density
+      %>
+      <div class="widget-measure widget-measure-main">
+        <span class="widget-label"><%= message('widget.documentation_comments.documentation') -%></span>
+        <span class="nowrap">
+          <%= format_measure(public_documented_api_density, :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) %>
+          <%= format_variation('public_documented_api_density') if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+      <% end %>
+      <div class="widget-measure">
+        <span class="widget-label"><%= message('metric.public_api.name') -%></span>
+        <span class="nowrap">
+          <%= format_measure(public_api,:url => url_for_drilldown(public_api)) %>
+          <%= format_variation(public_api) if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+      <div class="widget-measure">
+        <span class="widget-label"><%= message('metric.public_undocumented_api.abbreviation') -%></span>
+        <span class="nowrap">
+          <%= format_measure(public_undocumented_api,:url => url_for_drilldown(public_undocumented_api)) %>
+          <%= format_variation(public_undocumented_api) if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+    </div>
+    <% end %>
+  </div>
+
+  <div class="widget-span widget-span-6">
+    <div class="widget-measure-container">
+      <div class="widget-measure widget-measure-main">
+        <span class="widget-label"><%= message('widget.documentation_comments.comments') -%></span>
+        <span class="nowrap">
+          <%= format_measure(comment_lines_density,:url => url_for_drilldown(comment_lines_density))%>
+          <%= format_variation(comment_lines_density) if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+      <div class="widget-measure">
+        <span class="widget-label"><%= message('metric.comment_lines.name') -%></span>
+        <span class="nowrap">
+          <%= format_measure(comment_lines,:url => url_for_drilldown(comment_lines)) %>
+          <%= format_variation(comment_lines) if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+    </div>
+  </div>
+</div>
+<%
+  end
+%>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/duplications_widget.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/duplications_widget.html.erb
new file mode 100644 (file)
index 0000000..99b487a
--- /dev/null
@@ -0,0 +1,41 @@
+<%
+  duplicated_lines_density=measure('duplicated_lines_density')
+  if duplicated_lines_density
+%>
+<div class="widget-row">
+  <div class="widget-span widget-span-12">
+    <div class="widget-measure widget-measure-main">
+      <span class="widget-label"><%= message('widget.duplications.duplications') -%></span>
+      <span class="nowrap">
+        <%= format_measure(duplicated_lines_density, :url => url_for_drilldown('duplicated_lines', :highlight =>  'duplicated_lines_density')) %>
+        <%= format_variation('duplicated_lines_density') if dashboard_configuration.selected_period? -%>
+      </span>
+    </div>
+
+    <div class="widget-measure">
+      <span class="widget-label"><%= message('widget.duplications.lines.suffix') -%></span>
+      <span class="nowrap">
+        <%= format_measure(measure('duplicated_lines'), :url => url_for_drilldown('duplicated_lines'))%>
+        <%= format_variation('duplicated_lines') if dashboard_configuration.selected_period? -%>
+      </span>
+    </div>
+
+    <div class="widget-measure">
+      <span class="widget-label"><%= message('widget.duplications.blocks.suffix') -%></span>
+      <span class="nowrap">
+        <%= format_measure(measure('duplicated_blocks'), :url => url_for_drilldown('duplicated_blocks'))%>
+        <%= format_variation('duplicated_blocks') if dashboard_configuration.selected_period? -%>
+      </span>
+    </div>
+
+    <div class="widget-measure">
+      <span class="widget-label"><%= message('widget.duplications.files.suffix') -%></span>
+      <span class="nowrap">
+        <%= format_measure(measure('duplicated_files'), :url => url_for_drilldown('duplicated_files'))%>
+        <%= format_variation('duplicated_files') if dashboard_configuration.selected_period? -%>
+      </span>
+    </div>
+
+  </div>
+</div>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/events.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/events.html.erb
new file mode 100644 (file)
index 0000000..d6be1d2
--- /dev/null
@@ -0,0 +1,120 @@
+<% 
+  if @resource.scope=='PRJ'
+
+    conditions = "component_uuid=:component_uuid"
+    values = {:component_uuid => @resource.uuid}
+    # in order to not display events linked to deleted snapshot, we build the SQL request with 'NOT IN' as most of the time, there won't be unprocessed snapshots
+    snapshots_to_be_deleted = Snapshot.find(:all, :conditions => ["status='U' AND project_id=?", @resource.id])
+    unless snapshots_to_be_deleted.empty?
+      conditions << " AND snapshot_id NOT IN (:sids)"
+      values[:sids] = snapshots_to_be_deleted.map { |s| s.id }
+    end
+
+    events=Event.find(:all, :conditions => [conditions, values], :order => 'event_date desc')
+    
+    categories = EventCategory.categories(true)
+%>
+
+<script type="text/javascript">
+  function changeCategory(categoryId, widgetId) {
+    var eventTableMaxSize = 8;
+    $j('#events_' + widgetId + ' tr.event').hide();
+    var elements;
+    if (categoryId=='all') {
+      elements = $j('#events_' + widgetId + ' tr.event');
+    } else {
+      elements = $j('#events_' + widgetId + ' tr.cat_' + categoryId);
+    }
+    var elementsToDisplay = elements.slice(0,eventTableMaxSize);
+    if (elementsToDisplay.size()==0) {
+      $j('#events_' + widgetId).hide();
+      $j('#show_more_events_' + widgetId).hide();
+      $j('#no_event_message_' + widgetId).show();
+    } else {
+      $j('#events_' + widgetId).show();
+      $j('#no_event_message_' + widgetId).hide();
+      elementsToDisplay.show();
+      if (elements.size() > eventTableMaxSize) {
+        $j('#show_more_events_' + widgetId).show();
+      } else {
+        $j('#show_more_events_' + widgetId).hide();
+      }
+    }
+  }
+
+  function showAllEvents(widgetId) {
+    var selectedCategory = $j('#select_category_' + widgetId).val();
+    if (selectedCategory=='all') {
+      $j('#events_' + widgetId + ' tr.event').show();
+    } else {
+      $j('#events_' + widgetId + ' tr.cat_' + selectedCategory).show();
+    }
+    $j('#show_more_events_' + widgetId).hide();
+  }
+</script>
+
+
+<h3><%= message('widget.events.title') -%> &nbsp;&nbsp;
+
+  <select class="small" id="select_category_<%= widget.id -%>" onchange="changeCategory(this.value, <%= widget.id -%>);">
+    <option value="all"><%= message('widget.events.all') -%></option>
+    <% categories.each do |categ| %>
+    <option value="<%= categ.name.parameterize -%>"><%= h message('event.category.' + categ.name, :default => categ.name) %></option>
+    <% end %>
+  </select>
+
+  <script>
+    $j(function() {
+      $j('#select_category_<%= widget.id -%>').select2({ width: '150px' });
+    });
+  </script>
+
+</h3>
+
+<table id="events_<%= widget.id -%>" class="spaced data">
+  <thead>
+    <tr>
+      <th colspan="4"></th>
+    </tr>
+  </thead>
+  
+  <tbody>
+<%
+   events.each do |event|
+     categ = event.category
+     profile_data={}
+     if categ=='Profile' && event.event_data
+       profile_data=Hash[*(event.event_data.split(';').map { |elt| elt.split('=') }.flatten)]
+     end
+%>
+<tr class="<%= cycle 'even','odd' -%> event cat_<%= categ.parameterize -%>">
+    <td x="<%= event.event_date -%>"><%= l(event.event_date.to_date) %></td>
+    <td><%= h message('event.category.' + categ, :default => categ) %></td>
+    <td>
+      <%= link_to_if profile_data['key'] && profile_data['from'] && profile_data['to'], event.name,
+                             :controller => 'profiles', :action => 'changelog', :key => profile_data['key'],
+                             :since =>  profile_data['from'], :to => profile_data['to'] -%>
+    </td>
+    <td>
+      <% unless event.description.blank? %>
+        <i class="icon-info" title="<%= h event.description -%>"></i>
+      <% end %>
+    </td>
+</tr>
+<%
+   end
+%>
+  </tbody>
+</table>
+
+<div id="no_event_message_<%= widget.id -%>" style="margin: 5px">
+  <span class="empty_widget"><%= message('widget.events.no_event') -%></span>
+</div>
+
+<a href="#" onclick="showAllEvents(<%= widget.id -%>);return false;" id="show_more_events_<%= widget.id -%>" class="action"><%= message('widget.events.show_all') -%></a>
+
+<script type="text/javascript">
+  changeCategory('all', <%= widget.id -%>);
+</script>
+
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/hotspot_metric.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/hotspot_metric.html.erb
new file mode 100644 (file)
index 0000000..bf28727
--- /dev/null
@@ -0,0 +1,85 @@
+<%
+   metric = widget_properties["metric"] || Metric.by_key('ncloc')
+
+   if measure(metric)
+
+     limit = widget_properties["numberOfLines"]
+     title = widget_properties["title"]
+     title = message('widget.hotspot_metric.hotspots_by_x', :params => metric.short_name) if title.blank?
+
+     snapshots = nil
+     if metric.numeric? && !@snapshot.leaves_qualifiers.empty?
+       snapshots_conditions=["snapshots.qualifier in (:qualifiers)", "snapshots.islast=:islast", "snapshots.status = 'P'"]
+       snapshots_values={:qualifiers => @snapshot.leaves_qualifiers, :islast => true}
+       snapshots_conditions << '(snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path)'
+       snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id)
+       snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%"
+
+       measures_conditions = ["project_measures.rule_id IS NULL", "project_measures.characteristic_id IS NULL", "project_measures.person_id IS NULL"]
+       measures_values = {}
+       measures_conditions << "project_measures.metric_id = :m_id"
+       measures_values[:m_id] = metric.id
+
+       measures=ProjectMeasure.find(:all,
+                                    :joins => :snapshot,
+                                    :conditions => [(snapshots_conditions + measures_conditions).join(' AND '), snapshots_values.merge(measures_values)],
+                                    :order => "project_measures.value #{'DESC' if metric.direction<0}",
+                                    :limit => limit)
+
+       snapshots=Snapshot.find(measures.map { |m| m.snapshot_id }, :include => 'project')
+       snapshots_by_id = {}
+       snapshots.each do |s|
+         snapshots_by_id[s.id]=s
+       end
+     end
+
+     unless snapshots && !snapshots.empty? %>
+    <h3><%= title -%></h3>
+    <span class="empty_widget"><%= message('no_results') -%></span>
+  <% else %>
+
+    <div class="line-block">
+      <div style="float:right">
+        <a class="underlined-link" href="<%= url_for_drilldown(metric) -%>"><%= message('widget.hotspot_metric.more') -%></a>
+      </div>
+      <h3><%= title -%></h3>
+    </div>
+
+    <table id="hotspots-<%= metric.name -%>-<%= widget.id -%>" class="data">
+      <thead>
+      <tr>
+        <th colspan="3"/>
+      </tr>
+      </thead>
+      <tbody>
+      <%
+         if metric.direction > 0
+           metric_max_value = measures.last.value
+         else
+           metric_max_value = measures.first.value
+         end
+         measures.each do |measure|
+           resource = snapshots_by_id[measure.snapshot_id].resource
+      %>
+        <tr class="<%= cycle 'even', 'odd', :name => ('hotspot_metric' + widget.id.to_s) -%>">
+          <td>
+            <%= link_to_resource(resource, h(resource.name), {:metric => metric.name, :class => 'underlined-link'}) -%>
+          </td>
+          <td class="right nowrap">
+            <%= format_measure(measure) -%>
+          </td>
+          <td class="barchart">
+            <div class="barchart" style="width: <%= (measure.value*100/metric_max_value).round.to_i -%>%">
+              <div style="width: 100%;"></div>
+            </div>
+          </td>
+        </tr>
+      <%
+         end
+      %>
+      </tbody>
+    </table>
+
+  <% end %>
+
+<% end %>
\ No newline at end of file
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_filter.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_filter.html.erb
new file mode 100644 (file)
index 0000000..f70e79e
--- /dev/null
@@ -0,0 +1,52 @@
+<%
+   container_id = 'widget-issue-filter-' + widget.id.to_s
+   filter_id = widget_properties['filter']
+   filter = Internal.issues.findIssueFilterById(filter_id.to_i)
+   distribution_axis = widget_properties['distributionAxis']
+   is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
+%>
+
+<% if filter %>
+
+  <% if is_enough_permissions %>
+
+    <% @widget_title = "<a href=\"#{url_for({:controller => 'issues', :action => 'index'})}#id=#{filter.id}\">#{h(filter.name)}</a>" %>
+    <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
+      <p class="note spacer-bottom"><%= h filter.description -%></p>
+    <% end %>
+
+    <div id="<%= container_id -%>"></div>
+    <script>
+      (function () {
+        var query = '<%= filter.data -%>';
+
+        // do not show widget if the filter contains "my" criterion,
+        // and a user is not authenticated
+        if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
+          jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
+          return;
+        }
+
+        require(['widgets/issue-filter/widget'], function (IssueFilter) {
+          window.requestMessages().done(function () {
+            new IssueFilter({
+              el: '#<%= container_id -%>',
+              query: query,
+              distributionAxis: '<%= distribution_axis -%>'
+            });
+          });
+        });
+      })();
+    </script>
+
+  <% else %>
+
+    <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
+
+  <% end %>
+
+<% else %>
+
+  <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
+
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_tag_cloud.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issue_tag_cloud.html.erb
new file mode 100644 (file)
index 0000000..99012a2
--- /dev/null
@@ -0,0 +1,61 @@
+<%
+  containerId = 'issue-tag-cloud' + widget.id.to_s
+  maxItems = widget_properties['maxItems'].to_i
+
+  if has_role?(:user, @project) && !Internal.issues.listTagsForComponent(@project.uuid, maxItems).isEmpty()
+    search_options = {
+      'resolved' => 'false'
+    }
+    if @project
+      search_options['componentUuids'] = @project.uuid
+    end
+    if @dashboard_configuration.selected_period?
+      search_options['createdAfter'] = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
+    end
+
+    title = message('widget.issue_tag_cloud.title')
+%>
+
+<div class="histogram-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <h3 style="margin-bottom: 5px;"><%= title -%></h3>
+  <!--<![endif]-->
+
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var createdAfter = '';
+    <% if @dashboard_configuration.selected_period? -%>
+    createdAfter = moment('<%= search_options['createdAfter'] -%>').format('YYYY-MM-DD');
+    <% end -%>
+
+    var queryParams = [
+          'componentUuid=<%= @project.uuid() -%>',
+          'ps=<%= maxItems -%>',
+          'createdAfter=' + createdAfter
+        ],
+        query = queryParams.join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('TagCloud')
+      .source(baseUrl + '/api/issues/component_tags?' + query)
+      .options({
+        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+        baseUrl: baseUrl + '/component_issues/index?id=<%= @project.key -%>#resolved=false',
+        noData: '<%= message('no_data') -%>',
+        createdAfter: createdAfter
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issues.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/issues.html.erb
new file mode 100644 (file)
index 0000000..0b2fe0c
--- /dev/null
@@ -0,0 +1,205 @@
+<%
+   issues = @snapshot.measure('violations')
+   blocker_issues = @snapshot.measure('blocker_violations')
+   critical_issues = @snapshot.measure('critical_violations')
+   major_issues = @snapshot.measure('major_violations')
+   minor_issues = @snapshot.measure('minor_violations')
+   info_issues = @snapshot.measure('info_violations')
+
+   new_issues = @snapshot.measure('new_violations')
+   new_blocker_issues = @snapshot.measure('new_blocker_violations')
+   new_critical_issues = @snapshot.measure('new_critical_violations')
+   new_major_issues = @snapshot.measure('new_major_violations')
+   new_minor_issues = @snapshot.measure('new_minor_violations')
+   new_info_issues = @snapshot.measure('new_info_violations')
+
+   technical_debt = @snapshot.measure('sqale_index')
+   new_technical_debt = @snapshot.measure('new_technical_debt')
+
+   if @dashboard_configuration.selected_period?
+     period_date = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
+   end
+
+   tooltip = message('widget.as_calculated_on_x', :params => l(@snapshot.created_at))
+%>
+
+<div class="widget-row">
+
+  <% if technical_debt %>
+    <div class="widget-span widget-span-3">
+      <div class="widget-measure-container">
+        <div class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('metric.sqale_index.short_name') -%></span>
+          <a href="<%= url_for_drilldown('sqale_index') -%>" class="widget-link link-<%= widget.key %>-debt"
+             title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(technical_debt) -%>
+          </a>
+          <%= format_variation(technical_debt) if dashboard_configuration.selected_period? -%>
+        </div>
+        <div class="widget-measure-delta">
+          <%
+             if @dashboard_configuration.selected_period?
+               technical_debt_variation = variation_value(technical_debt)
+               new_technical_debt_variation = variation_value(new_technical_debt)
+               estimated_cleared_technical_debt = (new_technical_debt_variation - technical_debt_variation).to_i if technical_debt_variation && new_technical_debt_variation
+          %>
+            <% if new_technical_debt_variation && new_technical_debt_variation > 0 %>
+              <p class="small">
+                <%= message('widget.rules.added') %>
+                <a href="<%= url_for_drilldown('new_technical_debt', :period => @dashboard_configuration.period_index) -%>"
+                   class="varw widget-link widget-link-red link-<%= widget.key %>-new-debt"
+                   title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_technical_debt, :style => 'none', :default => '-') -%></a>
+              </p>
+            <% end %>
+            <% if estimated_cleared_technical_debt && estimated_cleared_technical_debt > 0 %>
+              <p class="small">
+                <%= message('widget.rules.removed') %>
+                <span class="varb">-<%= Internal.i18n.formatLongDuration(estimated_cleared_technical_debt, 'SHORT') -%></span>
+              </p>
+            <% end %>
+          <% end %>
+        </div>
+      </div>
+    </div>
+  <% end %>
+
+  <div class="widget-span widget-span-3">
+    <div class="widget-measure-container">
+      <div class="widget-measure widget-measure-main">
+        <span class="widget-label"><%= message('widget.rules.issues') -%></span>
+        <span class="nowrap">
+          <span class="link-<%= widget.key %>-issues">
+            <a href="<%= "#{url_for(:controller => 'component_issues', :action => 'index')}?id=#{url_encode(@project.key)}" -%>" class="widget-link link-<%= widget.key %>-debt"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+              <%= format_measure(issues) -%>
+            </a>
+          </span>
+          <%= format_variation(issues) if dashboard_configuration.selected_period? -%>
+        </span>
+      </div>
+      <div class="widget-measure-delta">
+        <%
+           if @dashboard_configuration.selected_period?
+             issues_variation = variation_value(issues)
+             new_issues_variation = variation_value(new_issues)
+             estimated_cleared_issues = (new_issues_variation - issues_variation).to_i if issues_variation && new_issues_variation
+        %>
+          <% if new_issues_variation && new_issues_variation > 0 %>
+            <p class="small">
+              <%= message('widget.rules.added') %>
+              <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|createdAfter=<%= period_date -%>"
+                 class="varw widget-link widget-link-red link-<%= widget.key %>-new-issues"
+                 title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_issues, :style => 'none', :default => '-') -%></a>
+            </p>
+          <% end %>
+          <% if estimated_cleared_issues && estimated_cleared_issues > 0 %>
+            <p class="small">
+              <%= message('widget.rules.removed') %>
+              <span class="varb">-<%= number_with_precision(estimated_cleared_issues, :precision => 0) -%></span>
+            </p>
+          <% end %>
+        <% end %>
+      </div>
+    </div>
+  </div>
+
+  <div class="widget-span widget-span-4">
+    <table class="data widget-barchar">
+      <tr>
+        <td class="thin nowrap">
+          <i class="icon-severity-blocker"></i>
+          <%= message('blocker') -%>
+        </td>
+        <td class="thin right nowrap">
+          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER"
+             class="widget-link drilldown_BLOCKER" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(blocker_issues) -%>
+          </a>
+        </td>
+        <td class="thin nowrap">
+          <% if @dashboard_configuration.selected_period? %>
+            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER|createdAfter=<%= url_encode(period_date) -%>"
+               class="widget-link <% if variation_value(new_blocker_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-blocker-issues"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_blocker_issues, :style => 'none', :default => '-') -%></a>
+          <% end %>
+        </td>
+      </tr>
+      <tr>
+        <td class="thin nowrap">
+          <i class="icon-severity-critical"></i>
+          <%= message('critical') -%>
+        </td>
+        <td class="thin right nowrap">
+          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL"
+             class="widget-link drilldown_CRITICAL" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(critical_issues) -%>
+          </a>
+        </td>
+        <td class="thin nowrap">
+          <% if @dashboard_configuration.selected_period? %>
+            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL|createdAfter=<%= url_encode(period_date) -%>"
+               class="widget-link <% if variation_value(new_critical_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-critical-issues"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_critical_issues, :style => 'none', :default => '-') -%></a>
+          <% end %>
+        </td>
+      </tr>
+      <tr>
+        <td class="thin nowrap">
+          <i class="icon-severity-major"></i>
+          <%= message('major') -%>
+        </td>
+        <td class="thin right nowrap">
+          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR"
+             class="widget-link drilldown_MAJOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(major_issues) -%>
+          </a>
+        </td>
+        <td class="thin nowrap">
+          <% if @dashboard_configuration.selected_period? %>
+            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR|createdAfter=<%= url_encode(period_date) -%>"
+               class="widget-link <% if variation_value(new_major_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-major-issues"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_major_issues, :style => 'none', :default => '-') -%></a>
+          <% end %>
+        </td>
+      </tr>
+      <tr>
+        <td class="thin nowrap">
+          <i class="icon-severity-minor"></i>
+          <%= message('minor') -%>
+        </td>
+        <td class="thin right nowrap">
+          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR"
+             class="widget-link drilldown_MINOR" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(minor_issues) -%>
+          </a>
+        </td>
+        <td class="thin nowrap">
+          <% if @dashboard_configuration.selected_period? %>
+            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR|createdAfter=<%= url_encode(period_date) -%>"
+               class="widget-link <% if variation_value(new_minor_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-minor-issues"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_minor_issues, :style => 'none', :default => '-') -%></a>
+          <% end %>
+        </td>
+      </tr>
+      <tr>
+        <td class="thin nowrap">
+          <i class="icon-severity-info"></i>
+          <%= message('info') -%>
+        </td>
+        <td class="thin right nowrap">
+          <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO"
+             class="widget-link drilldown_INFO" title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
+            <%= format_measure(info_issues) -%>
+          </a>
+        </td>
+        <td class="thin nowrap">
+          <% if @dashboard_configuration.selected_period? %>
+            <a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO|createdAfter=<%= url_encode(period_date) -%>"
+               class="widget-link <% if variation_value(new_info_issues).to_i > 0 %>varw text-danger<% end -%> link-<%= widget.key %>-new-info-issues"
+               title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_info_issues, :style => 'none', :default => '-') -%></a>
+          <% end %>
+        </td>
+      </tr>
+    </table>
+  </div>
+</div>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/it_coverage.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/it_coverage.html.erb
new file mode 100644 (file)
index 0000000..52c01fe
--- /dev/null
@@ -0,0 +1,213 @@
+<%
+   it_coverage=measure('it_coverage')
+   overall_coverage=measure('overall_coverage')
+
+   if it_coverage || overall_coverage
+-%>
+  <div class="widget-row">
+
+  <% if it_coverage -%>
+    <div class="widget-span widget-span-6">
+      <div class="widget-measure-container">
+
+        <div class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('widget.it-coverage.name') -%></span>
+            <span class="nowrap">
+              <%= format_measure(it_coverage, :url => url_for_drilldown('it_coverage'), :default => '-') %>
+              <%= format_variation(it_coverage) if dashboard_configuration.selected_period? -%>
+            </span>
+        </div>
+
+        <%
+           it_line_coverage=measure('it_line_coverage')
+           if it_line_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
+              <span class="nowrap">
+                <%= format_measure(it_line_coverage, :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %>
+                <%= format_variation(it_line_coverage) if dashboard_configuration.selected_period? -%>
+              </span>
+          </div>
+        <% end %>
+
+        <%
+           it_branch_coverage=measure('it_branch_coverage')
+           if it_branch_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
+              <span class="nowrap">
+                <%= format_measure(it_branch_coverage, :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %>
+                <%= format_variation(it_branch_coverage) if dashboard_configuration.selected_period? -%>
+              </span>
+          </div>
+        <% end %>
+
+        <%
+           if dashboard_configuration.selected_period?
+             new_lines_to_cover_measure=measure('new_it_lines_to_cover')
+             if new_lines_to_cover_measure
+               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
+               if new_lines
+                 new_coverage=measure('new_it_coverage')
+                 new_line_coverage=measure('new_it_line_coverage')
+                 new_branch_coverage=measure('new_it_branch_coverage')
+        %>
+              <% if new_lines.to_i==0 %>
+                <div class="widget-measure widget-measure-main">
+                  <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
+
+                  <p><%= message('widget.it-coverage.no_new_lines_to_cover') -%></p>
+                </div>
+              <% else %>
+
+                <% if new_coverage %>
+                  <div class="widget-measure widget-measure-main">
+                    <span class="widget-label"><%= message('widget.it-coverage.on_new_code') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_coverage, :period => dashboard_configuration.period_index),
+                                           :default => '-') %>
+                      </span>
+                  </div>
+                <% end %>
+
+                <% if new_line_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_line_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_line_coverage, :period => dashboard_configuration.period_index)) %>
+                      </span>
+                  </div>
+                <% end %>
+
+                <% if new_branch_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_branch_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_branch_coverage, :period => dashboard_configuration.period_index)) %>
+                      </span>
+                  </div>
+                <% end %>
+
+              <% end %>
+
+            <% end %>
+          <% end %>
+        <% end %>
+
+      </div>
+    </div>
+  <% end %>
+
+  <% if overall_coverage -%>
+    <div class="widget-span widget-span-6">
+      <div class="widget-measure-container">
+
+        <div class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('widget.overall-coverage.name') -%></span>
+            <span class="nowrap">
+              <%= format_measure(overall_coverage, :url => url_for_drilldown('overall_coverage'), :default => '-') %>
+              <%= format_variation(overall_coverage) if dashboard_configuration.selected_period? -%>
+            </span>
+        </div>
+
+        <%
+           overall_line_coverage=measure('overall_line_coverage')
+           if overall_line_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
+              <span class="nowrap">
+                <%= format_measure(overall_line_coverage, :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
+                <%= format_variation(overall_line_coverage) if dashboard_configuration.selected_period? -%>
+              </span>
+          </div>
+        <% end %>
+
+        <%
+           overall_branch_coverage=measure('overall_branch_coverage')
+           if overall_branch_coverage
+        %>
+          <div class="widget-measure">
+            <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
+              <span class="nowrap">
+                <%= format_measure(overall_branch_coverage, :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
+                <%= format_variation(overall_branch_coverage) if dashboard_configuration.selected_period? -%>
+              </span>
+          </div>
+        <% end %>
+
+        <%
+           if dashboard_configuration.selected_period?
+             new_lines_to_cover_measure=measure('new_overall_lines_to_cover')
+             if new_lines_to_cover_measure
+               new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
+               if new_lines
+                 new_coverage=measure('new_overall_coverage')
+                 new_line_coverage=measure('new_overall_line_coverage')
+                 new_branch_coverage=measure('new_overall_branch_coverage')
+        %>
+              <% if new_lines.to_i==0 %>
+                <div class="widget-measure widget-measure-main">
+                  <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
+
+                  <p><%= message('widget.overall-coverage.no_new_lines_to_cover') -%></p>
+                </div>
+              <% else %>
+
+                <% if new_coverage %>
+                  <div class="widget-measure widget-measure-main">
+                    <span class="widget-label"><%= message('widget.overall-coverage.on_new_code') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_coverage, :period => dashboard_configuration.period_index),
+                                           :default => '-') %>
+                        <%= format_variation(new_coverage) if dashboard_configuration.selected_period? -%>
+                      </span>
+                  </div>
+                <% end %>
+
+                <% if new_line_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_line_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_line_coverage, :period => dashboard_configuration.period_index)) %>
+                        <%= format_variation(new_line_coverage) if dashboard_configuration.selected_period? -%>
+                      </span>
+                  </div>
+                <% end %>
+
+                <% if new_branch_coverage %>
+                  <div class="widget-measure">
+                    <span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
+                      <span class="nowrap">
+                        <%= format_measure(new_branch_coverage,
+                                           :period => dashboard_configuration.period_index,
+                                           :url => url_for_drilldown(new_branch_coverage, :period => dashboard_configuration.period_index)) %>
+                        <%= format_variation(new_branch_coverage) if dashboard_configuration.selected_period? -%>
+                      </span>
+                  </div>
+                <% end %>
+
+              <% end %>
+
+            <% end %>
+          <% end %>
+        <% end %>
+
+      </div>
+    </div>
+  <% end %>
+
+  </div>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_bubble_chart.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_bubble_chart.html.erb
new file mode 100644 (file)
index 0000000..c5a2302
--- /dev/null
@@ -0,0 +1,68 @@
+<%
+   containerId = 'bubble-chart-widget' + widget.id.to_s
+   chartTitle = widget_properties["chartTitle"]
+   chartHeight = widget_properties["chartHeight"]
+   filterId = widget_properties["filter"].to_i
+   xMetric = widget_properties["xMetric"]
+   yMetric = widget_properties["yMetric"]
+   sizeMetric = widget_properties["sizeMetric"]
+   xLog = !!widget_properties["xLogarithmic"]
+   yLog = !!widget_properties["yLogarithmic"]
+   maxItems = widget_properties["maxItems"].to_i
+
+   filter = MeasureFilter.find_by_id(filterId.to_i)
+   if filter
+     @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
+%>
+
+<div class="bubble-chart-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= xMetric.name -%>', '<%= yMetric.name -%>', '<%= sizeMetric.name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,longName,qualifier',
+          <% if (maxItems > 0) %>
+          'pageSize=<%= maxItems -%>',
+          <% end %>
+          'page=1',
+          'sort=metric:' + metrics[0]
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('BubbleChart')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .height(<%= chartHeight -%>)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index',
+        xLog: <%= xLog -%>,
+        yLog: <%= yLog -%>,
+        noData: '<%= message('no_data') -%>',
+        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% else %>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_cloud.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_cloud.html.erb
new file mode 100644 (file)
index 0000000..c45bb01
--- /dev/null
@@ -0,0 +1,59 @@
+<%
+  containerId = 'word-cloud' + widget.id.to_s
+  chartTitle = widget_properties['chartTitle']
+  filterId = widget_properties['filter'].to_i
+  maxItems = widget_properties['maxItems'].to_i
+
+  filter = MeasureFilter.find_by_id(filterId.to_i)
+  if filter
+    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
+%>
+
+<div class="histogram-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties['colorMetric'].name -%>',
+          '<%= widget_properties['sizeMetric'].name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,longName,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[1],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('WordCloud')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .options({
+        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+        baseUrl: baseUrl + '/dashboard/index',
+        noData: '<%= message('no_data') -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% else %>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_histogram.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_histogram.html.erb
new file mode 100644 (file)
index 0000000..9884207
--- /dev/null
@@ -0,0 +1,62 @@
+<%
+  containerId = 'histogram-widget' + widget.id.to_s
+  chartTitle = widget_properties["chartTitle"]
+  filterId = widget_properties["filter"].to_i
+  maxItems = widget_properties["maxItems"].to_i
+  reverseOrder = widget_properties["reverseOrder"]
+  relativeScale = widget_properties["relativeScale"]
+
+  filter = MeasureFilter.find_by_id(filterId.to_i)
+  if filter
+    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
+%>
+
+<div class="histogram-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties["metric"].name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,longName,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[0],
+          'asc=<%= reverseOrder -%>'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('Histogram')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index',
+        relativeScale: <%= relativeScale -%>,
+        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+        noData: '<%= message('no_data') -%>',
+        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% else %>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_list.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_list.html.erb
new file mode 100644 (file)
index 0000000..438c7f4
--- /dev/null
@@ -0,0 +1,28 @@
+<%
+   filter_id = widget_properties['filter']
+   page_size = widget_properties['pageSize']
+   filter = MeasureFilter.find_by_id(filter_id.to_i) if filter_id
+   if filter
+     filter.load_criteria_from_data
+     if !filter.require_authentication? || logged_in?
+       filter.set_criteria_value('display', 'list')
+       filter.set_criteria_value('pageSize', page_size)
+       filter.execute(self, :user => current_user)
+       @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id}
+%>
+
+  <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
+    <div style="padding-bottom: 5px">
+      <span class="note"><%= h filter.description -%></span>
+    </div>
+  <% end %>
+
+    <%= render :partial => 'measures/display_list', :locals => {:edit_mode => false, :filter => filter, :widget_id => widget.id} -%>
+<%
+     end
+   else
+%>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<%
+   end
+%>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_pie_chart.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_pie_chart.html.erb
new file mode 100644 (file)
index 0000000..c011ede
--- /dev/null
@@ -0,0 +1,64 @@
+<%
+  containerId = 'pie-chart-widget' + widget.id.to_s
+  chartHeight = widget_properties["chartHeight"]
+  chartTitle = widget_properties["chartTitle"]
+  filterId = widget_properties["filter"].to_i
+  maxItems = widget_properties["maxItems"].to_i
+
+  filter = MeasureFilter.find_by_id(filterId.to_i)
+  if filter
+    @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
+%>
+
+<div class="pie-chart-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties["mainMetric"].name -%>',
+          '<%= widget_properties["extraMetric1"].name -%>'
+          <% if (widget_properties["extraMetric2"]) %>
+          , '<%= widget_properties["extraMetric2"].name -%>'
+          <% end %>
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[0],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('PieChart')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .height(<%= chartHeight %>)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index',
+        noData: '<%= message('no_data') -%>',
+        noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% else %>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_treemap.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/measure_filter_treemap.html.erb
new file mode 100644 (file)
index 0000000..48c08f8
--- /dev/null
@@ -0,0 +1,67 @@
+<%
+   containerId = 'treemap-widget' + widget.id.to_s
+   chartTitle = widget_properties['chartTitle']
+   filterId = widget_properties['filter'].to_i
+   maxItems = widget_properties['maxItems'].to_i
+
+   # SONAR-2456
+   # When metrics are removed, we have to manually set them to the default ones
+   colorMetric = widget_properties['colorMetric'] || Metric.by_key('coverage')
+   sizeMetric = widget_properties['sizeMetric'] || Metric.by_key('ncloc')
+
+   filter = MeasureFilter.find_by_id(filterId.to_i)
+   if filter
+     @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
+%>
+
+<div class="treemap-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= colorMetric.name -%>',
+          '<%= sizeMetric.name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,longName,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[1],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+        .type('Treemap')
+        .source(baseUrl + '/measures/search_filter?' + query)
+        .metricsPriority(metrics)
+        .options({
+          heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
+          maxItems: <%= maxItems -%>,
+          maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+          baseUrl: baseUrl + '/dashboard/index',
+          noData: '<%= message('no_data') -%>',
+          resource: '<%= filter.name -%>'
+        })
+        .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+<% else %>
+  <p><%= image_tag 'warning.png' %> <%= message 'measure_filter.widget.unknown_filter_warning' -%></p>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_file_cloud.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_file_cloud.html.erb
new file mode 100644 (file)
index 0000000..8cb1c02
--- /dev/null
@@ -0,0 +1,76 @@
+<%
+  containerId = 'project-file-widget' + widget.id.to_s
+  colorMetric = widget_properties['colorMetric']
+  sizeMetric = widget_properties['sizeMetric']
+  chartTitle = widget_properties['chartTitle']
+  maxItems = widget_properties['maxItems'].to_i
+%>
+
+<div class="word-cloud-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    <%
+      filter = MeasureFilter.new
+      # Test files should not be returned
+      qualifiers = Api::Utils.java_facade.getResourceLeavesQualifiers(@project.qualifier).to_a.reject {|q| q == 'UTS'}
+      filter.criteria = {:qualifiers => qualifiers, :base => @project.key, :pageSize => maxItems, :sort => 'metric:' + sizeMetric.name, :asc => false}
+      filter.metrics = [colorMetric.name, sizeMetric.name]
+      filter.execute(self, :user => current_user)
+    %>
+
+    var data = {
+          metrics: {
+            <%= colorMetric.name -%>: {
+              name: '<%= colorMetric.short_name -%>',
+              direction: <%= colorMetric.direction -%>
+            },
+            <%= sizeMetric.name -%>: {
+              name: '<%= sizeMetric.short_name -%>'
+            }
+          },
+          components: [
+            <%
+            filter.rows.each  do |row|
+              color = row.measure(colorMetric)
+              size = row.measure(sizeMetric)
+            %>
+            {
+              key: '<%= escape_javascript row.resource.key -%>',
+              name: '<%= escape_javascript row.resource.name -%>',
+              longName: '<%= escape_javascript row.resource.long_name -%>',
+              qualifier: '<%= escape_javascript row.resource.qualifier -%>',
+              measures: {
+                <%= colorMetric.name -%>: { val: <%= color ? color.value : "null" -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
+                <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
+              }
+            },
+            <% end %>
+          ]
+        },
+        widget = new SonarWidgets.WordCloud();
+
+    widget
+        .metrics(data.metrics)
+        .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
+        .components(data.components)
+        .options({
+          baseUrl: baseUrl + '/dashboard/index/'
+        })
+        .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_issue_filter.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/project_issue_filter.html.erb
new file mode 100644 (file)
index 0000000..16edb81
--- /dev/null
@@ -0,0 +1,63 @@
+<%
+   container_id = 'widget-issue-filter-' + widget.id.to_s
+   filter_id = widget_properties['filter']
+   filter = Internal.issues.findIssueFilterById(filter_id.to_i)
+   distribution_axis = widget_properties['distributionAxis']
+   is_enough_permissions = filter.shared || (current_user && filter.userLogin == current_user.login)
+
+   if @dashboard_configuration.selected_period?
+     period_date = @snapshot.period_datetime(@dashboard_configuration.period_index).strftime('%FT%T%z')
+   else
+     period_date = nil
+   end
+%>
+
+<% if filter %>
+
+  <% if is_enough_permissions %>
+
+    <% @widget_title = "<a href=\"#{url_for({:controller => 'component_issues', :action => 'index'})}?id=#{u(@project.key)}##{filter.data}\">#{h(filter.name)}</a>" %>
+    <% if widget_properties['displayFilterDescription'] && !filter.description.blank? %>
+      <p class="note spacer-bottom"><%= h filter.description -%></p>
+    <% end %>
+
+    <div id="<%= container_id -%>"></div>
+    <script>
+      (function () {
+        var query = '<%= filter.data -%>';
+
+        // do not show widget if the filter contains "my" criterion,
+        // and a user is not authenticated
+        if (query && query.indexOf('__me__') !== -1 && !window.SS.user) {
+          jQuery('#<%= container_id -%>').closest('.block').addClass('hidden');
+          return;
+        }
+
+        require(['widgets/issue-filter/widget'], function (IssueFilter) {
+          window.requestMessages().done(function () {
+            new IssueFilter({
+              el: '#<%= container_id -%>',
+              query: query,
+              distributionAxis: '<%= distribution_axis -%>',
+              <% if period_date %>
+              periodDate: '<%= period_date -%>',
+              <% end %>
+              componentUuid: '<%= @project.uuid -%>',
+              componentKey: '<%= @project.key -%>'
+            });
+          });
+        });
+      })();
+    </script>
+
+  <% else %>
+
+    <p class="alert alert-warning"><%= message 'widget.issue_filter.insufficient_privileges_warning' -%></p>
+
+  <% end %>
+
+<% else %>
+
+  <p class="alert alert-warning"><%= message 'widget.issue_filter.unknown_filter_warning' -%></p>
+
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/size.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/size.html.erb
new file mode 100644 (file)
index 0000000..1a4387b
--- /dev/null
@@ -0,0 +1,195 @@
+<%
+  lines=measure('lines')
+  ncloc=measure('ncloc')
+  ncloc_language_distribution = measure('ncloc_language_distribution')
+  ncloc_language_dist_hash = Hash[*(ncloc_language_distribution.data.split(';').map { |elt| elt.split('=') }.flatten)] if ncloc && ncloc_language_distribution
+  generated_ncloc=measure('generated_ncloc')
+  generated_lines=measure('generated_lines')
+  accessors=measure('accessors')
+  classes=measure('classes')
+  files=measure('files')
+  directories=measure('directories')
+  functions=measure('functions')
+  projects=measure('projects')
+  if measure('lines') || ncloc
+    files=measure('files')
+    statements=measure('statements')
+    languages = Api::Utils.java_facade.getLanguages()
+%>
+
+<div class="widget-row widget-row-x">
+
+  <div class="widget-span widget-span-3-5">
+    <div class="widget-measure-container">
+      <% if ncloc %>
+        <p class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('metric.ncloc.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(ncloc, :url => url_for_drilldown(ncloc)) %>
+            <%= format_variation(ncloc) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+        <%  if generated_ncloc && generated_ncloc.value>0 %>
+          <p class="widget-label nowrap" style="margin-bottom: 7px">
+            <%= message('including_abbreviated') -%>
+            <%= format_measure(generated_ncloc, :url => url_for_drilldown(generated_ncloc)) -%> <%= format_variation(generated_ncloc) if dashboard_configuration.selected_period? -%>
+            <%= message('metric.generated_ncloc.name.suffix') -%>
+          </p>
+        <% end %>
+
+        <% if ncloc_language_dist_hash %>
+          <% if ncloc_language_dist_hash.size > 1 %>
+            <table class="data widget-barchar" id="size-widget-language-dist">
+              <%
+                 max = Math.sqrt(ncloc_language_dist_hash.max_by{|_k,v| v.to_i}[1].to_i)
+
+                 # Sort lines language distribution by lines count
+                 languages_by_key = Hash[languages.collect { |l| [l.getKey(), l.getName] }]
+                 ncloc_language_dist_hash.sort {|v1,v2| v2[1].to_i <=> v1[1].to_i }.each do |language_key, language_ncloc|
+              %>
+                <tr>
+                  <td>
+                    <% if  language_key.eql? '<null>' %>
+                      <%= message('unknown') -%>
+                    <% else %>
+                      <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
+                      <%= language ? language.getName() : language_key -%>
+                    <% end %>
+                  </td>
+                  <td class="thin right nowrap">
+                    <%= ncloc.format_numeric_value(language_ncloc) %>
+                  </td>
+                </tr>
+              <% end %>
+            </table>
+            <script>
+              jQuery(function () {
+                var chart = jQuery('#size-widget-language-dist'),
+                    count = chart.find('tr').length;
+                if (count > 3) {
+                  chart.find('tr:gt(2)').hide();
+                  var moreLinkBox = jQuery('<div></div>').addClass('widget-barchart-more').insertAfter(chart),
+                      moreLink = jQuery('<a><%= message('more') -%></a>').appendTo(moreLinkBox).on('click', function () {
+                    jQuery(this).hide();
+                    chart.find('tr').show();
+                  });
+                }
+              });
+            </script>
+          <% else %>
+            <% 
+              language_key = ncloc_language_dist_hash.first[0]
+              if  language_key.eql? '<null>' %>
+              <%= message('unknown') -%>
+            <% else %>
+              <% language = languages.find { |l| l.getKey()==language_key.to_s } -%>
+              <%= language ? language.getName() : language_key -%>
+            <% end %>
+          <% end %>
+        <% end %>
+      <% else %>
+        <p class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('metric.lines.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(lines, :url => url_for_drilldown(ncloc)) %>
+            <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+    </div>
+  </div>
+
+  <div class="widget-span widget-span-3-5">
+    <div class="widget-measure-container">
+      <p class="widget-measure widget-measure-main">
+        <span class="widget-label"><%= message('metric.files.name') -%></span>
+        <span class="nowrap">
+          <%= format_measure(files, :url => url_for_drilldown(files)) %>
+          <%= format_variation(files) if dashboard_configuration.selected_period? -%>
+        </span>
+      </p>
+
+      <% if directories %>
+        <p class="widget-measure">
+          <span class="widget-label"><%= message('metric.directories.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(directories, :url => url_for_drilldown(directories)) %>
+            <%= format_variation(directories) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+
+      <p class="widget-measure">
+        <span class="widget-label"><%= message('metric.lines.name') -%></span>
+        <span class="nowrap">
+          <%= format_measure(lines, :url => url_for_drilldown(lines)) %>
+          <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
+        </span>
+      </p>
+
+      <%  if generated_lines && generated_lines.value>0 %>
+        <p class="widget-label nowrap" style="margin-bottom: 7px">
+          <%= message('including_abbreviated') -%>
+          <%= format_measure(generated_lines, :url => url_for_drilldown(generated_lines)) -%> <%= format_variation(generated_lines) if dashboard_configuration.selected_period? -%>
+          <%= message('metric.generated_lines.name.suffix') -%>
+        </p>
+      <% end %>
+
+      <% if projects %>
+        <p class="widget-measure">
+          <span class="widget-label"><%= message('projects') -%></span>
+          <span class="nowrap">
+            <span class="widget-number"><%= format_measure(projects) %></span>
+            <%= format_variation(projects) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+    </div>
+  </div>
+
+  <div class="widget-span widget-span-5">
+    <div class="widget-measure-container">
+      <% if functions %>
+        <p class="widget-measure widget-measure-main">
+          <span class="widget-label"><%= message('metric.functions.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(functions, :url => url_for_drilldown(functions)) %>
+            <%= format_variation(functions) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+
+      <% if classes %>
+        <p class="widget-measure">
+          <span class="widget-label"><%= message('metric.classes.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(classes, :url => url_for_drilldown(classes)) %>
+            <%= format_variation(classes) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+
+      <% if statements %>
+        <p class="widget-measure">
+          <span class="widget-label"><%= message('metric.statements.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(statements, :url => url_for_drilldown(statements)) %>
+            <%= format_variation(statements) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+
+      <% if accessors %>
+        <p class="widget-measure">
+          <span class="widget-label"><%= message('metric.accessors.name') -%></span>
+          <span class="nowrap">
+            <%= format_measure(accessors, :url => url_for_drilldown(accessors)) %>
+            <%= format_variation(accessors) if dashboard_configuration.selected_period? -%>
+          </span>
+        </p>
+      <% end %>
+    </div>
+  </div>
+
+</div>
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/technical_debt_pyramid.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/technical_debt_pyramid.html.erb
new file mode 100644 (file)
index 0000000..6f5464e
--- /dev/null
@@ -0,0 +1,156 @@
+<%
+   technical_debt = measure('sqale_index')
+
+   root_characteristics = Internal.debt.characteristics().to_a
+
+   should_display_diff_measures = dashboard_configuration.selected_period? && technical_debt.variation(dashboard_configuration.period_index)!=nil
+   if technical_debt.nil? || root_characteristics.empty?
+%>
+
+  <h3><%= message('widget.technical_debt_pyramid.name') -%></h3>
+  <span style="color: #777777; font-size: 93%; font-style:italic"><%= message('widget.technical_debt_pyramid.no_info_available') -%></span>
+
+<%
+   else
+%>
+  <style>
+    table.technicalDebtPyramid td {
+      padding: 4px 10px 4px 0;
+    }
+
+    table.technicalDebtPyramid td.label {
+      width: 1%;
+      white-space: nowrap;
+      text-align: left;
+      padding: 5px 10px 5px 0;
+    }
+
+    table.technicalDebtPyramid th.val {
+      width: 1%;
+      white-space: nowrap;
+      text-align: right;
+      padding: 0 0 0 10px;
+    }
+
+    table.technicalDebtPyramid td.val {
+      width: 1%;
+      white-space: nowrap;
+      text-align: right;
+      padding: 0 0 0 10px;
+    }
+
+    table.technicalDebtPyramid td.bar {
+      width: 97%;
+    }
+
+    table.technicalDebtPyramid .legendValue {
+      width: 10px;
+      height: 10px;
+      background-color: #4b9fd5;
+      display: inline-block;
+      zoom: 1; /* IE hack to trigger hasLayout */
+      *display: inline; /* IE hack to achieve inline-block behavior */
+    }
+
+    table.technicalDebtPyramid .legendTotal {
+      width: 10px;
+      height: 10px;
+      background-color: #cae3f2;
+      display: inline-block;
+      zoom: 1; /* IE hack to trigger hasLayout */
+      *display: inline; /* IE hack to achieve inline-block behavior */
+    }
+
+    table.technicalDebtPyramid td.bar>a>div>div {
+      float: right;
+    }
+  </style>
+
+  <table class="technicalDebtPyramid">
+    <thead>
+    <tr>
+      <th colspan="2"><div class="marginbottom10">
+        <h3><%= message('widget.technical_debt_pyramid.name') -%></h3>
+      </div></th>
+      <th class="val"><div class="marginbottom10">
+        <h3><div class="legendValue"></div>&nbsp;<%= message('widget.technical_debt_pyramid.technical_debt') -%></h3>
+      </div></th>
+      <th class="val"><div class="marginbottom10">
+        <h3><%= message('widget.technical_debt_pyramid.total') -%></h3>
+      </div></th>
+    </tr>
+    </thead>
+    <tbody>
+    <%
+       measures_by_characteristic_id={}
+       ProjectMeasure.find(:all,
+                           :conditions => ['characteristic_id IN (?) AND snapshot_id=? AND metric_id=?',
+                                           root_characteristics.map{|c| c.id}, @snapshot.id, technical_debt.metric().id]).each do |measure|
+         measures_by_characteristic_id[measure.characteristic_id]=measure
+       end
+
+       total = technical_debt.value
+       cumulated=total
+
+       if should_display_diff_measures
+         diff_by_characteristic_id={}
+         total_diff = 0;
+         root_characteristics.each do |c|
+           measure = measures_by_characteristic_id[c.id]
+           if measure && measure.variation(dashboard_configuration.period_index)
+             diff_by_characteristic_id[c.id] = measure.variation(dashboard_configuration.period_index)
+             total_diff += measure.variation(dashboard_configuration.period_index)
+           end
+         end
+       end
+
+       root_characteristics.sort_by {|characteristic| characteristic.order}.each do |characteristic|
+         measure=measures_by_characteristic_id[characteristic.id]
+         value=(measure && measure.value ? measure.value : 0)
+         total_size=(total>0 ? (100*cumulated/total).round(3): 0)
+         value_size=(cumulated>0 ? (100*value/cumulated).round(3): 100)
+         drilldown_url = url_for_drilldown('sqale_index', :characteristic => characteristic.key)
+    %>
+      <tr>
+        <td class="label"><%= h(characteristic.name) -%></td>
+        <td class="bar">
+          <a href="<%= drilldown_url -%>">
+            <div style="width: <%=total_size-%>%; height: 17px;background-color: #cae3f2;">
+              <div style="width: <%=value_size-%>%; height: 17px;background-color: #4b9fd5;"></div>
+            </div>
+          </a>
+        </td>
+        <td class="val value-debt-<%= h(characteristic.key) -%>">
+          <a href="<%= drilldown_url -%>" class="underlined-link link-debt-<%= h(characteristic.key) -%>"><%= Internal.i18n.formatLongDuration(value.to_i, 'SHORT') -%></a>
+          <% if should_display_diff_measures %>
+            <% if diff_by_characteristic_id[characteristic.id] %>
+              <%= format_variation(measure) -%>
+            <% else %>
+              <span class="var"><b>(+0)</b></span>
+            <% end %>
+          <% end %>
+        </td>
+        <td class="val value-total-<%= h(characteristic.key) -%>">
+          <%= Internal.i18n.formatLongDuration(cumulated.to_i, 'SHORT') -%>
+          <%
+             if should_display_diff_measures
+               css_style = 'var'
+               css_style += 'b' if total_diff < 0
+               css_style += 'w' if total_diff > 0
+               diff_to_display = (total_diff < 0 ? '' : '+') + Internal.i18n.formatLongDuration(total_diff.to_i, 'SHORT')
+          %>
+            <span class="<%= css_style -%>"><b>(<%= diff_to_display -%>)</b></span>
+          <%
+             total_diff -= diff_by_characteristic_id[characteristic.id] if diff_by_characteristic_id[characteristic.id]
+             end
+          %>
+        </td>
+      </tr>
+    <%
+       cumulated-=value
+       end
+    %>
+    </tbody>
+  </table>
+
+<% end %>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/time_machine.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/time_machine.html.erb
new file mode 100644 (file)
index 0000000..3c00988
--- /dev/null
@@ -0,0 +1,130 @@
+<%
+   rows_by_metric_id={}
+   
+   # Retrieve widget settings
+   metric_ids = []
+   (1..10).each do |index|
+     metric=widget_properties["metric#{index}"]
+     if metric
+       metric_ids << metric.id
+       row=Sonar::TimemachineRow.new(metric)
+       rows_by_metric_id[metric.id]=row
+     end
+   end
+   if metric_ids.empty?
+     # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
+     ncloc = Metric.find(:first, :conditions => "name = 'ncloc'")
+     metric_ids << ncloc.id
+   end
+   number_of_columns = widget_properties["numberOfColumns"]
+
+   # Retrieve the measures for each metric on each snapshot
+   options = {}
+   from_date = dashboard_configuration.from_datetime
+   if from_date
+     options[:from] = from_date
+   end
+   snapshots=Snapshot.for_timemachine_widget(@resource, number_of_columns, options)
+   sids = snapshots.collect { |s| s.id }.uniq
+   measures=ProjectMeasure.find(:all,
+                                :conditions =>
+                                    ["snapshot_id IN (:snapshot_id) AND metric_id IN (:metric_id) AND rule_id IS NULL AND characteristic_id IS NULL AND person_id IS NULL",
+                                     {:snapshot_id => sids, :metric_id => metric_ids}
+                                    ]
+   )
+
+   
+   # Prepare the rows to display
+   snapshot_by_id={}
+   snapshots.each do |s|
+     snapshot_by_id[s.id]=s
+   end
+   measures.each do |measure|
+     next unless measure.metric
+
+     if measure.metric.timemachine? && (measure.value || measure.text_value)
+       row=rows_by_metric_id[measure.metric_id]
+       
+       #optimization : avoid eager loading of snapshots
+       measure.snapshot=snapshot_by_id[measure.snapshot_id]
+       row.add_measure(measure)
+     end
+   end
+
+   # Create the list of rows to display in the same order as defined by the user
+   rows=[]
+   metric_ids.each do |metric_id|
+     row = rows_by_metric_id[metric_id]
+     if row
+       rows<<row
+     end
+   end
+
+   # Should display the sparkline?
+   sparkline_urls_by_row = {}
+   if widget_properties["displaySparkLine"]
+     rows.each do |row|
+       sparkline_url = row.sparkline_url
+       sparkline_urls_by_row[row] = sparkline_url if sparkline_url
+     end
+   end
+   display_sparkline = !sparkline_urls_by_row.empty?
+%>
+
+<% if widget_properties["title"] %>
+  <div style="position: absolute">
+    <h3><%= h(widget_properties["title"]) -%></h3>
+  </div>
+<% end %>
+
+<div style="overflow: auto;font-size: 12px;padding: 1px;">
+  <table class="table table-bordered">
+
+    <thead>
+    <tr>
+      <th></th>
+      <%
+         snapshots.each do |snapshot|
+           event = snapshot.event('Version')
+      %>
+        <th nowrap="nowrap" style="vertical-align:top;text-align: right;font-size: 10px">
+          <%= l snapshot.created_at.to_date -%>
+          <br/>
+          <%= event.name unless event==nil -%>
+        </th>
+      <% end %>
+      <% if display_sparkline %>
+        <th></th>
+      <% end %>
+    </tr>
+    </thead>
+
+    <tbody>
+    <%
+       rows.select { |row| row.metric.val_type != Metric::VALUE_TYPE_DISTRIB }.each do |row|
+    %>
+      <tr class="<%= cycle 'even', 'odd', :name => ('time_machine' + widget.id.to_s) -%>">
+        <td width="1%" nowrap="nowrap" class="left text">
+          <%= row.metric.short_name %>
+        </td>
+        <%
+           snapshots.each do |snapshot|
+             measure=row.measure(snapshot)
+        %>
+          <td width="1%" nowrap="nowrap" class="right"><%= format_measure(measure, :skip_span_id => true) %></td>
+        <% end %>
+        <%
+           if display_sparkline
+             sparkline_url = sparkline_urls_by_row[row]
+        %>
+          <td width="1%">
+            <%= image_tag(sparkline_url) if sparkline_url %>
+          </td>
+        <% end %>
+      </tr>
+    <% end %>
+    </tbody>
+
+  </table>
+
+</div>
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/timeline.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/timeline.html.erb
new file mode 100644 (file)
index 0000000..7e7ad6e
--- /dev/null
@@ -0,0 +1,193 @@
+<%
+   # Retrieve widget settings
+   metric_data_map = {}
+   metric_map = {}
+   metrics_specified = false
+   (1..3).each do |index|
+     metric=widget_properties["metric#{index}"]
+     # we check that the current resource has the selected metric on the last snapshot
+     # => if not, we do not display this metric at all
+     if metric
+       metrics_specified = true
+       if measure(metric)
+         metric_data_map[metric.id] = []
+         metric_map[metric.id] = metric
+       end
+     end
+   end
+   unless metrics_specified
+     # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
+     ncloc = Metric.by_name('ncloc')
+     metric_data_map[ncloc.id] = []
+     metric_map[ncloc.id] = ncloc
+   end
+   chartHeight = widget_properties["chartHeight"]
+
+  unless metric_data_map.values.empty?
+     # Retrieve metric trend information
+     options = {}
+     from_date = dashboard_configuration.from_datetime
+     if from_date
+       options[:from] = from_date
+     end
+     metric_count_per_snapshot_id = {}
+     TrendsChart.time_machine_measures(@resource, metric_data_map.keys, options).each() do |trend_item|
+       sid = trend_item["sid"]
+       if metric_count_per_snapshot_id[sid]
+         metric_count_per_snapshot_id[sid] += 1
+       else
+         metric_count_per_snapshot_id[sid] = 1
+       end
+       metric_data_map[trend_item["metric_id"].to_i] << {:date => Time.at(trend_item["created_at"].to_i/1000), :value => trend_item["value"], :sid => trend_item["sid"]}
+     end
+
+     # Create JS structures to print out in the HTML page
+     js_data = "["
+     js_snapshots = "["
+     js_metrics = "["
+     total_number_of_metrics = metric_map.keys.size()
+     metric_data_map.keys.each_with_index() do |metric_id, index|
+       unless metric_data_map[metric_id].empty?
+         js_metrics += "\"" + metric_map[metric_id].short_name + "\","
+         js_data += "["
+         metric_data_map[metric_id].each() do |metric_data|
+           # for every metric value, we need to check that the corresponding snapshot has values for each metric
+           if metric_count_per_snapshot_id[metric_data[:sid]]==total_number_of_metrics
+             m_date = metric_data[:date]
+             m_value = sprintf("%0.02f", metric_data[:value])
+             m_value_localized = ProjectMeasure.new(:metric => metric_map[metric_id]).format_numeric_value(metric_data[:value], {})
+             js_data += "{x:d("
+             js_data += m_date.year.to_s
+             js_data += ","
+             # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
+             js_data += (m_date.month - 1).to_s
+             js_data += ","
+             js_data += m_date.day.to_s
+             js_data += ","
+             js_data += m_date.hour.to_s
+             js_data += ","
+             js_data += m_date.min.to_s
+             js_data += ","
+             js_data += m_date.sec.to_s
+             js_data += "),y:"
+             js_data += m_value
+             js_data += ",yl:\""
+             js_data += m_value_localized
+             js_data += "\"},"
+             if index == 0
+               # we fill the js_snapshots array (no need to do this more than once)
+               js_snapshots += "{sid:"
+               js_snapshots += metric_data[:sid].to_s
+               js_snapshots += ",d:\""
+               js_snapshots += human_short_date m_date
+               js_snapshots += "\"},"
+             end
+           end
+         end
+         js_data = js_data.chomp(',') + "],"
+       end
+     end
+     js_data = js_data.chomp(',') + "]"
+     js_snapshots = js_snapshots.chomp(',') + "]"
+     js_metrics = js_metrics.chomp(',') + "]"
+
+     # Prepare also event structure if required
+     unless widget_properties["hideEvents"]
+       events = {}
+       unless from_date
+         # find the oldest date
+         metric_data_map.values.each() do |metric_data_array|
+           first_date = metric_data_array[0][:date]
+           from_date = first_date if !from_date || from_date > first_date
+         end
+       end
+       Event.find(:all, :conditions => ["component_uuid=? AND event_date>=?", @resource.uuid, from_date.to_i*1000], :order => 'event_date').each() do |event|
+         if events[event.event_date]
+           events[event.event_date] << event
+         else
+           date_entry = [event]
+           events[event.event_date] = date_entry
+         end
+       end
+       js_events = "["
+       events.keys().sort.each() do |e_date|
+         e_details = events[e_date]
+         js_events += "{sid:"
+         js_events += e_details[0].snapshot_id.to_s
+         js_events += ",d:d("
+         js_events += e_date.year.to_s
+         js_events += ","
+         # Need to decrease by 1 the month as the JS Date object start months at 0 (= January)
+         js_events += (e_date.month - 1).to_s
+         js_events += ","
+         js_events += e_date.day.to_s
+         js_events += ","
+         js_events += e_date.hour.to_s
+         js_events += ","
+         js_events += e_date.min.to_s
+         js_events += ","
+         js_events += e_date.sec.to_s
+         js_events += "),l:["
+         e_details.each() do |e|
+           js_events += "{n:\""
+           js_events += json_escape(e.name)
+           js_events += "\"},"
+         end
+         js_events = js_events.chomp(',') + "]},"
+       end
+       js_events = js_events.chomp(',') + "]"
+     end
+  end
+
+
+%>
+
+<!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<% if widget_properties["chartTitle"] %>
+  <h3 style="margin-bottom: 10px"><%= h(widget_properties["chartTitle"]) -%></h3>
+<% end %>
+<!--<![endif]-->
+
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<%
+   unless metric_data_map.values.empty?
+
+     if metric_data_map.values[0].size == 1
+%>
+
+  <span class="empty_widget"><%= message('widget.timeline.timeline_not_displayed') -%></span>
+
+<%   else %>
+  <% timeline = 'timeline' + widget.id.to_s %>
+
+  <div id="timeline-chart-<%= widget.id -%>"></div>
+  <script>
+    function d(y, m, d, h, min, s) {
+      return new Date(y, m, d, h, min, s);
+    }
+    var data = <%= js_data -%>;
+    var snapshots = <%= js_snapshots -%>;
+    var metrics = <%= js_metrics -%>;
+    var events = <%= js_events ? js_events : "[]" -%>;
+    var <%= timeline -%> = new SonarWidgets.Timeline('timeline-chart-<%= widget.id -%>')
+      .height(<%= chartHeight -%>)
+      .data(data)
+      .snapshots(snapshots)
+      .metrics(metrics)
+      .events(events);
+    <%= timeline -%>.limitedHistoricalData = '<%= message('widget.timeline.limited_histortical_data') -%>';
+    <%= timeline -%>.render();
+
+    autoResize(200, function() {
+      <%= timeline -%>.update();
+    });
+  </script>
+
+<%
+     end
+   end
+%>
+<!--<![endif]-->
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/treemap.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/treemap.html.erb
new file mode 100644 (file)
index 0000000..f6a1fbc
--- /dev/null
@@ -0,0 +1,85 @@
+<%
+   containerId = 'project-file-widget' + widget.id.to_s
+   colorMetric = widget_properties['colorMetric']
+   sizeMetric = widget_properties['sizeMetric']
+   chartTitle = widget_properties['chartTitle']
+   maxItems = widget_properties['maxItems'].to_i
+%>
+
+<div class="treemap-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+    <h3 style="margin-bottom: 5px;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    <%
+      filter = MeasureFilter.new
+      filter.set_criteria_value(:base, @resource.key)
+      filter.set_criteria_value(:onBaseComponents, 'true')
+      filter.set_criteria_value(:pageSize, 100)
+      filter.set_criteria_value(:page, 1)
+      filter.set_criteria_value(:sort, 'metric:' + sizeMetric.name)
+      filter.set_criteria_value(:asc, false)
+      filter.metrics=([sizeMetric, colorMetric].compact)
+      filter.execute(self, :user => current_user)
+    %>
+
+    var data = {
+      metrics: {
+        <%= colorMetric.name -%>: {
+          name: '<%= colorMetric.short_name -%>',
+          direction: <%= colorMetric.direction -%>,
+          type: '<%= colorMetric.val_type -%>'
+        },
+        <%= sizeMetric.name -%>: {
+          name: '<%= sizeMetric.short_name -%>'
+        }
+      },
+      components: [
+        <%
+        filter.rows.each  do |row|
+          color = row.measure(colorMetric)
+          size = row.measure(sizeMetric)
+        %>
+          {
+            key: '<%= escape_javascript row.resource.key -%>',
+            name: '<%= escape_javascript row.resource.name -%>',
+            longName: '<%= escape_javascript row.resource.long_name -%>',
+            qualifier: '<%= escape_javascript row.resource.qualifier -%>',
+            measures: {
+              <%= colorMetric.name -%>: { val: <%= color ? color.value : "null" -%>, fval: '<%= color ? color.formatted_value : "-" -%>' },
+              <%= sizeMetric.name -%>: { val: <%= size ? size.value : "null" -%>, fval: '<%= size ? size.formatted_value : "-" -%>' }
+            }
+          },
+        <% end %>
+      ]
+    },
+    widget = new SonarWidgets.Treemap();
+
+    widget
+      .metrics(data.metrics)
+      .metricsPriority(['<%= colorMetric.name -%>', '<%= sizeMetric.name -%>'])
+      .components(data.components)
+      .options({
+        heightInPercents: '<%= widget_properties['heightInPercents'] -%>',
+        maxItems: <%= maxItems -%>,
+        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+        baseUrl: baseUrl + '/dashboard/index',
+        noData: '<%= message('no_data') -%>',
+        resource: '<%= @resource.name -%>'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/welcome.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/welcome.html.erb
new file mode 100644 (file)
index 0000000..a3e651d
--- /dev/null
@@ -0,0 +1 @@
+<%= message('widget.welcome.html') -%>
\ No newline at end of file
diff --git a/server/sonar-server/src/test/java/org/sonar/server/charts/AbstractChartTest.java b/server/sonar-server/src/test/java/org/sonar/server/charts/AbstractChartTest.java
new file mode 100644 (file)
index 0000000..e1110fa
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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.server.charts;
+
+import org.apache.commons.io.FileUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.ui.ApplicationFrame;
+import org.jfree.ui.RefineryUtilities;
+
+import javax.swing.JPanel;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractChartTest {
+  protected void assertChartSizeGreaterThan(BufferedImage img, int size) throws IOException {
+    ByteArrayOutputStream output = new ByteArrayOutputStream();
+    ChartUtilities.writeBufferedImageAsPNG(output, img);
+    assertTrue("PNG size in bits=" + output.size(), output.size() > size);
+  }
+
+  protected void assertChartSizeLesserThan(BufferedImage img, int size) throws IOException {
+    ByteArrayOutputStream output = new ByteArrayOutputStream();
+    ChartUtilities.writeBufferedImageAsPNG(output, img);
+    assertTrue("PNG size in bits=" + output.size(), output.size() < size);
+  }
+
+  protected void saveChart(BufferedImage img, String name) throws IOException {
+    File target = new File("target/tmp-chart", name);
+    FileUtils.forceMkdir(target.getParentFile());
+    ByteArrayOutputStream imgOutput = new ByteArrayOutputStream();
+    ChartUtilities.writeBufferedImageAsPNG(imgOutput, img);
+    OutputStream out = new FileOutputStream(target);
+    out.write(imgOutput.toByteArray());
+    out.close();
+
+  }
+
+  protected static void displayTestPanel(BufferedImage image) {
+    ApplicationFrame frame = new ApplicationFrame("testframe");
+    BufferedPanel imgPanel = new BufferedPanel(image);
+    frame.setContentPane(imgPanel);
+    frame.pack();
+    RefineryUtilities.centerFrameOnScreen(frame);
+    frame.setVisible(true);
+  }
+
+  protected static Date stringToDate(String sDate) throws ParseException {
+    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy hh'h'mm");
+    return sdf.parse(sDate);
+  }
+
+  private static class BufferedPanel extends JPanel {
+    private final BufferedImage chartImage;
+
+    public BufferedPanel(BufferedImage chartImage) {
+      this.chartImage = chartImage;
+    }
+
+    @Override
+    protected void paintComponent(Graphics graphics) {
+      super.paintComponent(graphics);
+      graphics.drawImage(chartImage, 0, 0, null);
+    }
+
+    @Override
+    public Dimension getPreferredSize() {
+      return new Dimension(chartImage.getWidth(), chartImage.getHeight());
+    }
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/charts/DistributionAreaChartTest.java b/server/sonar-server/src/test/java/org/sonar/server/charts/DistributionAreaChartTest.java
new file mode 100644 (file)
index 0000000..0d40c70
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.server.charts;
+
+import org.junit.Test;
+import org.sonar.api.charts.ChartParameters;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+
+public class DistributionAreaChartTest extends AbstractChartTest {
+
+  @Test
+  public void oneSerie() throws IOException {
+    DistributionAreaChart chart = new DistributionAreaChart();
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionAreaChartTest/oneSerie.png");
+  }
+
+  @Test
+  public void manySeries() throws IOException {
+    DistributionAreaChart chart = new DistributionAreaChart();
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionAreaChartTest/manySeries.png");
+  }
+
+  @Test
+  public void manySeriesWithDifferentCategories() throws IOException {
+    DistributionAreaChart chart = new DistributionAreaChart();
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|2%3D7%3B4%3D15%3B9%3D4"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionAreaChartTest/manySeriesWithDifferentCategories.png");
+  }
+
+  @Test
+  public void manySeriesIncludingAnEmptySerie() throws IOException {
+    // the third serie should not have the second default color, but the third one !
+    DistributionAreaChart chart = new DistributionAreaChart();
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2||2%3D7%3B4%3D15%3B9%3D4"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionAreaChartTest/manySeriesIncludingAnEmptySerie.png");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/charts/DistributionBarChartTest.java b/server/sonar-server/src/test/java/org/sonar/server/charts/DistributionBarChartTest.java
new file mode 100644 (file)
index 0000000..55dd0f4
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * 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.server.charts;
+
+import org.junit.Test;
+import org.sonar.api.charts.ChartParameters;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+
+public class DistributionBarChartTest extends AbstractChartTest {
+  DistributionBarChart chart = new DistributionBarChart();
+
+  @Test
+  public void simpleSample() throws IOException {
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/simpleSample.png");
+  }
+
+  @Test
+  public void addXSuffix() throws IOException {
+    // should suffix x labels with +
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&xsuf=%2B"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/addXSuffix.png");
+  }
+
+  @Test
+  public void addYSuffix() throws IOException {
+    // should suffix y labels with %
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&ysuf=%25"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/addYSuffix.png");
+  }
+
+  @Test
+  public void manySeries() throws IOException {
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/manySeries.png");
+  }
+
+  @Test
+  public void manySeriesIncludingAnEmptySerie() throws IOException {
+    // the third serie should not have the second default color, but the third one !
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2||0%3D7%3B1%3D15%3B2%3D4"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/manySeriesIncludingAnEmptySerie.png");
+  }
+
+  @Test
+  public void overridenSize() throws IOException {
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4&w=500&h=200"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/overridenSize.png");
+  }
+
+  @Test
+  public void changeColor() throws IOException {
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2&c=777777&bgc=777777"));
+    assertChartSizeGreaterThan(image, 1000);
+    saveChart(image, "DistributionBarChartTest/changeColor.png");
+  }
+
+  @Test
+  public void smallSize() throws IOException {
+    BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2%3B4%3D22%3B5%3D22%3B6%3D22&c=777777&w=120&h=80&fs=8"));
+    assertChartSizeGreaterThan(image, 500);
+    saveChart(image, "DistributionBarChartTest/smallSize.png");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/GlobalDefaultDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/GlobalDefaultDashboardTest.java
new file mode 100644 (file)
index 0000000..f9f784b
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 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.server.dashboard.template;
+
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.Dashboard.Widget;
+import org.sonar.core.measure.db.MeasureFilterDao;
+import org.sonar.core.measure.db.MeasureFilterDto;
+import org.sonar.server.dashboard.widget.MeasureFilterAsTreemapWidget;
+import org.sonar.server.dashboard.widget.MeasureFilterListWidget;
+import org.sonar.server.dashboard.widget.WelcomeWidget;
+import org.sonar.server.measure.template.MyFavouritesFilter;
+import org.sonar.server.measure.template.ProjectFilter;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class GlobalDefaultDashboardTest {
+  GlobalDefaultDashboard template;
+  MeasureFilterDao dao;
+
+  @Before
+  public void init() {
+    dao = mock(MeasureFilterDao.class);
+    template = new GlobalDefaultDashboard(dao);
+  }
+
+  @Test
+  public void should_have_a_name() {
+    assertThat(template.getName()).isEqualTo("Home");
+  }
+
+  @Test
+  public void should_create_global_dashboard_with_four_widgets() {
+    when(dao.findSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(
+      new MeasureFilterDto().setId(100L)
+      );
+    when(dao.findSystemFilterByName(ProjectFilter.NAME)).thenReturn(
+      new MeasureFilterDto().setId(101L)
+      );
+    Dashboard dashboard = template.createDashboard();
+    List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
+    assertThat(firstColumn).hasSize(2);
+    assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
+    assertThat(firstColumn.get(1).getId()).isEqualTo(MeasureFilterListWidget.ID);
+    assertThat(firstColumn.get(1).getProperty("filter")).isEqualTo("100");
+
+    List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
+    assertThat(secondColumn).hasSize(2);
+    assertThat(secondColumn.get(0).getId()).isEqualTo(MeasureFilterListWidget.ID);
+    assertThat(secondColumn.get(0).getProperty("filter")).isEqualTo("101");
+    assertThat(secondColumn.get(1).getId()).isEqualTo(MeasureFilterAsTreemapWidget.ID);
+    assertThat(secondColumn.get(1).getProperty("filter")).isEqualTo("101");
+  }
+
+  @Test
+  public void should_not_fail_if_filter_widgets_not_found() {
+    when(dao.findSystemFilterByName(MyFavouritesFilter.NAME)).thenReturn(null);
+    when(dao.findSystemFilterByName(ProjectFilter.NAME)).thenReturn(null);
+
+    Dashboard dashboard = template.createDashboard();
+    List<Widget> firstColumn = dashboard.getWidgetsOfColumn(1);
+    assertThat(firstColumn).hasSize(1);
+    assertThat(firstColumn.get(0).getId()).isEqualTo(WelcomeWidget.ID);
+
+    List<Widget> secondColumn = dashboard.getWidgetsOfColumn(2);
+    assertThat(secondColumn).isEmpty();
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java
new file mode 100644 (file)
index 0000000..2050d5c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.junit.Test;
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ProjectDefaultDashboardTest {
+  ProjectDefaultDashboard template = new ProjectDefaultDashboard();
+
+  @Test
+  public void should_have_a_name() {
+    assertThat(template.getName()).isEqualTo("Dashboard");
+  }
+
+  @Test
+  public void should_create_dashboard() {
+    Dashboard dashboard = template.createDashboard();
+
+    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
+    assertThat(dashboard.getWidgets()).hasSize(9);
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java
new file mode 100644 (file)
index 0000000..b84c0a0
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.core.issue.db.IssueFilterDao;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.test.DbTests;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@Category(DbTests.class)
+public class ProjectIssuesDashboardTest {
+
+  @ClassRule
+  public static final DbTester dbTester = new DbTester();
+
+  ProjectIssuesDashboard template;
+
+  @Before
+  public void setUp() {
+    IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis());
+    template = new ProjectIssuesDashboard(issueFilterDao);
+  }
+
+  @Test
+  public void should_have_a_name() {
+    assertThat(template.getName()).isEqualTo("Issues");
+  }
+
+  @Test
+  public void should_create_dashboard() {
+    dbTester.prepareDbUnit(getClass(), "filters.xml");
+    Dashboard dashboard = template.createDashboard();
+
+    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
+    assertThat(dashboard.getWidgets()).hasSize(5);
+  }
+
+  @Test
+  public void should_provide_clean_error_message_on_failure() {
+    try {
+      template.createDashboard();
+    } catch (IllegalStateException illegalState) {
+      assertThat(illegalState).hasMessage("Could not find a provided issue filter with name 'Unresolved Issues'");
+    }
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java
new file mode 100644 (file)
index 0000000..84f96ed
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.server.dashboard.template;
+
+import org.junit.Test;
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.Dashboard.Widget;
+import org.sonar.api.web.DashboardLayout;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ProjectTimeMachineDashboardTest {
+  ProjectTimeMachineDashboard template = new ProjectTimeMachineDashboard();
+
+  @Test
+  public void should_have_a_name() {
+    assertThat(template.getName()).isEqualTo("TimeMachine");
+  }
+
+  @Test
+  public void should_create_dashboard() {
+    Dashboard dashboard = template.createDashboard();
+
+    assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
+    assertThat(dashboard.getWidgets()).hasSize(7);
+
+    for (Widget widget : dashboard.getWidgets()) {
+      if (widget.getId().equals("time_machine")) {
+        assertThat(widget.getProperty("displaySparkLine")).isEqualTo("true");
+      }
+    }
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/widget/CoreWidgetsTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/widget/CoreWidgetsTest.java
new file mode 100644 (file)
index 0000000..bc15edf
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * 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.server.dashboard.widget;
+
+import com.google.common.base.Function;
+import com.google.common.base.Throwables;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.Set;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.junit.Test;
+import org.reflections.Reflections;
+
+import static com.google.common.collect.Lists.newArrayList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class CoreWidgetsTest {
+
+  @Test
+  public void widget_ids_should_be_unique() {
+    Collection<CoreWidget> widgets = widgets();
+    Collection<String> widgetIds = Collections2.transform(widgets, new Function<CoreWidget, String>() {
+      public String apply(@Nonnull CoreWidget widget) {
+        return widget.getId();
+      }
+    });
+    assertThat(widgetIds).hasSize(Sets.newHashSet(widgetIds).size());
+  }
+
+  @Test
+  public void widget_templates_should_be_unique() {
+    Collection<CoreWidget> widgets = widgets();
+    Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
+      public String apply(@Nonnull CoreWidget widget) {
+        return widget.getTemplatePath();
+      }
+    });
+    assertThat(templates).hasSize(Sets.newHashSet(templates).size());
+  }
+
+  @Test
+  public void widget_titles_should_be_unique() {
+    Collection<CoreWidget> widgets = widgets();
+    Collection<String> templates = Collections2.transform(widgets, new Function<CoreWidget, String>() {
+      public String apply(@Nonnull CoreWidget widget) {
+        return widget.getTitle();
+      }
+    });
+    assertThat(templates).hasSize(Sets.newHashSet(templates).size());
+  }
+
+  @Test
+  public void should_find_templates() {
+    for (CoreWidget widget : widgets()) {
+      assertThat(widget.getClass().getResource(widget.getTemplatePath()))
+        .as("Template not found: " + widget.getTemplatePath())
+        .isNotNull();
+    }
+  }
+
+  @Test
+  public void should_find_core_widgets() {
+    assertThat(widgets().size()).isGreaterThan(23);
+  }
+
+  private Set<Class<? extends CoreWidget>> widgetClasses() {
+    String[] packages = {"org.sonar.server.dashboard.widget"};
+    return new Reflections(packages).getSubTypesOf(CoreWidget.class);
+  }
+
+  private Collection<CoreWidget> widgets() {
+    return newArrayList(Iterables.transform(widgetClasses(), new Function<Class<? extends CoreWidget>, CoreWidget>() {
+      public CoreWidget apply(@Nullable Class<? extends CoreWidget> aClass) {
+        try {
+          return aClass.newInstance();
+        } catch (Exception e) {
+          throw Throwables.propagate(e);
+        }
+      }
+    }));
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/template/MyFavouritesFilterTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/template/MyFavouritesFilterTest.java
new file mode 100644 (file)
index 0000000..1aa6b58
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.server.measure.template;
+
+import org.junit.Test;
+import org.sonar.api.web.Filter;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MyFavouritesFilterTest {
+  @Test
+  public void should_create_filter() {
+    MyFavouritesFilter template = new MyFavouritesFilter();
+
+    Filter filter = template.createFilter();
+
+    assertThat(template.getName()).isEqualTo("My favourites");
+    assertThat(filter).isNotNull();
+    assertThat(filter.isFavouritesOnly()).isTrue();
+    assertThat(filter.getCriteria()).isEmpty();
+    assertThat(filter.getColumns()).hasSize(3);
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/template/ProjectFilterTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/template/ProjectFilterTest.java
new file mode 100644 (file)
index 0000000..783b3f3
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.server.measure.template;
+
+import org.junit.Test;
+import org.sonar.api.web.Filter;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ProjectFilterTest {
+  @Test
+  public void should_create_filter() {
+    ProjectFilter template = new ProjectFilter();
+
+    Filter filter = template.createFilter();
+
+    assertThat(template.getName()).isEqualTo("Projects");
+    assertThat(filter).isNotNull();
+    assertThat(filter.getCriteria()).hasSize(1);
+    assertThat(filter.getColumns()).hasSize(6);
+  }
+}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml b/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml
new file mode 100644 (file)
index 0000000..8ec92dd
--- /dev/null
@@ -0,0 +1,33 @@
+<dataset>
+
+  <issue_filters
+      id="1"
+      name="Unresolved Issues"
+      user_login="[null]"
+      shared="[true]"
+      description="[null]"
+      data="resolved=false"
+      created_at="2011-04-25 01:15:00"
+      updated_at="2011-04-25 01:15:00" />
+
+  <issue_filters
+      id="2"
+      name="False Positive and Won't Fix Issues"
+      user_login="[null]"
+      shared="[true]"
+      description="[null]"
+      data="resolutions=FALSE-POSITIVE,WONTFIX"
+      created_at="2011-04-25 01:15:00"
+      updated_at="2011-04-25 01:15:00" />
+
+  <issue_filters
+      id="3"
+      name="My Unresolved Issues"
+      user_login="[null]"
+      shared="[true]"
+      description="[null]"
+      data="resolved=false|assignees=__me__"
+      created_at="2011-04-25 01:15:00"
+      updated_at="2011-04-25 01:15:00" />
+
+</dataset>