%# (C) COPYRIGHT HELP/SYSTEMS, L.L.C. 2009 %>
<%
button_id = "button_switch_#{job_history.id}"
dialog_id = 'job_history_restart_job'
grid_id = 'job_history_restart_job_grid'
has_agent_id = job_history.agent_id > 0
is_target_group_balanced = job.target_type == 'AgentGroup' && job.target.group_balanced?
restart_job_path, t_prefix = (job.class == MemberJob ? [restart_job_now_member_job_path(job.id), 'member_'] : [restart_job_now_job_path(job.id), ''])
window_height, cookie_state = is_target_group_balanced ? [665, 'a'] : [565, 'b']
(window_height += 15) and (cookie_state = 'c') if (skipped_job = job_history.job_status == JobHistory::SKIPPED)
%>
"
buttons="[{
text: '<%= t("#{t_prefix}jobs.restart_job.restart_job") %>',
handler: helpsys.restartJob,
id: '<%= button_id %>'
}, {
text: '<%= t('common.cancel') %>',
handler: ActiveDialog.hideDialog
}]"
minHeight="<%= window_height %>"
minWidth="500"
height="<%= window_height %>"
width="500"
layout="border"
stateId="job_history_restart_job"
cookieStateID="<%= cookie_state %>"
cls="popup-window">
<%= hidden_field :job, :id %>
<%= hidden_field :job_history, :id %>
<%= hidden_field :job_history, :agent_id %>
<%= hidden_field :job_history, :agent_name %>
<%= javascript_tag "secret_token = '#{form_authenticity_token}'" %>
<% if [ JobHistory::FAILED, JobHistory::ERROR, JobHistory::SKIPPED, JobHistory::CANCELED, JobHistory::MEMBER_FAILED].include?(job_history.job_status) && is_target_group_balanced %>
<% end %>
<% unless @authorized_to_view_commands %>
<%= t('jobs.unauthorized_to_commands', :type=> (job.command_set.command_set_type == CommandSet::SHARED ? 'Shared' : 'IBM i Shared')) %>
<%= t('jobs.start_at_first_command') %>
<% end %>
"
rowToSelect="<%= job_history.failed_at_command_sequence - 1 %>"
dojoType="helpsys.ext.LiveGrid"
authenticity_token="<%= form_authenticity_token %>"
autoExpandColumn="commandString"
dataColumns="[{ name: 'id' }, { name: 'line_number' }, { name: 'command_string' }]"
gridColumns="[
{ dataIndex: 'line_number', header: ' ', id: 'lineNumber', locked: true, sortable: false, width: 40},
{ dataIndex: 'command_string', header: '<%= t('jobs.restart_job.command') %>', id: 'commandString', locked: false, sortable: true, width: 100}]"
sortField="{field: 'id', direction: 'ASC'}"
url="<%= commands_path(:format => 'json', :command_set_id => job.command_set_id, :command_set_type => job.command_set.command_set_type, :job_id => job.id) %>"
style="height:100%;">