Sha256: 3df0434eb705f2d78592602c76c026f6967cb07aa27d03da7e430bc1466b240d
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
module RocketJobMissionControl module JobsHelper STATE_ICON_MAP = { aborted: 'fa-stop', completed: 'fa-check', disabled: 'fa-stop', enabled: 'fa-check', failed: 'fa-exclamation-triangle', paused: 'fa-pause', pending: 'fa-inbox', queued: 'fa-inbox', running: 'fa-play', scheduled: 'fa-clock-o', } def job_state_icon(state) STATE_ICON_MAP[state.to_sym] + ' ' + state.to_s end def job_icon(job) # TODO move this logic to RocketJob::Job state = if job.queued? && job.run_at && (job.run_at > Time.now) :scheduled else job.state end job_state_icon(state) end def job_action_link(action, path, http_method=:get) link_to( action, path, method: http_method, class: 'btn btn-default', data: { confirm: t(:confirm, scope: [:job, :action], action: action)} ) end def job_states @job_states ||= RocketJob::Job.aasm.states.map { |state| state.name.to_s } end def job_selected_class(job, selected_job) if selected_job.present? && job.id == selected_job.id 'selected' else '' end end def job_title(job) perform_method = job.perform_method == :perform ? '' : "##{job.perform_method}" "#{job.class.name}#{perform_method}" end end end
Version data entries
5 entries across 5 versions & 1 rubygems