10037: Merge branch 'master' into 10037-useless-progress-bar
authorLucas Di Pentima <lucas@curoverse.com>
Thu, 22 Sep 2016 17:01:40 +0000 (14:01 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Thu, 22 Sep 2016 17:01:40 +0000 (14:01 -0300)
apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/test/controllers/projects_controller_test.rb
apps/workbench/test/integration/application_layout_test.rb
services/api/test/fixtures/container_requests.yml

index e8742f424697f0b7cfed91c9e212e441efcf5230..c02577fcfd28ca3e9a2e552a14af22e12a183620 100644 (file)
             </div>
             <% else %>
             <div class="dashboard-panel-info-row row-<%=wu.uuid%>">
-              <div class="clearfix">
-                <%= link_to_if_arvados_object p, {friendly_name: true} %>
-                <div class="pull-right" style="width: 40%">
+              <div class="row">
+                <div class="col-md-6">
+                  <%= link_to_if_arvados_object p, {friendly_name: true} %>
+                </div>
+                <% if wu.is_running? %>
+                <div class="col-md-6">
                   <div class="progress" style="margin-bottom: 0px">
                     <% wu.progress %>
                   </div>
                 </div>
+                <% else %>
+                <div class="col-md-2">
+                  <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
+                </div>
+                <% end %>
               </div>
 
               <%
index fa87e849a26ce01f2068675d33ff740f82418d89..d31d6e3458a94f629bc21329ba3fa5db1b79061e 100644 (file)
@@ -410,6 +410,60 @@ class ProjectsControllerTest < ActionController::TestCase
     end
   end
 
+  test "dashboard should show the correct status for processes" do
+    get :index, {}, session_for(:active)
+    assert_select 'div.panel-body.recent-processes' do
+      [
+        {
+          fixture: 'container_requests',
+          state: 'completed',
+          selectors: [['div.progress', false],
+                      ['span.label.label-success', true, 'Complete']]
+        },
+        {
+          fixture: 'container_requests',
+          state: 'uncommitted',
+          selectors: [['div.progress', false],
+                      ['span.label.label-default', true, 'Uncommitted']]
+        },
+        {
+          fixture: 'container_requests',
+          state: 'queued',
+          selectors: [['div.progress', false],
+                      ['span.label.label-default', true, 'Queued']]
+        },
+        {
+          fixture: 'container_requests',
+          state: 'running',
+          selectors: [['div.progress', true]]
+        },
+        {
+          fixture: 'pipeline_instances',
+          state: 'new_pipeline',
+          selectors: [['div.progress', false],
+                      ['span.label.label-default', true, 'Not started']]
+        },
+        {
+          fixture: 'pipeline_instances',
+          state: 'pipeline_in_running_state',
+          selectors: [['div.progress', true]]
+        },
+      ].each do |c|
+        uuid = api_fixture(c[:fixture])[c[:state]]['uuid']
+        assert_select "div.dashboard-panel-info-row.row-#{uuid}" do
+          if c.include? :selectors
+            c[:selectors].each do |selector, should_show, label|
+              assert_select selector, should_show, "UUID #{uuid} should #{should_show ? '' : 'not'} show '#{selector}'"
+              if should_show and not label.nil?
+                assert_select selector, label, "UUID #{uuid} state label should show #{label}"
+              end
+            end
+          end
+        end
+      end
+    end
+  end
+
   test "visit a public project and verify the public projects page link exists" do
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
     uuid = api_fixture('groups')['anonymously_accessible_project']['uuid']
index 93827a9c74339a2b67365e6199ad9e2d32668410..c840a418cb44f60786cca371cabac15dca7aba7d 100644 (file)
@@ -256,8 +256,8 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       end
 
       within('.recent-processes') do
-        assert_text 'running_with_job'
-        within('.row-zzzzz-d1hrv-runningpipeline') do
+        assert_text 'pipeline_with_job'
+        within('.row-zzzzz-d1hrv-1yfj6xkidf2muk3') do
           assert_text 'foo'
         end
 
index 49a1faec3f726fcf7322b664410cfe2e02431e6a..f22cc3fbcbbe1f592db95d52cb1e36c80ef47a15 100644 (file)
@@ -4,9 +4,9 @@ queued:
   name: queued
   state: Committed
   priority: 1
-  created_at: 2016-01-11 11:11:11.111111111 Z
-  updated_at: 2016-01-11 11:11:11.111111111 Z
-  modified_at: 2016-01-11 11:11:11.111111111 Z
+  created_at: <%= 2.minute.ago.to_s(:db) %>
+  updated_at: <%= 1.minute.ago.to_s(:db) %>
+  modified_at: <%= 1.minute.ago.to_s(:db) %>
   modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   container_image: test
   cwd: test
@@ -23,9 +23,9 @@ running:
   name: running
   state: Committed
   priority: 1
-  created_at: 2016-01-11 11:11:11.111111111 Z
-  updated_at: 2016-01-11 11:11:11.111111111 Z
-  modified_at: 2016-01-11 11:11:11.111111111 Z
+  created_at: <%= 2.minute.ago.to_s(:db) %>
+  updated_at: <%= 1.minute.ago.to_s(:db) %>
+  modified_at: <%= 1.minute.ago.to_s(:db) %>
   modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   container_image: test
   cwd: test
@@ -193,9 +193,9 @@ uncommitted:
   uuid: zzzzz-xvhdp-cr4uncommittedc
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   name: uncommitted
-  created_at: 2016-01-11 11:11:11.111111111 Z
-  updated_at: 2016-01-11 11:11:11.111111111 Z
-  modified_at: 2016-01-11 11:11:11.111111111 Z
+  created_at: <%= 2.minute.ago.to_s(:db) %>
+  updated_at: <%= 1.minute.ago.to_s(:db) %>
+  modified_at: <%= 1.minute.ago.to_s(:db) %>
   modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   command: ["arvados-cwl-runner", "--local", "--api=containers",
             "/var/lib/cwl/workflow.json", "/var/lib/cwl/cwl.input.json"]