Merge remote-tracking branch 'origin/master' into 2049-run-job-from-workbench
[arvados.git] / apps / workbench / app / controllers / pipeline_instances_controller.rb
index 7ca4f6a11ed2d6c6f4c5fdead9362d1eee74df0f..a8a35b510b4b93fbf6905a5c8cb85602b3bfc7bb 100644 (file)
@@ -45,6 +45,12 @@ class PipelineInstancesController < ApplicationController
   end
 
   def show
+    if @object.components.empty? and @object.pipeline_template_uuid
+      template = PipelineTemplate.find(@object.pipeline_template_uuid)
+      @object.components= template.components
+      @object.save
+    end
+
     @pipelines = [@object]
 
     if params[:compare]
@@ -95,6 +101,7 @@ class PipelineInstancesController < ApplicationController
       highscore = {}           # attr => how common "normal" is
       score = {}               # attr => { value => how common }
       row[:components].each do |pj|
+        next if pj.nil?
         pj.each do |k,v|
           vstr = for_comparison v
           score[k] ||= {}
@@ -113,6 +120,7 @@ class PipelineInstancesController < ApplicationController
 
       # Add a hash in component[:is_normal]: { attr => is_the_value_normal? }
       row[:components].each do |pj|
+        next if pj.nil?
         pj[:is_normal] = {}
         pj.each do |k,v|
           pj[:is_normal][k] = (normal.has_key?(k) && normal[k] == for_comparison(v))