9318: Update the compute node status pane to make sure the Details option is only...
authorradhika <radhika@curoverse.com>
Thu, 9 Jun 2016 20:16:06 +0000 (16:16 -0400)
committerradhika <radhika@curoverse.com>
Thu, 9 Jun 2016 20:16:06 +0000 (16:16 -0400)
apps/workbench/app/models/job_work_unit.rb
apps/workbench/app/models/proxy_work_unit.rb
apps/workbench/app/views/projects/_compute_node_status.html.erb
apps/workbench/app/views/projects/_compute_node_summary.html.erb
apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/test/integration/application_layout_test.rb
apps/workbench/test/integration/logins_test.rb
apps/workbench/test/integration/pipeline_templates_test.rb
apps/workbench/test/integration/user_profile_test.rb

index 43918099119fd0968ae745074a3d98c10c67c415..a3f13f388c9bff38d8f5450633b1e41d1fad338a 100644 (file)
@@ -73,12 +73,7 @@ class JobWorkUnit < ProxyWorkUnit
 
   def outputs
     items = []
-    children.each do |c|
-      items.concat c.outputs
-    end
-    if !items.any?
-      items << get(:output) if get(:output)
-    end
+    items << get(:output) if get(:output)
     items
   end
 
index b1d758b8f2589b3df39e88d6bb1fd73ae2871758..b0f754aee0eb5e81a2e8738bc4fbf4e389fae037 100644 (file)
@@ -25,25 +25,25 @@ class ProxyWorkUnit < WorkUnit
 
   def created_at
     t = get(:created_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
   def started_at
     t = get(:started_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
   def modified_at
     t = get(:modified_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
   def finished_at
     t = get(:finished_at)
-    t = Time.parse(t) if (t.andand.class == String)
+    t = Time.parse(t) if (t.is_a? String)
     t
   end
 
index 6ad7ff43843e381a7394770a04fc44772333f667..c2f5f39429c13f51b96ba87bf9063967c0b883c2 100644 (file)
@@ -1,9 +1,6 @@
 <h4>Node status</h4>
-<% active_nodes = 0 %>
 <div class="compute-summary-nodelist">
-    <% nodes.sort_by { |n| n.hostname || "" }.each do |n| %>
-      <% if n.crunch_worker_state.in? ["busy", "idle"] and (Time.now - n[:last_ping_at]) < 3600 %>
-        <% active_nodes += 1 %>
+    <% nodes.each do |n| %>
         <div class="compute-summary">
           <a data-toggle="collapse" href="#detail_<%= n.hostname %>" class="compute-summary-head label label-<%= if n.crunch_worker_state == 'busy' then 'primary' else 'default' end %>">
             <%= n.hostname %>
@@ -15,9 +12,5 @@
             <% end %>
           </div>
         </div>
-      <% end %>
-    <% end %>
-    <% if active_nodes == 0 %>
-      No active nodes
     <% end %>
 </div>
index 7d6a4fbf2904354ddb522ce57ea09005b5eba300..652d4ad06ed1c0659c7df9592bc1b9685637ebf6 100644 (file)
@@ -1,17 +1,14 @@
 <div class="compute-summary-numbers">
     <table>
       <colgroup>
-        <col width="25%">
-        <col width="25%">
-        <col width="25%">
+        <col width="50%">
+        <col width="50%">
       </colgroup>
       <tr>
-        <td><%= Job.queue_size %></td>
         <td><%= nodes.select {|n| n.crunch_worker_state == "busy" }.size %></td>
         <td><%= nodes.select {|n| n.crunch_worker_state == "idle" }.size %></td>
       </tr>
       <tr>
-        <th>Queued jobs</th>
         <th>Busy nodes</th>
         <th>Idle nodes</th>
       </tr>
index efd6acfd65d642c0ce97a9c4118f212ec35a8318..12b3ef2846db568a654dc69ea411fa49df3a56ab 100644 (file)
@@ -1,7 +1,7 @@
   <div class="row">
     <div class="col-md-6">
       <div class="panel panel-default" style="min-height: 10.5em">
-        <div class="panel-heading"><span class="panel-title">Recent processes</span>
+        <div class="panel-heading"><span class="panel-title">Recent pipelines and processes</span>
           <% if current_user.andand.is_active %>
             <span class="pull-right">
               <span>
@@ -28,7 +28,7 @@
         <% _recent_processes = recent_processes(12) %>
         <div class="panel-body recent-processes">
           <% if _recent_processes.empty? %>
-            No recent processes.
+            No recent pipelines or processes.
           <% else %>
           <% _recent_processes.each do |p| %>
             <% wu = p.work_unit %>
         <div class="panel-body compute-node-summary-pane">
           <div>
             <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
-            <div style="text-align: center">
-              <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
-            </div>
+            <% active_nodes = [] %>
+            <% nodes.sort_by { |n| n.hostname || "" }.each do |n| %>
+              <% if n.crunch_worker_state.in? ["busy", "idle"] and (Time.now - n[:last_ping_at]) < 3600 %>
+                <% active_nodes << n %>
+              <% end %>
+            <% end %>
+            <% if active_nodes.any? %>
+              <div style="text-align: center">
+                <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
+              </div>
+            <% end %>
           </div>
           <div id="compute_node_status" class="collapse">
-            <%= render partial: 'compute_node_status', locals: {nodes: nodes} %>
+            <%= render partial: 'compute_node_status', locals: {nodes: active_nodes} %>
           </div>
         </div>
       </div>
index 969ec89780ec0f457392ac796ce2cafb243fa9ba..2d101f94e4c764423fd5af7c89040851f12edca0 100644 (file)
@@ -179,7 +179,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
         first('button', text: 'x').click
       end
-      assert_text 'Recent processes' # seeing dashboard now
+      assert_text 'Recent pipelines and processes' # seeing dashboard now
     end
   end
 
@@ -249,7 +249,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     test "visit dashboard as #{token}" do
       visit page_with_token(token)
 
-      assert_text 'Recent processes' # seeing dashboard now
+      assert_text 'Recent pipelines and processes' # seeing dashboard now
       within('.recent-processes') do
         page.has_button? 'Run a pipeline'
         page.has_link? 'All pipelines'
index ed16e8cf45e3a773ccb2321390e6775a4cf9d2b2..0d6514d75d75901b5f3a9b78a1fffaeb057a2b77 100644 (file)
@@ -7,7 +7,7 @@ class LoginsTest < ActionDispatch::IntegrationTest
 
   test "login with api_token works after redirect" do
     visit page_with_token('active_trustedclient')
-    assert page.has_text?('Recent processes'), "Missing 'Recent processes' from page"
+    assert page.has_text?('Recent pipelines and processes'), "Missing 'Recent pipelines and processes' from page"
     assert_no_match(/\bapi_token=/, current_path)
   end
 
index ccd97fbb4dea49531642f309e6f5dfe020c50590..4fce9e061056078c10827fd495a0fcf6523f5f0a 100644 (file)
@@ -35,7 +35,7 @@ class PipelineTemplatesTest < ActionDispatch::IntegrationTest
     assert page.has_text? 'Textile description for pipeline template'
     assert page.has_link? 'Go to dashboard'
     click_link 'Go to dashboard'
-    assert page.has_text? 'Recent processes'
+    assert page.has_text? 'Recent pipelines and processes'
 
     # again visit recent templates page and verify edited description
     visit page_with_token("active", "/pipeline_templates")
index ea9b836a81a36ea680e615833dc9d670f1f3d86a..a98fa3542d859be996225e082db21b38c2a6ece2 100644 (file)
@@ -20,7 +20,7 @@ class UserProfileTest < ActionDispatch::IntegrationTest
         assert page.has_text?('Save profile'), 'No text - Save profile'
         add_profile user
       else
-        assert page.has_text?('Recent processes'), 'Not found text - Recent processes'
+        assert page.has_text?('Recent pipelines and processes'), 'Not found text - Recent pipelines and processes'
         assert page.has_no_text?('Save profile'), 'Found text - Save profile'
       end
     elsif invited
@@ -119,7 +119,7 @@ class UserProfileTest < ActionDispatch::IntegrationTest
     end
 
     # profile saved and in home page now
-    assert page.has_text?('Recent processes'), 'No text - Recent processes'
+    assert page.has_text?('Recent pipelines and processes'), 'No text - Recent pipelines and processes'
   end
 
   [