Sha256: ce25d62b75df13685b105f6e3986f411cbe55b4a184c4805f0a70746ec228493
Contents?: true
Size: 1.45 KB
Versions: 96
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true # # Manage cron job servers # module CoreCronController include CoreController # # Table to display cron job servers # def index authorize! :read, Cron::Server authorize! :read, Cron::Tab end # # Run the crontab entry now # def run_now authorize! :read, cron_tab cron_tab.run redirect_to index_path rescue StandardError => error log_controller_error error, true redirect_to index_path end # # Update a crontab entry # def update authorize! :update, cron_tab cron_tab.update! cron_tab_params redirect_to index_path rescue StandardError => error log_controller_error error render :edit end # # Demote a cron job server # def demote authorize! :edit, cron_server cron_server.become_secondary redirect_to index_path rescue StandardError => error log_controller_error error, true redirect_to index_path end # # Destroy a cron job server # def destroy authorize! :destroy, cron_server cron_server.destroy! redirect_to index_path rescue StandardError => error log_controller_error error, true redirect_to index_path end private def cron_tab @cron_tab ||= Cron::Tab.find(params[:id]) end def cron_server @cron_server ||= Cron::Server.find(params[:id]) end def cron_tab_params p = params['cron/job_tab'] p[:enabled] ||= false p.permit(Cron::Tab.allowed_param_names) end end
Version data entries
96 entries across 96 versions & 1 rubygems