[ARVADOS] updated: 92d5df330b86fb4c279a6e030258b860bed37358

git at public.curoverse.com git at public.curoverse.com
Tue Sep 30 15:40:45 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb      | 16 +++++----
 apps/workbench/app/helpers/application_helper.rb   |  2 +-
 apps/workbench/app/models/arvados_base.rb          |  2 +-
 apps/workbench/app/models/collection.rb            |  2 +-
 apps/workbench/app/models/node.rb                  |  2 +-
 apps/workbench/app/models/pipeline_instance.rb     |  8 +++--
 apps/workbench/app/models/user.rb                  |  2 +-
 apps/workbench/app/models/virtual_machine.rb       |  2 +-
 .../app/views/projects/_show_dashboard.html.erb    | 23 +++++++-----
 .../test/integration/pipeline_instances_test.rb    | 41 ++++++++++++++++++++++
 apps/workbench/test/integration/projects_test.rb   |  8 +++++
 11 files changed, 84 insertions(+), 24 deletions(-)

       via  92d5df330b86fb4c279a6e030258b860bed37358 (commit)
      from  936ea7131a5c0e254ef213e5e2fe390e4e52e872 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 92d5df330b86fb4c279a6e030258b860bed37358
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Sep 30 15:40:37 2014 -0400

    4004: Rename "Compute status" to "Compute and job status".  Added integration
    tests for buttons.  Reduced dashboard page rendering time by at least 25% by
    batching certain API server requests (previously happing per-object),

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 4b775c6..0313111 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -704,14 +704,16 @@ class ApplicationController < ActionController::Base
       end
     end
 
-    Job.filter([["uuid", "in", jobs.keys]]).each do |j|
-      jobs[j[:uuid]] = j
-    end
+    if jobs.keys.any?
+      Job.filter([["uuid", "in", jobs.keys]]).each do |j|
+        jobs[j[:uuid]] = j
+      end
 
-    pi.each do |pl|
-      pl.components.each do |k,v|
-        if v.is_a? Hash and v[:job]
-          v[:job] = jobs[v[:job][:uuid]]
+      pi.each do |pl|
+        pl.components.each do |k,v|
+          if v.is_a? Hash and v[:job]
+            v[:job] = jobs[v[:job][:uuid]]
+          end
         end
       end
     end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 624cb3d..d343249 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -93,7 +93,7 @@ module ApplicationHelper
 
         if opts[:friendly_name]
           if attrvalue.respond_to? :friendly_link_name
-            link_name = attrvalue.friendly_link_name
+            link_name = attrvalue.friendly_link_name opts[:lookup]
           else
             begin
               if resource_class.name == 'Collection'
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index b691e6d..e0e93b9 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -379,7 +379,7 @@ class ArvadosBase < ActiveRecord::Base
     self.class.to_s.underscore
   end
 
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     (name if self.respond_to? :name) || default_name
   end
 
diff --git a/apps/workbench/app/models/collection.rb b/apps/workbench/app/models/collection.rb
index 40fd930..87a083e 100644
--- a/apps/workbench/app/models/collection.rb
+++ b/apps/workbench/app/models/collection.rb
@@ -102,7 +102,7 @@ class Collection < ArvadosBase
     end
   end
 
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     if self.respond_to? :name
       self.name
     else
diff --git a/apps/workbench/app/models/node.rb b/apps/workbench/app/models/node.rb
index 6518047..e66be83 100644
--- a/apps/workbench/app/models/node.rb
+++ b/apps/workbench/app/models/node.rb
@@ -2,7 +2,7 @@ class Node < ArvadosBase
   def self.creatable?
     current_user and current_user.is_admin
   end
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     (hostname && !hostname.empty?) ? hostname : uuid
   end
 end
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index 89acbb0..9369057 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -5,10 +5,14 @@ class PipelineInstance < ArvadosBase
     true
   end
 
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     pipeline_name = self.name
     if pipeline_name.nil? or pipeline_name.empty?
-      template = PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+      template = if lookup and lookup[self.pipeline_template_uuid]
+                   lookup[self.pipeline_template_uuid]
+                 else
+                   PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+                 end
       if template
         template.name
       else
diff --git a/apps/workbench/app/models/user.rb b/apps/workbench/app/models/user.rb
index 87ea5fa..967ea2a 100644
--- a/apps/workbench/app/models/user.rb
+++ b/apps/workbench/app/models/user.rb
@@ -39,7 +39,7 @@ class User < ArvadosBase
     (not (self.uuid.andand.match(/000000000000000$/) and self.is_admin)) and super
   end
 
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     [self.first_name, self.last_name].compact.join ' '
   end
 
diff --git a/apps/workbench/app/models/virtual_machine.rb b/apps/workbench/app/models/virtual_machine.rb
index 9789641..083aae3 100644
--- a/apps/workbench/app/models/virtual_machine.rb
+++ b/apps/workbench/app/models/virtual_machine.rb
@@ -15,7 +15,7 @@ class VirtualMachine < ArvadosBase
             {current_user_logins: {column_heading: "logins", type: 'array'}},
             super]
   end
