[ARVADOS] updated: 7b9529d616cdf9022392321dc055f668a1a1ba62

git at public.curoverse.com git at public.curoverse.com
Mon Aug 11 18:22:04 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb      |  26 ++--
 apps/workbench/app/helpers/application_helper.rb   |   2 +-
 .../app/views/application/_choose.html.erb         |  13 +-
 apps/workbench/app/views/users/profile.html.erb    |  36 ++---
 apps/workbench/config/application.default.yml      |  15 +-
 .../test/integration/application_layout_test.rb    | 156 +++++++++++--------
 .../test/integration/pipeline_instances_test.rb    |   1 +
 doc/_config.yml                                    |   2 +-
 ...py.liquid => _concurrent_hash_script_py.liquid} |   0
 .../topics/tutorial-job-debug.html.textile.liquid  | 163 --------------------
 .../topics/tutorial-parallel.html.textile.liquid   |  22 +--
 .../tutorial-firstscript.html.textile.liquid       | 165 ++++++++-------------
 ...uid => tutorial-submit-job.html.textile.liquid} |  11 +-
 sdk/cli/bin/arv-run-pipeline-instance              |  33 +++--
 sdk/cli/bin/crunch-job                             |  23 ++-
 services/api/app/models/user.rb                    |  17 +--
 services/api/script/crunch-dispatch.rb             |   6 +-
 17 files changed, 264 insertions(+), 427 deletions(-)
 rename doc/_includes/{_parallel_hash_script_py.liquid => _concurrent_hash_script_py.liquid} (100%)
 delete mode 100644 doc/user/topics/tutorial-job-debug.html.textile.liquid
 copy doc/user/tutorials/{tutorial-firstscript.html.textile.liquid => tutorial-submit-job.html.textile.liquid} (90%)

       via  7b9529d616cdf9022392321dc055f668a1a1ba62 (commit)
       via  7c4b27bff2d9ad383689217b068b3ba70d463def (commit)
       via  1626b1014244622928ebd98498b73282052439d6 (commit)
       via  a6010696b246cc43c721a35d56179c629d54e798 (commit)
       via  e8a6a6726da065dc650913a101279717f3bc35e8 (commit)
       via  6c91320c3a53ddbe1b81bee8ed6322c20acbd047 (commit)
       via  f45b07b22f6d6e4169899d1d036610c29a7f495d (commit)
       via  aa923c951ff68e7131628c449b5e2f8a74e2a21e (commit)
       via  965bf2a51134ed26fb23d2209d9a0d319fe05744 (commit)
       via  cd3a0b27c6985f72d58581d43c7cd6686a977f56 (commit)
       via  7f4ff745bfd5356e885e13b4984d93c5c5b204f1 (commit)
       via  774a5d8543e7335a8580c7c86f2436b96aff1024 (commit)
       via  872cf2e096a7b72722aa76040339a23e962cdf96 (commit)
       via  802fd8ec8df8a36029c76b20e472f78c09772950 (commit)
       via  7ea5d6161e4eab67795fbe2758d98822a9a03f13 (commit)
       via  cedd2b046ddf4d2f819a4d1dedbbe82d4e70e72d (commit)
       via  612d5fd9a0066665b522997f025499460d9edf43 (commit)
       via  b79c440b6af5cf4855e3fb3fb510b3eb8de1da9c (commit)
       via  fb0585a11cc10929cd8121ddd219855172754ef3 (commit)
      from  9e5af4afef0f70222515214fb4778389c0d364d9 (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 7b9529d616cdf9022392321dc055f668a1a1ba62
Merge: 7c4b27b a601069
Author: radhika <radhika at curoverse.com>
Date:   Mon Aug 11 18:21:12 2014 -0400

    Merge branch 'master' into 3296-user-profile


commit 7c4b27bff2d9ad383689217b068b3ba70d463def
Author: radhika <radhika at curoverse.com>
Date:   Mon Aug 11 18:20:39 2014 -0400

    3296: break the tests into multiple tests

diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 1426b9d..aae6dc2 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -61,20 +61,6 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         end
       end
     end
-
-    # check help menu
-    check_help_menu
-
-    if user && user['is_active']
-      # check system menu
-      check_system_menu user
-
-      # test manage account page
-      check_manage_account_page user
-
-      # check search box
-      check_search_box user
-    end
   end
 
   # test the help menu
@@ -89,8 +75,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     end
   end
 
-  # test the system menu
-  def check_system_menu user
+  def verify_system_menu user
     if user && user['is_active']
       look_for_add_new = nil
       within('.navbar-fixed-top') do
@@ -127,43 +112,45 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
   end
 
   # test manage_account page
-  def check_manage_account_page user
-    within('.navbar-fixed-top') do
-      find('a', text: "#{user['email']}").click
-      within('.dropdown-menu') do
-        find('a', text: 'Manage account').click
+  def verify_manage_account user
+    if user && user['is_active']
+      within('.navbar-fixed-top') do
+        find('a', text: "#{user['email']}").click
+        within('.dropdown-menu') do
+          find('a', text: 'Manage account').click
+        end
       end
-    end
-
-    # now in manage account page
-    assert page.has_text? 'Virtual Machines'
-    assert page.has_text? 'Repositories'
-    assert page.has_text? 'SSH Keys'
-    assert page.has_text? 'Current Token'
 
-    assert page.has_text? 'The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados'
+      # now in manage account page
+      assert page.has_text? 'Virtual Machines'
+      assert page.has_text? 'Repositories'
+      assert page.has_text? 'SSH Keys'
+      assert page.has_text? 'Current Token'
 
-    click_link 'Add new SSH key'
+      assert page.has_text? 'The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados'
 
-    within '.modal-content' do
-      assert page.has_text? 'Public Key'
-      assert page.has_button? 'Cancel'
-      assert page.has_button? 'Submit'
+      click_link 'Add new SSH key'
 
-      page.find_field('public_key').set 'first test with an incorrect ssh key value'
-      click_button 'Submit'
-      assert page.has_text? 'Public key does not appear to be a valid ssh-rsa or dsa public key'
-
-      public_key_str = api_fixture('authorized_keys')['active']['public_key']
-      page.find_field('public_key').set public_key_str
-      page.find_field('name').set 'added_in_test'
-      click_button 'Submit'
-      assert page.has_text? 'Public key already exists in the database, use a different key.'
-
-      new_key = SSHKey.generate
-      page.find_field('public_key').set new_key.ssh_public_key
-      page.find_field('name').set 'added_in_test'
-      click_button 'Submit'
+      within '.modal-content' do
+        assert page.has_text? 'Public Key'
+        assert page.has_button? 'Cancel'
+        assert page.has_button? 'Submit'
+
+        page.find_field('public_key').set 'first test with an incorrect ssh key value'
+        click_button 'Submit'
+        assert page.has_text? 'Public key does not appear to be a valid ssh-rsa or dsa public key'
+
+        public_key_str = api_fixture('authorized_keys')['active']['public_key']
+        page.find_field('public_key').set public_key_str
+        page.find_field('name').set 'added_in_test'
+        click_button 'Submit'
+        assert page.has_text? 'Public key already exists in the database, use a different key.'
+
+        new_key = SSHKey.generate
+        page.find_field('public_key').set new_key.ssh_public_key
+        page.find_field('name').set 'added_in_test'
+        click_button 'Submit'
+      end
     end
 
     # key must be added. look for it in the refreshed page
@@ -218,8 +205,8 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
   end
 
   # test the search box
-  def check_search_box user
-    if user
+  def verify_search_box user
+    if user && user['is_active']
       # let's search for a valid uuid
       within('.navbar-fixed-top') do
         page.find_field('search').set user['uuid']
@@ -306,4 +293,55 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     end
   end
 
+  [
+    [nil, nil, false, false],
+    ['inactive', api_fixture('users')['inactive'], true, false],
+    ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false],
+    ['active', api_fixture('users')['active'], true, true],
+    ['admin', api_fixture('users')['admin'], true, true],
+    ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
+  ].each do |token, user, invited, has_profile|
+    test "check help for user #{token}" do
+      Rails.configuration.user_profile_form_fields = false
+
+      if !token
+        visit ('/')
+      else
+        visit page_with_token(token)
+      end
+
+      check_help_menu
+    end
+  end
+
+  [
+    ['active', api_fixture('users')['active'], true, true],
+    ['admin', api_fixture('users')['admin'], true, true],
+  ].each do |token, user|
+    test "test system menu for user #{token}" do
+      visit page_with_token(token)
+      verify_system_menu user
+    end
+  end
+
+  [
+    ['active', api_fixture('users')['active'], true, true],
+    ['admin', api_fixture('users')['admin'], true, true],
+  ].each do |token, user|
+    test "test manage account for user #{token}" do
+      visit page_with_token(token)
+      verify_manage_account user
+    end
+  end
+
+  [
+    ['active', api_fixture('users')['active'], true, true],
+    ['admin', api_fixture('users')['admin'], true, true],
+  ].each do |token, user|
+    test "test search for user #{token}" do
+      visit page_with_token(token)
+      verify_search_box user
+    end
+  end
+
 end

