Merge branch 'master' into 3052-crunch-log-stdout
[arvados.git] / apps / workbench / app / models / pipeline_instance.rb
index 9acc849fa989e0e5b34a731d47d92492245609e5..936905713e44891f22261bf6e1c0ba19e598ae75 100644 (file)
@@ -5,12 +5,21 @@ class PipelineInstance < ArvadosBase
     true
   end
 
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     pipeline_name = self.name
     if pipeline_name.nil? or pipeline_name.empty?
-      return PipelineTemplate.where(uuid: self.pipeline_template_uuid).first.name
+      template = if lookup and lookup[self.pipeline_template_uuid]
+                   lookup[self.pipeline_template_uuid]
+                 else
+                   PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+                 end
+      if template
+        template.name
+      else
+        self.uuid
+      end
     else
-      return pipeline_name
+      pipeline_name
     end
   end
 
@@ -39,7 +48,7 @@ class PipelineInstance < ArvadosBase
   end
 
   def attribute_editable? attr, *args
-    super && (attr.to_sym == :name ||
+    super && (attr.to_sym == :name || attr.to_sym == :description ||
               (attr.to_sym == :components and
                (self.state == 'New' || self.state == 'Ready')))
   end
@@ -62,4 +71,8 @@ class PipelineInstance < ArvadosBase
       "\"#{input_name.to_s}\" parameter for #{component[:script]} script in #{component_name} component"
     end
   end
+
+  def textile_attributes
+    [ 'description' ]
+  end
 end