Fix up legend colors and labels on pipeline_instances > compare > graph.
authorTom Clegg <tom@curoverse.com>
Wed, 12 Feb 2014 19:40:21 +0000 (11:40 -0800)
committerTom Clegg <tom@curoverse.com>
Wed, 12 Feb 2014 19:40:21 +0000 (11:40 -0800)
apps/workbench/app/helpers/provenance_helper.rb
apps/workbench/app/views/pipeline_instances/_show_graph.html.erb

index cb2d9244d95ea599254706a901a4da1b6619de04..ae4d25180960a8f5c505bcdb6afc306ec9fa1f7e 100644 (file)
@@ -25,16 +25,8 @@ module ProvenanceHelper
     end
 
     def determine_fillcolor(n)
-      bgcolor = ""
-      case n
-      when 1
-        bgcolor = "style=filled,fillcolor=\"#88ff88\""
-      when 2
-        bgcolor = "style=filled,fillcolor=\"#8888ff\""
-      when 3
-        bgcolor = "style=filled,fillcolor=\"#88ffff\""
-      end
-      bgcolor
+      fillcolor = %w(aaaaaa aaffaa aaaaff aaaaaa ffaaaa)[n || 0] || 'aaaaaa'
+      "style=filled,fillcolor=\"##{fillcolor}\""
     end
 
     def describe_node(uuid)
index ad3a8bb6837d707584e2ab1f038a05263aba7d16..e96ff1624073f8e5b0b5f6f86ff13abc80d78ce9 100644 (file)
@@ -1,15 +1,22 @@
 <% content_for :css do %>
   .pipeline_color_legend {
-    padding-left: 1em;
-    padding-right: 1em;
+    margin-top: 0.2em;
+    padding: 0.2em 1em;
+    border: 1px solid #000;
+  }
+  .pipeline_color_legend a {
+    color: #000;
   }
 <% end %>
 
 <% if @pipelines.count > 1 %>
-  <div style="text-align: center">
-    <span class="pipeline_color_legend" style="background: #88ff88">This pipeline</span> 
-    <span class="pipeline_color_legend" style="background: #8888ff">Comparison pipeline</span>
-    <span class="pipeline_color_legend" style="background: #88ffff">Shared by both pipelines</span>
+  <div style="text-align: center; padding-top: 0.5em">
+    <span class="pipeline_color_legend" style="background: #aaffaa"><%= link_to_if_arvados_object @pipelines[0], friendly_name: true %></span>
+    <span class="pipeline_color_legend" style="background: #aaaaff"><%= link_to_if_arvados_object @pipelines[1], friendly_name: true %></span>
+    <% if @pipelines.count > 2 %>
+    <span class="pipeline_color_legend" style="background: #ffaaaa"><%= link_to_if_arvados_object @pipelines[2], friendly_name: true %></span>
+    <% end %>
+    <span class="pipeline_color_legend" style="background: #aaaaaa">Common to <%= @pipelines.count > 2 ? 'multiple' : 'both' %> pipelines</span>
   </div>
 <% end %>