commit 1626b1014244622928ebd98498b73282052439d6
Author: radhika <radhika at curoverse.com>
Date:   Mon Aug 11 18:00:22 2014 -0400

    3296: minor updates to profile page display

diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index 085d97a..2c40fef 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -26,13 +26,13 @@
               <p style="margin: 8px;">Thank you for filling in your profile. If you are done updating your profile,
                  you can now access Arvados Workbench by clicking on this button.
                   <form action="<%=target%>">
-                    <input style="margin-left: 8px;" class="btn btn-primary" type="submit" value="Take me to my page">
+                    <input style="margin-left: 8px;" class="btn btn-primary" type="submit" value="Access Arvados Workbench">
                   </form>
               </p>
             </div>
           <% else %>
             <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
-              <p style="margin: 8px;"> <%=profile_message%> </p>
+              <p style="margin: 8px;"> <%=raw(profile_message)%> </p>
             </div>
           <% end %>
 
@@ -41,25 +41,25 @@
               <%= hidden_field_tag :return_to, return_to_url %>
               <div class="form-group">
                   <label for="email" class="col-sm-3 control-label"> Email </label>
-                  <div class="col-sm-9">
+                  <div class="col-sm-8">
                     <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="first_name" class="col-sm-3 control-label"> First name </label>
