diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-16 17:47:59 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-16 17:47:59 +0000 |
commit | dcbf1fc1630fa311fdbbe883e4e286d2fa74bd76 (patch) | |
tree | ded787ce0bb23b63d67818f75904431cccdb2ba8 /sonar-server/src | |
parent | 4b756e42a163a02f2bf29dca930295cfd3c5f0ea (diff) | |
download | sonarqube-dcbf1fc1630fa311fdbbe883e4e286d2fa74bd76.tar.gz sonarqube-dcbf1fc1630fa311fdbbe883e4e286d2fa74bd76.zip |
SONAR-1941 add a period filter on violations tab
Diffstat (limited to 'sonar-server/src')
6 files changed, 49 insertions, 36 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 242be6bc1f5..916064adc1e 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 @@ -75,6 +75,26 @@ module ApplicationHelper params['configuring']=='true' end + def period_label(snapshot, period_index) + return nil if snapshot.nil? || snapshot.project_snapshot.nil? + mode=snapshot.project_snapshot.send "period#{period_index}_mode" + mode_param=snapshot.project_snapshot.send "period#{period_index}_param" + + label='' + if mode + if mode=='days' + label = "%s previous days" % mode_param + elsif mode=='version' + label = "Version %s" % mode_param + elsif mode=='previous_analysis' + label = "Previous analysis (%s)" % localize(Date.parse(mode_param)) + elsif mode=='date' + label = "Date: #{localize(Date.parse(mode_param))}" + end + end + label + end + def html_measure(measure, metric_name=nil, show_alert_status=true, url=nil, suffix='', small=true, no_tendency_img=false) html='' 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 f49827b46cb..b6473f95dee 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 @@ -29,24 +29,10 @@ module DashboardHelper end 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" - - if mode - if mode=='days' - label = "Compare to %s previous days" % mode_param - elsif mode=='version' - label = "Compare to version %s" % mode_param - elsif mode=='previous_analysis' - label = "Compare to previous analysis (%s)" % localize(Date.parse(mode_param)) - elsif mode=='date' - label = "Compare to #{localize(Date.parse(mode_param))}" - end - if label - selected=(params[:period]==index.to_s ? 'selected' : '') - "<option value='#{index}' #{selected}>#{label}</option>" - end + label=period_label(snapshot, index) + if label + selected=(params[:period]==index.to_s ? 'selected' : '') + "<option value='#{index}' #{selected}>#{label}</option>" 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 da1002c6288..9a0c9fb913e 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 @@ -171,14 +171,14 @@ module FiltersHelper def period_name(property) if property=='previous_analysis' - "Since previous analysis" + "Compare to previous analysis" elsif property =~ /^[\d]+(\.[\d]+){0,1}$/ # is integer - "Previous #{property} days" + "Compare to previous #{property} days" elsif property =~ /\d{4}-\d{2}-\d{2}/ - "Since #{property}" + "Compare to #{property}" elsif !property.blank? - "Since version #{property}" + "Compare to version #{property}" else nil 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 f608d3a7da9..fd245d00529 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,14 +1,17 @@ <% filter=@filter_context.filter %> <div> -Period: -<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.period_index==index+1 -%>><%= name -%></value> - <% end %> - </select> -</form> + <div class="line-block"> + <div class="operations"> + <form action="<%= url_for :overwrite_params => {:period => nil} -%>" style="display: inline" method="get"> + <select name="period" onchange="submit()" class="small"> + <option value="">Trends</option> + <% period_names.each_with_index do |name, index| %> + <option value="<%= index+1 -%>" <%= 'selected' if @filter_context.period_index==index+1 -%>><%= name -%></value> + <% end %> + </select> + </form> + </div> + </div> <table class="data nowrap width100" id="results"> <thead id="results-head"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb index 4f57e2112ff..eaa8e3d7636 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb @@ -13,23 +13,23 @@ <% end %> <% if @snapshot %> <% if @snapshot.project_snapshot.period1_mode %> - ,"period1": "<%= @snapshot.project_snapshot.period1_mode -%>" + ,"period1": "<%= period_label(@snapshot, 1) -%>" ,"period1_date": "<%= @snapshot.project_snapshot.period1_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>" <% end if @snapshot.project_snapshot.period2_mode %> - ,"period2": "<%= @snapshot.project_snapshot.period2_mode -%>" + ,"period2": "<%= period_label(@snapshot, 2) -%>" ,"period2_date": "<%= @snapshot.project_snapshot.period2_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>" <% end if @snapshot.project_snapshot.period3_mode %> - ,"period3": "<%= @snapshot.project_snapshot.period3_mode -%>" + ,"period3": "<%= period_label(@snapshot, 3) -%>" ,"period3_date": "<%= @snapshot.project_snapshot.period3_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>" <% end if @snapshot.project_snapshot.period4_mode %> - ,"period4": "<%= @snapshot.project_snapshot.period4_mode -%>" + ,"period4": "<%= period_label(@snapshot, 4) -%>" ,"period4_date": "<%= @snapshot.project_snapshot.period4_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>" <% end if @snapshot.project_snapshot.period5_mode %> - ,"period5": "<%= @snapshot.project_snapshot.period5_mode -%>" + ,"period5": "<%= period_label(@snapshot, 5) -%>" ,"period5_date": "<%= @snapshot.project_snapshot.period5_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>" <% end %> <% end %> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index c63c1a72527..98b72c1a42b 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -571,6 +571,10 @@ table.form td img { display: inline-block; width: 100%; } +div.operations { + float: right; + margin: 0; +} ul.operations { float: right; list-style-type: none; |