Merge branch 'master' into 3088-project-chooser-on-run-pipeline-template
[arvados.git] / apps / workbench / app / views / pipeline_instances / show.html.erb
index cf56b9798d191e2cd571819712494da941ae8d0f..28972a4bebc5f7a39f9298428b1a1559e17f13e4 100644 (file)
@@ -1,89 +1,55 @@
-<% content_for :css do %>
-  .pipeline_color_legend {
-    padding-left: 1em;
-    padding-right: 1em;
-  }
-table.pipeline-components-table thead th {
-  text-align: bottom;
-}
-table.pipeline-components-table div.progress {
-  margin-bottom: 0;
-}
+<% 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 %>
-<br />
 
-<table class="table pipeline-components-table">
-  <colgroup>
-    <col width="15%" />
-    <col width="15%" />
-    <col width="35%" />
-    <col width="35%" />
-  </colgroup>
-  <thead>
-    <tr>
-      <th>
-        component
-      </th><th>
-        progress
-        <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
-      </th><th>
-        script, version
-      </th><th>
-        output
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-    <% render_pipeline_jobs.each do |pj| %>
-    <tr>
-      <td>
-        <% if pj[:job].andand[:uuid] %>
-        <%= link_to pj[:name], job_url(id: pj[:job][:uuid]) %>
-        <% else %>
-        <%= pj[:name] %>
-        <% end %>
-      </td><td>
-        <%= pj[:progress_bar] %>
-        <% if pj[:job].andand[:cancelled_at] %>
-        <span class="pull-right label label-warning">cancelled</span>
-        <% elsif pj[:failed] %>
-        <span class="pull-right label label-warning">failed</span>
-        <% elsif pj[:result] == 'queued' %>
-        <span class="pull-right label">queued</span>
-        <% end %>
-      </td><td>
-        <%= pj[:script] %>
-        <br /><span class="deemphasize"><%= pj[:script_version] %></span>
-      </td><td>
-        <%= link_to_if_arvados_object pj[:output] %>
-      </td>
-    </tr>
-    <% end %>
-  </tbody>
-  <tfoot>
-    <tr><td colspan="4"></td></tr>
-  </tfoot>
-</table>
+<% 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 %>
 
-<% if @pipelines.count > 1 %>
-  <div style="text-align: center">
-    <span class="pipeline_color_legend" style="background: #88ff88">This pipeline</span> 
-    <span class="pipeline_color_legend" style="background: #8888ff">Comparison pipeline</span>
-    <span class="pipeline_color_legend" style="background: #88ffff">Shared by both pipelines</span>
-  </div>
+  <% 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 %>
+  <% end %>
 <% end %>
 
-   <%= render partial: 'application/svg_div', locals: {
-         divId: "provenance_graph", 
-         svgId: "provenance_svg", 
-         svg: @prov_svg } %>
-
-<div style="height: 1em"></div>
-
-<%= render partial: 'arvados_object' %>
-
-<% if @object.active %>
-<% content_for :js do %>
-setInterval(function(){$('a.refresh').click()}, 30000);
-<% end %>
+<% if @object.state.in? %w(RunningOnServer RunningOnClient) %>
+  <% content_for :js do %>
+    setInterval(function(){$('a.refresh').click()}, 15000);
+  <% end %>
 <% end %>
+
+<%= render partial: 'content', layout: 'content_layout', locals: {pane_list: controller.show_pane_list }%>