11014: When PipelineInstance API is off and also show_recent_collections_on_dashboard...
authorLucas Di Pentima <lucas@curoverse.com>
Fri, 17 Mar 2017 14:16:05 +0000 (11:16 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Fri, 17 Mar 2017 14:16:05 +0000 (11:16 -0300)
Corrected test name.
Avoid calling PipelineInstance.api_exist?(:index) more than once.

apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/test/controllers/disabled_api_test.rb

index 4f01f9d357c6b519fe2e2d7f34eff4174dd2933f..bcfeb6a466e544926dc4a8c7555dcbcd0cdd4ab7 100644 (file)
 %>
 
 <%
+  recent_procs_panel_width = 6
   if !PipelineInstance.api_exists?(:index)
     recent_procs_title = 'Recent processes'
     run_proc_title = 'Choose a workflow to run:'
+    show_node_status = false
+    # Recent processes panel should take the entire width when is the only one
+    # being rendered.
+    if !Rails.configuration.show_recent_collections_on_dashboard
+      recent_procs_panel_width = 12
+    end
   else
     recent_procs_title = 'Recent pipelines and processes'
     run_proc_title = 'Choose a pipeline or workflow to run:'
+    show_node_status = true
   end
 %>
 
   <div class="row">
-    <div class="col-md-6">
+    <div class="col-md-<%= recent_procs_panel_width %>">
       <div class="panel panel-default" style="min-height: 10.5em">
         <div class="panel-heading">
           <span class="panel-title"><%=recent_procs_title%></span>
     </div>
 
     <div class="col-md-6">
-      <% if PipelineInstance.api_exists?(:index) %>
+      <% if show_node_status %>
       <% nodes = Node.filter([["last_ping_at", ">", Time.now - 3600]]).results %>
       <div class="panel panel-default" style="min-height: 10.5em">
         <div class="panel-heading"><span class="panel-title">Compute node status</span>
index 55c7b2409231a6bde640be7ca51f7c65805e0967..334b89c4da7aa5ec578a353dcafd180d7bc09240 100644 (file)
@@ -15,7 +15,7 @@ class DisabledApiTest < ActionController::TestCase
     assert_includes @response.body, "Run a process"
   end
 
-  test "dashboard compute node status when pipeline_instance index API is disabled" do
+  test "dashboard compute node status not shown when pipeline_instance index API is disabled" do
     @controller = ProjectsController.new
 
     dd = ArvadosApiClient.new_or_current.discovery.deep_dup