class Container < ArvadosBase
+ def self.creatable?
+ false
+ end
+
def work_unit(label=nil)
ContainerWorkUnit.new(self, label)
end
class ContainerRequest < ArvadosBase
+ def self.creatable?
+ false
+ end
+
+ def textile_attributes
+ [ 'description' ]
+ end
+
def work_unit(label=nil)
ContainerWorkUnit.new(self, label)
end
"container"
end
+ def uri
+ uuid = get(:uuid)
+ "/#{@proxied.class.table_name}/#{uuid}" rescue nil
+ end
+
+
def can_cancel?
@proxied.is_a?(ContainerRequest) && state_label.in?(["Queued", "Locked", "Running"]) && priority > 0
end
state_label.in? ["Queued", "Running"]
end
+ def uri
+ uuid = get(:uuid)
+ "/jobs/#{uuid}"
+ end
+
def title
"job"
end
items
end
+ def uri
+ uuid = get(:uuid)
+ "/pipeline_instances/#{uuid}"
+ end
+
def title
"pipeline"
end
resp
end
- def uri
- uuid = get(:uuid)
- "/#{@proxied.class.table_name}/#{uuid}"
- end
-
protected
def get key, obj=@proxied
end
end
end
+
+ [
+ ['jobs', 'running_job_with_components'],
+ ['pipeline_instances', 'has_component_with_completed_jobs'],
+ ['container_requests', 'running'],
+ ['container_requests', 'completed'],
+ ].each do |type, fixture|
+ test "edit description for #{type}/#{fixture}" do
+ obj = api_fixture(type)[fixture]
+ visit page_with_token "active", "/#{type}/#{obj['uuid']}"
+
+ within('.arv-description-as-subtitle') do
+ find('.fa-pencil').click
+ find('.editable-input textarea').set('*Textile description for object*')
+ find('.editable-submit').click
+ end
+ wait_for_ajax
+
+ # verify description
+ assert page.has_no_text? '*Textile description for object*'
+ assert page.has_text? 'Textile description for object'
+ end
+ end
end
errors.add :priority, "cannot be nil"
end
- # Can update priority, container count.
- permitted.push :priority, :container_count_max, :container_uuid
+ # Can update priority, container count, name and description
+ permitted.push :priority, :container_count_max, :container_uuid, :name, :description
if self.state_changed?
# Allow create-and-commit in a single operation.
end
when Final
- if not current_user.andand.is_admin
+ if not current_user.andand.is_admin and not (self.name_changed? || self.description_changed?)
errors.add :state, "of container request can only be set to Final by system."
end
- if self.state_changed?
- permitted.push :state
+ if self.state_changed? || self.name_changed? || self.description_changed?
+ permitted.push :state, :name, :description
else
errors.add :state, "does not allow updates"
end
end
[
- ['active', 'zzzzz-dz642-requestercntnr1'],
+ ['active', 'zzzzz-dz642-runningcontainr'],
['active_no_prefs', nil],
].each do |token, expected|
test "create as #{token} and expect requesting_container_uuid to be #{expected}" do