Merge branch '1976-pipeline-progress'
[arvados.git] / apps / workbench / app / models / pipeline_instance.rb
1 class PipelineInstance < ArvadosBase
2   attr_accessor :pipeline_template
3
4   def update_job_parameters(new_params)
5     self.components[:steps].each_with_index do |step, i|
6       step[:params].each do |param|
7         if new_params.has_key?(new_param_name = "#{i}/#{param[:name]}") or
8             new_params.has_key?(new_param_name = "#{step[:name]}/#{param[:name]}") or
9             new_params.has_key?(new_param_name = param[:name])
10           param_type = :value
11           %w(hash data_locator).collect(&:to_sym).each do |ptype|
12             param_type = ptype if param.has_key? ptype
13           end
14           param[param_type] = new_params[new_param_name]
15         end
16       end
17     end
18   end
19
20   def attribute_editable?(attr)
21     attr == 'name'
22   end
23
24   def attributes_for_display
25     super.reject { |k,v| k == 'components' }
26   end
27 end