diff options
Diffstat (limited to 'sonar-server')
23 files changed, 126 insertions, 96 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index 83097d23c35..2daf8b9d568 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -350,9 +350,16 @@ class Api::ResourcesController < Api::ApiController json_measure[:alert]=measure.alert_status json_measure[:alert_text]=measure.alert_text end - if include_trends && measure.tendency - json_measure[:trend]=measure.tendency_qualitative - json_measure[:var]=measure.tendency + if include_trends + if measure.tendency + json_measure[:trend]=measure.tendency_qualitative + json_measure[:var]=measure.tendency + end + json_measure[:var1]=measure.variation_value_1.to_f if measure.variation_value_1 + json_measure[:var2]=measure.variation_value_2.to_f if measure.variation_value_2 + json_measure[:var3]=measure.variation_value_3.to_f if measure.variation_value_3 + json_measure[:var4]=measure.variation_value_4.to_f if measure.variation_value_4 + json_measure[:var5]=measure.variation_value_5.to_f if measure.variation_value_5 end if measure.rule_id rule = rules_by_id[measure.rule_id] @@ -391,6 +398,29 @@ class Api::ResourcesController < Api::ApiController xml.date(format_datetime(snapshot.created_at)) xml.description(resource.description) if include_descriptions && resource.description xml.copy(resource.copy_resource_id) if resource.copy_resource_id + + if include_trends + xml.period1(snapshot.period1_mode) if snapshot.period1_mode + xml.period1_param(snapshot.period1_param) if snapshot.period1_param + xml.period1_date(format_datetime(snapshot.period1_date)) if snapshot.period1_date + + xml.period2(snapshot.period2_mode) if snapshot.period2_mode + xml.period2_param(snapshot.period2_param) if snapshot.period2_param + xml.period2_date(format_datetime(snapshot.period2_date)) if snapshot.period2_date + + xml.period3(snapshot.period3_mode) if snapshot.period3_mode + xml.period3_param(snapshot.period3_param) if snapshot.period3_param + xml.period3_date(format_datetime(snapshot.period3_date)) if snapshot.period3_date + + xml.period4(snapshot.period4_mode) if snapshot.period4_mode + xml.period4_param(snapshot.period4_param) if snapshot.period4_param + xml.period4_date(format_datetime(snapshot.period4_date)) if snapshot.period4_date + + xml.period5(snapshot.period5_mode) if snapshot.period5_mode + xml.period5_param(snapshot.period5_param) if snapshot.period5_param + xml.period5_date(format_datetime(snapshot.period5_date)) if snapshot.period5_date + end + if measures measures.each do |measure| xml.msr do @@ -405,9 +435,16 @@ class Api::ResourcesController < Api::ApiController xml.alert(measure.alert_status) if measure.alert_status xml.alert_text(measure.alert_text) if measure.alert_text end - if include_trends && measure.tendency - xml.trend(measure.tendency_qualitative) - xml.var(measure.tendency) + if include_trends + if measure.tendency + xml.trend(measure.tendency_qualitative) + xml.var(measure.tendency) + end + xml.var1(measure.variation_value_1.to_f) if measure.variation_value_1 + xml.var2(measure.variation_value_2.to_f) if measure.variation_value_2 + xml.var3(measure.variation_value_3.to_f) if measure.variation_value_3 + xml.var4(measure.variation_value_4.to_f) if measure.variation_value_4 + xml.var5(measure.variation_value_5.to_f) if measure.variation_value_5 end if measure.rule_id rule = rules_by_id[measure.rule_id] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 2ac65f9e3ba..c56dab9ba68 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -169,7 +169,7 @@ class DashboardController < ApplicationController end end @dashboard=(@active ? @active.dashboard : nil) - @dashboard_configuration=Api::DashboardConfiguration.new(@dashboard, :variation_index => params[:var]) + @dashboard_configuration=Api::DashboardConfiguration.new(@dashboard, :period_index => params[:period]) end def load_resource diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb index f5fb0714d83..636f55c531e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb @@ -65,11 +65,11 @@ class DrilldownController < ApplicationController @rule=Rule.by_key_or_id(params[:rule]) # variation measures - if params[:var].blank? - @variation_index=nil + if params[:period].blank? + @period_index=nil metric_prefix = '' else - @variation_index=params[:var].to_i + @period_index=params[:period].to_i metric_prefix = 'new_' end @@ -93,7 +93,7 @@ class DrilldownController < ApplicationController # options for Drilldown - options={:exclude_zero_value => true, :variation_index => @variation_index} + options={:exclude_zero_value => true, :period_index => @period_index} if @rule params[:rule]=@rule.key # workaround for SONAR-1767 : the javascript hash named "rp" in the HTML source must contain the rule key, but not the rule id options[:rule_id]=@rule.id diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb index d1be0ad873e..30cc0c01038 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb @@ -51,8 +51,8 @@ class FiltersController < ApplicationController load_filter_from_params(@filter, params) @filter.columns.build(:family => 'name', :order_index => 1, :sort_direction => 'ASC') - @filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 2, :variation => @filter.default_period?) - @filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 3, :variation => @filter.default_period?) + @filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 2, :variation => @filter.period?) + @filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 3, :variation => @filter.period?) @filter.columns.build(:family => 'date', :order_index => 4) column_index=0 @@ -408,7 +408,7 @@ class FiltersController < ApplicationController @width=(params[:width]||'800').to_i @height=(params[:height]||'500').to_i - treemap_options={:variation_index => @filter_context.variation_index} + treemap_options={:period_index => @filter_context.period_index} @treemap=Sonar::Treemap.new(@filter_context.measures_by_snapshot, @width, @height, @size_metric, @color_metric, treemap_options) render :action => "treemap", :layout => false end @@ -428,7 +428,7 @@ class FiltersController < ApplicationController filter.favourites=params[:favourites].present? filter.resource_id=(params[:path_id].present? ? Project.by_key(params[:path_id]).id : nil) filter.user_id=current_user.id - filter.variation_index=params[:variation_index].to_i + filter.period_index=params[:period_index].to_i filter.criteria=[] filter.criteria<<Criterion.new_for_qualifiers(params['qualifiers']) filter.criteria<<Criterion.new(:family => 'date', :operator => params['date_operator'], :value => params['date_value']) if params['date_operator'].present? @@ -484,7 +484,7 @@ class FiltersController < ApplicationController end @filter=nil - @variation_index=params[:var].to_i + @period_index=params[:period].to_i if @active @filter=@active.filter unless @filter.ajax_loading? 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 d240996c7c0..242be6bc1f5 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 @@ -440,8 +440,8 @@ module ApplicationHelper end index=options[:index] - if index.nil? && defined?(@dashboard_configuration) && @dashboard_configuration.variation? - index = @dashboard_configuration.variation_index + if index.nil? && defined?(@dashboard_configuration) && @dashboard_configuration.selected_period? + index = @dashboard_configuration.period_index end m.variation(index) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb index 0cebecfe02a..f49827b46cb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb @@ -28,7 +28,7 @@ module DashboardHelper @snapshot.measure(metric_key) end - def variation_select_option(snapshot, index) + def period_select_options(snapshot, index) return nil if snapshot.nil? || snapshot.project_snapshot.nil? mode=snapshot.project_snapshot.send "period#{index}_mode" mode_param=snapshot.project_snapshot.send "period#{index}_param" @@ -44,7 +44,7 @@ module DashboardHelper label = "Compare to #{localize(Date.parse(mode_param))}" end if label - selected=(params[:var]==index.to_s ? 'selected' : '') + selected=(params[:period]==index.to_s ? 'selected' : '') "<option value='#{index}' #{selected}>#{label}</option>" end else diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb index 1959e5709ae..0016d5e7919 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb @@ -19,7 +19,7 @@ # module DrilldownHelper - def variation_select_option(snapshot, index) + def period_select_options(snapshot, index) return nil if snapshot.nil? || snapshot.project_snapshot.nil? mode=snapshot.project_snapshot.send "period#{index}_mode" mode_param=snapshot.project_snapshot.send "period#{index}_param" @@ -35,7 +35,7 @@ module DrilldownHelper label = "New violations since #{localize(Date.parse(mode_param))}" end if label - selected=(params[:var]==index.to_s ? 'selected' : '') + selected=(params[:period]==index.to_s ? 'selected' : '') "<option value='#{index}' #{selected}>#{label}</option>" end else @@ -46,7 +46,7 @@ module DrilldownHelper def measure_or_variation_value(measure) if measure - @variation_index ? measure.variation(@variation_index) : measure.value + @period_index ? measure.variation(@period_index) : measure.value else nil end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb index 159341710d1..b6a2b77c04b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb @@ -98,7 +98,7 @@ module FiltersHelper #----- VARIATION - java_filter.setSortedVariationIndex(filter_context.variation_index) + java_filter.setSortedVariationIndex(filter_context.period_index) #----- EXECUTION java_result=java_facade.execute_filter(java_filter) @@ -160,9 +160,9 @@ module FiltersHelper end def period_names - p1=Property.value('sonar.timemachine.variation1', nil, 'previous_analysis') - p2=Property.value('sonar.timemachine.variation2', nil, '5') - p3=Property.value('sonar.timemachine.variation3', nil, '30') + p1=Property.value('sonar.timemachine.period1', nil, 'previous_analysis') + p2=Property.value('sonar.timemachine.period2', nil, '5') + p3=Property.value('sonar.timemachine.period3', nil, '30') [period_name(p1), period_name(p2), period_name(p3)] end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb index 8e7bd6c4d7b..623c92856d9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb @@ -19,12 +19,12 @@ # class Api::DashboardConfiguration - attr_accessor :dashboard, :variation_index, :variation + attr_accessor :dashboard, :period_index, :selected_period def initialize(dashboard, options={}) @dashboard=dashboard - @variation_index=options[:variation_index].to_i - @variation=(@variation_index>0) + @period_index=options[:period_index].to_i + @selected_period=(@period_index>0) end def name @@ -43,8 +43,8 @@ class Api::DashboardConfiguration @dashboard.number_of_columns end - def variation? - @variation + def selected_period? + @selected_period end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb index d424ce3ccc7..7f916b07d1a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb @@ -45,7 +45,7 @@ class DrilldownColumn @scope=scope @snapshot = snapshot - value_column = (options[:variation_index] ? "variation_value_#{options[:variation_index]}" : 'value') + value_column = (options[:period_index] ? "variation_value_#{options[:period_index]}" : 'value') order="project_measures.#{value_column}" if metric.direction<0 order += ' DESC' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb index 1809b9c7d43..3cf5c83907f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb @@ -125,20 +125,20 @@ class Filter < ActiveRecord::Base def advanced_search? @advanced_search ||= begin - !(criterion('language').nil?) || favourites || !(criterion('name').nil?) || !(criterion('key').nil?) || !(criterion('date').nil?) || default_period? + !(criterion('language').nil?) || favourites || !(criterion('name').nil?) || !(criterion('key').nil?) || !(criterion('date').nil?) || period? end end - def variation_index=(vi) + def period_index=(vi) if vi && vi>0 - write_attribute(:variation_index, vi) + write_attribute(:period_index, vi) else - write_attribute(:variation_index, nil) + write_attribute(:period_index, nil) end end - def default_period? - variation_index && variation_index>0 + def period? + period_index && period_index>0 end protected diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb index 1503cabb4ad..3145b1c26f3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # class FilterContext - attr_accessor :filter, :page_size, :page_id, :security_exclusions, :variation_index, :user, :sorted_column_id, :ascending_sort + attr_accessor :filter, :page_size, :page_id, :security_exclusions, :period_index, :user, :sorted_column_id, :ascending_sort def initialize(filter, options={}) @filter = filter @@ -27,7 +27,7 @@ @sorted_column_id=(options[:sort].blank? ? nil : options[:sort].to_i) @ascending_sort=(options[:asc].blank? ? nil : options[:asc]=='true') @user=options[:user] - @variation_index = (options[:var] ? options[:var].to_i : @filter.variation_index ) + @period_index = (options[:period] ? options[:period].to_i : @filter.period_index ) @metric_ids=(options[:metric_ids] || @filter.columns.map{|col| col.metric ? col.metric.id : nil}.compact.uniq) end @@ -132,8 +132,8 @@ @security_exclusions==true end - def variation? - @variation_index && @variation_index>0 + def selected_period? + @period_index && @period_index>0 end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb index 4f8afc58f65..d7971393cf6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb @@ -28,7 +28,7 @@ class MeasureColor # Options : # * min : min value, else the metric worst_value # * max : max value, else the metric best_value - # * variation_index: integer between 1 and 5 if set, else nil + # * period_index: integer between 1 and 5 if set, else nil # * check_alert_status: true|false. Default is true. # def self.color(measure, options={}) @@ -38,9 +38,9 @@ class MeasureColor min_value = options[:min] || measure.metric.worst_value percent=-1.0 - if options[:variation_index] + if options[:period_index] if min_value && max_value - value=measure.variation(options[:variation_index]) + value=measure.variation(options[:period_index]) percent = value_to_percent(value, min_value, max_value) end else diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index 5c45f336390..0089401ff7c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -110,9 +110,9 @@ class ProjectMeasure < ActiveRecord::Base end end - def variation(variation_index) + def variation(period_index) result = nil - case variation_index + case period_index when 1 result=variation_value_1 when 2 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb index a7b6c931adb..cb9d2bfaa55 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb @@ -29,8 +29,8 @@ class Sonar::Treemap @width = width @height = height - if options[:variation_index] && options[:variation_index]>0 - @variation_index = options[:variation_index] + if options[:period_index] && options[:period_index]>0 + @period_index = options[:period_index] end end @@ -91,8 +91,8 @@ class Sonar::Treemap end def size_value(measure) - if @variation_index - var=measure.variation(@variation_index) + if @period_index + var=measure.variation(@period_index) var ? var.to_f.abs : 0.0 elsif measure.value measure.value.to_f.abs||0.0 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb index 2753b7b92f7..958fb837c7b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb @@ -16,28 +16,21 @@ <% if @snapshot %> <div id="snapshot_title" class="page_title"> <h4> - <% - profile_measure=@snapshot.measure(Metric::PROFILE) - %> <%= link_to_favourite(@project) -%> Version <%= @snapshot.version -%> - <%= l @snapshot.created_at %> - <% if profile_measure %> - Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %><% end %> <% if @snapshot.project_snapshot.periods? %> - - <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:var => nil} -%>" style="display: inline"> - <select id="select-comparison" name="var" onchange="submit()" class="small"> + <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:period => nil} -%>" style="display: inline"> + <select id="select-comparison" name="period" onchange="submit()" class="small"> <option value="">Display trends</option> - <%= variation_select_option(@snapshot, 1) -%> - <%= variation_select_option(@snapshot, 2) -%> - <%= variation_select_option(@snapshot, 3) -%> - <%= variation_select_option(@snapshot, 4) -%> - <%= variation_select_option(@snapshot, 5) -%> + <%= period_select_options(@snapshot, 1) -%> + <%= period_select_options(@snapshot, 2) -%> + <%= period_select_options(@snapshot, 3) -%> + <%= period_select_options(@snapshot, 4) -%> + <%= period_select_options(@snapshot, 5) -%> </select> </form> <% end %> </h4> </div> <% end %> -</div> - - - +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb index c6e52fd8faa..e9e85333357 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb @@ -1,8 +1,8 @@ <tr class="<%= css -%> <%= 'selected' if Sonar::RulePriority.to_s(priority_id)==params[:priority] -%>"> <td><%= image_tag "priority/#{priority_id}.png" %></td> - <td><%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :var => @variation_index} %></td> + <td><%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :period => @period_index} %></td> <td style="padding-left: 10px;" align="right"> - <%= @variation_index ? format_variation(measure, :index => @variation_index) : format_measure(measure) -%> + <%= @period_index ? format_variation(measure, :index => @period_index) : format_measure(measure) -%> </td> <td align="left"> <% value = measure_or_variation_value(measure) %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb index 84dd2eef2ff..131eb5227ee 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb @@ -6,14 +6,14 @@ <%= link_to_favourite(@project) -%> Version <%= @snapshot.version -%> - <%= l @snapshot.created_at %> <% if profile_measure %> - Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %><% end %> <% if @snapshot.project_snapshot.periods? %> -- <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:var => nil} -%>" style="display: inline"> - <select id="select-comparison" name="var" onchange="submit()" class="small"> +- <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:period => nil} -%>" style="display: inline"> + <select id="select-comparison" name="period" onchange="submit()" class="small"> <option value="">All violations</option> - <%= variation_select_option(@snapshot, 1) -%> - <%= variation_select_option(@snapshot, 2) -%> - <%= variation_select_option(@snapshot, 3) -%> - <%= variation_select_option(@snapshot, 4) -%> - <%= variation_select_option(@snapshot, 5) -%> + <%= period_select_options(@snapshot, 1) -%> + <%= period_select_options(@snapshot, 2) -%> + <%= period_select_options(@snapshot, 3) -%> + <%= period_select_options(@snapshot, 4) -%> + <%= period_select_options(@snapshot, 5) -%> </select> </form> <% end %> @@ -28,9 +28,9 @@ <td align="left" width="1%" nowrap class="column first"> <% - value_column = (@variation_index ? "variation_value_#{@variation_index}" : 'value') + value_column = (@period_index ? "variation_value_#{@period_index}" : 'value') max = 0 - if @variation_index + if @period_index blocker_violations=@snapshot.measure('new_blocker_violations') critical_violations=@snapshot.measure('new_critical_violations') major_violations=@snapshot.measure('new_major_violations') @@ -63,7 +63,7 @@ <div class="scrollable"> <table class="spacedicon" width="100%" id="col_rules"> <% - if @variation_index + if @period_index rule_measures=@snapshot.rule_measures(Metric.by_key('new_violations'), @priority_id) else rule_measures=@snapshot.rule_measures(Metric.by_key('violations'), @priority_id) @@ -103,7 +103,7 @@ <%= link_to(rule.name, {:overwrite_params => {:rule => rule.key, :sid => nil, :priority => Sonar::RulePriority.to_s(@priority_id)}}, :title => "#{rule.plugin_name}: #{rule.plugin_rule_key}") %> </td> <td class="right" nowrap="nowrap"> - <span><%= @variation_index ? format_variation(rule_measure, :index => @variation_index) : rule_measure.formatted_value -%></span> + <span><%= @period_index ? format_variation(rule_measure, :index => @period_index) : rule_measure.formatted_value -%></span> </td> <td class="left last"> <%= barchart(:width => 70, :percent => (100 * value / max).to_i, :color => '#777') if max>0 %> @@ -158,7 +158,7 @@ <% end %> </td> <td class="right last" nowrap> - <%= @variation_index ? format_variation(measure, :index => @variation_index) : measure.formatted_value -%> + <%= @period_index ? format_variation(measure, :index => @period_index) : measure.formatted_value -%> <!--[if IE]> <![endif]--> </td> </tr> 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 d6016ab67d6..f608d3a7da9 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,11 +1,11 @@ <% filter=@filter_context.filter %> <div> Period: -<form action="<%= url_for :overwrite_params => {:var => nil} -%>" style="display: inline" method="get"> - <select name="var" onchange="submit()" class="small"> +<form action="<%= url_for :overwrite_params => {:period => nil} -%>" style="display: inline" method="get"> + <select name="period" onchange="submit()" class="small"> <option value="">None</option> <% period_names.each_with_index do |name, index| %> - <option value="<%= index+1 -%>" <%= 'selected' if @filter_context.variation_index==index+1 -%>><%= name -%></value> + <option value="<%= index+1 -%>" <%= 'selected' if @filter_context.period_index==index+1 -%>><%= name -%></value> <% end %> </select> </form> @@ -84,11 +84,11 @@ Period: measure = @filter_context.measure(snapshot, column.metric) %> <% if column.variation %> - <%= format_variation(measure, :index => @filter_context.variation_index) -%> + <%= format_variation(measure, :index => @filter_context.period_index) -%> <% else %> <%= format_measure(measure) -%> - <% if @filter_context.variation? %> - <%= format_variation(measure, :index => @filter_context.variation_index) -%> + <% if @filter_context.selected_period? %> + <%= format_variation(measure, :index => @filter_context.period_index) -%> <% else %> <%= trend_icon(measure, :empty => true) -%> <% end %> 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 ee040078283..846634e6fa3 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 @@ -10,12 +10,12 @@ color_metric=metrics[1] <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, variation_index) { +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 + '&var=' + variation_index" %> + :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[:var].to_i -%>); +load_treemap('<%= size_metric.key -%>', '<%= color_metric.key -%>', <%= edit_mode -%>, <%= params[:period].to_i -%>); </script>
\ 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 9e4bda43fd5..88b99c28c9e 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 @@ -102,10 +102,10 @@ table#columns td { <tr> <td class="first">Default period:</td> <td> - <select id="variation_index" name="variation_index"> + <select id="period_index" name="period_index"> <option value="">None</option> <% period_names.each_with_index do |name, index| %> - <option value="<%= index+1 -%>" <%= 'selected' if @filter.variation_index==index+1 -%>><%= name -%></value> + <option value="<%= index+1 -%>" <%= 'selected' if @filter.period_index==index+1 -%>><%= name -%></value> <% end %> </select> </td> 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 4fa5b299e59..5c881d2f96e 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 @@ -19,10 +19,10 @@ <td> <span class="comments">Period:</span> <br/> - <select name="var" onchange="submit()" class="small"> + <select name="period" onchange="submit()" class="small"> <option value="">None</option> <% period_names.each_with_index do |name, index| %> - <option value="<%= index+1 -%>" <%= 'selected' if params[:var].to_i==index+1 -%>><%= name -%></value> + <option value="<%= index+1 -%>" <%= 'selected' if params[:period].to_i==index+1 -%>><%= name -%></value> <% end %> </select> </td> diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_variations_to_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_periods_to_filters.rb index 905407fad79..23be6b35b04 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_variations_to_filters.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_periods_to_filters.rb @@ -21,10 +21,10 @@ # # Sonar 2.5 # -class AddVariationsToFilters < ActiveRecord::Migration +class AddPeriodsToFilters < ActiveRecord::Migration def self.up - add_column :filters, :variation_index, :integer, :null => true + add_column :filters, :period_index, :integer, :null => true Filter.reset_column_information add_column :filter_columns, :variation, :boolean, :null => true |