dashboard.addWidget("rules", 2);
dashboard.addWidget("alerts", 2);
dashboard.addWidget("file_design", 2);
- dashboard.addWidget("package_design", 2);
dashboard.addWidget("code_coverage", 2);
}
Dashboard dashboard = template.createDashboard();
assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS);
- assertThat(dashboard.getWidgets()).hasSize(11);
+ assertThat(dashboard.getWidgets()).hasSize(10);
}
}
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;
FileTangleIndexDecorator.class,
// UI
- FileDesignWidget.class,
- PackageDesignWidget.class);
+ FileDesignWidget.class);
}
}
+++ /dev/null
-/*
- * 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";
- }
-}
<%
+ 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">></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">></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
+%>
+++ /dev/null
-<%
- 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">></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 %>