]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2414 use blue instead of green in clouds
authorSimon Brandhof <simon.brandhof@gmail.com>
Thu, 9 Jun 2011 09:11:14 +0000 (11:11 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Thu, 9 Jun 2011 09:20:59 +0000 (11:20 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/cloud_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb
sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb

index 1a2fa29fe92289f22dc4f814ed03e2fd6ff89b67..006184a5a26074743ea5ac908d76e8a3dc3664eb 100644 (file)
@@ -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))'
index 79b86cfebdb3322f3d94958016a1ec5e5fceaa6d..745fb54a45bfeb63fbae829d64b6bdcd76a9f8dd 100644 (file)
@@ -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
 
index b7fd87e8ce1226b95e8002b1e1b10ff1e7c882fd..2201de2c81b818dc708e61256b7fe8784465ccde 100644 (file)
 </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
index 86c54dfed7551912392cf89ce3e0d4b323af19ab..7de0d6da97eaf106b4275fd09ee8a3927d57ee61 100644 (file)
           <% 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 %>