-                  <div class="col-sm-9">
+                  <div class="col-sm-8">
                     <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="last_name" class="col-sm-3 control-label"> Last name </label>
-                  <div class="col-sm-9">
+                  <div class="col-sm-8">
                     <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
-                  <div class="col-sm-9">
+                  <div class="col-sm-8">
                     <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
                   </div>
               </div>
@@ -96,7 +96,7 @@
 
               <% if show_save_button %>
                 <div class="form-group">
-                  <div class="col-sm-offset-3 col-sm-9">
+                  <div class="col-sm-offset-3 col-sm-8">
                     <button type="submit" class="btn btn-primary">Save profile</button>
                   </div>
                 </div>
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index bef907d..1426b9d 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -210,7 +210,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     click_button "Save profile"
     # profile saved and in profile page now with success
     assert page.has_text? 'Thank you for filling in your profile'
-    click_button 'Take me to my page'
+    click_button 'Access Arvados Workbench'
 
     # profile saved and in home page now
     assert page.has_text? 'My projects'

commit e8a6a6726da065dc650913a101279717f3bc35e8
Author: radhika <radhika at curoverse.com>
Date:   Mon Aug 11 17:47:54 2014 -0400

    3296: split profile config into two parameters: one for fields and one for message.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 4385f81..0802113 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -506,36 +506,38 @@ class ApplicationController < ActionController::Base
   end
 
   def check_user_profile
-    profile_config = Rails.configuration.user_profile_form_fields
-
     if request.method.downcase != 'get' || params[:partial] ||
        params[:tab_pane] || params[:action_method] ||
        params[:action] == 'setup_popup'
       return true
     end
 
-    if current_user && profile_config
-      missing_required_profile = false
+    if missing_required_profile?
+      render 'users/profile'
+    end
+    true
+  end
 
-      user_prefs = current_user.prefs
-      current_user_profile = user_prefs[:profile] if user_prefs
+  helper_method :missing_required_profile?
+  def missing_required_profile?
+    missing_required = false
 
+    profile_config = Rails.configuration.user_profile_form_fields
+    if current_user && profile_config
+      current_user_profile = current_user.prefs[:profile]
       profile_config.kind_of?(Array) && profile_config.andand.each do |entry|
         if entry['required']
           if !current_user_profile ||
              !current_user_profile[entry['key'].to_sym] ||
              current_user_profile[entry['key'].to_sym].empty?
-            missing_required_profile = true
+            missing_required = true
             break
           end
         end
       end
-
-      if missing_required_profile
-        render 'users/profile'
-      end
     end
-    true
+
+    missing_required
   end
 
   def select_theme
diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index 906ca48..085d97a 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -3,21 +3,9 @@
     current_user_profile = current_user.prefs[:profile]
     show_save_button = false
 
-    profile_message = 'You can manage your profile using this page. Any feilds in red are required and missing.
-                       Please fill in those fields before you can accesse Arvados Workbench.'
-              
-    missing_required_profile = false
-    profile_config.kind_of?(Array) && profile_config.andand.each do |entry|
-      if entry['message']
-        profile_message = entry['message']
-      else    # key
-        if !current_user_profile ||
-           !current_user_profile[entry['key'].to_sym] ||
-           current_user_profile[entry['key'].to_sym].empty?
-          missing_required_profile = true
-        end
-      end
-    end
+    profile_message = Rails.configuration.user_profile_form_message ? Rails.configuration.user_profile_form_message : 'You can manage your profile using this page. Any feilds in red are required and missing. Please fill in those fields before you can accesse Arvados Workbench.'
+
+    missing_required = missing_required_profile?
 
     profile_url = '/users/'+current_user.uuid+'/profile'
     target = request.url.partition('?target=')[-1]
