!!!
%html
%head
%title== #{Rails.application.class.parent_name} Job Queue
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
/ %meta{name: "viewport", content: "width=device-width, initial-scale=1.0"}
= stylesheet_link_tag "afterparty"
= javascript_include_tag "jquery", "afterparty"
= csrf_meta_tag
= favicon_link_tag
= yield(:head)
%body
%h1
Viewing
- if params[:completed]
= pluralize @jobs.size, "completed job"
%h3= link_to "View Job Queue", afterparty_engine.dashboard_path
- else
= pluralize @jobs.size, "job"
%h3= link_to "View Completed Jobs", afterparty_engine.dashboard_path(completed: true)
- if notice
%p.notice= notice
%table.job-table
%thead
%tr
%th Execute At
%tbody
- if @jobs.empty?
%tr
%td{colspan: 3}
%em No jobs to show...
- else
- @jobs.each do |job_container|
- job = job_container.reify
%tr.job-row
%td
%h3
- if job
= link_to job.class.to_s, "#", class: 'debug'
- if job.respond_to? :description
%span.description= job.description.html_safe
- elsif job_container.has_error
%sp.error-description= job_container.error_message
- else
%em Error marshaling job
- if job_container.completed_at
%span.distance-future= "Completed #{time_ago_in_words(job_container.completed_at)} ago"
- else
- distance = time_ago_in_words(job_container.execute_at)
- if job_container.execute_at > Time.now
%span.distance-future= "Scheduled to execute in #{distance}"
- else
%span.distance-past= "Scheduled to execute #{distance} ago"
%span.job_id== ##{job_container.id} #{job_container.queue}
- if params[:completed]
= link_to "run again", afterparty_engine.run_job_path(id: job_container.id), class: 'job-action'
- else
= link_to "run", afterparty_engine.run_job_path(id: job_container.id), class: 'job-action'
= link_to "delete", afterparty_engine.destroy_job_path(id: job_container.id), class: 'job-action'
%tr.debug-row
%td
- if job
= debug job
- else
%p
%strong YAML dump:
= job_container.job_dump
- if job_container.has_error
%p
%strong Error Message:
= job_container.error_message
- if job_container.error_backtrace
%p
%strong Error Backtrace:
= job_container.error_backtrace.gsub("\n","
")
- if job_container.completed_at
%p
%strong Completed At:
= job_container.completed_at.strftime("%B %d, %Y at %l:%I %P")
%p
Current Time:
= Time.now.strftime("%B %d, %Y at %l:%M %P")