Sha256: ba834a00c2a7601a3373f666abf9535ce7acfd177e54e66894b7fb9484dd7521

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

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{|e| [e.instance_variable_get(:@period), e.job.to_s] }
      # TODO fetch all disabled jobs and last runs in one call
    end

    def job
      job = params[:job]
      if params[:enable] == "true"
        ClockworkWeb.enable(job)
      else
        ClockworkWeb.disable(job)
      end
      redirect_to root_path
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clockwork_web-0.0.1 app/controllers/clockwork_web/home_controller.rb