Sha256: 4e37e1174565a4e03c238fae310abe05c1c80fdcb77801f946e0faae88c16766

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

module RocketJobMissionControl
  module Jobs
    class FailuresController < RocketJobMissionControl::ApplicationController
      def index
        job_failures = JobFailures.new(params[:job_id])
        @job         = job_failures.job

        if @job && @job.failed?
          @slice_errors = job_failures.list

          if @slice_errors.present?
            @error_type = params[:error_type] || @slice_errors.first['_id']['error_class']

            offset             = params.fetch(:offset, 0).to_i
            selected_exception = job_failures.for_error(@error_type, offset)
            current_failure    = selected_exception.first

            @pagination = {
              offset: offset,
              total:  (selected_exception.count - 1),
            }

            if current_failure.present?
              @failure_exception = current_failure['exception']
            end
          else
            flash[:notice] = t(:no_errors, scope: [:job, :failures])
          end
        else
          redirect_to(job_path(params[:job_id]))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rocketjob_mission_control-2.1.1 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-2.1.0 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-2.0.0 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-2.0.0.rc2 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-2.0.0.rc1 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb