Sha256: acfb0de64ad62a33d175ae3570ef1c1016bd692e4f9458d08f68908c4e406eb0
Contents?: true
Size: 1.5 KB
Versions: 4
Compression:
Stored size: 1.5 KB
Contents
module RocketJobMissionControl module JobsHelper def job_icon(job) state = job_state(job) state_icon(state) end def job_state(job) if job.scheduled? :scheduled elsif job.sleeping? :sleeping else job.state end end def job_states @job_states ||= RocketJob::Job.aasm.states.map { |state| state.name.to_s } end def job_states_with_scheduled @job_states_with_scheduled ||= ['scheduled'] + job_states end def job_counts_by_state(state) @job_counts ||= begin counts = RocketJob::Job.counts_by_state counts[:queued] = counts[:queued_now] || 0 counts end @job_counts.fetch(state.downcase.to_sym, 0) end def job_action_link(action, path, http_method=:get) link_to( action, path, method: http_method, title: "#{action} job", class: 'btn btn-default', data: {confirm: t(:confirm, scope: [:job, :action], action: action)} ) end def job_action_links_for_show(action, path, http_method=:get) link_to( action, path, method: http_method, title: "#{action} job", class: 'btn btn-primary', data: {confirm: t(:confirm, scope: [:job, :action], action: action)} ) end def job_selected_class(job, selected_job) if selected_job.present? && job.id == selected_job.id 'selected' else '' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems