4084: Job display, log and buttons refresh using same mechanism as pipeline instances.
[arvados.git] / apps / workbench / app / views / jobs / show.html.erb
index 74c53ca157d892244824a918f3d5a446b854573b..5f46505dc2487f923f556d6e0ab3c9c74a9d4767 100644 (file)
@@ -1,37 +1,15 @@
 <% content_for :tab_line_buttons do %>
-    <% if @object.state == "Running" %>
-    <%= form_tag "/jobs/#{@object.uuid}/cancel", style: "display:inline; padding-left: 1em" do |f| %>
-      <%= button_tag "Cancel running job", {class: 'btn btn-sm btn-danger', id: "cancel-job-button"} %>
-    <% end %>
-  <% else %>
-    <%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %>
-      <% [:script, :script_version, :repository, :supplied_script_version, :nondeterministic].each do |d| %>
-        <%= hidden_field :job, d, :value => @object[d] %>
-      <% end %>
-      <% [:script_parameters, :runtime_constraints].each do |d| %>
-        <%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
-      <% end %>
-      <%= button_tag ({class: 'btn btn-sm btn-primary', id: "re-run-same-job-button",
-                       title: 'Re-run job using the same script version as this run'}) do %>
-        <i class="fa fa-fw fa-gear"></i> Re-run same version
-      <% end %>
-    <% end %>
-  <% if @object.respond_to? :supplied_script_version and !@object.supplied_script_version.nil? and !@object.supplied_script_version.empty? and @object.script_version != @object.supplied_script_version%>
-      <%= form_tag '/jobs', style: "display:inline" do |f| %>
-      <% [:script, :repository, :supplied_script_version, :nondeterministic].each do |d| %>
-        <%= hidden_field :job, d, :value => @object[d] %>
-      <% end %>
-      <%= hidden_field :job, :script_version, :value => @object[:supplied_script_version] %>
-      <% [:script_parameters, :runtime_constraints].each do |d| %>
-        <%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
-      <% end %>
-      <%= button_tag ({class: 'btn btn-sm btn-primary', id: "re-run-latest-job-button",
-                       title: 'Re-run job using the latest script version'}) do%>
-        <i class="fa fa-fw fa-gear"></i> Re-run latest version
-      <% end %>
-    <% end %>
-  <% end %>
-<% end %>
+  <div id="job-tab-buttons"
+       class="pane-anchor active arv-log-event-listener arv-refresh-on-state-change"
+       href="#job-tab-buttons-pane"
+       data-pane-content-url="<%= url_for(params.merge(tab_pane: "job_buttons")) %>"
+       data-object-uuid="<%= @object.uuid %>"
+       style="display: inline"
+       >
+    <div id="job-tab-buttons-pane" class="active" style="display: inline">
+      <%= render partial: 'show_job_buttons', locals: {object: @object}%>
+    </div>
+  </div>
 <% end %>
 
 <%= render partial: 'title_and_buttons' %>