[ARVADOS] created: 22a1738ab42e62e6d8d80f02a3b30e78371bde5e

git at public.curoverse.com git at public.curoverse.com
Wed Aug 19 11:26:05 EDT 2015


        at  22a1738ab42e62e6d8d80f02a3b30e78371bde5e (commit)


commit 22a1738ab42e62e6d8d80f02a3b30e78371bde5e
Author: Manoj <jonam33 at gmail.com>
Date:   Tue Aug 11 11:00:05 2015 -0400

    6640: UI updates.

diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 9560bb7..a09de69 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -219,6 +219,10 @@ table.table-fixed-header-row tbody {
     overflow-y: auto;
 }
 
+.dropdown-menu a {
+    cursor: pointer;
+}
+
 .row-fill-height, .row-fill-height>div[class*='col-'] {
     display: flex;
 }
diff --git a/apps/workbench/app/views/application/_projects_tree_menu.html.erb b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
index 4de3c23..77b9d45 100644
--- a/apps/workbench/app/views/application/_projects_tree_menu.html.erb
+++ b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
@@ -1,3 +1,6 @@
+<li role="presentation" class="dropdown-header">
+  My projects
+</li>
 <li>
   <%= project_link_to.call({object: current_user, depth: 0}) do %>
     <span style="padding-left: 0">Home</span>
@@ -11,15 +14,3 @@
     <% end %>
   </li>
 <% end %>
-<li class="divider" />
-<li role="presentation" class="dropdown-header">
-  Projects shared with me
-</li>
-<% shared_project_tree.each do |pnode| %>
-  <% next if pnode[:object].class != Group %>
-  <li>
-    <%= project_link_to.call pnode do %>
-      <span style="padding-left: <%= pnode[:depth]-1 %>em"></span><i class="fa fa-fw fa-share-alt" style="color:#aaa"></i> <%= pnode[:object].name %>
-    <% end %>
-  </li>
-<% end %>
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 2eee6a7..d14bf99 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -34,7 +34,7 @@
                           action_name: 'Show',
                           action_href: url_for(controller: :actions, action: :show),
                           action_method: 'get',
-                          action_data: {selection_param: 'uuid', success: 'redirect-to-created-object', copy_from_search_box: true}.to_json)
+                          action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json)
                          %>">
                 <div class="input-group" style="width: 220px">
                   <input type="text" class="form-control" placeholder="search">
@@ -201,14 +201,31 @@
               <span class="caret"></span>
             </a>
             <ul class="dropdown-menu" style="min-width: 20em" role="menu">
+              <li role="menuitem">
+                  <%= link_to(
+                        url_for(
+                          action: 'choose',
+                          controller: 'search',
+                          filters: [['uuid', 'is_a', 'arvados#group']].to_json,
+                          title: 'Search',
+                          action_name: 'Show',
+                          action_href: url_for(controller: :actions, action: :show),
+                          action_method: 'get',
+                          action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json),
+                { remote: true, method: 'get', title: "Search" }) do %>
+                    <i class="glyphicon fa-fw glyphicon-search"></i> Search all projects ...
+                  <% end %>
+               </li>
               <% if Rails.configuration.anonymous_user_token and Rails.configuration.enable_public_projects_page %>
-                <li><%= link_to 'Browse public projects', "/projects/public", class: 'btn btn-xs btn-default pull-right' %></li>
+                <li role="menuitem"><a href="/projects/public" role="menuitem"><i class="fa fa-fw fa-list"></i> Browse public projects </a>
+                </li>
               <% end %>
-              <li>
-                <%= link_to projects_path(options: {ensure_unique_name: true}), method: :post, class: 'btn btn-xs btn-default pull-right' do %>
-                  <i class="fa fa-plus"></i> Add a new project
+              <li role="menuitem">
+                <%= link_to projects_path(options: {ensure_unique_name: true}), role: 'menu-item', method: :post do %>
+                  <i class="fa fa-fw fa-plus"></i> Add a new project
                 <% end %>
               </li>
