diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-28 10:23:58 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-28 10:23:58 +0000 |
commit | 5078541b8e1e33d790fe63c2faa37de70f18e376 (patch) | |
tree | 01f0099a7c8064ba014438c3dcdecc733f4a3f7a /plugins | |
parent | 7a8fe553fe231961e9095348042a296dbbc6679e (diff) | |
download | sonarqube-5078541b8e1e33d790fe63c2faa37de70f18e376.tar.gz sonarqube-5078541b8e1e33d790fe63c2faa37de70f18e376.zip |
SONAR-1643 move core widgets from sonar-server to sonar-core-plugin + improve UI
Diffstat (limited to 'plugins')
24 files changed, 338 insertions, 158 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index e96985a92cb..f599ea64c8f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -145,13 +145,15 @@ public class CorePlugin implements Plugin { extensions.add(Hotspots.class); //widgets - extensions.add(DefaultAlertsWidget.class); - extensions.add(DefaultCodeCoverageWidget.class); - extensions.add(DefaultCommentsDuplicationsWidget.class); - extensions.add(DefaultDescriptionWidget.class); + extensions.add(AlertsWidget.class); + extensions.add(CodeCoverageWidget.class); + extensions.add(CommentsDuplicationsWidget.class); + extensions.add(DescriptionWidget.class); extensions.add(DefaultExtendedAnalysisWidget.class); - extensions.add(DefaultRulesWidget.class); + extensions.add(RulesWidget.class); extensions.add(DefaultStaticAnalysisWidget.class); + extensions.add(EventsWidget.class); + extensions.add(CustomMeasuresWidget.class); // chart extensions.add(XradarChart.class); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultAlertsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/AlertsWidget.java index b826b83fdd7..c30344f2c5f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultAlertsWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/AlertsWidget.java @@ -22,7 +22,7 @@ package org.sonar.plugins.core.widgets; import org.sonar.api.web.AbstractRubyTemplate;
import org.sonar.api.web.RubyRailsWidget;
-public class DefaultAlertsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+public class AlertsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
return "alerts";
}
@@ -34,6 +34,6 @@ public class DefaultAlertsWidget extends AbstractRubyTemplate implements RubyRai @Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/_alerts.html.erb";
+ return "/org/sonar/plugins/core/widgets/alerts.html.erb";
}
}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCodeCoverageWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CodeCoverageWidget.java index 88471b2f755..abb4f2cf5bc 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCodeCoverageWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CodeCoverageWidget.java @@ -22,7 +22,7 @@ package org.sonar.plugins.core.widgets; import org.sonar.api.web.AbstractRubyTemplate;
import org.sonar.api.web.RubyRailsWidget;
-public class DefaultCodeCoverageWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+public class CodeCoverageWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
return "code_coverage";
}
@@ -34,6 +34,6 @@ public class DefaultCodeCoverageWidget extends AbstractRubyTemplate implements R @Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/_code_coverage.html.erb";
+ return "/org/sonar/plugins/core/widgets/code_coverage.html.erb";
}
}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCommentsDuplicationsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CommentsDuplicationsWidget.java index 8d1a8da9eec..2d3fcaaac3d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCommentsDuplicationsWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CommentsDuplicationsWidget.java @@ -22,18 +22,18 @@ package org.sonar.plugins.core.widgets; import org.sonar.api.web.AbstractRubyTemplate;
import org.sonar.api.web.RubyRailsWidget;
-public class DefaultCommentsDuplicationsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+public class CommentsDuplicationsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
return "comments_duplications";
}
public String getTitle() {
// not used for the moment by widgets.
- return "Comments duplications";
+ return "Comments & Duplications";
}
@Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/_comments_duplications.html.erb";
+ return "/org/sonar/plugins/core/widgets/comments_duplications.html.erb";
}
}
\ No newline at end of file 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 new file mode 100644 index 00000000000..b664ae3a6f3 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java @@ -0,0 +1,39 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.core.widgets; + +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; + +public class CustomMeasuresWidget extends AbstractRubyTemplate implements RubyRailsWidget { + public String getId() { + return "custom_measures"; + } + + public String getTitle() { + // not used for the moment by widgets. + return "Custom measures"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/core/widgets/custom_measures.html.erb"; + } +}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultDescriptionWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DescriptionWidget.java index 455fe019dd7..0c191d9f751 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultDescriptionWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DescriptionWidget.java @@ -22,7 +22,7 @@ package org.sonar.plugins.core.widgets; import org.sonar.api.web.AbstractRubyTemplate;
import org.sonar.api.web.RubyRailsWidget;
-public class DefaultDescriptionWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+public class DescriptionWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
return "description";
}
@@ -34,6 +34,6 @@ public class DefaultDescriptionWidget extends AbstractRubyTemplate implements Ru @Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/_description.html.erb";
+ return "/org/sonar/plugins/core/widgets/description.html.erb";
}
}
\ No newline at end of file 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 new file mode 100644 index 00000000000..547bc2f01a4 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/EventsWidget.java @@ -0,0 +1,39 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.core.widgets; + +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; + +public class EventsWidget extends AbstractRubyTemplate implements RubyRailsWidget { + public String getId() { + return "events"; + } + + public String getTitle() { + // not used for the moment by widgets. + return "Events"; + } + + @Override + protected String getTemplatePath() { + return "/org/sonar/plugins/core/widgets/events.html.erb"; + } +}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultRulesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/RulesWidget.java index f2985fa6ccf..50a70b78e97 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultRulesWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/RulesWidget.java @@ -22,7 +22,7 @@ package org.sonar.plugins.core.widgets; import org.sonar.api.web.AbstractRubyTemplate;
import org.sonar.api.web.RubyRailsWidget;
-public class DefaultRulesWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+public class RulesWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
return "rules";
}
@@ -34,6 +34,6 @@ public class DefaultRulesWidget extends AbstractRubyTemplate implements RubyRail @Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/_rules.html.erb";
+ return "/org/sonar/plugins/core/widgets/rules.html.erb";
}
}
\ No newline at end of file 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 new file mode 100644 index 00000000000..b75db5d24fd --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_complexity_chart.html.erb @@ -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/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb index 230633d4e24..b2c4f1cedc1 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb @@ -1,126 +1,111 @@ -<% - file_complexity=measure('file_complexity') - function_complexity=measure('function_complexity') - class_complexity=measure('class_complexity') - paragraph_complexity=measure('paragraph_complexity') - - if file_complexity || function_complexity || class_complexity || paragraph_complexity - complexity=measure('complexity') + +<% + file_complexity=measure('file_complexity') + function_complexity=measure('function_complexity') + class_complexity=measure('class_complexity') + paragraph_complexity=measure('paragraph_complexity') + + if file_complexity || function_complexity || class_complexity || paragraph_complexity +complexity=measure('complexity') %> +<div class="widget"> <div class="dashbox" > - <h3>Complexity</h3> - <% if function_complexity %> - <p> - <span class="big"><%= format_measure(function_complexity, :suffix => '', :url => url_for_drilldown(function_complexity)) -%> <%= tendency_icon(function_complexity, false) -%></span>/ method - </p> - <% end %> - <% if paragraph_complexity %> - <p> - <span class="big"><%= format_measure(paragraph_complexity, :suffix => '', :url => url_for_drilldown(paragraph_complexity)) -%> <%= tendency_icon(paragraph_complexity, false) -%></span>/ paragraph - </p> - <% end %> - <% if class_complexity %> - <p> - <span class="big"><%= format_measure(class_complexity, :suffix => '', :url => url_for_drilldown(class_complexity)) -%> <%= tendency_icon(class_complexity, false) -%></span>/ class - </p> - <% end %> - <% if file_complexity %> - <p> - <span class="big"><%= format_measure(file_complexity, :suffix => '', :url => url_for_drilldown(file_complexity)) -%> <%= tendency_icon(file_complexity, false) -%></span>/ file - </p> - <% end %> - <% if complexity %> - <p> - Total: <%= format_measure(complexity, :url => url_for_drilldown(complexity)) -%> <%= tendency_icon(complexity) -%> - </p> - <% end %> + <h3>Complexity</h3> + <% if function_complexity %> + <p> + <span class="big"><%= format_measure(function_complexity, :suffix => '', :url => url_for_drilldown(function_complexity)) -%> <%= tendency_icon(function_complexity, false) -%></span>/ method + </p> + <% end %> + <% if paragraph_complexity %> + <p> + <span class="big"><%= format_measure(paragraph_complexity, :suffix => '', :url => url_for_drilldown(paragraph_complexity)) -%> <%= tendency_icon(paragraph_complexity, false) -%></span>/ paragraph + </p> + <% end %> + <% if class_complexity %> + <p> + <span class="big"><%= format_measure(class_complexity, :suffix => '', :url => url_for_drilldown(class_complexity)) -%> <%= tendency_icon(class_complexity, false) -%></span>/ class + </p> + <% end %> + <% if file_complexity %> + <p> + <span class="big"><%= format_measure(file_complexity, :suffix => '', :url => url_for_drilldown(file_complexity)) -%> <%= tendency_icon(file_complexity, false) -%></span>/ file + </p> + <% end %> + <% if complexity %> + <p> + Total: <%= format_measure(complexity, :url => url_for_drilldown(complexity)) -%> <%= tendency_icon(complexity) -%> + </p> + <% end %> </div> -<% - function_distribution=measure('function_complexity_distribution') - paragraph_distribution=measure('paragraph_complexity_distribution') - class_distribution=measure('class_complexity_distribution') - file_distribution=measure('file_complexity_distribution') - distributions=[function_distribution,paragraph_distribution,class_distribution,file_distribution].compact - selected_distribution=nil - if distributions.size>0 - selected_distribution=distributions.first - end - if selected_distribution +<% + function_distribution=measure('function_complexity_distribution') + paragraph_distribution=measure('paragraph_complexity_distribution') + class_distribution=measure('class_complexity_distribution') + file_distribution=measure('file_complexity_distribution') + distributions=[function_distribution,paragraph_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" style="float:right"> - <script type='text/javascript'> - //<![CDATA[ - function selectComplexity(metric) { - $$('#cmp_charts .chart').each(function(chart) { - chart.hide(); - }); - $('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| %> - <% metric = distribution_measure.metric.key - dist_measure = measure(metric) - title = distribution_measure.metric.description - visible = (selected_distribution==distribution_measure) - 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[ + function selectComplexity(metric) { + $$('#cmp_charts .chart').each(function(chart) { + chart.hide(); + }); + $('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 %> - <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 %> - <% 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 -%>></input> <label for="cmp_dist_function_complexity_distribution">Methods</label> +<% +end +if paragraph_distribution + count_dist+=1 +%> +<input type="radio" name="cmp_dist" value="paragraph_complexity_distribution" id="cmp_dist_paragraph_complexity_distribution" onClick="selectComplexity('paragraph_complexity_distribution');" <%= 'checked' if paragraph_distribution==selected_distribution -%>></input> <label for="cmp_dist_paragraph_complexity_distribution">Paragraphs</label><%= '<br/>' if count_dist==2 %> +<% +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 -%>></input> <label for="cmp_dist_class_complexity_distribution">Classes</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 -%>></input> <label for="cmp_dist_file_complexity_distribution">Files</label> +<% 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 -%>></input> <label for="cmp_dist_function_complexity_distribution">Methods</label> - <% - end - if paragraph_distribution - count_dist+=1 - %> - <input type="radio" name="cmp_dist" value="paragraph_complexity_distribution" id="cmp_dist_paragraph_complexity_distribution" onClick="selectComplexity('paragraph_complexity_distribution');" <%= 'checked' if paragraph_distribution==selected_distribution -%>></input> <label for="cmp_dist_paragraph_complexity_distribution">Paragraphs</label><%= '<br/>' if count_dist==2 %> - <% - 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 -%>></input> <label for="cmp_dist_class_complexity_distribution">Classes</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 -%>></input> <label for="cmp_dist_file_complexity_distribution">Files</label> - <% end %> - - </form> + </form> </div> <% end %> + +<div class="clear"></div> +</div> <% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb index 6ada91d46ae..d654238d02c 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb @@ -3,6 +3,7 @@ if measure('lines') || measure('ncloc') files=measure('files') statements=measure('statements') %> +<div class="widget"> <table width="100%"> <tr> <td valign="top" width="48%" nowrap> @@ -12,8 +13,8 @@ if measure('lines') || measure('ncloc') <p><span class="big"> <%= format_measure('ncloc', :suffix => '', :url => url_for_drilldown('ncloc')) -%> <%= tendency_icon('ncloc', false) -%></span></p> <% - generated_ncloc=measure('generated_ncloc') - if generated_ncloc && generated_ncloc.value>0 + generated_ncloc=measure('generated_ncloc') + if generated_ncloc && generated_ncloc.value>0 %> <p>+<%= format_measure(generated_ncloc, :suffix => ' generated', :url => url_for_drilldown(generated_ncloc)) -%> <%= tendency_icon(generated_ncloc) -%></p> <% end %> @@ -23,7 +24,7 @@ if measure('lines') || measure('ncloc') <% end %> <% generated_lines=measure('generated_lines') - if generated_lines && generated_lines.value>0 + if generated_lines && generated_lines.value>0 %> <p>incl. <%= format_measure(generated_lines, :suffix => ' generated', :url => url_for_drilldown(generated_lines)) -%> <%= tendency_icon(generated_lines) -%></p> <% end %> @@ -60,4 +61,5 @@ if measure('lines') || measure('ncloc') </td> </tr> </table> +</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 index 095afb59331..5304aaca9b4 100644 --- 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 @@ -2,9 +2,11 @@ if m && !m.alert_status.blank? css_class = "widget color_#{m.alert_status}" if m.alert_status==Metric::TYPE_LEVEL_OK - label = '<b>No alerts</b>.' + label = '<b>No alerts</b>.' else label = "<b>Alerts</b> : #{h(m.alert_text)}." end -%> <div><%= format_measure(m) -%> <%= label -%></div> +%><div class="<%= css_class -%>" id="alerts_widget"> + <div><%= format_measure(m) -%> <%= label -%></div> +</div> <% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_code_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb index 02b1dc5ef5a..82dcc03258e 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_code_coverage.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb @@ -2,8 +2,9 @@ code_coverage_measure=measure(Metric::COVERAGE) tests_measure=measure(Metric::TESTS) if code_coverage_measure || tests_measure %> +<div class="widget"> <div class="yui-g"> - <div class="yui-u first"> + <div class="yui-u first"> <div class="dashbox"> <p class="title">Code coverage</p> <p><span class="big"><%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown(Metric::COVERAGE), :default => '-') %> <%= tendency_icon(code_coverage_measure, false) %></span></p> @@ -25,21 +26,22 @@ if code_coverage_measure || tests_measure %> </div> </div> <div class="yui-u"> - <% - success_percentage=measure(Metric::TEST_SUCCESS_DENSITY) - if success_percentage - %> - <div class="dashbox"> - <h3>Test success</h3> - <p><span class="big"><%= format_measure(success_percentage, :suffix => '', :url => url_for_drilldown(success_percentage)) %> <%= tendency_icon(measure(Metric::TEST_SUCCESS_DENSITY), false) %></span></p> - <p> - <%= format_measure(Metric::TEST_FAILURES, :suffix => ' failures', :url => url_for_drilldown(Metric::TEST_FAILURES)) %> <%= tendency_icon(measure(Metric::TEST_FAILURES)) %> - </p> - <p> - <%= format_measure(Metric::TEST_ERRORS, :suffix => ' errors', :url => url_for_drilldown(Metric::TEST_ERRORS)) %> <%= tendency_icon(measure(Metric::TEST_ERRORS)) %> - </p> - </div> - <% end %> + <% + success_percentage=measure(Metric::TEST_SUCCESS_DENSITY) + if success_percentage + %> + <div class="dashbox"> + <h3>Test success</h3> + <p><span class="big"><%= format_measure(success_percentage, :suffix => '', :url => url_for_drilldown(success_percentage)) %> <%= tendency_icon(measure(Metric::TEST_SUCCESS_DENSITY), false) %></span></p> + <p> + <%= format_measure(Metric::TEST_FAILURES, :suffix => ' failures', :url => url_for_drilldown(Metric::TEST_FAILURES)) %> <%= tendency_icon(measure(Metric::TEST_FAILURES)) %> + </p> + <p> + <%= format_measure(Metric::TEST_ERRORS, :suffix => ' errors', :url => url_for_drilldown(Metric::TEST_ERRORS)) %> <%= tendency_icon(measure(Metric::TEST_ERRORS)) %> + </p> + </div> + <% end %> +</div> </div> </div> <% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_comments_duplications.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb index b7b7e2f54cd..aabb5c642e6 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_comments_duplications.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb @@ -1,4 +1,5 @@ <% if measure(Metric::LINES) || measure(Metric::NCLOC) %> +<div class="widget"> <table width="100%"> <tr> <td valign="top" width="48%" nowrap> @@ -12,7 +13,7 @@ if comment_blank_lines && comment_blank_lines.value>0 %> <p>+<%= format_measure(comment_blank_lines, :suffix => ' blank', :url => url_for_drilldown(comment_blank_lines)) -%> <%= tendency_icon(comment_blank_lines) -%></p> - <% end %> + <% end %> <p><%= format_measure(Metric::PUBLIC_DOCUMENTED_API_DENSITY, :suffix => ' docu. API', :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) -%> <%= tendency_icon(Metric::PUBLIC_DOCUMENTED_API_DENSITY) -%></p> <p><%= format_measure(Metric::PUBLIC_UNDOCUMENTED_API, :suffix => ' undocu. API', :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_UNDOCUMENTED_API)) -%> <%= tendency_icon(Metric::PUBLIC_UNDOCUMENTED_API) -%></p> <p><%= format_measure(Metric::COMMENTED_OUT_CODE_LINES, :suffix => ' commented LOCs', :url => url_for_drilldown(Metric::COMMENTED_OUT_CODE_LINES, :highlight => Metric::COMMENTED_OUT_CODE_LINES)) -%> <%= tendency_icon(Metric::COMMENTED_OUT_CODE_LINES) -%></p> @@ -30,8 +31,9 @@ <p><%= format_measure(Metric::DUPLICATED_FILES, :suffix => ' files', :url => url_for_drilldown(Metric::DUPLICATED_FILES)) -%> <%= tendency_icon(Metric::DUPLICATED_FILES) -%></p> </div> <% end %> - + </td> </tr> </table> +</div> <% end %>
\ No newline at end of file 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 new file mode 100644 index 00000000000..4fc22a71d71 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb @@ -0,0 +1,70 @@ + <% + measures = @snapshot.async_measures.select{ |m| + m.metric and m.metric.enabled==true and m.metric.user_managed? + }.sort{ |m1,m2| + m1.metric.name <=> m2.metric.name + } + %> + <% if is_admin?(@snapshot) || measures.size>0 %> + <div class="widget"> + <script type="text/javascript"> + function selectReviewMetric(){ + $$('.review_description_update').each(function(element) { + element.hide(); + }); + review = $('review_metric_id').value; + $('review_description_'+review).show(); + $('review_value_'+review).show(); + } + + function selectEventCateg(){ + $$('#event_cat_desc .comments').each(function(elt) { + elt.hide(); + }); + selected_categ = $('event_category').value; + if (selected_categ!=null && selected_categ!='') { + $('event_cat_desc_'+selected_categ).show(); + } + } + </script> + <% + measures.each do |m| + html_name_id = "review_name_#{m.metric.short_name}" + html_value_id = "review_value_#{m.metric.short_name}" + html_date_id = "review_date_#{m.metric.short_name}" + %> + <div class="dashbox"> + <h3 id='<%= html_name_id %>'><%= m.metric.short_name %></h3> + <p><span id='<%= html_value_id %>' class="big"> + <%= format_measure(m, :suffix => '', :url => m.url) -%> + </span></p> + <% if m.measure_date %> + <p><span id='<%= html_date_id %>'><%= l(m.measure_date.to_date) %></span> + <% if m.review? && is_admin?(@snapshot) %> + <%= link_to 'delete', + {:controller => 'project', :action => 'delete_review', :id => m.id, :sid => @snapshot.id}, :method => 'delete', :confirm => 'Delete this measure ?', + :class => 'action', :id => "delete_review_#{m.metric_key}" %> + <% end %> + </p> + <% end %> + <% unless m.description.blank? %> + <p><%= m.description %></p> + <% end %> + </div> + <% end %> + <% if is_admin?(@snapshot) %> + <div id="add_review_form"> + <p> + <% if @review %> + <%= render :partial => 'dashboard_edit_review' %> + <% else %> + <%= link_to_remote 'Add a measure', + {:url => {:controller => 'project', :action => 'edit_review', :sid => @snapshot.id}, :update => 'add_review_form'}, + {:class => 'action', :id => 'add_review'} %> + <% end %> + </p> + </div> + <% end %> + <div class="clear"></div> + </div> + <% 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 index 8ae52acc63b..aee61ede107 100644 --- 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 @@ -1,7 +1,10 @@ - <% if not @project.description.blank? %> +<div class="widget box"> + <% if @project.description.present? %> <%= h @project.description %><br/> <% end %> + <%= @project.name %> + Key : <%= @project.key %><br/> <% if @project.language %> Language : <%= @project.language %><br/> @@ -22,6 +25,7 @@ <tr><td colspan="2"> <a href="<%= url_for :controller => :feeds, :action => 'project', :id => @project.key, :category => EventCategory::KEY_ALERT -%>" class="nolink"><%= image_tag 'feed-icon-14x14.png' %></a> <a href="<%= url_for :controller => :feeds, :action => 'project', :id => @project.key, :category => EventCategory::KEY_ALERT -%>" class="action">Alerts feed</a> - </td></tr> + </td></tr> <% end %> </table> +</div>
\ No newline at end of file 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 new file mode 100644 index 00000000000..41a9415f667 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/events.html.erb @@ -0,0 +1,6 @@ +<% if @project.project? %> +<div class="widget" id="widget_events"><div id="events_portlet"></div></div> +<script> +<%= remote_function(:update => "events_portlet", :url => { :controller => :project, :action => :events, :id => @snapshot.id }, :method => 'get') %> +</script> +<% end %>
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb index 7befce2e792..a1cc13ed827 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_rules.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb @@ -1,4 +1,5 @@ <% if measure(Metric::LINES) %> +<div class="widget" id="widget_rules"> <table width="100%"> <tr> <td valign="top"> @@ -57,14 +58,14 @@ <div class="big"> <%= format_measure(Metric::VIOLATIONS, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%> <%= tendency_icon(Metric::VIOLATIONS) -%> </div> - <% + <% blocker_violations = @snapshot.measure(Metric::BLOCKER_VIOLATIONS) critical_violations = @snapshot.measure(Metric::CRITICAL_VIOLATIONS) major_violations = @snapshot.measure(Metric::MAJOR_VIOLATIONS) minor_violations = @snapshot.measure(Metric::MINOR_VIOLATIONS) info_violations = @snapshot.measure(Metric::INFO_VIOLATIONS) max = 0 - [blocker_violations,critical_violations,major_violations,minor_violations,info_violations].each do |m| + [blocker_violations,critical_violations,major_violations,minor_violations,info_violations].each do |m| max = m.value if m and m.value and m.value>max end %> @@ -129,4 +130,6 @@ </td> </tr> </table> + +</div> <% end %>
\ No newline at end of file diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java index d05806e1a34..b2b145d1785 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java @@ -30,7 +30,7 @@ public final class ChidamberKemererWidget extends AbstractRubyTemplate implement } public String getTitle() { - return "2_Chidamber & Kemerer"; + return "Chidamber & Kemerer"; } @Override diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/FileDesignWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/FileDesignWidget.java index fc946c5c19b..bd6bda2aaee 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/FileDesignWidget.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/FileDesignWidget.java @@ -30,7 +30,7 @@ public final class FileDesignWidget extends AbstractRubyTemplate implements Ruby } public String getTitle() { - return "1_File design"; + return "File design"; } @Override 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 index 807cb5b5329..7c54c87ba55 100644 --- 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 @@ -30,7 +30,7 @@ public final class PackageDesignWidget extends AbstractRubyTemplate implements R } public String getTitle() { - return "1_Package design"; + return "Package design"; } @Override diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb index 2f772d05ce7..936a6f7efec 100644 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb +++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb @@ -6,6 +6,7 @@ if lcom || rfc rfc_distribution=measure('rfc_distribution') suspect_lcom4_density=measure('suspect_lcom4_density') %> +<div class="widget"> <table width="100%"> <tbody> <tr> @@ -47,4 +48,5 @@ if lcom || rfc </tr> </tbody> </table> +</div> <% end %> 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 70041753975..6f53a2478d5 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 @@ -4,6 +4,7 @@ file_cycles=measure('file_cycles') file_feedback_edges=measure('file_feedback_edges') %> +<div class="widget"> <table width="100%"> <tbody> <tr> @@ -27,6 +28,7 @@ </tr> </tbody> </table> +</div> <% 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 index 59136259ee1..c4903328ace 100644 --- 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 @@ -2,6 +2,7 @@ package_tangle_index=measure('package_tangle_index') if package_tangle_index %> +<div class="widget"> <table width="100%"> <tbody> <tr> @@ -33,6 +34,7 @@ </tr> </tbody> </table> +</div> <% end %>
\ No newline at end of file |