Module: SolidWebUi::Queue::ApplicationHelper

Defined in:
app/helpers/solid_web_ui/queue/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#job_status(job) ⇒ Object

Status of a job derived from which execution table holds it.



17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/solid_web_ui/queue/application_helper.rb', line 17

def job_status(job)
  return :finished if job.finished_at?
  return :failed if job.failed_execution
  return :blocked if job.blocked_execution
  return :in_progress if job.claimed_execution
  return :scheduled if job.scheduled_execution
  return :ready if job.ready_execution

  :unknown
end

#queue_latency(queue) ⇒ Object



28
29
30
# File 'app/helpers/solid_web_ui/queue/application_helper.rb', line 28

def queue_latency(queue)
  queue.respond_to?(:human_latency) ? queue.human_latency : queue.latency
end

#queue_nav(active) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/solid_web_ui/queue/application_helper.rb', line 5

def queue_nav(active)
  [
    { label: "Dashboard", href: root_path, active: active == :dashboard },
    { label: "Queues", href: queues_path, active: active == :queues },
    { label: "Jobs", href: jobs_path, active: active == :jobs },
    { label: "Failed", href: failed_executions_path, active: active == :failed },
    { label: "Processes", href: processes_path, active: active == :processes },
    { label: "Recurring", href: recurring_tasks_path, active: active == :recurring }
  ]
end

#short_time(time) ⇒ Object



32
33
34
35
36
# File 'app/helpers/solid_web_ui/queue/application_helper.rb', line 32

def short_time(time)
  return "" if time.nil?

  time.in_time_zone(SolidWebUi::Queue.config.time_zone).strftime("%Y-%m-%d %H:%M:%S")
end