if readable
link_to_if_arvados_object attrvalue, opts
elsif opts[:required] and current_user # no need to show this for anonymous user
- raw('<div><input type="text" style="border:none;width:100%;background:#ffdddd" disabled=true class="required unreadable-input" value="' + link_text_if_not_readable + '" ></input></div>')
+ raw('<div><input type="text" style="border:none;width:100%;background:#ffdddd" disabled=true class="required unreadable-input" value="') + link_text_if_not_readable + raw('" ></input></div>')
else
link_text_if_not_readable
end
end
+ # This method takes advantage of preloaded collections and objects.
+ # Hence you can improve performance by first preloading objects
+ # related to the page context before using this method.
def object_readable attrvalue, resource_class=nil
- # if it is a collection filename, check readable for the locator
- attrvalue = attrvalue.split('/')[0] if attrvalue
-
- resource_class = resource_class_for_uuid(attrvalue)
+ resource_class = resource_class_for_uuid(attrvalue) if resource_class.nil?
return if resource_class.nil?
+ return_value = nil
if resource_class.to_s == 'Collection'
+ # if it is a collection filename, check readable for the locator
+ attrvalue = attrvalue.split('/')[0] if attrvalue
+
if CollectionsHelper.match(attrvalue)
- collection_for_pdh(attrvalue).any?
+ found = collection_for_pdh(attrvalue)
+ return_value = found.first if found.any?
else
- collections_for_object(attrvalue).any?
+ found = collections_for_object(attrvalue)
+ return_value = found.first if found.any?
end
else
- object_for_dataclass(resource_class, attrvalue)
+ return_value = object_for_dataclass(resource_class, attrvalue)
end
+ return_value
end
def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={})
def render_unreadable_inputs_present
if current_user and controller.class.name.eql?('PipelineInstancesController') and unreadable_inputs_present?
- raw('<div class="unreadable-inputs-present">' +
- '<p style="color:#ff6666">One or more inputs provided are not readable by you. ' +
+ raw('<div class="alert alert-danger unreadable-inputs-present">' +
+ '<p>One or more inputs provided are not readable by you. ' +
'Please correct these before you can run the pipeline.</p></div>')
end
end
['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', false],
['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', false, 'spectator'],
['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', true, 'admin'],
+ ['new_pipeline_in_publicly_accessible_project_with_dataclass_file_and_other_objects_elsewhere', false, 'spectator'],
].each do |fixture, objects_readable, user=nil|
test "access #{fixture} in public project with objects readable=#{objects_readable} with user #{user}" do
object = api_fixture('pipeline_instances')[fixture]
dataclass: Collection
value: zzzzz-4zz18-bv31uwvy3neko21
+new_pipeline_in_publicly_accessible_project_with_dataclass_file_and_other_objects_elsewhere:
+ uuid: zzzzz-d1hrv-newsharenotfile
+ owner_uuid: zzzzz-j7d0g-zhxawtyetzwc5f0
+ name: Pipeline in public project in New state with file type data class with objects elsewhere
+ pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw
+ state: New
+ created_at: 2014-09-15 12:00:00
+ components:
+ foo:
+ script: foo
+ script_version: master
+ script_parameters:
+ input:
+ required: true
+ dataclass: File
+ value: zzzzz-4zz18-bv31uwvy3neko21
+
pipeline_in_running_state:
name: running_with_job
state: Ready