X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/82b46502f25b6992c93bfe7689acc095aa447e5b..91fe76f4a3f8e5f59d12343ae69d2ba5a43d8e55:/apps/workbench/app/models/job.rb diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb index 56428abb2c..9e9c096787 100644 --- a/apps/workbench/app/models/job.rb +++ b/apps/workbench/app/models/job.rb @@ -1,13 +1,44 @@ class Job < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end - def attribute_editable?(attr) - false + def content_summary + "#{script} job" + end + + def attribute_editable? attr, *args + if attr.to_sym == :description + super && attr.to_sym == :description + else + false + end end def self.creatable? false end + + def default_name + if script + x = "\"#{script}\" job" + else + x = super + end + if finished_at + x += " finished #{finished_at.strftime('%b %-d')}" + elsif started_at + x += " started #{started_at.strftime('%b %-d')}" + elsif created_at + x += " submitted #{created_at.strftime('%b %-d')}" + end + end + + def cancel + arvados_api_client.api "jobs/#{self.uuid}/", "cancel", {} + end + + def textile_attributes + [ 'description' ] + end end