2882: Improved re-run job buttons on job status page
[arvados.git] / apps / workbench / app / views / jobs / _show_status.html.erb
1
2 <div class="pull-right">
3   <% if @object.running %>
4     <%= form_tag "/jobs/#{@object.uuid}/cancel", style: "display:inline; padding-left: 1em" do |f| %>
5       <%= button_tag "Cancel running job", {class: 'btn btn-danger', id: "cancel-job-button"} %>
6     <% end %>
7   <% else %>
8     Re-run job using script version:
9     <%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %>
10       <% [:script, :script_version, :repository, :output_is_persistent, :supplied_script_version, :nondeterministic].each do |d| %>
11         <%= hidden_field :job, d, :value => @object[d] %>
12       <% end %>
13       <% [:script_parameters, :runtime_constraints].each do |d| %>
14         <%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
15       <% end %>
16       <%= hidden_field :options, :no_reuse, :value => true %>
17       <%= button_tag "Same as this run", {class: 'btn btn-primary', id: "re-run-same-job-button"} %>
18     <% end %>
19   <% if !@object.supplied_script_version.nil? and !@object.supplied_script_version.empty? and @object.script_version != @object.supplied_script_version%>
20       <%= form_tag '/jobs', style: "display:inline" do |f| %>
21       <% [:script, :repository, :output_is_persistent, :supplied_script_version, :nondeterministic].each do |d| %>
22         <%= hidden_field :job, d, :value => @object[d] %>
23       <% end %>
24       <%= hidden_field :job, :script_version, :value => @object[:supplied_script_version] %>
25       <% [:script_parameters, :runtime_constraints].each do |d| %>
26         <%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
27       <% end %>
28       <%= hidden_field :options, :no_reuse, :value => true %>
29         <%= button_tag "Latest (#{@object.repository}/#{@object.supplied_script_version})", {class: 'btn btn-primary', id: "re-run-latest-job-button"} %>
30       <% end %>
31   <% end %>
32 <% end %>
33 </div>
34
35 <table class="table pipeline-components-table">
36   <colgroup>
37     <col style="width: 20%" />
38     <col style="width: 24%" />
39     <col style="width: 12%" />
40     <col style="width: 45%" />
41   </colgroup>
42   <thead>
43     <tr><th>
44         script, version
45       </th><th>
46         progress
47         <%# format:'js' here helps browsers avoid using the cached js
48             content in html context (e.g., duplicate tab -> see
49                                      javascript) %>
50         <%= link_to '(refresh)', {format: :js}, {class: 'refresh hide', remote: true, method: 'get'} %>
51       </th>
52       <th></th>
53       <th>
54         output
55       </th>
56     </tr>
57   </thead>
58   <tbody>
59     <tr>
60       <td>
61         <%= @object[:script] %><br>
62         <span class="deemphasize"><%= @object[:script_version] %></span>
63       </td>
64       <td>
65         <%= render partial: 'job_progress', locals: {:j => @object} %>
66         <% if @object.running == false %>
67           <% if @object[:job].andand[:uuid] %>
68             <span class="deemphasize">
69               <%= link_to("..."+@object[:job][:uuid].last(15), job_url(id: @object[:job][:uuid])) %>
70             </span>
71
72             <% current_job = @object %>
73             <% if current_job.andand[:log] %>
74               <% fixup = /([a-f0-9]{32}\+\d+)(\+?.*)/.match(current_job[:log])%>
75               <% Collection.limit(1).where(uuid: fixup[1]).each do |c| %>
76                 <% c.files.each do |file| %>
77                   <br/><span class="deemphasize">
78                     <a href="<%= collection_path(current_job[:log]) %>/<%= file[1] %>?disposition=inline&size=<%= file[2] %>">log</a>
79                   </span>
80                 <% end %>
81               <% end %>
82             <% end %>
83           <% end %>
84         <% end %>
85       </td><td>
86         <%= render(partial: 'job_status_label',
87                    locals: { :j => @object }) %>
88       </td><td>
89         <%= link_to_if_arvados_object @object[:output], {:thumbnail => true} %>
90       </td>
91     </tr>
92     <tfoot>
93       <tr><td colspan="5"></td></tr>
94     </tfoot>
95 </table>