]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5712 Merge package_design widget into file_design widget
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 9 Oct 2014 10:53:42 +0000 (12:53 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 9 Oct 2014 11:04:41 +0000 (13:04 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboard.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectDefaultDashboardTest.java
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/PackageDesignWidget.java [deleted file]
plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb
plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb [deleted file]

index 96799dfec2cdd83e8547b4fa4f341256b0774015..b7deddf94a05d2508f7599fbc771a397cf78d9e5 100644 (file)
@@ -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);
   }
 
index 9da3ea6f7fedcf71b185ba0381b88b275c89d40e..ad3afee325c68207cb645d23d0040a9de056c8ec 100644 (file)
@@ -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);
   }
 }
index bc464fe4b969594e50b5c84b70d221185b542189..9c12c1bfe5cd2b385e4606803c68a1998ed34cdc 100644 (file)
@@ -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 (file)
index d79f933..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.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";
-  }
-}
index 2fcac1fc7a9c1bd1e397017e5a3a72eee67efe2d..63e9020b77b7905824a0ae0ea73685b9f7c12c01 100644 (file)
 <%
+  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 (file)
index b036433..0000000
+++ /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 %>