[ARVADOS] updated: 3c2ad38a0335977ce015c1b54267d466d85d2d1b

git at public.curoverse.com git at public.curoverse.com
Fri Jun 6 03:42:21 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb      | 19 +++++++--
 .../app/controllers/collections_controller.rb      |  2 +
 apps/workbench/app/controllers/users_controller.rb |  1 -
 apps/workbench/app/helpers/application_helper.rb   |  3 +-
 apps/workbench/app/views/application/show.html.erb |  3 +-
 apps/workbench/app/views/collections/show.html.erb |  9 +++--
 .../app/views/layouts/application.html.erb         |  2 +-
 .../views/pipeline_instances/_show_inputs.html.erb |  4 +-
 apps/workbench/app/views/users/inactive.html.erb   | 22 +++++++++++
 apps/workbench/app/views/users/welcome.html.erb    | 45 ++++++++++++++--------
 .../test/functional/collections_controller_test.rb | 12 ++++++
 .../test/functional/folders_controller_test.rb     | 11 ++++--
 apps/workbench/test/integration/logins_test.rb     |  3 +-
 13 files changed, 103 insertions(+), 33 deletions(-)
 create mode 100644 apps/workbench/app/views/users/inactive.html.erb

       via  3c2ad38a0335977ce015c1b54267d466d85d2d1b (commit)
       via  d17532201983ac55fc395240f722338f34c7210b (commit)
       via  d9e2cb7b64063741b4b1243f9ad630f55be93840 (commit)
       via  ef378f40946e37c904234f933743e499d981faf3 (commit)
       via  ac84cd774f837fd1feced6e2f535fe4c2e0518a8 (commit)
       via  45648db225a107b6475c04c105f5db3c58570811 (commit)
      from  7df2da959b583d3646b9fde606f9e74d598d4bb9 (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 3c2ad38a0335977ce015c1b54267d466d85d2d1b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 03:32:46 2014 -0400

    2872: Use collection name, not hash, for breadcrumbs/title/activity.

diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb
index 9da8ea1..d6eca3a 100644
--- a/apps/workbench/app/views/application/show.html.erb
+++ b/apps/workbench/app/views/application/show.html.erb
@@ -1,6 +1,7 @@
 <% content_for :page_title do %>
   <%= (@object.respond_to?(:properties) ? @object.properties[:page_title] : nil) ||
-        @object.friendly_link_name %>
+      @name_link.andand.name ||
+      @object.friendly_link_name %>
 <% end %>
 
 <% content_for :content_top do %>
diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb
index 16497c7..25cd845 100644
--- a/apps/workbench/app/views/collections/show.html.erb
+++ b/apps/workbench/app/views/collections/show.html.erb
@@ -44,16 +44,17 @@
 	<input type="text" class="form-control" placeholder="Search"/>
         -->
 	<div style="height:0.5em;"></div>
-        <% if not @logs.andand.any? %>
+        <% name_or_object = @name_link.andand.uuid ? @name_link : @object %>
+        <% if name_or_object.created_at and not @logs.andand.any? %>
           <p>
-            Created: <%= @object.created_at.to_s(:long) %>
+            Created: <%= name_or_object.created_at.to_s(:long) %>
           </p>
           <p>
-            Last modified: <%= @object.modified_at.to_s(:long) %> by <%= link_to_if_arvados_object @object.modified_by_user_uuid, friendly_name: true %>
+            Last modified: <%= name_or_object.modified_at.to_s(:long) %> by <%= link_to_if_arvados_object name_or_object.modified_by_user_uuid, friendly_name: true %>
           </p>
         <% else %>
           <%= render_arvados_object_list_start(@logs, 'Show all activity',
-                logs_path(filters: [['object_uuid','=', at object.uuid]].to_json)) do |log| %>
+                logs_path(filters: [['object_uuid','=',name_or_object.uuid]].to_json)) do |log| %>
           <p>
           <%= time_ago_in_words(log.event_at) rescue 'unknown time' %> ago: <%= log.summary %>
             <% if log.object_uuid %>
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 6359794..32a0f91 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -82,7 +82,7 @@
                   <span class="glyphicon glyphicon-arrow-right"></span>
                 </li>
                 <li>
-                  <%= link_to_if_arvados_object @object, {friendly_name: true}, {data: {object_uuid: @object.andand.uuid, name: 'name'}} %>
+                  <%= link_to_if_arvados_object (@name_link || @object), {friendly_name: true}, {data: {object_uuid: (@name_link.andand.uuid || @object.andand.uuid), name: 'name'}} %>
                 </li>
               <% end %>
             <% end %>

commit d17532201983ac55fc395240f722338f34c7210b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 03:17:32 2014 -0400

    2872: Enable OK/Cancel buttons on editable popup. Lose "close" button.

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index e23376b..552e79e 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -326,8 +326,9 @@ module ApplicationHelper
       "data-title" => "Set value for #{subattr[-1].to_s}",
       "data-name" => dn,
       "data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}",
