aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java1
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboardTest.java2
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java4
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/PackageDesignWidget.java43
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb128
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb62
6 files changed, 102 insertions, 138 deletions
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
index 96799dfec2c..b7deddf94a0 100644
--- 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
@@ -57,7 +57,6 @@ public final class ProjectDefaultDashboard extends DashboardTemplate {
dashboard.addWidget("rules", 2);
dashboard.addWidget("alerts", 2);
dashboard.addWidget("file_design", 2);
- dashboard.addWidget("package_design", 2);
dashboard.addWidget("code_coverage", 2);
}
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
index 9da3ea6f7fe..ad3afee325c 100644
--- 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
@@ -44,6 +44,6 @@ public class ProjectDefaultDashboardTest {
Dashboard dashboard = template.createDashboard();
assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
- assertThat(dashboard.getWidgets()).hasSize(11);
+ assertThat(dashboard.getWidgets()).hasSize(10);
}
}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
index bc464fe4b96..9c12c1bfe5c 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
@@ -27,7 +27,6 @@ import org.sonar.plugins.design.batch.MavenDependenciesSensor;
import org.sonar.plugins.design.batch.PackageTangleIndexDecorator;
import org.sonar.plugins.design.batch.ProjectDsmDecorator;
import org.sonar.plugins.design.ui.widgets.FileDesignWidget;
-import org.sonar.plugins.design.ui.widgets.PackageDesignWidget;
import java.util.List;
@@ -42,7 +41,6 @@ public class DesignPlugin extends SonarPlugin {
FileTangleIndexDecorator.class,
// UI
- FileDesignWidget.class,
- PackageDesignWidget.class);
+ FileDesignWidget.class);
}
}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/PackageDesignWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/PackageDesignWidget.java
deleted file mode 100644
index d79f9337d68..00000000000
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/PackageDesignWidget.java
+++ /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.design.ui.widgets;
-
-import org.sonar.api.web.AbstractRubyTemplate;
-import org.sonar.api.web.RubyRailsWidget;
-import org.sonar.api.web.UserRole;
-import org.sonar.api.web.WidgetCategory;
-
-@UserRole(UserRole.USER)
-@WidgetCategory({ "Design" })
-public final class PackageDesignWidget extends AbstractRubyTemplate implements RubyRailsWidget {
-
- public String getId() {
- return "package_design";
- }
-
- public String getTitle() {
- return "File design";
- }
-
- @Override
- protected String getTemplatePath() {
- return "/org/sonar/plugins/design/ui/widgets/package_design.html.erb";
- }
-}
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb
index 2fcac1fc7a9..63e9020b77b 100644
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb
+++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb
@@ -1,38 +1,110 @@
<%
+ dsm_url = ApplicationController.root_context + '/design/index/' + @resource.key
+
file_tangle_index=measure('file_tangle_index')
if file_tangle_index
file_cycles=measure('file_cycles')
file_feedback_edges=measure('file_feedback_edges')
%>
-<table width="100%">
- <tbody>
- <tr>
- <td valign="top" width="50%">
- <div class="dashbox">
- <p class="title"><%= message('widget.file_design.file_tangle_index') -%></p>
- <p>
- <span class="big"><%= format_measure(file_tangle_index, :suffix => '', :default => '-', :url => url_for_drilldown('file_tangle_index')) -%></span> <%= dashboard_configuration.selected_period? ? format_variation(file_tangle_index) : trend_icon(file_tangle_index, :big => true) -%>
- </p>
- <% if file_cycles %>
- <p>
- > <%= format_measure(file_cycles, :suffix => message('widget.file_design.cycles.suffix'), :url => url_for_drilldown('file_cycles')) %> <%= dashboard_configuration.selected_period? ? format_variation(file_cycles) : trend_icon(file_cycles) -%>
- </p>
- <% end %>
+<div class="widget-row">
+ <div class="widget-span widget-span-5">
+ <div class="widget-measure-container">
+ <div class="widget-measure widget-measure-main">
+ <span class="widget-label"><%= message('widget.file_design.file_tangle_index') -%></span>
+ <span class="nowrap">
+ <%= format_measure(file_tangle_index, :suffix => '', :default => '-', :url => dsm_url) -%>
+ <%= dashboard_configuration.selected_period? ? format_variation(file_tangle_index) : trend_icon(file_tangle_index, :big => true) -%>
+ </span>
+ </div>
+
+ <% if file_cycles %>
+ <div class="widget-measure">
+ <span class="widget-label"><%= message('widget.file_design.cycles.suffix') -%></span>
+ <span class="nowrap">
+ <span class="widget-medium">&gt;</span>
+ <%= format_measure(file_cycles, :default => '-', :url => dsm_url) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(file_cycles) : trend_icon(file_cycles) -%>
+ </span>
</div>
- </td>
- <td valign="top" width="50%">
- <% if file_feedback_edges %>
- <div class="dashbox">
- <p class="title"><%= message('widget.file_design.suspect_file_dependencies') -%></p>
- <p>
- <span class="big"><%= format_measure(file_feedback_edges, :url => url_for_drilldown('file_feedback_edges')) -%></span> <%= dashboard_configuration.selected_period? ? format_variation(file_feedback_edges) : trend_icon(file_feedback_edges, :big => true) -%>
- </p>
+ <% end %>
+ </div>
+ </div>
+
+ <div class="widget-span widget-span-5">
+ <% if file_feedback_edges %>
+ <div class="widget-measure-container">
+ <div class="widget-measure widget-measure-main">
+ <span class="widget-label"><%= message('widget.file_design.suspect_file_dependencies') -%></span>
+ <span class="nowrap">
+ <%= format_measure(file_feedback_edges, :url => dsm_url) -%>
+ <%= dashboard_configuration.selected_period? ? format_variation(file_feedback_edges) : trend_icon(file_feedback_edges, :big => true) -%>
+ </span>
+ </div>
+ </div>
+ <% end %>
+ </div>
+</div>
+<%
+ else
+ package_tangle_index=measure('package_tangle_index')
+ if package_tangle_index
+ package_cycles=measure('package_cycles')
+ package_feedback_edges=measure('package_feedback_edges')
+ package_tangles=measure('package_tangles')
+%>
+<div class="widget-row">
+ <div class="widget-span widget-span-5">
+ <div class="widget-measure-container">
+ <div class="widget-measure widget-measure-main">
+ <span class="widget-label"><%= message('widget.package_design.package_tangle_index') -%></span>
+ <span class="nowrap">
+ <%= format_measure(package_tangle_index, :suffix => '', :default => '-', :url => dsm_url) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(package_tangle_index) : trend_icon(package_tangle_index) -%>
+ </span>
+ </div>
+
+ <% if package_cycles %>
+ <div class="widget-measure">
+ <span class="widget-label"><%= message('widget.package_design.cycles.suffix') -%></span>
+ <span class="nowrap">
+ <span class="widget-medium">&gt;</span>
+ <%= format_measure(package_cycles, :default => '-', :url => dsm_url) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(package_cycles) : trend_icon(package_cycles) -%>
+ </span>
+ </div>
+ <% end %>
+ </div>
+ </div>
+
+ <div class="widget-span widget-span-5">
+ <div class="widget-measure-container">
+ <div class="widget-measure widget-measure-main">
+ <span class="widget-label"><%= message('widget.package_design.dependencies_to_cut') -%></span>
+ </div>
+
+ <% if package_feedback_edges %>
+ <div class="widget-measure">
+ <span class="widget-label"><%= message('widget.package_design.between_packages.suffix') -%></span>
+ <span class="nowrap">
+ <%= format_measure(package_feedback_edges, :default => '-', :url => dsm_url) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(package_feedback_edges) : trend_icon(package_feedback_edges) -%>
+ </span>
</div>
- <% end %>
- </td>
- </tr>
- </tbody>
-</table>
+ <% end %>
+
+ <% if package_tangles %>
+ <div class="widget-measure">
+ <span class="widget-label"><%= message('widget.package_design.between_files.suffix') -%></span>
+ <span class="nowrap">
+ <%= format_measure(package_tangles, :default => '-', :url => dsm_url) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(package_tangles) : trend_icon(package_tangles) -%>
+ </span>
+ </div>
+ <% end %>
+ </div>
+ </div>
+</div>
<%
+ end
end
-%> \ No newline at end of file
+%>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb
deleted file mode 100644
index b036433449a..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb
+++ /dev/null
@@ -1,62 +0,0 @@
-<%
- package_tangle_index=measure('package_tangle_index')
- if package_tangle_index
- package_cycles=measure('package_cycles')
- package_feedback_edges=measure('package_feedback_edges')
- package_tangles=measure('package_tangles')
- dsm_url = ApplicationController.root_context + '/design/index/' + @resource.key
-%>
- <div class="widget-row">
- <div class="widget-span widget-span-5">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.package_design.package_tangle_index') -%></span>
- <span class="nowrap">
- <%= format_measure(package_tangle_index, :suffix => '', :default => '-', :url => dsm_url) %>
- <%= dashboard_configuration.selected_period? ? format_variation(package_tangle_index) : trend_icon(package_tangle_index) -%>
- </span>
- </div>
-
- <% if package_cycles %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.package_design.cycles.suffix') -%></span>
- <span class="nowrap">
- <span class="widget-medium">&gt;</span>
- <%= format_measure(package_cycles, :default => '-', :url => dsm_url) %>
- <%= dashboard_configuration.selected_period? ? format_variation(package_cycles) : trend_icon(package_cycles) -%>
- </span>
- </div>
- <% end %>
- </div>
- </div>
-
- <div class="widget-span widget-span-5">
- <div class="widget-measure-container">
- <div class="widget-measure widget-measure-main">
- <span class="widget-label"><%= message('widget.package_design.dependencies_to_cut') -%></span>
- </div>
-
- <% if package_feedback_edges %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.package_design.between_packages.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(package_feedback_edges, :default => '-', :url => dsm_url) %>
- <%= dashboard_configuration.selected_period? ? format_variation(package_feedback_edges) : trend_icon(package_feedback_edges) -%>
- </span>
- </div>
- <% end %>
-
- <% if package_tangles %>
- <div class="widget-measure">
- <span class="widget-label"><%= message('widget.package_design.between_files.suffix') -%></span>
- <span class="nowrap">
- <%= format_measure(package_tangles, :default => '-', :url => dsm_url) %>
- <%= dashboard_configuration.selected_period? ? format_variation(package_tangles) : trend_icon(package_tangles) -%>
- </span>
- </div>
- <% end %>
- </div>
- </div>
- </div>
-
-<% end %>