<%= @job.class.name %>
State
<%= job_state(@job) %>
<% if sub_state = @job['sub_state'] %>
Batch
<%= @job.sub_state %>
<% end %>
<% if @job.respond_to?(:input) && @job.input.failed.count > 0 %>
<%= link_to('Show Exceptions', exceptions_job_path(@job), class: 'btn btn-default') %>
<% end %>
<% if @job.scheduled? %>
<%= job_action_link('Run', rocket_job_mission_control.run_now_job_path(@job), :patch) %>
<% end %>
<% valid_events = @job.aasm.events.collect { |e| e.name } %>
<% if valid_events.include?(:pause) && can?(:pause, @job)%>
<%= job_action_link('Pause', rocket_job_mission_control.pause_job_path(@job), :patch) %>
<% end %>
<% if valid_events.include?(:resume) && can?(:resume, @job)%>
<%= job_action_link('Resume', rocket_job_mission_control.resume_job_path(@job), :patch) %>
<% end %>
<% if valid_events.include?(:retry) && can?(:retry, @job)%>
<%= job_action_link('Retry', rocket_job_mission_control.retry_job_path(@job), :patch) %>
<% end %>
<% if valid_events.include?(:fail) && can?(:fail, @job)%>
<%= job_action_link('Fail', rocket_job_mission_control.fail_job_path(@job), :patch) %>
<% end %>
<% if valid_events.include?(:abort) && can?(:abort, @job) %>
<%= job_action_link('Abort', rocket_job_mission_control.abort_job_path(@job), :patch) %>
<% end %>
<% if can?(:destroy, @job)%>
<%= job_action_link('Destroy', rocket_job_mission_control.job_path(@job), :delete) %>
<% end %>
<% unless @job.completed? || @job.aborted? %>
<% if can?(:edit, @job)%>
<%= link_to 'Edit', edit_job_path(@job), class: 'btn btn-default' %>
<% end %>
<% end %>