Sha256: 375c87103ab83723e3d72bb1f5b66f4145a75096656bcce004e43cf855168951
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module MissionControl::Jobs::NavigationHelper attr_reader :page_title, :current_section def navigation_sections { queues: [ "Queues", application_queues_path(@application) ] }.tap do |sections| supported_job_statuses.without(:pending).each do |status| sections[navigation_section_for_status(status)] = [ "#{status.to_s.titleize} jobs (#{jobs_count_with_status(status)})", application_jobs_path(@application, status) ] end sections[:workers] = [ "Workers", application_workers_path(@application) ] if workers_exposed? end end def navigation_section_for_status(status) if status.nil? || status == :pending :queues else "#{status}_jobs".to_sym end end def navigation(title: nil, section: nil) @page_title = title @current_section = section end def selected_application?(application) MissionControl::Jobs::Current.application.name == application.name end def selectable_applications MissionControl::Jobs.applications.reject { |app| selected_application?(app) } end def selected_server?(server) MissionControl::Jobs::Current.server.name == server.name end def jobs_filter_param if @job_filters&.any? { filter: @job_filters } else {} end end def jobs_count_with_status(status) count = ApplicationJob.jobs.with_status(status).count count.infinite? ? "..." : number_to_human(count) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mission_control-jobs-0.1.1 | app/helpers/mission_control/jobs/navigation_helper.rb |
mission_control-jobs-0.1.0 | app/helpers/mission_control/jobs/navigation_helper.rb |