diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-06-08 23:17:39 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-06-08 23:18:05 +0200 |
commit | 88804cbff751b89ffb818daf5a99237e0d6f721b (patch) | |
tree | 79e3f759be63689845a21cf577f79898ce3c77a7 /sonar-server | |
parent | 2233993388ae63625d926099903a9b697a062409 (diff) | |
download | sonarqube-88804cbff751b89ffb818daf5a99237e0d6f721b.tar.gz sonarqube-88804cbff751b89ffb818daf5a99237e0d6f721b.zip |
SONAR-2414 remove the Clouds page written in GWT
Diffstat (limited to 'sonar-server')
4 files changed, 83 insertions, 22 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb index 87bacc79aef..1a2fa29fe92 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb @@ -27,11 +27,11 @@ class CloudController < ApplicationController if @project.nil? return render :text => "Resource [#{project_key}] not found", :status => 404 end + return access_denied unless has_role?(:user, @project) @snapshot=@project.last_snapshot - # metrics - size_metric=Metric.by_key('ncloc') - color_metric=Metric.by_key('violations_density') + @size_metric=Metric.by_key(params[:size]||'ncloc') + @color_metric=Metric.by_key(params[:color]||'violations_density') snapshot_conditions='snapshots.islast=:islast AND snapshots.scope=:scope AND snapshots.qualifier!=:test_qualifier AND (snapshots.id=:sid OR (snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path))' @@ -46,27 +46,27 @@ class CloudController < ApplicationController @snapshots=Snapshot.find(:all, :conditions => [snapshot_conditions, snapshot_values], :include => 'project', :order => 'projects.name') - @size_measures=ProjectMeasure.find(:all, + size_measures=ProjectMeasure.find(:all, :select => '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.alert_status', :joins => :snapshot, - :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{size_metric.id}", snapshot_values], + :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{@size_metric.id}", snapshot_values], :order => 'project_measures.value') - @color_measures=ProjectMeasure.find(:all, + color_measures=ProjectMeasure.find(:all, :select => '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.alert_status', :joins => :snapshot, - :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{color_metric.id}", snapshot_values], + :conditions => [snapshot_conditions + " AND project_measures.metric_id=#{@color_metric.id}", snapshot_values], :order => 'project_measures.value') @size_measure_by_sid={}, @color_measure_by_sid={} - @size_measures.each do |m| + size_measures.each do |m| @size_measure_by_sid[m.snapshot_id]=m end - @color_measures.each do |m| + color_measures.each do |m| @color_measure_by_sid[m.snapshot_id]=m end - @min_size_value=(@size_measures.empty? ? 0.0 : @size_measures.first.value) - @max_size_value=(@size_measures.empty? ? 0.0 : @size_measures.last.value) + @min_size_value=(size_measures.empty? ? 0.0 : size_measures.first.value) + @max_size_value=(size_measures.empty? ? 0.0 : size_measures.last.value) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb index ca30e0aaa12..b7fd87e8ce1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb @@ -1,15 +1,57 @@ <style> -#cloud a { - text-decoration: none; -} + #cloud a { + text-decoration: none; + } </style> +<script type="text/javascript"> + // open view + function ov(id) { + window.location.href = '<%=ApplicationController.root_context-%>/cloud/index/' + id + '?size=<%= @size_metric.key -%>&color=<%= @color_metric.key -%>'; + return false; + } + + // open file + function of(id) { + window.open('<%=ApplicationController.root_context-%>/resource/index/' + id + '?metric=<%= @color_metric.key -%>', 'resource', 'height=800,width=900,scrollbars=1,resizable=1'); + return false; + } +</script> + +<form id="cloudform" action="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>" method="GET"> + <ul class="headerLine"> + <li class="first"> + <span class="note">Color:</span> + <select name="color" onchange="document.forms['cloudform'].submit()"> + <option value="coverage" <%= 'selected' if @color_metric.key=='coverage' -%>>Coverage</option> + <option value="violations_density" <%= 'selected' if @color_metric.key=='violations_density' -%>>Rules compliance</option> + </select> + </li> + <li> + <input type="radio" name="size" value="ncloc" <%= 'checked' if @size_metric.key=='ncloc' -%> onchange="document.forms['cloudform'].submit()"> + Quick wins</option> + + <input type="radio" name="size" value="function_complexity" <%= 'checked' if @size_metric.key=='function_complexity' -%> onchange="document.forms['cloudform'].submit()"> + Top risk</input> + </li> + </ul> +</form> + <div id="cloud"> -<% @snapshots.each do |s| - size_measure=@size_measure_by_sid[s.id] - if size_measure && size_measure.value - color_measure=@color_measure_by_sid[s.id] -%> - <a href=""><span style="font-size: <%= font_size(size_measure.value) -%>%;color: <%= MeasureColor.color(color_measure, :check_alert_status => false).html -%>"><%= s.resource.name %></span></a> -<% end - end %> + <% @snapshots.each do |s| + size_measure=@size_measure_by_sid[s.id] + if size_measure && size_measure.value + color_measure=@color_measure_by_sid[s.id] + if s.resource.copy_resource_id + link="ov(#{s.resource.copy_resource_id})" + else + link="of(#{s.project_id})" + end + title="#{s.resource.long_name} | #{@size_metric.short_name}: #{size_measure.formatted_value}" + if color_measure && color_measure.value + title += " | #{@color_metric.short_name}: #{color_measure.formatted_value}" + end + %> + <a href="#" onclick="<%= link -%>" title="<%= title -%>"><span style="font-size:<%= font_size(size_measure.value) -%>%;color: <%= MeasureColor.color(color_measure, :check_alert_status => false).html -%>"><%= s.resource.name %></span></a> + <% end + end %> </div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index e6ab11b5d22..86c54dfed75 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -38,6 +38,7 @@ <% ActiveDashboard.user_dashboards(current_user).each do |active_dashboard| %> <li class="<%= 'selected' if @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id -%>"><a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%>"><%= active_dashboard.dashboard.name -%></a></li> <% end %> + <li class="<%= 'selected' if request.request_uri.include?('/cloud/index') -%>"><a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>">Clouds</a></li> <li class="<%= 'selected' if request.request_uri.include?('/components/index') -%>"><a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>">Components</a></li> <li class="<%= 'selected' if request.request_uri.include?('/drilldown/violations') -%>"><a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%>">Violations drilldown</a></li> <li class="<%= 'selected' if controller.controller_path=='timemachine' -%>"><a href="<%= ApplicationController.root_context -%>/timemachine/index/<%= @project.id -%>">Time machine</a></li> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index f0246a34b58..f43efd4d03f 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -1178,6 +1178,24 @@ table.header1 td { text-align: left; vertical-align: top; } +.headerLine { + background-color: #ECECEC; + color: #444; + border: 1px solid #DDD; + margin: 0 0 10px 0; + line-height: 30px; + height: 30px; + width: 100%; +} +ul.headerLine li { + float: left; + display: block; + padding: 0 10px 0; + background: url("../images/sep12.png") no-repeat scroll 0 50% transparent; +} +ul.headerLine li.first { + background: none; +} select.withIcons option { background-repeat: no-repeat; background-position: 2px 0; |