Class: MaintenanceTasks::TasksController Private

Inherits:
ApplicationController show all
Defined in:
app/controllers/maintenance_tasks/tasks_controller.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class handles rendering the maintenance_tasks page in the host application. It makes data about available, enqueued, performing, and completed tasks accessible to the views so it can be displayed in the UI.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::BULMA_CDN

Instance Method Summary collapse

Instance Method Details

#indexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders the maintenance_tasks/tasks page, displaying available tasks to users, grouped by category.



14
15
16
# File 'app/controllers/maintenance_tasks/tasks_controller.rb', line 14

def index
  @available_tasks = TaskDataIndex.available_tasks.group_by(&:category)
end

#showObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders the page responsible for providing Task actions to users. Shows running and completed instances of the Task.



20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/maintenance_tasks/tasks_controller.rb', line 20

def show
  task_name = params.fetch(:id)
  @task = TaskDataShow.new(task_name)
  @task.active_runs.load
  set_refresh if @task.active_runs.any?
  @runs_page = RunsPage.new(@task.completed_runs, params[:cursor])
  if @task.active_runs.none? && @runs_page.records.none?
    Task.named(task_name)
  end
end