@@ -33,9 +21,9 @@
           </h4>
         </div>
         <div class="panel-body">
-          <% if !missing_required_profile && params.andand.keys.include?('target') %>
+          <% if !missing_required && params.andand.keys.include?('target') %>
             <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
-              <p style="margin: 8px;">Thank you for filling in your profile. If you are done updating your profile, 
+              <p style="margin: 8px;">Thank you for filling in your profile. If you are done updating your profile,
                  you can now access Arvados Workbench by clicking on this button.
                   <form action="<%=target%>">
                     <input style="margin-left: 8px;" class="btn btn-primary" type="submit" value="Take me to my page">
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index b639350..32e1495 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -60,7 +60,6 @@ test:
 
   # Enable user profile with one required field
   user_profile_form_fields:
-    - message: Welcome to Curoverse.
     - key: organization
       type: text
       form_field_title: Institution
@@ -99,15 +98,12 @@ common:
   # Default is set to false. A commented setting with full description is provided below.
   user_profile_form_fields: false
 
-  # Below is a sample setting of user_profile_form_fields.
+  # Below is a sample setting of user_profile_form_fields config parameter.
   # This configuration parameter should be set to either false (to disable) or
-  # to an array as shown below. This parameter supports two types of fields,
-  # an optional "message" and an optional list of input fields.
-  # Use "message" to configure the message you want to display at the top of the
-  # profile page. If this is not provided, a default message will be displayed.
+  # to an array as shown below. 
   # Configure the list of input fields to be displayed in the profile page
   # using the attribute "key" for each of the input fields.
-  # This sample shows configuration with message and two input fields.
+  # This sample shows configuration with one required and one optional form fields.
   # For each of these input fields:
   #   You can specify "type" as "text" or "select".
   #   List the "options" to be displayed for each of the "select" menu.
@@ -115,7 +111,6 @@ common:
   # If any of the required fields are missing in the user's profile, the user will be
   # redirected to the profile page before they can access any Workbench features.
   #user_profile_form_fields:
-  #  - message: Welcome to Curoverse. Any fields in red are required and missing. Please fill in those fields before you can access Arvados Workbench.
   #  - key: organization
   #    type: text
   #    form_field_title: Institution/Company
@@ -132,3 +127,7 @@ common:
   #      - Software developer
   #      - IT
   #      - Other
+
+  # Use "user_profile_form_message" to configure the message you want to display in
+  # the profile page. If this is not provided, a default message will be displayed.
+  user_profile_form_message: Welcome to Arvados. Please fill in all required fields before you can access Arvados Workbench.
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 21406b0..bef907d 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -192,18 +192,14 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     assert page.has_text? 'Save profile'
 
     # This time fill in required field and then save. Expect to go to requested page after that.
-    profile_config = Rails.configuration.user_profile_form_fields
-    profile_message = ''
+    profile_message = Rails.configuration.user_profile_form_message
     required_field_title = ''
     required_field_key = ''
-    profile_config.andand.each do |entry| 
-      if entry['message']
-        profile_message = entry['message']
-      else
-        if entry['required']
-          required_field_key = entry['key']
-          required_field_title = entry['form_field_title']
-        end
+    profile_config = Rails.configuration.user_profile_form_fields
+    profile_config.andand.each do |entry|
+      if entry['required']
+        required_field_key = entry['key']
+        required_field_title = entry['form_field_title']
       end
     end
 

commit f45b07b22f6d6e4169899d1d036610c29a7f495d
Author: radhika <radhika at curoverse.com>
Date:   Mon Aug 11 16:36:18 2014 -0400

    3296: check for prefs_changed instead of cycling through all changes.

diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 7cd6ac4..072ad49 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -200,19 +200,6 @@ class User < ArvadosModel
     self.save!
   end
 
-  # update current user profile
-  def profile updated_profile
-    user_profile = self.prefs['profile']
-    user_profile ||= {}
-    updated_profile.each do |entry|
-      if entry[0].starts_with? 'profile_'
-        user_profile[entry[0].partition('_').last] = entry[1]
-      end
-    end
-    self.prefs['profile'] = user_profile
-    self.save!
-  end
-
   protected
 
   def ensure_ownership_path_leads_to_user
@@ -447,8 +434,8 @@ class User < ArvadosModel
 
   # Send notification if the user saved profile for the first time
   def send_profile_created_notification
-    if self.changes.andand.include?(:prefs)
-      if !self.changes[:prefs][0].andand.keys.andand.any?
+    if self.prefs_changed?
+      if self.prefs_was.andand.empty?
         profile_notification_address = Rails.configuration.user_profile_notification_address
         ProfileNotifier.profile_created(self, profile_notification_address).deliver if profile_notification_address
       end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list