aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-06-09 11:11:14 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-06-09 11:20:59 +0200
commitd4d85219363a7f559b837a6b312e7aa328a5fc5a (patch)
tree731af2fc1a177d4ba19248f9bb8cbed40e4966ad /sonar-server
parentaf1f34a4fb6546c9f0ba630671315077015356c5 (diff)
downloadsonarqube-d4d85219363a7f559b837a6b312e7aa328a5fc5a.tar.gz
sonarqube-d4d85219363a7f559b837a6b312e7aa328a5fc5a.zip
SONAR-2414 use blue instead of green in clouds
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb2
4 files changed, 15 insertions, 6 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 1a2fa29fe92..006184a5a26 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
@@ -31,7 +31,7 @@ class CloudController < ApplicationController
@snapshot=@project.last_snapshot
@size_metric=Metric.by_key(params[:size]||'ncloc')
- @color_metric=Metric.by_key(params[:color]||'violations_density')
+ @color_metric=Metric.by_key(params[:color]||'coverage')
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))'
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 79b86cfebdb..745fb54a45b 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
@@ -61,12 +61,15 @@ class MeasureColor
end
end
+ max_color=options[:max_color]||MAX_COLOR
+ min_color=options[:min_color]||MIN_COLOR
+ mean_color=options[:mean_color]||MEAN_COLOR
if percent<0.0
NONE_COLOR
elsif (percent > 50.0)
- MAX_COLOR.mix_with(MEAN_COLOR, (percent - 50.0) * 2.0)
+ max_color.mix_with(mean_color, (percent - 50.0) * 2.0)
else
- MIN_COLOR.mix_with(MEAN_COLOR, (50.0 - percent) * 2.0)
+ min_color.mix_with(mean_color, (50.0 - percent) * 2.0)
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 b7fd87e8ce1..2201de2c81b 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
@@ -37,7 +37,13 @@
</form>
<div id="cloud">
- <% @snapshots.each do |s|
+ <%
+ color_options={
+ :check_alert_status => false,
+ :min_color => Color::RGB.from_html("EE0000"), # red
+ :mean_color => Color::RGB.from_html("4D05B1"), # purple
+ :max_color => Color::RGB.from_html("2360BF")} # blue
+ @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]
@@ -51,7 +57,7 @@
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>
+ <a href="#" onclick="<%= link -%>" title="<%= title -%>"><span style="font-size:<%= font_size(size_measure.value) -%>%;color: <%= MeasureColor.color(color_measure, color_options).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 86c54dfed75..7de0d6da97e 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,10 +38,10 @@
<% 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>
+ <li class="<%= 'selected' if request.request_uri.include?('/cloud/index') -%>"><a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>">Clouds</a></li>
<% controller.java_facade.getPages(Navigation::SECTION_RESOURCE, @project.scope, @project.qualifier, @project.language).each do |page| %>
<li class="<%= 'selected' if request.request_uri.include?("page=#{page.getId()}") -%>"><a href="<%= ApplicationController.root_context -%>/plugins/resource/<%= @project.id-%>?page=<%= page.getId() -%>"><%= page.getTitle() %></a></li>
<% end %>