-      "data-showbuttons" => "false",
       "data-value" => attrvalue,
+      # "clear" button interferes with form-control's up/down arrows
+      "data-clear" => false,
       :class => "editable #{'required' if required} form-control",
       :id => id
     }.merge(htmloptions)

commit d9e2cb7b64063741b4b1243f9ad630f55be93840
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 03:10:36 2014 -0400

    2872: Tweak wording on pipeline inputs page.

diff --git a/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb b/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
index 354ebd2..5106710 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
@@ -32,7 +32,7 @@
 <% end %>
 
 <% if n_inputs == 0 %>
-  <p>This pipeline does not need any further inputs specified. You can start it by clicking the "Run" button.</p>
+  <p>This pipeline does not need any further inputs specified. You can start it by clicking the "Run" button whenever you're ready. (It's not too late to change existing settings, though.)</p>
 <% else %>
   <p><i>Provide <%= n_inputs > 1 ? 'values' : 'a value' %> for the following <%= n_inputs > 1 ? 'parameters' : 'parameter' %>, then click the "Run" button to start the pipeline.</i></p>
   <%= content_for :pi_input_form %>
@@ -47,5 +47,5 @@
 <% end %>
 
 <div style="margin-top: 1em;">
-  <p>Click the "Components" tab above to see a full list of pipeline components and parameters.</p>
+  <p>Click the "Components" tab above to see a full list of pipeline settings.</p>
 </div>

commit ef378f40946e37c904234f933743e499d981faf3
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 03:07:18 2014 -0400

    2872: Fix up login behavior.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 64f5c69..d410da9 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -371,6 +371,12 @@ class ApplicationController < ActionController::Base
     thread_with_api_token(true) do
       if Thread.current[:arvados_api_token]
         yield
+      elsif session[:arvados_api_token]
+        # Expired session. Clear it before refreshing login so that,
+        # if this login procedure fails, we end up showing the "please
+        # log in" page instead of getting stuck in a redirect loop.
+        session.delete :arvados_api_token
+        redirect_to_login
       else
         render 'users/welcome'
       end
diff --git a/apps/workbench/test/integration/logins_test.rb b/apps/workbench/test/integration/logins_test.rb
index 6e5389e..19b6e4b 100644
--- a/apps/workbench/test/integration/logins_test.rb
+++ b/apps/workbench/test/integration/logins_test.rb
@@ -13,10 +13,9 @@ class LoginsTest < ActionDispatch::IntegrationTest
   end
 
   test "expired token yields login page, not error page" do
-    skip
     visit page_with_token('expired_trustedclient')
     # Even the error page has a "Log in" link. We should look for
     # something that only appears the real login page.
-    assert page.has_text? 'Please log in'
+    assert page.has_text? 'log in here with your Google account'
   end
 end

commit ac84cd774f837fd1feced6e2f535fe4c2e0518a8
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 02:49:56 2014 -0400

    2872: Make "inactive" and "not logged in" behavior work on all pages, not just dashboard.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index a5034fd..64f5c69 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -368,8 +368,12 @@ class ApplicationController < ActionController::Base
   end
 
   def thread_with_mandatory_api_token
-    thread_with_api_token do
-      yield
+    thread_with_api_token(true) do
+      if Thread.current[:arvados_api_token]
+        yield
+      else
+        render 'users/welcome'
+      end
     end
   end
 
@@ -403,7 +407,10 @@ class ApplicationController < ActionController::Base
   end
 
   def check_user_agreements
-    if current_user && !current_user.is_active && current_user.is_invited
+    if current_user && !current_user.is_active
+      if not current_user.is_invited
+        return render 'users/inactive'
+      end
       signatures = UserAgreement.signatures
       @signed_ua_uuids = UserAgreement.signatures.map &:head_uuid
       @required_user_agreements = UserAgreement.all.map do |ua|
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 3d8c853..0313de5 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -1,6 +1,5 @@
 class UsersController < ApplicationController
   skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity, :storage]
-  skip_around_filter :thread_with_mandatory_api_token, :only => :welcome
   before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
 
   def welcome
