X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d4c8504da527f1a984ecd1ed0da7147010f38b6e..1c8feea9305ca6fa78ddf1875f893304c3739db8:/apps/workbench/app/models/pipeline_instance.rb diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb index 9acc849fa9..f575e20d4e 100644 --- a/apps/workbench/app/models/pipeline_instance.rb +++ b/apps/workbench/app/models/pipeline_instance.rb @@ -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 @@ -38,10 +47,16 @@ class PipelineInstance < ArvadosBase end end - def attribute_editable? attr, *args - super && (attr.to_sym == :name || - (attr.to_sym == :components and - (self.state == 'New' || self.state == 'Ready'))) + def editable_attributes + %w(name description components) + end + + def attribute_editable?(name, ever=nil) + if name.to_s == "components" + (ever or %w(New Ready).include?(state)) and super + else + super + end end def attributes_for_display @@ -62,4 +77,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