]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2701 Change TimeMachine widget style to match Sonar table style
authorFabrice Bellingard <bellingard@gmail.com>
Mon, 29 Aug 2011 16:09:07 +0000 (18:09 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Mon, 29 Aug 2011 16:14:04 +0000 (18:14 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb
sonar-server/src/main/webapp/stylesheets/style.css

index e4244e0c700b7a84a89b0a273aeb3e5ad6d24fa2..2f9830e54f9ae71e1c5e89d2b84c4383194f82a8 100644 (file)
@@ -31,7 +31,6 @@
     snapshot_by_id[s.id]=s
   end
   rows_by_metric_id={}
-  rows=[]
   measures.each do |measure|
     next unless measure.metric
 
@@ -39,7 +38,6 @@
       row=rows_by_metric_id[measure.metric_id]
       unless row
         row=Sonar::TimemachineRow.new(measure.metric)
-        rows<<row
         rows_by_metric_id[measure.metric_id]=row
       end
 
     end
   end
   
-  domains = []
-  rows.select{|row| row.metric.val_type != Metric::VALUE_TYPE_DISTRIB}.each do |row|
-    domains << row.domain
+  # Create the list of rows to display in the same order as defined by the user
+  rows=[]
+  metric_ids.each do |metric_id|
+    row = rows_by_metric_id[metric_id]
+    if row
+      rows<<row
+    end
   end
-  display_domains = domains.uniq.size > 1
-  
-  rows.sort!
 %>
 
 <div class="widget-matrix">
 
-<table class="widget-matrix">
+<table class="data">
 
   <thead>
     <tr>
-      <th valign="top" nowrap="nowrap" style="background-color: #FFFFFF; border: 0px;"> 
-      </th>
+      <th> </th>
       <% snapshots.each do |snapshot| %>
-        <th nowrap="nowrap" align="right" valign="top">
-            <%= l snapshot.created_at.to_date %>
+        <th nowrap="nowrap">
+            <%= l snapshot.created_at.to_date -%>
             <br/>
-            <% snapshot.user_events.each do |event| %>
-                <b><%= event.name %></b>
-                <br/>
-            <% end %>
-          </th>
+            <%= snapshot.event('Version').name -%>
+        </th>
       <% end %>
       <% if displaySparkLine %>
       <th> </th>
 
   <tbody>
     <%
-      previous_domain=''
       rows.select{|row| row.metric.val_type != Metric::VALUE_TYPE_DISTRIB}.each do |row|
-        if display_domains && previous_domain != row.domain 
-    %>
-    <tr>
-      <td class="title" colspan="<%= snapshots.size + (displaySparkLine ? 2 : 1) -%>"><%= row.domain %></td>
-    </tr>
-    <% 
-        end
-        previous_domain = row.domain 
     %>
-    <tr class="<%= cycle("even", "odd", :name => row.domain) -%>">
-      <td width="1%" nowrap="nowrap" valign="top">
+    <tr class="<%= cycle 'even','odd' -%>">
+      <td width="1%" nowrap="nowrap" class="left text">
         <%= row.metric.short_name %>
       </td>
     <% 
       snapshots.each do |snapshot|
         measure=row.measure(snapshot)
     %>
-      <td align="right" width="1%" nowrap="nowrap"><%= format_measure(measure, :skip_span_id => true) %></td>
+      <td width="1%" nowrap="nowrap" class="right"><%= format_measure(measure, :skip_span_id => true) %></td>
     <% end %>
     <%
       sparkline_url=row.sparkline_url
index d606e23e264cffd2c1ea0b823939707e576dd0d4..6ebe37498805b3b1f391ea3a6f10d845c07e5732 100644 (file)
@@ -1794,35 +1794,13 @@ table.matrix tbody td.title {
 
 div.widget-matrix {
   overflow:auto;
-}
-
-table.widget-matrix {
   font-size: 12px;
-  margin: 1px; 
-}
-
-table.widget-matrix thead {
-  background-color: #CAE3F2;
+  padding: 1px;
 }
 
-table.widget-matrix thead th {
+div.widget-matrix th {
   text-align: right;
-  border: 1px solid #4b9fd5;
-  padding: 2px;
-  font-size: 11px;
-}
-
-table.widget-matrix tbody td.title {
-  border: none;
-  font-weight: bold;
-  padding: 5px 0 0 0px;
-}
-
-table.widget-matrix tbody td {
-  border: 1px solid #ddd;
-  margin: 0;
-  padding: 1px 2px 1px 10px;
-  vertical-align: middle;
+  font-weight: normal;
 }