1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class Workflow < ArvadosModel
8 include CommonApiTemplate
10 validate :validate_definition
11 before_save :set_name_and_description
13 api_accessible :user, extend: :common do |t|
19 def validate_definition
21 @definition_yaml = YAML.safe_load self.definition if !definition.nil?
23 errors.add :definition, "is not valid yaml: #{e.message}"
27 def set_name_and_description
30 old_wf = YAML.safe_load self.definition_was if !self.definition_was.nil?
32 logger.warn "set_name_and_description error: #{e.message}"
36 ['name', 'description'].each do |a|
37 if !self.changes.include?(a)
38 v = self.read_attribute(a)
39 if !v.present? or v == old_wf[a]
40 val = @definition_yaml[a] if self.definition and @definition_yaml
47 def self.full_text_searchable_columns
48 super - ["definition"]
51 def self.limit_index_columns_read