-
-
Save Paxa/9913290 to your computer and use it in GitHub Desktop.
Revisions
-
Paxa revised this gist
Apr 1, 2014 . 1 changed file with 35 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,14 @@ actions :index, :show, :edit, :update, :destroy scope :success, default: true do |items| items.where('failed_at is NULL') end scope :failed do |items| items.where('failed_at IS NOT NULL') end index do column :id column :queue @@ -37,7 +45,31 @@ f.input :locked_at, input_html: {disabled: true} f.input :locked_by, input_html: {disabled: true} end f.actions end show do |job| attributes_table do row :id row :priority row :attempts row :handler row :last_error do div do pre do job.last_error end end end row :run_at row :locked_at row :locked_by row :failed_at row :queue row :created_at row :updated_at end end action_item :only => [:edit] do @@ -61,9 +93,9 @@ end member_action :reset, :method => :post do resource.update_attributes locked_at: nil, locked_by: nil, attempts: 0, last_error: nil, run_at: Time.now resource.update_attribute :attempts, 0 redirect_to action: :index end end -
webmat revised this gist
Jun 29, 2012 . 1 changed file with 7 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,29 +41,28 @@ end action_item :only => [:edit] do link_to 'Delete Job', admin_job_path(resource), 'data-method' => :delete, 'data-confirm' => 'Are you sure?' end action_item :only => [:show, :edit] do link_to 'Schedule now', run_now_admin_job_path(resource), 'data-method' => :post, :title => 'Cause a job scheduled in the future to run now.' end action_item :only => [:show, :edit] do link_to 'Reset Job', reset_admin_job_path(resource), 'data-method' => :post, :title => 'Resets the state caused by errors. Lets a worker give it another go ASAP.' end member_action :run_now, :method => :post do resource.update_attributes run_at: Time.now redirect_to action: :index end member_action :reset, :method => :post do resource.update_attributes locked_at: nil, locked_by: nil, attempts: 0, last_error: nil resource.update_attribute :attempts, 0 redirect_to action: :index end -
webmat revised this gist
Apr 3, 2012 . 1 changed file with 25 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,16 @@ ActiveAdmin.register Delayed::Job, as: 'Job' do menu parent: 'Admin' actions :index, :show, :edit, :update, :destroy index do column :id column :queue column :priority column :attempts column :failed_at column :run_at column :created_at column :locked_by column :locked_at default_actions @@ -29,7 +31,7 @@ end f.inputs "Diagnostics" do f.input :attempts, input_html: {disabled: true} f.input :failed_at, input_html: {disabled: true} f.input :last_error, input_html: {disabled: true} f.input :locked_at, input_html: {disabled: true} @@ -38,17 +40,31 @@ f.buttons end action_item :only => [:edit] do link_to 'Delete Job', admin_job_path(@job), 'data-method' => :delete, 'data-confirm' => 'Are you sure?' end action_item :only => [:show, :edit] do link_to 'Schedule now', run_now_admin_job_path(@job), 'data-method' => :post, :title => 'Cause a job scheduled in the future to run now.' end action_item :only => [:show, :edit] do link_to 'Reset Job', reset_admin_job_path(@job), 'data-method' => :post, :title => 'Resets the state caused by errors. Lets a worker give it another go ASAP.' end member_action :run_now, :method => :post do job = Delayed::Job.find(params[:id]) job.update_attributes run_at: Time.now redirect_to action: :index end member_action :reset, :method => :post do job = Delayed::Job.find(params[:id]) job.update_attributes locked_at: nil, locked_by: nil, attempts: 0, last_error: nil job.update_attribute :attempts, 0 redirect_to action: :index end end -
webmat revised this gist
Mar 1, 2012 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ActiveAdmin.register Delayed::Job, as: 'Job' do menu parent: 'Admin' actions :index, :show, :edit, :destroy index do column :id @@ -44,7 +44,11 @@ redirect_to action: :index end action_item :only => [:show, :edit] do link_to 'Delete', admin_job_path(@job), 'data-method' => :delete, 'data-confirm' => 'Are you sure?' end action_item :only => [:show, :edit] do link_to 'Schedule now', run_now_admin_job_path(@job), 'data-method' => :post end end -
webmat revised this gist
Feb 23, 2012 . 1 changed file with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ ActiveAdmin::Dashboards.build do # Add this section in your dashboard... section "Background Jobs" do now = Time.now.getgm ul do li do jobs = Delayed::Job.where('failed_at is not null').count(:id) link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red' end li do jobs = Delayed::Job.where('run_at <= ?', now).count(:id) link_to "#{jobs} late jobs", admin_jobs_path(q: {run_at_lte: now.to_s(:db)}), style: 'color: hsl(40, 100%, 40%)' end li do jobs = Delayed::Job.where('run_at >= ?', now).count(:id) link_to "#{jobs} scheduled jobs", admin_jobs_path(q: {run_at_gte: now.to_s(:db)}), style: 'color: green' end end end # ... end -
webmat revised this gist
Feb 23, 2012 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ActiveAdmin.register Delayed::Job, as: 'Job' do menu parent: 'Admin' actions :index, :show, :edit, :delete @@ -45,7 +45,6 @@ end sidebar "Perform", only: [:show, :edit] do a 'Schedule for now!', href: run_now_admin_job_path, 'data-method' => :post end end -
webmat revised this gist
Feb 22, 2012 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,4 +37,15 @@ end f.buttons end member_action :run_now, :method => :post do job = Delayed::Job.find(params[:id]) job.update_attributes run_at: Time.now redirect_to action: :index end sidebar "Perform", only: [:show, :edit] do # aa creates extremely weird routes for the DJ model atm a 'Schedule for now!', href: "#{request.path}/run_now", 'data-method' => :post end end -
webmat revised this gist
Feb 22, 2012 . No changes.There are no files selected for viewing
-
webmat created this gist
Feb 22, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ ActiveAdmin.register Delayed::Job do menu parent: 'Admin' actions :index, :show, :edit, :delete index do column :id column :priority column :attempts column :created_at column :run_at column :locked_by column :locked_at default_actions end form do |f| f.inputs "Scheduling" do f.input :priority f.input :queue f.input :run_at end f.inputs "Details" do f.input :id, input_html: {disabled: true} f.input :created_at, input_html: {disabled: true} f.input :updated_at, input_html: {disabled: true} f.input :handler, input_html: {disabled: true} end f.inputs "Diagnostics" do f.input :attempts f.input :failed_at, input_html: {disabled: true} f.input :last_error, input_html: {disabled: true} f.input :locked_at, input_html: {disabled: true} f.input :locked_by, input_html: {disabled: true} end f.buttons end end