Class: RocketJobMissionControl::JobsDatatable

Inherits:
AbstractDatatable show all
Defined in:
app/datatables/rocket_job_mission_control/jobs_datatable.rb

Constant Summary collapse

COMMON_FIELDS =
%i[id _type description completed_at created_at started_at state worker_name login].freeze
ABORTED_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type", width: "30%"},
  {display: "Description", value: :description, field: "description", width: "30%"},
  {display: "Aborted", value: :completed_ago, field: "completed_at"},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
COMPLETED_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type", width: "30%"},
  {display: "Description", value: :description, field: "description", width: "30%"},
  {display: "Duration", value: :duration, field: "duration", orderable: false},
  {display: "Completed", value: :completed_ago, field: "completed_at"},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
FAILED_COLUMNS =
ABORTED_COLUMNS.deep_dup
PAUSED_COLUMNS =
ABORTED_COLUMNS.deep_dup
QUEUED_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type"},
  {display: "Description", value: :description, field: "description"},
  {display: "Record Count", value: :record_count, field: "record_count"},
  {display: "Priority", value: :priority, field: "priority"},
  {display: "Queued For", value: :duration, field: "duration", orderable: false},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
QUEUED_FIELDS =
(COMMON_FIELDS + %i[record_count run_at priority]).freeze
RUNNING_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type"},
  {display: "Description", value: :description, field: "description"},
  {display: "Record Count", value: :record_count, field: "record_count"},
  {display: "Progress", value: :progress, field: "percent_complete", orderable: false},
  {display: "Workers", value: :worker_count, field: "worker_count", orderable: false},
  {display: "Priority", value: :priority, field: "priority"},
  {display: "Started", value: :started, field: "started_at"},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
RUNNING_FIELDS =
(COMMON_FIELDS + %i[record_count input_categories output_categories priority sub_state percent_complete]).freeze
SCHEDULED_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type"},
  {display: "Description", value: :description, field: "description"},
  {display: "Runs in", value: :time_till_run, field: "run_at"},
  {display: "Cron Schedule", value: :cron_schedule, field: "cron_schedule"},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
SCHEDULED_FIELDS =
(COMMON_FIELDS + %i[run_at cron_schedule]).freeze
ALL_COLUMNS =
[
  {display: "Class", value: :class_with_link, field: "_type"},
  {display: "Description", value: :description, field: "description"},
  {display: "Created", value: :created_at, field: "created_at"},
  {display: "Duration", value: :duration, field: "duration", orderable: false},
  {display: "Actions", value: :action_buttons, orderable: false}
].freeze
ALL_FIELDS =
(QUEUED_FIELDS + RUNNING_FIELDS + SCHEDULED_FIELDS).uniq.freeze

Instance Attribute Summary

Attributes inherited from AbstractDatatable

#query, #view

Instance Method Summary collapse

Methods inherited from AbstractDatatable

#as_json

Constructor Details

#initialize(view, query, columns) ⇒ JobsDatatable

Returns a new instance of JobsDatatable.



70
71
72
73
# File 'app/datatables/rocket_job_mission_control/jobs_datatable.rb', line 70

def initialize(view, query, columns)
  @columns = columns
  super(view, query)
end