Class: RocketJobMissionControl::DirmonEntriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RocketJobMissionControl::DirmonEntriesController
- Defined in:
- app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #disable ⇒ Object
- #disabled ⇒ Object
- #edit ⇒ Object
- #enable ⇒ Object
- #enabled ⇒ Object
- #failed ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #pending ⇒ Object
- #properties ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 55 def create :create, RocketJob::DirmonEntry @dirmon_entry = RocketJob::DirmonEntry.new(dirmon_params) if properties = params[:rocket_job_dirmon_entry][:properties] @dirmon_entry.properties = JobSanitizer.sanitize(properties, @dirmon_entry.job_class, @dirmon_entry, false) end if @dirmon_entry.errors.empty? && @dirmon_entry.save redirect_to(dirmon_entry_path(@dirmon_entry)) else render :new end end |
#destroy ⇒ Object
69 70 71 72 73 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 69 def destroy :destroy, @dirmon_entry @dirmon_entry.destroy redirect_to(dirmon_entries_path) end |
#disable ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 102 def disable :disable, @dirmon_entry if @dirmon_entry.may_disable? @dirmon_entry.disable! redirect_to(rocket_job_mission_control.dirmon_entry_path(@dirmon_entry)) else flash[:alert] = t(:failure, scope: [:dirmon_entry, :disable]) render(:show) end end |
#disabled ⇒ Object
23 24 25 26 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 23 def disabled @data_table_url = disabled_dirmon_entries_url(format: 'json') render_datatable(RocketJob::DirmonEntry.disabled, 'Disabled') end |
#edit ⇒ Object
75 76 77 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 75 def edit :edit, @dirmon_entry end |
#enable ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 91 def enable :enable, @dirmon_entry if @dirmon_entry.may_enable? @dirmon_entry.enable! redirect_to(rocket_job_mission_control.dirmon_entry_path(@dirmon_entry)) else flash[:alert] = t(:failure, scope: [:dirmon_entry, :enable]) render(:show) end end |
#enabled ⇒ Object
28 29 30 31 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 28 def enabled @data_table_url = enabled_dirmon_entries_url(format: 'json') render_datatable(RocketJob::DirmonEntry.enabled, 'Enabled') end |
#failed ⇒ Object
33 34 35 36 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 33 def failed @data_table_url = failed_dirmon_entries_url(format: 'json') render_datatable(RocketJob::DirmonEntry.failed, 'Failed') end |
#index ⇒ Object
18 19 20 21 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 18 def index @data_table_url = dirmon_entries_url(format: 'json') render_datatable(RocketJob::DirmonEntry.all, 'All') end |
#new ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 46 def new @dirmon_entry = RocketJob::DirmonEntry.new(dirmon_params) @previous_job_class_names = RocketJob::DirmonEntry.distinct(:job_class_name) if dirmon_params[:job_class_name] && !@dirmon_entry.job_class @dirmon_entry.errors.add(:job_class_name, 'Invalid Job Class') end end |
#pending ⇒ Object
38 39 40 41 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 38 def pending @data_table_url = pending_dirmon_entries_url(format: 'json') render_datatable(RocketJob::DirmonEntry.pending, 'Pending') end |
#properties ⇒ Object
113 114 115 116 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 113 def properties @dirmon_entry = RocketJob::DirmonEntry.new(dirmon_params) render json: @dirmon_entry end |
#show ⇒ Object
43 44 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 43 def show end |
#update ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 79 def update :update, @dirmon_entry if properties = params[:rocket_job_dirmon_entry][:properties] @dirmon_entry.properties = JobSanitizer.sanitize(properties, @dirmon_entry.job_class, @dirmon_entry, false) end if @dirmon_entry.errors.empty? && @dirmon_entry.valid? && @dirmon_entry.update_attributes(dirmon_params) redirect_to(rocket_job_mission_control.dirmon_entry_path(@dirmon_entry)) else render :edit end end |