-  def friendly_link_name
+  def friendly_link_name lookup=nil
     (hostname && !hostname.empty?) ? hostname : uuid
   end
 end
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index f2c5863..9ddd1d5 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -17,14 +17,18 @@
     </span>
         </div>
 
+        <% _running_pipelines = running_pipelines %>
+        <% _finished_pipelines = finished_pipelines(8) %>
+        <% lookup = preload_objects_for_dataclass PipelineTemplate, (_running_pipelines.map(&:pipeline_template_uuid) + _finished_pipelines.map(&:pipeline_template_uuid)) %>
+
         <div class="panel-body">
-          <% if running_pipelines.empty? %>
+          <% if _running_pipelines.empty? %>
             No pipelines are currently running.
-          <% end %>
-          <% running_pipelines.each do |p| %>
+          <% else %>
+          <% _running_pipelines.each do |p| %>
             <div class="dashboard-panel-info-row">
               <div class="clearfix">
-                <%= link_to_if_arvados_object p, friendly_name: true %>
+                <%= link_to_if_arvados_object p, {friendly_name: true, lookup: lookup} %>
 
                 <div class="pull-right" style="width: 40%">
                   <div class="progress" style="margin-bottom: 0px">
@@ -82,6 +86,7 @@
               </div>
             </div>
           <% end %>
+          <% end %>
           </div>
       </div>
 
@@ -94,11 +99,11 @@
           </span>
         </div>
         <div class="panel-body">
-          <% finished_pipelines(8).each do |p| %>
+          <% _finished_pipelines.each do |p| %>
             <div class="dashboard-panel-info-row">
               <div class="row">
                 <div class="col-md-6 text-overflow-ellipsis">
-                  <%= link_to_if_arvados_object p, friendly_name: true %>
+                  <%= link_to_if_arvados_object p, {friendly_name: true, lookup: lookup} %>
                 </div>
                 <div class="col-md-2">
                   <%= render partial: "pipeline_status_label", locals: {p: p}%>
@@ -140,7 +145,7 @@
                     <% end %>
                   </div>
                 </div>
-              </div>              
+              </div>
             </div>
           <% end %>
         </div>
@@ -150,7 +155,7 @@
     <div class="col-md-6">
       <% nodes = Node.all %>
       <div class="panel panel-default" style="min-height: 10.5em">
-        <div class="panel-heading"><span class="panel-title">Compute status</span>
+        <div class="panel-heading"><span class="panel-title">Compute and job status</span>
           <span class="pull-right">
             <%= link_to jobs_path, class: 'btn btn-default btn-xs' do %>
               All jobs <i class="fa fa-fw fa-arrow-circle-right"></i>
@@ -185,7 +190,7 @@
               <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object r[:owners][p[:owner_uuid]], friendly_name: true %>/
               <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
             </div>
-            <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, friendly_name: true %>
+            <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, {friendly_name: true, no_tags: true} %>
             </div>
             </div>
           <% end %>
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index 33e581a..3e8663d 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -146,6 +146,47 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert_not page.has_text? 'Graph'
   end
 
+  # Create a pipeline instance from within a project and run
+  test 'Run a pipeline from dashboard' do
+    visit page_with_token('active_trustedclient')
+
+    # create a pipeline instance
+    find('.btn', text: 'Run a pipeline').click
+    within('.modal-dialog') do
+      find('.selectable', text: 'Two Part Pipeline Template').click
+      find('.btn', text: 'Next: choose inputs').click
+    end
+
+    assert find('p', text: 'Provide a value')
+
+    find('div.form-group', text: 'Foo/bar pair').
+      find('.btn', text: 'Choose').
+      click
+
+    within('.modal-dialog') do
+      assert_selector 'button.dropdown-toggle', text: 'Home'
+      wait_for_ajax
+      click_button "Home"
+      click_link "A Project"
+      wait_for_ajax
+      first('span', text: 'foo_tag').click
+      find('button', text: 'OK').click
+    end
+    wait_for_ajax
+
+    # "Run" button present and enabled
+    page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
+    first('a,button', text: 'Run').click
+
+    # Pipeline is running. We have a "Pause" button instead now.
+    page.assert_no_selector 'a,button', text: 'Run'
+    page.assert_selector 'a,button', text: 'Pause'
+
+    # Since it is test env, no jobs are created to run. So, graph not visible
+    assert_not page.has_text? 'Graph'
+  end
+
+
   test 'view pipeline with job and see graph' do
     visit page_with_token('active_trustedclient')
 
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 2a363c5..565ca8d 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -457,4 +457,12 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     assert page.has_link?('Jobs and pipelines'), 'Jobs and pipelines link not found in project'
   end
 
+  [["jobs", "/jobs"], ["pipelines", "/pipeline_instances"], ["collections", "/collections"]].each do |target,path|
+  test "Test dashboard button all #{target}" do
+      visit page_with_token 'active', '/'
+      click_link "All #{target}"
+      assert_equal path, current_path
+    end
+  end
+
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list