Skip to content

Commit

Permalink
allow auto_job_name to be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Aug 23, 2024
1 parent 5c9c4e4 commit 10b696c
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

module SmartAttributes
class AttributeFactory

# Build this attribute object. Must specify a valid directory in opts
#
# @param opts [Hash] attribute's options
Expand All @@ -18,8 +17,7 @@ class AutoJobName < Attribute
# Defaults to ondemand/[dev,sys]/projects
# @return [String] attribute value
def value
env = Rails.env.production? ? 'sys' : 'dev'
opts[:value] || "ondemand/#{env}/projects"
job_name(opts[:value] || 'Project Manager Job')
end

def widget
Expand All @@ -36,6 +34,15 @@ def label(*)
def submit(*)
{ script: { job_name: value } }
end

def job_name(name)
[
ENV['OOD_PORTAL'], # the OOD portal id
ENV['RAILS_RELATIVE_URL_ROOT'].to_s.sub(%r{^/[^/]+/}, ''), # the OOD app
'project-manager',
name # the user supplied job name
].reject(&:blank?).join('/')
end
end
end
end

0 comments on commit 10b696c

Please sign in to comment.