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
-
#copy ⇒ Object
When you click on the Copy button, the copy method loads the Dirmon Entity attributes in Copy Dirmon Entry Page.
- #create ⇒ Object
- #destroy ⇒ Object
- #disable ⇒ Object
- #disabled ⇒ Object
- #edit ⇒ Object
- #enable ⇒ Object
- #enabled ⇒ Object
- #failed ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #pending ⇒ Object
- #properties ⇒ Object
-
#replicate ⇒ Object
When you click on the replicate button, the replicate method clones the existing Dirmon Entity.
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#copy ⇒ Object
When you click on the Copy button, the copy method loads the Dirmon Entity attributes in Copy Dirmon Entry Page
76 77 78 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 76 def copy :copy, @dirmon_entry end |
#create ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 49 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
64 65 66 67 68 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 64 def destroy :destroy, @dirmon_entry @dirmon_entry.destroy redirect_to(dirmon_entries_path) end |
#disable ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 128 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[:danger] = t(:failure, scope: i[dirmon_entry disable]) render(:show) end end |
#disabled ⇒ Object
17 18 19 20 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 17 def disabled @data_table_url = disabled_dirmon_entries_url(format: "json") render_datatable(RocketJob::DirmonEntry.disabled, "Disabled") end |
#edit ⇒ Object
70 71 72 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 70 def edit :edit, @dirmon_entry end |
#enable ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 116 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[:danger] = t(:failure, scope: i[dirmon_entry enable]) render(:show) end end |
#enabled ⇒ Object
22 23 24 25 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 22 def enabled @data_table_url = enabled_dirmon_entries_url(format: "json") render_datatable(RocketJob::DirmonEntry.enabled, "Enabled") end |
#failed ⇒ Object
27 28 29 30 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 27 def failed @data_table_url = failed_dirmon_entries_url(format: "json") render_datatable(RocketJob::DirmonEntry.failed, "Failed") end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 12 def index @data_table_url = dirmon_entries_url(format: "json") render_datatable(RocketJob::DirmonEntry.all, "All") end |
#new ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 40 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
32 33 34 35 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 32 def pending @data_table_url = pending_dirmon_entries_url(format: "json") render_datatable(RocketJob::DirmonEntry.pending, "Pending") end |
#properties ⇒ Object
140 141 142 143 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 140 def properties @dirmon_entry = RocketJob::DirmonEntry.new(dirmon_params) render json: @dirmon_entry end |
#replicate ⇒ Object
When you click on the replicate button, the replicate method clones the existing Dirmon Entity
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 82 def replicate :replicate, @dirmon_entry dirmon_entry_replicate = RocketJob::DirmonEntry.new(@dirmon_entry.dup.attributes.except("id")) if properties = params[:rocket_job_dirmon_entry][:properties] dirmon_entry_replicate.properties = JobSanitizer.sanitize(properties, dirmon_entry_replicate.job_class, @dirmon_entry, false) end if dirmon_entry_replicate.update_attributes(dirmon_params) redirect_to(rocket_job_mission_control.dirmon_entry_path(dirmon_entry_replicate)) else dirmon_params.each { |k,v| @dirmon_entry.send("#{k}=", v) } @dirmon_entry.properties = dirmon_entry_replicate.properties dirmon_entry_replicate.errors..each_pair do |field, | @dirmon_entry.errors.add(field, ) end render :copy end end |
#show ⇒ Object
37 38 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 37 def show end |
#update ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb', line 102 def update :update, @dirmon_entry sanitized_params = DirmonSanitizer.sanitize(params[:rocket_job_dirmon_entry], @dirmon_entry.job_class, @dirmon_entry) properties = DirmonSanitizer.diff_properties(sanitized_params[:properties], @dirmon_entry) sanitized_params[:properties] = properties if @dirmon_entry.errors.empty? && @dirmon_entry.valid? && @dirmon_entry.update_attributes(sanitized_params) redirect_to(rocket_job_mission_control.dirmon_entry_path(@dirmon_entry)) else render :edit end end |