Merge branch '3413-keep-trash-list'
[arvados.git] / apps / workbench / app / models / pipeline_instance.rb
index fa9fab68eb6e149ecef2e062ff332aa9a6f42fd4..89acbb0dbb9438bbbb80ba2bc97cc1ce93eac9fa 100644 (file)
@@ -5,6 +5,20 @@ class PipelineInstance < ArvadosBase
     true
   end
 
+  def friendly_link_name
+    pipeline_name = self.name
+    if pipeline_name.nil? or pipeline_name.empty?
+      template = PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+      if template
+        template.name
+      else
+        self.uuid
+      end
+    else
+      pipeline_name
+    end
+  end
+
   def content_summary
     begin
       PipelineTemplate.find(pipeline_template_uuid).name
@@ -30,7 +44,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
@@ -46,7 +60,15 @@ class PipelineInstance < ArvadosBase
   def component_input_title(component_name, input_name)
     component = components[component_name]
     return nil if component.nil?
-    component[:script_parameters].andand[input_name.to_sym].andand[:title] ||
+    param_info = component[:script_parameters].andand[input_name.to_sym]
+    if param_info.is_a?(Hash) and param_info[:title]
+      param_info[:title]
+    else
       "\"#{input_name.to_s}\" parameter for #{component[:script]} script in #{component_name} component"
+    end
+  end
+
+  def textile_attributes
+    [ 'description' ]
   end
 end