Sha256: ffd101b49048d691ff4c91eddc07783147e6bb13879a27424e9f2a7c16aaed50
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module ClockworkWeb class HomeController < ActionController::Base layout false helper ClockworkWeb::HomeHelper http_basic_authenticate_with name: ENV["CLOCKWORK_USERNAME"], password: ENV["CLOCKWORK_PASSWORD"] if ENV["CLOCKWORK_PASSWORD"] def index @events = Clockwork.manager.instance_variable_get(:@events).sort_by do |e| at = e.instance_variable_get(:@at) [ e.instance_variable_get(:@period), (at && at.instance_variable_get(:@hour)) || -1, (at && at.instance_variable_get(:@min)) || -1, e.job.to_s ] end @last_runs = ClockworkWeb.last_runs @disabled = ClockworkWeb.disabled_jobs @last_heartbeat = ClockworkWeb.last_heartbeat end def job job = params[:job] enable = params[:enable] == "true" if enable ClockworkWeb.enable(job) else ClockworkWeb.disable(job) end ClockworkWeb.on_job_update.call(job: job, enable: enable, user: try(:current_user)) if ClockworkWeb.on_job_update redirect_to root_path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clockwork_web-0.1.1 | app/controllers/clockwork_web/home_controller.rb |
clockwork_web-0.1.0 | app/controllers/clockwork_web/home_controller.rb |