Module: Flightdeck::InfrastructureHelper

Defined in:
app/helpers/flightdeck/infrastructure_helper.rb

Constant Summary collapse

RECURRING_STATUS =
{
  ok: [ "OK", "finished" ],
  failed: [ "LAST RUN FAILED", "failed" ],
  unknown: [ "PURGED", "scheduled" ]
}.freeze

Instance Method Summary collapse

Instance Method Details

#dom_id_for_process(id) ⇒ Object



12
# File 'app/helpers/flightdeck/infrastructure_helper.rb', line 12

def dom_id_for_process(id) = "fd-process-#{id}"

#dom_id_for_queue(name) ⇒ Object



11
# File 'app/helpers/flightdeck/infrastructure_helper.rb', line 11

def dom_id_for_queue(name) = "fd-queue-#{name.parameterize.presence || Digest::MD5.hexdigest(name)}"

#dom_id_for_recurring_task(id) ⇒ Object



13
# File 'app/helpers/flightdeck/infrastructure_helper.rb', line 13

def dom_id_for_recurring_task(id) = "fd-recurring-task-#{id}"

#fd_recurring_status_pill(status) ⇒ Object

A task that has never run has no status to report, and a task whose job has been purged is reported as purged rather than as a success we did not see.



17
18
19
20
21
22
# File 'app/helpers/flightdeck/infrastructure_helper.rb', line 17

def fd_recurring_status_pill(status)
  return tag.span("", class: "dim") if status.nil?

  label, pill = RECURRING_STATUS.fetch(status, [ status.to_s.upcase, "scheduled" ])
  tag.span(label, class: "fd-pill #{pill}")
end