+               <li role="presentation" class="divider"></li>
               <%= render partial: "projects_tree_menu", locals: {
                   :project_link_to => Proc.new do |pnode, &block|
                     link_to(project_path(pnode[:object].uuid),
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index afcba93..e497069 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -407,4 +407,21 @@ class ProjectsControllerTest < ActionController::TestCase
     refute_empty css_select("[href=\"/projects/#{project['uuid']}\"]")
     assert_includes @response.body, "<a href=\"/projects/public\">Public Projects</a>"
   end
+
+  test "project menu shows all projects owned" do
+    use_token :user1_with_load
+
+    # API server returns 100 objects per request even if more exist.
+    # So create 101 objects to verify that multiple pages are fetched as needed
+    (1..101).each do |i|
+      Group.create(name: "My new project #{i}", group_class: 'project')
+    end
+
+    # Get all_projects readable by this user
+    all_projects = @controller.send :all_projects
+    refute_nil all_projects
+
+    assert_equal true, all_projects.items_available>101
+    assert_equal all_projects.items_available, all_projects.results.length
+  end
 end
diff --git a/apps/workbench/test/integration/anonymous_access_test.rb b/apps/workbench/test/integration/anonymous_access_test.rb
index 7d3dfab..aabbf00 100644
--- a/apps/workbench/test/integration/anonymous_access_test.rb
+++ b/apps/workbench/test/integration/anonymous_access_test.rb
@@ -19,9 +19,12 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
         assert_text 'Unrestricted public data'
         assert_selector 'a', text: 'Projects'
         page.find("#projects-menu").click
-        assert_selector 'a', text: 'Add a new project'
-        assert_selector 'a', text: 'Browse public projects'
-        assert page.has_text?('Projects shared with me'), 'Not found text - Project shared with me'
+        within('.dropdown-menu') do
+          assert_selector 'a', text: 'Search all projects'
+          assert_selector "a[href=\"/projects/public\"]", text: 'Browse public projects'
+          assert_selector 'a', text: 'Add a new project'
+          assert_selector 'li[class="dropdown-header"]', text: 'My projects'
+        end
       else
         assert_text 'indicate that you have read and accepted the user agreement'
       end
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index ba36220..61ba162 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -24,9 +24,10 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       else
         assert page.has_link?("Projects"), 'Not found link - Projects'
         page.find("#projects-menu").click
-        assert_selector 'a', text: 'Add a new project'
+        assert_selector 'a', text: 'Search all projects'
         assert_no_selector 'a', text: 'Browse public projects'
-        assert page.has_text?('Projects shared with me'), 'Not found text - Project shared with me'
+        assert_selector 'a', text: 'Add a new project'
+        assert_selector 'li[class="dropdown-header"]', text: 'My projects'
       end
     elsif invited
       assert page.has_text?('Please check the box below to indicate that you have read and accepted the user agreement'), 'Not found text - Please check the box below . . .'
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index dc54b8d..5703e18 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -382,9 +382,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
       my_project = api_fixture('groups')['aproject']
       my_collection = api_fixture('collections')['collection_to_move_around_in_aproject']
 
-      visit page_with_token user, '/'
-      find("#projects-menu").click
-      find(".dropdown-menu a", text: my_project['name']).click
+      visit page_with_token user, "/projects/#{my_project['uuid']}"
       click_link 'Data collections'
       assert page.has_text?(my_collection['name']), 'Collection not found in project'
 
@@ -689,4 +687,26 @@ class ProjectsTest < ActionDispatch::IntegrationTest
       assert_no_selector 'li.disabled', text: 'Copy selected'
     end
   end
+
+  test "test search all projects menu item in projects menu" do
+     need_selenium
+     visit page_with_token('active')
+     find('#projects-menu').click
+     within('.dropdown-menu') do
+       assert_selector 'a', text: 'Search all projects'
+       find('a', text: 'Search all projects').click
+     end
+     within('.modal-content') do
+        assert page.has_text?('All projects'), 'No text - All projects'
+        assert page.has_text?('Search'), 'No text - Search'
+        assert page.has_text?('Cancel'), 'No text - Cancel'
+        fill_in "Search", with: 'Unrestricted public data'
+        wait_for_ajax
+        assert_selector 'div', text: 'Unrestricted public data'
+        find(:xpath, '//*[@id="choose-scroll"]/div[2]/div').click
+        click_button 'Show'
+     end
+     assert page.has_text?('Unrestricted public data'), 'No text - Unrestriced public data'
+     assert page.has_text?('An anonymously accessible project'), 'No text - An anonymously accessible project'
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list