Merge branch 'master' into 3088-project-chooser-on-run-pipeline-template
[arvados.git] / apps / workbench / app / views / pipeline_instances / show.html.erb
index 2745e76f71db8d5ee9f046a894e2705b35507c0b..28972a4bebc5f7a39f9298428b1a1559e17f13e4 100644 (file)
@@ -1,36 +1,55 @@
-<table class="table table-condensed table-hover topalign">
-  <thead>
-  </thead>
-  <tbody>
-    <% @object.attributes_for_display.each do |attr, attrvalue| %>
-    <% if attr == 'components' and attrvalue.is_a? Hash %>
+<% template = PipelineTemplate.find?(@object.pipeline_template_uuid) %>
+<%= content_for :content_top do %>
+  <h2>
+    <%= render_editable_attribute @object, 'name', nil %>
+  </h2>
+  <% if template %>
+  <blockquote><span class="deemphasize">From template:</span><br />
+    <%= link_to_if_arvados_object template, friendly_name: true %><br />
+    <%= template.description %>
+  </blockquote>
+  <% end %>
+<% end %>
 
-    <tr class="info"><td><%= attr %></td><td>
-        <table class="table">
-          <% pipeline_jobs.each do |pj| %>
-          <tr><% %w(index name result job_link script script_version progress_detail progress_bar output_link).each do |key| %>
-            <td>
-              <% if key == 'script_version' %>
-              <%= pj[key.to_sym][0..6] rescue '' %>
-              <% else %>
-              <%= pj[key.to_sym] %>
-              <% end %>
-            </td>
-            <% end %>
-          </tr>
-          <% end %>
-        </table>
-    </td></tr>
+<% content_for :tab_line_buttons do %>
+  <%= link_to(copy_pipeline_instance_path('id' => @object.uuid, 'pipeline_instance[state]' => 'New'),
+      class: 'btn btn-primary',
+      #data: {toggle: :tooltip, placement: :top}, title: 'copy and modify',
+      method: :post,
+      ) do %>
+    Clone and edit <i class="fa fa-fw fa-copy"></i>
+  <% end %>
 
-    <% else %>
-    <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
+  <% if @object.state.in? ['New', 'Ready'] %>
+    <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
+        class: 'btn btn-primary run-pipeline-button',
+        method: :patch
+        ) do %>
+      Run <i class="fa fa-fw fa-play"></i>
     <% end %>
+  <% else %>
+    <% if @object.state.in? ['RunningOnClient', 'RunningOnServer'] %>
+      <%= link_to(url_for('pipeline_instance[state]' => 'Paused'),
+          class: 'btn btn-primary run-pipeline-button',
+          method: :patch
+          ) do %>
+        Stop <i class="fa fa-fw fa-stop"></i>
+      <% end %>
+    <% elsif @object.state == 'Paused' %>
+      <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
+          class: 'btn btn-primary run-pipeline-button',
+          method: :patch
+          ) do %>
+        Resume <i class="fa fa-fw fa-play"></i>
+      <% end %>
     <% end %>
-  </tbody>
-</table>
+  <% end %>
+<% end %>
 
-<%= raw(@prov_svg) %>
+<% if @object.state.in? %w(RunningOnServer RunningOnClient) %>
+  <% content_for :js do %>
+    setInterval(function(){$('a.refresh').click()}, 15000);
+  <% end %>
+<% end %>
 
-<pre>
-<%= JSON.pretty_generate(@object.attributes) rescue nil %>
-</pre>
+<%= render partial: 'content', layout: 'content_layout', locals: {pane_list: controller.show_pane_list }%>