Merge branch '3187-pipeline-instance-page' into 3605-improved-dashboard
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components_running.html.erb
index b9500f62541b84e33f698742401af3ee0e5fc57d..18ae9b08cfe35cb9537b267edff39a06286b99d6 100644 (file)
@@ -8,14 +8,18 @@
 <% end %>
 
 <p>
-  This pipeline
+  <% if @object.started_at %>
+    Started at <span data-utc-date="<%= @object.started_at %>"><%= @object.started_at %></span>.
+  <% end %>
+
   <% if @object.state == 'Complete' %>
-    completed in
+    Completed in
   <% elsif @object.state == 'Failed' %>
-    failed after
+    Failed after
   <% else %>
-    has been active for
+    Has been active for
   <% end %>
+
   <% walltime = if @object.started_at
         if @object.finished_at
           @object.finished_at - @object.started_at
         0
       end
       %>
-  <%= runtime(walltime, true) %>, running for
 
-    <% tasks = JobTask.filter([['job_uuid', 'in', render_pipeline_jobs.map { |j| j[:job].andand[:uuid] }]]).results %>
+  <%= runtime(walltime, true) %><% if @object.finished_at %> at <span data-utc-date="<%= @object.finished_at %>"><%= @object.finished_at %></span><% end %>.
 
-    <%# want to buy: algorithm that calculates wall clock runtime that takes into account
-        concurrent jobs.  %>
+  <% if @object.state == 'Failed' %>
+    Check the Log tab for more detail about why this pipeline failed.
+  <% end %>
+</p>
+
+<p>
+    <% tasks = JobTask.filter([['job_uuid', 'in', render_pipeline_jobs.map { |j| j[:job].andand[:uuid] }]]).results %>
     <% runningtime = determine_wallclock_runtime(render_pipeline_jobs.map {|j| j[:job]}) %>
 
-    <%= runtime(runningtime, true) %><% if tasks.size == 0 %>.<% else %>,
-      using
+    <% if @object.state.start_with? 'Running' %>
+      Has run
+      <% else %>
+      Ran
+    <% end %>
+    for
+    <%= runtime(runningtime, true) %> (<%= runtime(walltime - runningtime, true) %> queued)<% if tasks.size == 0 %>.<% else %>
+      and used
       <% cputime = tasks.map { |task|
            puts "started at #{task.started_at}"
                   if task.started_at
@@ -60,7 +74,7 @@
         <div class="row">
           <div class="col-md-3">
             <h4 class="panel-title">
-              <a data-toggle="collapse" data-parent="#accordion" href="#collapse<%= i %>">
+              <a data-toggle="collapse" href="#collapse<%= i %>">
                 <%= pj[:name] %> <span class="caret"></span>
               </a>
             </h4>
             <div class="col-md-5">
               <% queuetime = Time.now - current_job[:created_at] %>
               Queued for <%= runtime(queuetime, true) %>.
-                There
+              <% begin %>
               <% if current_job.queue_position == 0 %>
-                are no jobs
+                This job is next in the queue to run.
               <% elsif current_job.queue_position == 1 %>
-                is 1 job
+                There is 1 job in the queue ahead of this one.
               <% else  %>
-                <%= current_job.queue_position %> jobs
+                There are <%= current_job.queue_position %> jobs in the queue ahead of this one.
               <% end %>
-                ahead of this one.
+              <% rescue %>
+          <% end %>
             </div>
           <% end %>
         <% else %>
 </div>
 </div>
 
-<div id="collapse<%= i %>" class="panel-collapse collapse in">
+<div id="collapse<%= i %>" class="panel-collapse collapse">
   <div class="panel-body">
     <div class="container">
         <% current_component = (if current_job then current_job else pj end) %>
         <div class="row">
           <div class="col-md-6">
             <table>
-              <% [:script, :repository, :supplied_script_version, :script_version, :nondeterministic].each do |k| %>
+              <% [:script, :repository, :script_version, :supplied_script_version, :nondeterministic].each do |k| %>
                 <tr>
                   <td style="padding-right: 1em">
                     <%= k.to_s %>:
                   <td>
                     <% if k.to_s.end_with? 'uuid' %>
                       <%= link_to_if_arvados_object current_component[k], friendly_name: true %>
+                    <% elsif k.to_s.end_with? '_at' %>
+                      <span data-utc-date="<%= current_component[k] %>"><%= current_component[k] %></span>
                     <% else %>
                       <%= current_component[k] %>
                     <% end %>