diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-03 16:22:18 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-03 16:22:18 +0000 |
commit | 2f36cd3a805911fc31650bc1e445b8fc0f06cd7f (patch) | |
tree | c43d87bfc177bc7c82d6b00902bb04926b2d4bea | |
parent | a6e39adc0865d35f405adb3cd709c1d4b7f7fdf7 (diff) | |
download | sonarqube-2f36cd3a805911fc31650bc1e445b8fc0f06cd7f.tar.gz sonarqube-2f36cd3a805911fc31650bc1e445b8fc0f06cd7f.zip |
variation periods: keep period when clicking on a resource from filters + disable treemaps
4 files changed, 39 insertions, 31 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index c5f61b8c6c4..8bcaabd132b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -306,15 +306,17 @@ module ApplicationHelper # # def link_to_resource(resource, name=nil, options={}) + period_index=options[:period] + period_index=nil if period_index && period_index<=0 if resource.display_dashboard? if options[:dashboard] - link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => resource.copy_resource_id || resource.id}}, :title => options[:title]) + link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => (resource.copy_resource_id||resource.id), :period => period_index}}, :title => options[:title]) else # stay on the same page (for example components) - link_to(name || resource.name, {:overwrite_params => {:id => resource.copy_resource_id || resource.id}}, :title => options[:title]) + link_to(name || resource.name, {:overwrite_params => {:id => (resource.copy_resource_id||resource.id), :period => period_index}}, :title => options[:title]) end else - link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title]) + link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id, :period => period_index}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title]) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb index ece04cd569b..0534200ef9b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb @@ -1,5 +1,6 @@ <% filter=@filter_context.filter %> <div> +<% unless edit_mode %> <div class="line-block"> <div class="operations"> <form action="<%= url_for :overwrite_params => {:period => nil} -%>" style="display: inline" method="get"> @@ -12,7 +13,7 @@ </form> </div> </div> - +<% end %> <table class="data nowrap width100" id="results"> <thead id="results-head"> <tr> @@ -109,7 +110,7 @@ <% end %> <% end %> <% elsif column.on_name? %> - <%= qualifier_icon(snapshot) %> <%= link_to_resource(snapshot.project, snapshot.project.name(true), {:dashboard => true, :title => snapshot.project.key}) %> + <%= qualifier_icon(snapshot) %> <%= link_to_resource(snapshot.project, snapshot.project.name(true), {:dashboard => true, :title => snapshot.project.key, :period => @filter_context.period_index}) %> <% elsif column.on_version? %><%= h snapshot.version %> <% elsif column.on_language? %><%= snapshot.project.language %> <% elsif column.on_date? %><%= human_short_date(snapshot.created_at) %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb index 846634e6fa3..6feef866da6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb @@ -1,21 +1,26 @@ -<% -metrics=treemap_metrics(@filter) -size_metric=metrics[0] -color_metric=metrics[1] -%> -<div id="treemap_loading"> - <%= image_tag 'loading.gif' %> -</div> -<div id="treemap"> </div> -<script> -var treemap_width = $('treemap').getDimensions().width - 15; -var treemap_height = document.viewport.getDimensions().height - 220; -function load_treemap(size_metric, color_metric, hide_form, period_index) { - $('treemap_loading').show(); - $('treemap').hide(); - <%= remote_function :update => 'treemap', :url => {:action => 'treemap', :id => @filter.id, :show_periods => true}, - :complete => "$('treemap_loading').hide();$('treemap').show();", - :with => "'width=' + treemap_width + '&height=' + treemap_height + '&size_metric=' + size_metric + '&color_metric=' + color_metric + '&hide_form=' + hide_form + '&period=' + period_index" %> -} -load_treemap('<%= size_metric.key -%>', '<%= color_metric.key -%>', <%= edit_mode -%>, <%= params[:period].to_i -%>); -</script>
\ No newline at end of file +<% if @filter.period? %> +Treemap does not support yet the selection of a period. + +<% else %> + <% + metrics=treemap_metrics(@filter) + size_metric=metrics[0] + color_metric=metrics[1] + %> + <div id="treemap_loading"> + <%= image_tag 'loading.gif' %> + </div> + <div id="treemap"> </div> + <script> + var treemap_width = $('treemap').getDimensions().width - 15; + var treemap_height = document.viewport.getDimensions().height - 220; + function load_treemap(size_metric, color_metric, hide_form, period_index) { + $('treemap_loading').show(); + $('treemap').hide(); + <%= remote_function :update => 'treemap', :url => {:action => 'treemap', :id => @filter.id, :show_periods => true}, + :complete => "$('treemap_loading').hide();$('treemap').show();", + :with => "'width=' + treemap_width + '&height=' + treemap_height + '&size_metric=' + size_metric + '&color_metric=' + color_metric + '&hide_form=' + hide_form + '&period=' + period_index" %> + } + load_treemap('<%= size_metric.key -%>', '<%= color_metric.key -%>', <%= edit_mode -%>, <%= params[:period].to_i -%>); + </script> +<% end %>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb index 88b99c28c9e..b8fabbfd88d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb @@ -76,19 +76,19 @@ table#columns td { <tr> <td class="first">Criteria:</td> <td> - <%= render :partial => 'filters/criterion', :locals => {:id => '0', :criterion => (@filter.measure_criteria.size>0 ? @filter.measure_criteria[0] : nil)} %> + <%= render :partial => 'filters/criterion', :locals => {:id => '0', :criterion => (@filter.measure_criteria.size>0 ? @filter.measure_criteria[0] : nil)} %> </td> </tr> <tr> - <td class="first"></td> + <td class="first">and: </td> <td> - and <%= render :partial => 'filters/criterion', :locals => {:id => '1', :criterion => (@filter.measure_criteria.size>1 ? @filter.measure_criteria[1] : nil) } %> + <%= render :partial => 'filters/criterion', :locals => {:id => '1', :criterion => (@filter.measure_criteria.size>1 ? @filter.measure_criteria[1] : nil) } %> </td> </tr> <tr> - <td class="first"></td> + <td class="first">and: </td> <td> - and <%= render :partial => 'filters/criterion', :locals => {:id => '2', :criterion => (@filter.measure_criteria.size>2 ? @filter.measure_criteria[2] : nil) } %> + <%= render :partial => 'filters/criterion', :locals => {:id => '2', :criterion => (@filter.measure_criteria.size>2 ? @filter.measure_criteria[2] : nil) } %> </td> </tr> <% unless @filter.advanced_search? %> |