diff --git a/apps/workbench/app/views/users/inactive.html.erb b/apps/workbench/app/views/users/inactive.html.erb
new file mode 100644
index 0000000..5f825e4
--- /dev/null
+++ b/apps/workbench/app/views/users/inactive.html.erb
@@ -0,0 +1,22 @@
+<% content_for :breadcrumbs do raw '<!-- -->' end %>
+
+<div class="row">
+  <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
+    <div class="well clearfix">
+      <%= image_tag "dax.png", style: "width: 147px; height: 197px; max-width: 25%; margin-right: 2em", class: 'pull-left' %>
+
+      <h3>Hi! You're logged in, but...</h3>
+
+      <p>
+
+        Your account is inactive.
+
+      </p><p>
+
+        An administrator must activate your account before you can get
+        any further.
+
+      </p>
+    </div>
+  </div>
+</div>
diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb
index 537041e..9cacebd 100644
--- a/apps/workbench/app/views/users/welcome.html.erb
+++ b/apps/workbench/app/views/users/welcome.html.erb
@@ -1,23 +1,38 @@
 <% content_for :breadcrumbs do raw '<!-- -->' end %>
 
-<%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
-<h1>Hi there!  Please log in to use <%= Rails.configuration.site_name %>.</h1>
-<div class="row-fluid">
-  <div class="col span8" style="margin-top: 1em">
+<div class="row">
+  <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
     <div class="well clearfix">
-      <p>When you click on the button below you will be taken to a Google sign-in page.
-	After entering your information, you will be redirected back to <%= Rails.configuration.site_name %>
-	If you have never used <%= Rails.configuration.site_name %> before, logging in for the first
-	time will also create a new user account. <%= Rails.configuration.site_name %> uses your name and
-	email address from Google services only for identification, and can not access any personal information
-  beyond that.
-  </p>
+      <%= image_tag "dax.png", style: "width: 147px; height: 197px; max-width: 25%; margin-right: 2em", class: 'pull-left' %>
+
+      <h3>Please log in.</h3>
+
+      <p>
+
+        The "Log in" button below will show you a Google sign-in page.
+	After you assure Google that you want to log in here with your
+	Google account, you will be redirected back here to
+	<%= Rails.configuration.site_name %>.
+
+      </p><p>
+
+	If you have never used <%= Rails.configuration.site_name %>
+	before, logging in for the first time will automatically
+	create a new account.
+
+      </p><p>
+
+        <i><%= Rails.configuration.site_name %> uses your name and
+	email address only for identification, and does not retrieve
+	any other personal information from Google.</i>
+
+      </p>
       <p>
-	<a  class="pull-right btn btn-primary" href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">
-	  Click here to log in to <%= Rails.configuration.site_name %> with a Google account</a>
+	<%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "pull-right btn btn-primary" do %>
+          Log in to <%= Rails.configuration.site_name %>
+          <i class="fa fa-fw fa-arrow-circle-right"></i>
+        <% end %>
       </p>
     </div>
   </div>
 </div>
-
-
diff --git a/apps/workbench/test/functional/folders_controller_test.rb b/apps/workbench/test/functional/folders_controller_test.rb
index 2e06cca..8459278 100644
--- a/apps/workbench/test/functional/folders_controller_test.rb
+++ b/apps/workbench/test/functional/folders_controller_test.rb
@@ -1,7 +1,12 @@
 require 'test_helper'
 
 class FoldersControllerTest < ActionController::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+  test "inactive user is asked to sign user agreements on front page" do
+    get :index, {}, session_for(:inactive)
+    assert_response :success
+    assert_not_empty assigns(:required_user_agreements),
+    "Inactive user did not have required_user_agreements"
+    assert_template 'user_agreements/index',
+    "Inactive user was not presented with a user agreement at the front page"
+  end
 end

commit 45648db225a107b6475c04c105f5db3c58570811
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 6 01:50:55 2014 -0400

    2872: Ensure user agreement can be viewed before being accepted.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 24b9b1f..bf57625 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -3,6 +3,8 @@ class CollectionsController < ApplicationController
                      only: [:show_file, :show_file_links])
   skip_before_filter(:find_object_by_uuid,
                      only: [:provenance, :show_file, :show_file_links])
+  # We depend on show_file to display the user agreement:
+  skip_before_filter :check_user_agreements, only: [:show_file]
 
   RELATION_LIMIT = 5
 
diff --git a/apps/workbench/test/functional/collections_controller_test.rb b/apps/workbench/test/functional/collections_controller_test.rb
index 19d08d7..852772a 100644
--- a/apps/workbench/test/functional/collections_controller_test.rb
+++ b/apps/workbench/test/functional/collections_controller_test.rb
@@ -153,4 +153,16 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_not_equal(read_token, session[:arvados_api_token],
                      "using a reader token set the session's API token")
   end
+
+  test "inactive user can retrieve user agreement" do
+    ua_collection = api_fixture('collections')['user_agreement']
+    get :show_file, {
+      uuid: ua_collection['uuid'],
+      file: ua_collection['manifest_text'].match(/ \d+:\d+:(\S+)/)[1]
+    }, session_for(:inactive)
+    assert_nil(assigns(:required_user_agreements),
+               "Did not skip check_user_agreements filter " +
+               "when showing the user agreement.")
+    assert_response :success
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list