app/helpers/naf/application_helper.rb in naf-1.1.4 vs app/helpers/naf/application_helper.rb in naf-2.0.0

- old
+ new

@@ -18,20 +18,21 @@ "historical_job_affinity_tabs", "janitorial_assignments"] NAF_READ_ONLY_RESOURCES = [] NAF_CREATE_BLOCKED_RESOURCES = [] NAF_ALL_VISIBLE_RESOURCES = { - "historical_jobs" => "", - "applications" => "", - "machines" => "", - "runners" => ["machine_runners", - "machine_runner_invocations"], - "affinities" => "", - "loggers" => ["logger_styles", "logger_names"], - "janitorial_assignments" => ["janitorial_archive_assignments", - "janitorial_create_assignments", - "janitorial_drop_assignments"] + 'historical_jobs' => '', + 'applications' => '', + 'machines' => '', + 'runners' => ['machine_runners', + 'machine_runner_invocations'], + 'affinities' => '', + 'loggers' => ['logger_styles', 'logger_names'], + 'janitorial_assignments' => ['janitorial_archive_assignments', + 'janitorial_create_assignments', + 'janitorial_drop_assignments'], + 'status' => '' } def naf_tabs NAF_ALL_VISIBLE_RESOURCES end @@ -219,38 +220,10 @@ method: :delete, class: 'destroy' } end end - def include_actions_in_table? - current_page?(naf.root_url) or - current_page?(controller: 'applications', action: 'index') or - current_page?(controller: 'historical_jobs', action: 'index') - end - - def naf_papertrail_link(record, runner = false) - if group_id = Naf.papertrail_group_id - url = "http://www.papertrailapp.com/groups/#{group_id}/events" - if record.kind_of?(::Naf::HistoricalJob) || record.kind_of?(::Logical::Naf::Job) - if record.pid.present? - query = "jid(#{record.id})" - url << "?q=#{CGI.escape(query)}" - end - elsif record.kind_of?(::Naf::Machine) || record.kind_of?(::Logical::Naf::Machine) - query = record.server_name - unless query.nil? - query << " runner" if runner - url << "?q=#{CGI.escape(query)}" - end - end - else - url = "http://www.papertrailapp.com/dashboard" - end - - return url - end - def naf_link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end def naf_link_to_add_fields(name, f, association) @@ -266,9 +239,17 @@ 'running' elsif status == 'Queued' || status == 'Waiting' 'queued' elsif status =~ /Terminat/ || status == 'Error' || status == 'Failed to Start' 'dead' + end + end + + def http_protocol + if ['staging', 'production'].include?(Rails.env) + 'https://' + else + 'http://' end end end end