diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-04-23 00:00:36 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-04-23 19:23:31 +0200 |
commit | 5b0b77ac366811d1aa67e15adc10b09eb6351548 (patch) | |
tree | 810dd5f06c6c12a1bfbc0787e79b8beaad7d28a4 /server/sonar-web | |
parent | 4cb7edb0029e605faf960d9d569341c10c4897b2 (diff) | |
download | sonarqube-5b0b77ac366811d1aa67e15adc10b09eb6351548.tar.gz sonarqube-5b0b77ac366811d1aa67e15adc10b09eb6351548.zip |
SONAR-6392 Drop measure trends
Diffstat (limited to 'server/sonar-web')
6 files changed, 7 insertions, 57 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index 263be493f14..928fbb5dcef 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -289,7 +289,7 @@ class Api::ResourcesController < Api::ApiController def select_columns_for_measures select_columns='project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.rule_priority,project_measures.text_value,project_measures.characteristic_id,project_measures.measure_data' if params[:includetrends]=='true' - select_columns+=',project_measures.tendency,project_measures.variation_value_1,project_measures.variation_value_2,project_measures.variation_value_3,project_measures.variation_value_4,project_measures.variation_value_5' + select_columns+=',project_measures.variation_value_1,project_measures.variation_value_2,project_measures.variation_value_3,project_measures.variation_value_4,project_measures.variation_value_5' end if params[:includealerts]=='true' select_columns+=',project_measures.alert_status,project_measures.alert_text' @@ -438,10 +438,6 @@ class Api::ResourcesController < Api::ApiController json_measure[:alert_text]=measure.alert_text end 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[:fvar1]=measure.format_numeric_value(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 @@ -529,10 +525,6 @@ class Api::ResourcesController < Api::ApiController xml.alert_text(measure.alert_text) if measure.alert_text end 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.fvar1(measure.format_numeric_value(measure.variation_value_1.to_f)) if measure.variation_value_1 xml.var2(measure.variation_value_2.to_f) if measure.variation_value_2 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb index b7c210d08d1..c5f3c4bdc66 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb @@ -280,7 +280,6 @@ class MeasuresController < ApplicationController component_hash[:measures][measure.metric.key][:val] = measure.value if measure.value component_hash[:measures][measure.metric.key][:fval] = measure.formatted_value if measure.value component_hash[:measures][measure.metric.key][:text] = measure.data if measure.data - component_hash[:measures][measure.metric.key][:trend] = measure.tendency if fields.include?('measureTrend') && measure.tendency component_hash[:measures][measure.metric.key][:status] = measure.alert_status if fields.include?('measureStatus') && measure.alert_status component_hash[:measures][measure.metric.key][:p1] = measure.variation_value_1 if display_variation && measure.variation_value_1 component_hash[:measures][measure.metric.key][:p2] = measure.variation_value_2 if display_variation && measure.variation_value_2 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index c1eb79b9028..ff006badfd0 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -129,7 +129,7 @@ module ApplicationHelper # deprecated since 2.5. Use trend_icon() instead def tendency_icon(metric_or_measure, small=true, no_tendency_img=true) - trend_icon(metric_or_measure, {:big => !small, :empty => !no_tendency_img}) + trend_icon(nil, {:empty => !no_tendency_img}) end def boolean_icon(boolean_value, options={}) @@ -446,44 +446,10 @@ module ApplicationHelper end # - # - # Display the trend icon : - # - # === Optional parameters - # :empty: true|false. Show an empty transparent image when no trend or no measure. Default is false. - # :big : true|false (default is false). Default is 10x10px. Big is 16x16px. - # - # === Examples - # trend_icon('ncloc') - # trend_icon(measure('ncloc')) - # trend_icon('ncloc', :empty => true) + # Unsupported since version 5.2 # def trend_icon(metric_or_measure, options={}) - m=nil - if metric_or_measure.is_a? ProjectMeasure - m = metric_or_measure - elsif @snapshot - m = @snapshot.measure(metric_or_measure) - end - - if m.nil? || m.tendency.nil? || m.tendency==0 - return options[:empty] ? "<i class=\"icon-trend-0\"></i>" : nil - end - className = m.tendency.to_s - - if options[:big] - className += ' icon-trend-big' - end - - case m.tendency_qualitative - when 0 - className += ' icon-black' - when -1 - className += ' icon-red' - when 1 - className += ' icon-green' - end - "<i class=\"icon-trend-#{className}\"></i>" + return options[:empty] ? "<i class=\"icon-trend-0\"></i>" : nil end # diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb index ec76730db50..83b50b73d7f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb @@ -51,7 +51,7 @@ module ComponentsHelper elsif column.metric_column? measure = item_by_metric_id(measures_by_snapshot[snapshot], column.id ) measure_param = measure.value if measure - content = format_measure(measure) + trend_icon(measure, :empty => true) + content = format_measure(measure) end "<#{html_node} #{"nowrap='nowrap'" if nowrap} #{"x='#{measure_param}'" if measure_param} class='right'><span class='no-transform'>" + content + "</span></#{html_node}>" diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb index 294eda12107..ac2d7e536de 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb @@ -43,8 +43,6 @@ module MeasuresHelper else format_variation(measure, :index => column.period, :style => 'light') end - elsif column.metric.numeric? - format_measure(measure) + ' ' + trend_icon(measure, :empty => true) else format_measure(measure) + ' ' end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb index ca542e4b687..c85fcbb789a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -260,13 +260,8 @@ class ProjectMeasure < ActiveRecord::Base end def tendency_qualitative - if !metric.qualitative? || tendency.nil? || tendency==0 || metric.direction==0 - 0 - elsif tendency>0 - metric.direction>0 ? 1 : -1 - else - metric.direction<0 ? 1 : -1 - end + # unsupported since version 5.2 + 0 end def <=>(other) |