Class: ForemanTasks::TasksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanTasks::TasksController
- Includes:
- Foreman::Controller::AutoCompleteSearch
- Defined in:
- app/controllers/foreman_tasks/tasks_controller.rb
Instance Method Summary collapse
- #cancel ⇒ Object
- #cancel_step ⇒ Object
-
#controller_name ⇒ Object
we need do this to make the Foreman helpers working properly.
- #force_unlock ⇒ Object
- #index ⇒ Object
- #resume ⇒ Object
- #show ⇒ Object
- #sub_tasks ⇒ Object
- #unlock ⇒ Object
Instance Method Details
#cancel ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 29 def cancel task = find_dynflow_task if task.cancel flash[:notice] = _('Trying to cancel the task') else flash[:warning] = _('The task cannot be cancelled at the moment.') end redirect_to :back end |
#cancel_step ⇒ Object
22 23 24 25 26 27 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 22 def cancel_step task = find_dynflow_task flash[:notice] = _("Trying to cancel step %s") % params[:step_id] ForemanTasks.dynflow.world.event(task.external_id, params[:step_id].to_i, ::Dynflow::Action::Cancellable::Cancel).wait redirect_to foreman_tasks_task_path(task) end |
#controller_name ⇒ Object
we need do this to make the Foreman helpers working properly
71 72 73 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 71 def controller_name 'foreman_tasks_tasks' end |
#force_unlock ⇒ Object
62 63 64 65 66 67 68 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 62 def force_unlock task = find_dynflow_task task.state = :stopped task.save! flash[:notice] = _('The task resources were unlocked with force.') redirect_to :back end |
#index ⇒ Object
11 12 13 14 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 11 def index params[:order] ||= 'started_at DESC' @tasks = filter(resource_base) end |
#resume ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 39 def resume task = find_dynflow_task if task.resumable? ForemanTasks.dynflow.world.execute(task.execution_plan.id) flash[:notice] = _('The execution was resumed.') else flash[:warning] = _('The execution has to be resumable.') end redirect_to :back end |
#show ⇒ Object
7 8 9 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 7 def show @task = Task.find(params[:id]) end |
#sub_tasks ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 16 def sub_tasks task = Task.find(params[:id]) @tasks = filter(task.sub_tasks) render :index end |
#unlock ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/foreman_tasks/tasks_controller.rb', line 50 def unlock task = find_dynflow_task if task.paused? task.state = :stopped task.save! flash[:notice] = _('The task resources were unlocked.') else flash[:warning] = _('The execution has to be paused.') end redirect_to :back end |