Sha256: c97d51f7c2cd2f78d67508e0916f2bcdda8d7cce511da4a34934331da0cd7041

Contents?: true

Size: 1.06 KB

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
rocketjob_mission_control-1.2.4 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-1.2.3 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-1.2.2 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb
rocketjob_mission_control-1.2.1 app/controllers/rocket_job_mission_control/jobs/failures_controller.rb