From e08c67024acccb83a30d2010c34862973b883585 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Sat, 7 Jun 2014 11:36:58 -0400 Subject: [PATCH] 2872: Rename folders to projects --- .../app/assets/javascripts/selection.js | 2 +- .../{folders.css.scss => projects.css.scss} | 4 +- .../app/controllers/actions_controller.rb | 2 +- .../app/controllers/application_controller.rb | 20 ++++----- .../app/controllers/collections_controller.rb | 6 +-- .../app/controllers/groups_controller.rb | 9 ++-- ...s_controller.rb => projects_controller.rb} | 26 ++++++------ .../app/helpers/application_helper.rb | 4 +- apps/workbench/app/helpers/folders_helper.rb | 2 - apps/workbench/app/helpers/projects_helper.rb | 2 + apps/workbench/app/models/arvados_base.rb | 2 +- apps/workbench/app/models/collection.rb | 2 +- apps/workbench/app/models/group.rb | 4 +- apps/workbench/app/models/human.rb | 2 +- apps/workbench/app/models/job.rb | 2 +- .../workbench/app/models/pipeline_instance.rb | 2 +- .../workbench/app/models/pipeline_template.rb | 2 +- apps/workbench/app/models/specimen.rb | 2 +- apps/workbench/app/models/trait.rb | 2 +- .../app/views/application/_content.html.erb | 8 ++-- .../application/_selection_checkbox.html.erb | 2 +- .../views/application/_show_recent.html.erb | 4 +- .../app/views/collections/show.html.erb | 10 ++--- .../app/views/folders/_index_folders.html.erb | 31 -------------- .../app/views/layouts/application.html.erb | 3 +- .../views/pipeline_instances/compare.html.erb | 2 +- .../{folders => projects}/_choose.html.erb | 20 ++++----- .../{folders => projects}/_choose.js.erb | 0 .../_index_jobs_and_pipelines.html.erb | 0 .../views/projects/_index_projects.html.erb | 31 ++++++++++++++ .../_show_contents.html.erb | 18 ++++---- .../_show_contents_rows.html.erb | 4 +- .../_show_featured.html.erb | 0 .../_show_permissions.html.erb | 10 ++--- .../{folders => projects}/index.html.erb | 16 +++---- .../{folders => projects}/remove_items.js.erb | 0 apps/workbench/config/routes.rb | 4 +- .../functional/collections_controller_test.rb | 8 ++-- ...er_test.rb => projects_controller_test.rb} | 2 +- .../test/integration/collections_test.rb | 2 +- .../integration/pipeline_instances_test.rb | 24 +++++------ .../{folders_test.rb => projects_test.rb} | 42 +++++++++---------- .../test/unit/arvados_resource_list_test.rb | 12 +++--- apps/workbench/test/unit/group_test.rb | 12 +++--- .../test/unit/helpers/folders_helper_test.rb | 4 -- .../test/unit/helpers/projects_helper_test.rb | 4 ++ ...50616_rename_folder_to_project.rb_deferred | 9 ++++ services/api/test/fixtures/groups.yml | 14 +++---- services/api/test/fixtures/links.yml | 18 ++++---- services/api/test/fixtures/specimens.yml | 8 ++-- .../functional/arvados/v1/filters_test.rb | 4 +- .../arvados/v1/groups_controller_test.rb | 42 +++++++++---------- .../arvados/v1/links_controller_test.rb | 6 +-- services/api/test/unit/group_test.rb | 2 +- services/api/test/unit/link_test.rb | 10 ++--- services/api/test/unit/owner_test.rb | 2 +- 56 files changed, 250 insertions(+), 235 deletions(-) rename apps/workbench/app/assets/stylesheets/{folders.css.scss => projects.css.scss} (70%) rename apps/workbench/app/controllers/{folders_controller.rb => projects_controller.rb} (86%) delete mode 100644 apps/workbench/app/helpers/folders_helper.rb create mode 100644 apps/workbench/app/helpers/projects_helper.rb delete mode 100644 apps/workbench/app/views/folders/_index_folders.html.erb rename apps/workbench/app/views/{folders => projects}/_choose.html.erb (57%) rename apps/workbench/app/views/{folders => projects}/_choose.js.erb (100%) rename apps/workbench/app/views/{folders => projects}/_index_jobs_and_pipelines.html.erb (100%) create mode 100644 apps/workbench/app/views/projects/_index_projects.html.erb rename apps/workbench/app/views/{folders => projects}/_show_contents.html.erb (84%) rename apps/workbench/app/views/{folders => projects}/_show_contents_rows.html.erb (71%) rename apps/workbench/app/views/{folders => projects}/_show_featured.html.erb (100%) rename apps/workbench/app/views/{folders => projects}/_show_permissions.html.erb (79%) rename apps/workbench/app/views/{folders => projects}/index.html.erb (80%) rename apps/workbench/app/views/{folders => projects}/remove_items.js.erb (100%) rename apps/workbench/test/functional/{folders_controller_test.rb => projects_controller_test.rb} (87%) rename apps/workbench/test/integration/{folders_test.rb => projects_test.rb} (60%) delete mode 100644 apps/workbench/test/unit/helpers/folders_helper_test.rb create mode 100644 apps/workbench/test/unit/helpers/projects_helper_test.rb create mode 100644 services/api/db/migrate/20140607150616_rename_folder_to_project.rb_deferred diff --git a/apps/workbench/app/assets/javascripts/selection.js b/apps/workbench/app/assets/javascripts/selection.js index 59f0fd184f..84d65cda2d 100644 --- a/apps/workbench/app/assets/javascripts/selection.js +++ b/apps/workbench/app/assets/javascripts/selection.js @@ -58,7 +58,7 @@ jQuery(function($){ if (lst.length > 0) { html = '
  • Clear selections
  • '; if (this_object_uuid.match('-j7d0g-')) - html += '
  • '; + html += '
  • '; html += '
  • ' diff --git a/apps/workbench/app/assets/stylesheets/folders.css.scss b/apps/workbench/app/assets/stylesheets/projects.css.scss similarity index 70% rename from apps/workbench/app/assets/stylesheets/folders.css.scss rename to apps/workbench/app/assets/stylesheets/projects.css.scss index aa5f14cfaa..53b352d5e7 100644 --- a/apps/workbench/app/assets/stylesheets/folders.css.scss +++ b/apps/workbench/app/assets/stylesheets/projects.css.scss @@ -1,9 +1,9 @@ -.arv-folder-list > .row { +.arv-project-list > .row { padding-top: 5px; padding-bottom: 5px; padding-right: 1em; } -.arv-folder-list > .row.folder:hover { +.arv-project-list > .row.project:hover { background: #d9edf7; } div.scroll-20em { diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb index cbe34052bc..06775fc924 100644 --- a/apps/workbench/app/controllers/actions_controller.rb +++ b/apps/workbench/app/controllers/actions_controller.rb @@ -19,7 +19,7 @@ class ActionsController < ApplicationController redirect_to :back end - expose_action :copy_selections_into_folder do + expose_action :copy_selections_into_project do link_selections = Link.filter([['uuid','in',params["selection"]]]) link_uuids = link_selections.collect(&:uuid) diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 12f9c70c1a..9627ab6d79 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -501,14 +501,14 @@ class ApplicationController < ActionController::Base end end - helper_method :my_folders - def my_folders - return @my_folders if @my_folders - @my_folders = [] + helper_method :my_projects + def my_projects + return @my_projects if @my_projects + @my_projects = [] root_of = {} - Group.filter([['group_class','=','folder']]).each do |g| + Group.filter([['group_class','in',['project','folder']]]).each do |g| root_of[g.uuid] = g.owner_uuid - @my_folders << g + @my_projects << g end done = false while not done @@ -522,16 +522,16 @@ class ApplicationController < ActionController::Base end end end - @my_folders = @my_folders.select do |g| + @my_projects = @my_projects.select do |g| root_of[g.uuid] == current_user.uuid end end helper_method :recent_jobs_and_pipelines def recent_jobs_and_pipelines - in_my_folders = ['owner_uuid','in',my_folders.collect(&:uuid)] - (Job.limit(10).filter([in_my_folders]) | - PipelineInstance.limit(10).filter([in_my_folders])). + in_my_projects = ['owner_uuid','in',my_projects.collect(&:uuid)] + (Job.limit(10).filter([in_my_projects]) | + PipelineInstance.limit(10).filter([in_my_projects])). sort_by do |x| x.finished_at || x.started_at || x.created_at rescue x.created_at end diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index bf57625859..0148b72d26 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -157,10 +157,10 @@ class CollectionsController < ApplicationController end @output_of = jobs_with.call(output: @object.uuid) @log_of = jobs_with.call(log: @object.uuid) - folder_links = Link.limit(RELATION_LIMIT).order("modified_at DESC") + project_links = Link.limit(RELATION_LIMIT).order("modified_at DESC") .where(head_uuid: @object.uuid, link_class: 'name').results - folder_hash = Group.where(uuid: folder_links.map(&:tail_uuid)).to_hash - @folders = folder_links.map { |link| folder_hash[link.tail_uuid] } + project_hash = Group.where(uuid: project_links.map(&:tail_uuid)).to_hash + @projects = project_links.map { |link| project_hash[link.tail_uuid] } @permissions = Link.limit(RELATION_LIMIT).order("modified_at DESC") .where(head_uuid: @object.uuid, link_class: 'permission', name: 'can_read').results diff --git a/apps/workbench/app/controllers/groups_controller.rb b/apps/workbench/app/controllers/groups_controller.rb index 854496a56a..f97bb20f13 100644 --- a/apps/workbench/app/controllers/groups_controller.rb +++ b/apps/workbench/app/controllers/groups_controller.rb @@ -1,13 +1,16 @@ class GroupsController < ApplicationController def index - @groups = Group.filter [['group_class', 'not in', ['folder']]] + @groups = Group.filter [['group_class', 'not in', ['folder', 'project']]] @group_uuids = @groups.collect &:uuid @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids end def show - return redirect_to(folder_path(@object)) if @object.group_class == 'folder' - super + if @object.group_class.in?(['project','folder']) + redirect_to(project_path(@object)) + else + super + end end end diff --git a/apps/workbench/app/controllers/folders_controller.rb b/apps/workbench/app/controllers/projects_controller.rb similarity index 86% rename from apps/workbench/app/controllers/folders_controller.rb rename to apps/workbench/app/controllers/projects_controller.rb index ab7dcecc47..f73b6c074c 100644 --- a/apps/workbench/app/controllers/folders_controller.rb +++ b/apps/workbench/app/controllers/projects_controller.rb @@ -1,10 +1,10 @@ -class FoldersController < ApplicationController +class ProjectsController < ApplicationController def model_class Group end def index_pane_list - %w(Folders) + %w(Projects) end def show_pane_list @@ -14,7 +14,7 @@ class FoldersController < ApplicationController def remove_item params[:item_uuids] = [params[:item_uuid]] remove_items - render template: 'folders/remove_items' + render template: 'projects/remove_items' end def remove_items @@ -25,7 +25,7 @@ class FoldersController < ApplicationController item.link_class == 'name' and item.tail_uuid == @object.uuid) # Given uuid is a name link, linking an object to this - # folder. First follow the link to find the item we're removing, + # project. First follow the link to find the item we're removing, # then delete the link. links << item item = ArvadosBase.find item.head_uuid @@ -40,7 +40,7 @@ class FoldersController < ApplicationController link.destroy end if item.owner_uuid == @object.uuid - # Object is owned by this folder. Remove it from the folder by + # Object is owned by this project. Remove it from the project by # changing owner to the current user. item.update_attributes owner_uuid: current_user.uuid @removed_uuids << item.uuid @@ -49,7 +49,9 @@ class FoldersController < ApplicationController end def find_objects_for_index - @objects = Group.where(group_class: 'folder').order('name') + @objects = Group. + filter([['group_class','in',['project','folder']]]). + order('name') super parent_of = {current_user.uuid => 'me'} @objects.each do |ob| @@ -81,9 +83,9 @@ class FoldersController < ApplicationController end paths end - @my_folder_tree = + @my_project_tree = sorted_paths.call buildtree.call(children_of, 'me') - @shared_folder_tree = + @shared_project_tree = sorted_paths.call({'Shared with me' => buildtree.call(children_of, false)}) end @@ -121,7 +123,7 @@ class FoldersController < ApplicationController formats: [:html], locals: { objects_and_names: @objects_and_names, - folder: @object + project: @object }), next_page_href: (next_page_offset and url_for(offset: next_page_offset, partial: true)) @@ -134,13 +136,13 @@ class FoldersController < ApplicationController end def create - @new_resource_attrs = (params['folder'] || {}).merge(group_class: 'folder') - @new_resource_attrs[:name] ||= 'New folder' + @new_resource_attrs = (params['project'] || {}).merge(group_class: 'project') + @new_resource_attrs[:name] ||= 'New project' super end def update - @updates = params['folder'] + @updates = params['project'] super end end diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb index fd13bc4a8a..784958b8b0 100644 --- a/apps/workbench/app/helpers/application_helper.rb +++ b/apps/workbench/app/helpers/application_helper.rb @@ -136,7 +136,7 @@ module ApplicationHelper attrvalue = object.send(attr) if attrvalue.nil? if !object.attribute_editable?(attr, :ever) or (!object.editable? and - !object.owner_uuid.in?(my_folders.collect(&:uuid))) + !object.owner_uuid.in?(my_projects.collect(&:uuid))) return ((attrvalue && attrvalue.length > 0 && attrvalue) || (attr == 'name' and object.andand.default_name) || '(none)') @@ -222,7 +222,7 @@ module ApplicationHelper if !object or !object.attribute_editable?(attr, :ever) or (!object.editable? and - !object.owner_uuid.in?(my_folders.collect(&:uuid))) + !object.owner_uuid.in?(my_projects.collect(&:uuid))) return link_to_if_arvados_object attrvalue end diff --git a/apps/workbench/app/helpers/folders_helper.rb b/apps/workbench/app/helpers/folders_helper.rb deleted file mode 100644 index d27e7b4fb6..0000000000 --- a/apps/workbench/app/helpers/folders_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module FoldersHelper -end diff --git a/apps/workbench/app/helpers/projects_helper.rb b/apps/workbench/app/helpers/projects_helper.rb new file mode 100644 index 0000000000..db5c5ce1a7 --- /dev/null +++ b/apps/workbench/app/helpers/projects_helper.rb @@ -0,0 +1,2 @@ +module ProjectsHelper +end diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb index 590f6282e9..a66b3903d6 100644 --- a/apps/workbench/app/models/arvados_base.rb +++ b/apps/workbench/app/models/arvados_base.rb @@ -294,7 +294,7 @@ class ArvadosBase < ActiveRecord::Base current_user end - def self.goes_in_folders? + def self.goes_in_projects? false end diff --git a/apps/workbench/app/models/collection.rb b/apps/workbench/app/models/collection.rb index 2825618b5c..008d108fd4 100644 --- a/apps/workbench/app/models/collection.rb +++ b/apps/workbench/app/models/collection.rb @@ -6,7 +6,7 @@ class Collection < ArvadosBase !!locator.to_s.match("^#{MD5_EMPTY}(\\+.*)?\$") end - def self.goes_in_folders? + def self.goes_in_projects? true end diff --git a/apps/workbench/app/models/group.rb b/apps/workbench/app/models/group.rb index 638f6e884a..9e627bf66e 100644 --- a/apps/workbench/app/models/group.rb +++ b/apps/workbench/app/models/group.rb @@ -1,5 +1,5 @@ class Group < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end @@ -13,7 +13,7 @@ class Group < ArvadosBase end def class_for_display - group_class == 'folder' ? 'Folder' : super + group_class.in?(['folder', 'project']) ? 'Project' : super end def editable? diff --git a/apps/workbench/app/models/human.rb b/apps/workbench/app/models/human.rb index 3880f0513d..7c2d3e4396 100644 --- a/apps/workbench/app/models/human.rb +++ b/apps/workbench/app/models/human.rb @@ -1,5 +1,5 @@ class Human < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end end diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb index c853302c1a..2a69c284d8 100644 --- a/apps/workbench/app/models/job.rb +++ b/apps/workbench/app/models/job.rb @@ -1,5 +1,5 @@ class Job < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb index c9538d158c..c3b14755f3 100644 --- a/apps/workbench/app/models/pipeline_instance.rb +++ b/apps/workbench/app/models/pipeline_instance.rb @@ -1,7 +1,7 @@ class PipelineInstance < ArvadosBase attr_accessor :pipeline_template - def self.goes_in_folders? + def self.goes_in_projects? true end diff --git a/apps/workbench/app/models/pipeline_template.rb b/apps/workbench/app/models/pipeline_template.rb index 82e3d307c0..e1af2cb052 100644 --- a/apps/workbench/app/models/pipeline_template.rb +++ b/apps/workbench/app/models/pipeline_template.rb @@ -1,5 +1,5 @@ class PipelineTemplate < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end diff --git a/apps/workbench/app/models/specimen.rb b/apps/workbench/app/models/specimen.rb index 68c0038b63..7c611e47ff 100644 --- a/apps/workbench/app/models/specimen.rb +++ b/apps/workbench/app/models/specimen.rb @@ -1,5 +1,5 @@ class Specimen < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end end diff --git a/apps/workbench/app/models/trait.rb b/apps/workbench/app/models/trait.rb index cf7099d2fe..e7a6ceb70a 100644 --- a/apps/workbench/app/models/trait.rb +++ b/apps/workbench/app/models/trait.rb @@ -1,5 +1,5 @@ class Trait < ArvadosBase - def self.goes_in_folders? + def self.goes_in_projects? true end end diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb index 0e3fa0b978..e6343628f2 100644 --- a/apps/workbench/app/views/application/_content.html.erb +++ b/apps/workbench/app/views/application/_content.html.erb @@ -1,10 +1,10 @@ <% content_for :content_top do %> - <% if @object and not @object.is_a?(Group) and @object.class.goes_in_folders? and @object.owner_uuid == current_user.uuid %> + <% if @object and not @object.is_a?(Group) and @object.class.goes_in_projects? and @object.owner_uuid == current_user.uuid %>
    - Hey. This <%= @object.class_for_display.downcase %> belongs to your account, but it's not in any of your folders. If you want it to be easy to find in the future, you should move it to a folder.
    - <%= button_to(choose_folders_path( + Hey. This <%= @object.class_for_display.downcase %> belongs to your account, but it's not in any of your projects. If you want it to be easy to find in the future, you should move it to a project.
    + <%= button_to(choose_projects_path( title: 'Move to...', editable: true, action_name: 'Move', @@ -12,7 +12,7 @@ action_method: 'patch', action_data: {selection_param: @object.resource_param_name+'[owner_uuid]', success: 'page-refresh'}.to_json), { class: "btn btn-primary btn-sm", remote: true, method: 'get' }) do %> - Choose a folder... + Choose a project... <% end %>
    diff --git a/apps/workbench/app/views/application/_selection_checkbox.html.erb b/apps/workbench/app/views/application/_selection_checkbox.html.erb index 9645455ace..9d279bc402 100644 --- a/apps/workbench/app/views/application/_selection_checkbox.html.erb +++ b/apps/workbench/app/views/application/_selection_checkbox.html.erb @@ -1,4 +1,4 @@ -<%if object and object.class.goes_in_folders? %> +<%if object and object.class.goes_in_projects? %> <% fn = if defined? friendly_name friendly_name else diff --git a/apps/workbench/app/views/application/_show_recent.html.erb b/apps/workbench/app/views/application/_show_recent.html.erb index 800263f0f4..d94dd84be4 100644 --- a/apps/workbench/app/views/application/_show_recent.html.erb +++ b/apps/workbench/app/views/application/_show_recent.html.erb @@ -15,7 +15,7 @@ - <% if objects.first and objects.first.class.goes_in_folders? %> + <% if objects.first and objects.first.class.goes_in_projects? %> <% end %> @@ -34,7 +34,7 @@ <% objects.each do |object| %> - <% if objects.first.class.goes_in_folders? %> + <% if objects.first.class.goes_in_projects? %> diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb index 25cd845fe6..d611dbdee8 100644 --- a/apps/workbench/app/views/collections/show.html.erb +++ b/apps/workbench/app/views/collections/show.html.erb @@ -83,12 +83,12 @@
    - <% if @folders.andand.any? %> -

    Included in folders:
    - <%= render_arvados_object_list_start(@folders, 'Show all folders', + <% if @projects.andand.any? %> +

    Included in projects:
    + <%= render_arvados_object_list_start(@projects, 'Show all projects', links_path(filter: [['head_uuid', '=', @object.uuid], - ['link_class', '=', 'name']].to_json)) do |folder| %> - <%= link_to_if_arvados_object(folder, friendly_name: true) %>
    + ['link_class', '=', 'name']].to_json)) do |project| %> + <%= link_to_if_arvados_object(project, friendly_name: true) %>
    <% end %>

    <% end %> diff --git a/apps/workbench/app/views/folders/_index_folders.html.erb b/apps/workbench/app/views/folders/_index_folders.html.erb deleted file mode 100644 index 734e0f4c1f..0000000000 --- a/apps/workbench/app/views/folders/_index_folders.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -
    - <% tree.each do |foldernode| %> - <% rowtype = foldernode[:object].class %> - <% next if rowtype != Group and !show_root_node %> -
    -
    - <% if show_root_node and rowtype == String %> - - <%= foldernode[:object] %> - <% elsif show_root_node and rowtype == User %> - <% if foldernode[:object].uuid == current_user.andand.uuid %> - - My Folders - <% else %> - - <%= foldernode[:object].friendly_link_name %> - <% end %> - <% elsif rowtype == Group %> - - <% opts = {} %> - <% opts[:title] = foldernode[:object].description %> - <% opts[:'data-toggle'] = 'tooltip' %> - <% opts[:'data-placement'] = 'bottom' %> - <%= link_to foldernode[:object], opts do %> - <%= foldernode[:object].friendly_link_name %> - <% end %> - <% end %> -
    -
    - <% end %> -
    diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb index 32a0f9194e..7a7231f344 100644 --- a/apps/workbench/app/views/layouts/application.html.erb +++ b/apps/workbench/app/views/layouts/application.html.erb @@ -70,7 +70,7 @@ <% if @object and \ ((@name_link and (o = Group.find?(@name_link.tail_uuid)))\ or (o = Group.find?(@object.owner_uuid))) %> - <%= link_to(o.name, folder_path(o.uuid)) %> + <%= link_to(o.name, project_path(o.uuid)) %> <% else %> <%= link_to( controller.controller_name.humanize.downcase, @@ -82,6 +82,7 @@
  • + <%= link_to_if_arvados_object (@name_link || @object), {friendly_name: true}, {data: {object_uuid: (@name_link.andand.uuid || @object.andand.uuid), name: 'name'}} %>
  • <% end %> diff --git a/apps/workbench/app/views/pipeline_instances/compare.html.erb b/apps/workbench/app/views/pipeline_instances/compare.html.erb index 953c098d72..99caf9bcb9 100644 --- a/apps/workbench/app/views/pipeline_instances/compare.html.erb +++ b/apps/workbench/app/views/pipeline_instances/compare.html.erb @@ -2,7 +2,7 @@ <% content_for :breadcrumbs do %>
  • - <%= link_to(o.name, folder_path(o.uuid)) %> + <%= link_to(o.name, project_path(o.uuid)) %>
  • <%= render :partial => "selection_checkbox", :locals => {:object => object} %>
    +
    - <%= render partial: 'show_contents_rows', locals: {folder: @object, objects_and_names: @objects_and_names} %> + <%= render partial: 'show_contents_rows', locals: {project: @object, objects_and_names: @objects_and_names} %> diff --git a/apps/workbench/app/views/folders/_show_contents_rows.html.erb b/apps/workbench/app/views/projects/_show_contents_rows.html.erb similarity index 71% rename from apps/workbench/app/views/folders/_show_contents_rows.html.erb rename to apps/workbench/app/views/projects/_show_contents_rows.html.erb index 3c64b533b9..8b19c002c3 100644 --- a/apps/workbench/app/views/folders/_show_contents_rows.html.erb +++ b/apps/workbench/app/views/projects/_show_contents_rows.html.erb @@ -7,8 +7,8 @@
    <%= render partial: 'selection_checkbox', locals: {object: object, friendly_name: ((name_object.name rescue '') || '')} %> - <% if folder.editable? %> - <%= link_to({action: 'remove_item', id: folder.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this folder?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: 'remove') do %> + <% if project.editable? %> + <%= link_to({action: 'remove_item', id: project.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this project?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: 'remove') do %> <% end %> <% else %> diff --git a/apps/workbench/app/views/folders/_show_featured.html.erb b/apps/workbench/app/views/projects/_show_featured.html.erb similarity index 100% rename from apps/workbench/app/views/folders/_show_featured.html.erb rename to apps/workbench/app/views/projects/_show_featured.html.erb diff --git a/apps/workbench/app/views/folders/_show_permissions.html.erb b/apps/workbench/app/views/projects/_show_permissions.html.erb similarity index 79% rename from apps/workbench/app/views/folders/_show_permissions.html.erb rename to apps/workbench/app/views/projects/_show_permissions.html.erb index 0eca2283cc..9d93ce01c4 100644 --- a/apps/workbench/app/views/folders/_show_permissions.html.erb +++ b/apps/workbench/app/views/projects/_show_permissions.html.erb @@ -26,7 +26,7 @@ Inherited permissions
    -

    Permissions for this folder are inherited by the owner or parent folder: +

    Permissions for this project are inherited by the owner or parent project:

    <% if User == resource_class_for_uuid(@object.owner_uuid) %> @@ -36,14 +36,14 @@ <% end %> <%= link_to_if_arvados_object @object.owner_uuid, friendly_name: true %> <%= button_to('Move to...', - choose_folders_path( + choose_projects_path( title: 'Move to...', editable: true, action_name: 'Move', - action_href: folder_path(@object.uuid), + action_href: project_path(@object.uuid), action_method: 'put', - action_data: {selection_param: 'folder[owner_uuid]', success: 'page-refresh'}.to_json), - { class: "btn btn-default btn-xs arv-move-to-folder", remote: true, method: 'get' }) %> + action_data: {selection_param: 'project[owner_uuid]', success: 'page-refresh'}.to_json), + { class: "btn btn-default btn-xs arv-move-to-project", remote: true, method: 'get' }) %>

    diff --git a/apps/workbench/app/views/folders/index.html.erb b/apps/workbench/app/views/projects/index.html.erb similarity index 80% rename from apps/workbench/app/views/folders/index.html.erb rename to apps/workbench/app/views/projects/index.html.erb index ce5220bb63..6d79bc4ed9 100644 --- a/apps/workbench/app/views/folders/index.html.erb +++ b/apps/workbench/app/views/projects/index.html.erb @@ -6,7 +6,7 @@
    - <% if my_folders.empty? %> + <% if my_projects.empty? %>

    @@ -19,7 +19,7 @@ This site runs Arvados, the open source biomedical analysis platform. Learn more…

    - To get started, create a folder using the "Add new folder" button below. + To get started, create a project using the "Add new project" button below.

    @@ -27,17 +27,17 @@
    - <%= button_to folders_path(method: 'post'), class: 'btn btn-xs btn-primary' do %> + <%= button_to projects_path(method: 'post'), class: 'btn btn-xs btn-primary' do %> - Add new folder + Add new project <% end %>

    - My folders + My projects

    - <%= render partial: 'index_folders', locals: {tree: @my_folder_tree, show_root_node: false} %> + <%= render partial: 'index_projects', locals: {tree: @my_project_tree, show_root_node: false} %>
    @@ -45,11 +45,11 @@

    - Shared folders + Shared projects

    - <%= render partial: 'index_folders', locals: {tree: @shared_folder_tree, show_root_node: false} %> + <%= render partial: 'index_projects', locals: {tree: @shared_project_tree, show_root_node: false} %>
    diff --git a/apps/workbench/app/views/folders/remove_items.js.erb b/apps/workbench/app/views/projects/remove_items.js.erb similarity index 100% rename from apps/workbench/app/views/folders/remove_items.js.erb rename to apps/workbench/app/views/projects/remove_items.js.erb diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb index 95de0e0f94..df7f2e8eae 100644 --- a/apps/workbench/config/routes.rb +++ b/apps/workbench/config/routes.rb @@ -55,7 +55,7 @@ ArvadosWorkbench::Application.routes.draw do format: false) get '/collections/download/:uuid/:reader_token' => 'collections#show_file_links' get '/collections/:uuid/*file' => 'collections#show_file', :format => false - resources :folders do + resources :projects do match 'remove/:item_uuid', on: :member, via: :delete, action: :remove_item match 'remove_items', on: :member, via: :delete, action: :remove_items get 'choose', on: :collection @@ -64,7 +64,7 @@ ArvadosWorkbench::Application.routes.draw do post 'actions' => 'actions#post' get 'websockets' => 'websocket#index' - root :to => 'folders#index' + root :to => 'projects#index' # Send unroutable requests to an arbitrary controller # (ends up at ApplicationController#render_not_found) diff --git a/apps/workbench/test/functional/collections_controller_test.rb b/apps/workbench/test/functional/collections_controller_test.rb index 852772ae83..fb80f8874e 100644 --- a/apps/workbench/test/functional/collections_controller_test.rb +++ b/apps/workbench/test/functional/collections_controller_test.rb @@ -53,11 +53,11 @@ class CollectionsControllerTest < ActionController::TestCase assert_equal([['.', 'foo', 3]], assigns(:object).files) end - test "viewing a collection fetches related folders" do + test "viewing a collection fetches related projects" do show_collection(:foo_file, :active) - assert_includes(assigns(:folders).map(&:uuid), - api_fixture('groups')['afolder']['uuid'], - "controller did not find linked folder") + assert_includes(assigns(:projects).map(&:uuid), + api_fixture('groups')['aproject']['uuid'], + "controller did not find linked project") end test "viewing a collection fetches related permissions" do diff --git a/apps/workbench/test/functional/folders_controller_test.rb b/apps/workbench/test/functional/projects_controller_test.rb similarity index 87% rename from apps/workbench/test/functional/folders_controller_test.rb rename to apps/workbench/test/functional/projects_controller_test.rb index 8459278faf..b338aa8186 100644 --- a/apps/workbench/test/functional/folders_controller_test.rb +++ b/apps/workbench/test/functional/projects_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class FoldersControllerTest < ActionController::TestCase +class ProjectsControllerTest < ActionController::TestCase test "inactive user is asked to sign user agreements on front page" do get :index, {}, session_for(:inactive) assert_response :success diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb index 562e2d32c3..8978f73a54 100644 --- a/apps/workbench/test/integration/collections_test.rb +++ b/apps/workbench/test/integration/collections_test.rb @@ -40,7 +40,7 @@ class CollectionsTest < ActionDispatch::IntegrationTest test "Collection page renders default name links" do uuid = api_fixture('collections')['foo_file']['uuid'] - coll_name = api_fixture('links')['foo_collection_name_in_afolder']['name'] + coll_name = api_fixture('links')['foo_collection_name_in_aproject']['name'] visit page_with_token('active', "/collections/#{uuid}") assert(page.has_text?(coll_name), "Collection page did not include name") # Now check that the page is otherwise normal, and the collection name diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb index 9a329f1180..f0620cb7e8 100644 --- a/apps/workbench/test/integration/pipeline_instances_test.rb +++ b/apps/workbench/test/integration/pipeline_instances_test.rb @@ -23,10 +23,10 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest instance_page = current_path - # put this pipeline instance in "A Folder" - find('button', text: 'Choose a folder...').click + # put this pipeline instance in "A Project" + find('button', text: 'Choose a project...').click within('.modal-dialog') do - find('.selectable', text: 'A Folder').click + find('.selectable', text: 'A Project').click find('button', text: 'Move').click end @@ -37,9 +37,9 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest end find('#persistent-selection-count').click - # Add this collection to the folder - visit '/folders' - find('.arv-folder-list a,button', text: 'A Folder').click + # Add this collection to the project + visit '/projects' + find('.arv-project-list a,button', text: 'A Project').click find('.btn', text: 'Add data').click find('span', text: 'foo_tag').click within('.modal-dialog') do @@ -81,8 +81,8 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest assert_not page.has_text? 'Graph' end - # Create a pipeline instance from within a folder and run - test 'Create pipeline inside a folder and run' do + # Create a pipeline instance from within a project and run + test 'Create pipeline inside a project and run' do visit page_with_token('active_trustedclient') # Go over to the collections page and select something @@ -92,12 +92,12 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest end find('#persistent-selection-count').click - # Add this collection to the folder using collections menu from top nav - visit '/folders' - find('.arv-folder-list a,button', text: 'A Folder').click + # Add this collection to the project using collections menu from top nav + visit '/projects' + find('.arv-project-list a,button', text: 'A Project').click find('#collections-menu').click - click_button 'Copy selections into this folder' + click_button 'Copy selections into this project' # create a pipeline instance find('.btn', text: 'Run a pipeline').click diff --git a/apps/workbench/test/integration/folders_test.rb b/apps/workbench/test/integration/projects_test.rb similarity index 60% rename from apps/workbench/test/integration/folders_test.rb rename to apps/workbench/test/integration/projects_test.rb index c403c2e537..73733d243d 100644 --- a/apps/workbench/test/integration/folders_test.rb +++ b/apps/workbench/test/integration/projects_test.rb @@ -2,17 +2,17 @@ require 'integration_helper' require 'selenium-webdriver' require 'headless' -class FoldersTest < ActionDispatch::IntegrationTest +class ProjectsTest < ActionDispatch::IntegrationTest setup do Capybara.current_driver = Capybara.javascript_driver end - test 'Find a folder and edit its description' do + test 'Find a project and edit its description' do visit page_with_token 'active', '/' - find('.arv-folder-list a,button', text: 'A Folder'). + find('.arv-project-list a,button', text: 'A Project'). click - within('.container-fluid', text: api_fixture('groups')['afolder']['name']) do - find('span', text: api_fixture('groups')['afolder']['name']).click + within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do + find('span', text: api_fixture('groups')['aproject']['name']).click within('.arv-description-as-subtitle') do find('.fa-pencil').click find('.editable-input textarea').set('I just edited this.') @@ -26,9 +26,9 @@ class FoldersTest < ActionDispatch::IntegrationTest end test 'Add a new name, then edit it, without creating a duplicate' do - folder_uuid = api_fixture('groups')['afolder']['uuid'] - specimen_uuid = api_fixture('specimens')['owned_by_afolder_with_no_name_link']['uuid'] - visit page_with_token 'active', '/folders/' + folder_uuid + project_uuid = api_fixture('groups')['aproject']['uuid'] + specimen_uuid = api_fixture('specimens')['owned_by_aproject_with_no_name_link']['uuid'] + visit page_with_token 'active', '/projects/' + project_uuid within(".selection-action-container") do within (first('tr', text: 'Specimen')) do find(".fa-pencil").click @@ -49,40 +49,40 @@ class FoldersTest < ActionDispatch::IntegrationTest end end - test 'Create a folder and move it into a different folder' do - visit page_with_token 'active', '/folders' - find('.btn', text: "Add new folder").click + test 'Create a project and move it into a different project' do + visit page_with_token 'active', '/projects' + find('.btn', text: "Add new project").click - # within('.editable', text: 'New folder') do + # within('.editable', text: 'New project') do within('h2') do find('.fa-pencil').click - find('.editable-input input').set('Folder 1234') + find('.editable-input input').set('Project 1234') find('.glyphicon-ok').click end wait_for_ajax - visit '/folders' - find('.btn', text: "Add new folder").click + visit '/projects' + find('.btn', text: "Add new project").click within('h2') do find('.fa-pencil').click - find('.editable-input input').set('Folder 5678') + find('.editable-input input').set('Project 5678') find('.glyphicon-ok').click end wait_for_ajax click_link 'Permissions' find('input[value="Move to..."]').click - find('.selectable', text: 'Folder 1234').click + find('.selectable', text: 'Project 1234').click find('a,button', text: 'Move').click wait_for_ajax # Wait for the page to refresh and show the new parent in Permissions panel click_link 'Permissions' - find('.panel', text: 'Folder 1234') + find('.panel', text: 'Project 1234') - assert(find('.panel', text: 'Permissions for this folder are inherited by the owner or parent folder'). - all('*', text: 'Folder 1234').any?, - "Folder 5678 should now be inside folder 1234") + assert(find('.panel', text: 'Permissions for this project are inherited by the owner or parent project'). + all('*', text: 'Project 1234').any?, + "Project 5678 should now be inside project 1234") end end diff --git a/apps/workbench/test/unit/arvados_resource_list_test.rb b/apps/workbench/test/unit/arvados_resource_list_test.rb index a5681d24f4..fa4f9c5697 100644 --- a/apps/workbench/test/unit/arvados_resource_list_test.rb +++ b/apps/workbench/test/unit/arvados_resource_list_test.rb @@ -10,7 +10,7 @@ class ResourceListTest < ActiveSupport::TestCase test 'links_for on non-empty resource list' do use_token :active - results = Group.find(api_fixture('groups')['afolder']['uuid']).contents(include_linked: true) + results = Group.find(api_fixture('groups')['aproject']['uuid']).contents(include_linked: true) assert_equal [], results.links_for(api_fixture('users')['active']['uuid']) assert_equal [], results.links_for(api_fixture('jobs')['running_cancelled']['uuid']) assert_equal [], results.links_for(api_fixture('jobs')['running']['uuid'], 'bogus-link-class') @@ -18,25 +18,25 @@ class ResourceListTest < ActiveSupport::TestCase end test 'links_for returns all link classes (simulated results)' do - folder_uuid = api_fixture('groups')['afolder']['uuid'] - specimen_uuid = api_fixture('specimens')['in_afolder']['uuid'] + project_uuid = api_fixture('groups')['aproject']['uuid'] + specimen_uuid = api_fixture('specimens')['in_aproject']['uuid'] api_response = { kind: 'arvados#specimenList', links: [{kind: 'arvados#link', uuid: 'zzzzz-o0j2j-asdfasdfasdfas0', - tail_uuid: folder_uuid, + tail_uuid: project_uuid, head_uuid: specimen_uuid, link_class: 'name', name: 'Alice'}, {kind: 'arvados#link', uuid: 'zzzzz-o0j2j-asdfasdfasdfas1', - tail_uuid: folder_uuid, + tail_uuid: project_uuid, head_uuid: specimen_uuid, link_class: 'foo', name: 'Bob'}, {kind: 'arvados#link', uuid: 'zzzzz-o0j2j-asdfasdfasdfas2', - tail_uuid: folder_uuid, + tail_uuid: project_uuid, head_uuid: specimen_uuid, link_class: nil, name: 'Clydesdale'}], diff --git a/apps/workbench/test/unit/group_test.rb b/apps/workbench/test/unit/group_test.rb index 4a7144f99a..435463a83e 100644 --- a/apps/workbench/test/unit/group_test.rb +++ b/apps/workbench/test/unit/group_test.rb @@ -4,7 +4,7 @@ class GroupTest < ActiveSupport::TestCase test "get contents with names" do use_token :active oi = Group. - find(api_fixture('groups')['asubfolder']['uuid']). + find(api_fixture('groups')['asubproject']['uuid']). contents(include_linked: true) assert_operator(0, :<, oi.count, "Expected to find some items belonging to :active user") @@ -14,14 +14,14 @@ class GroupTest < ActiveSupport::TestCase "Expected to receive name links with contents response") oi_uuids = oi.collect { |i| i['uuid'] } - expect_uuid = api_fixture('specimens')['in_asubfolder']['uuid'] + expect_uuid = api_fixture('specimens')['in_asubproject']['uuid'] assert_includes(oi_uuids, expect_uuid, - "Expected '#{expect_uuid}' in asubfolder's contents") + "Expected '#{expect_uuid}' in asubproject's contents") - expect_uuid = api_fixture('specimens')['in_afolder_linked_from_asubfolder']['uuid'] - expect_name = api_fixture('links')['specimen_is_in_two_folders']['name'] + expect_uuid = api_fixture('specimens')['in_aproject_linked_from_asubproject']['uuid'] + expect_name = api_fixture('links')['specimen_is_in_two_projects']['name'] assert_includes(oi_uuids, expect_uuid, - "Expected '#{expect_uuid}' in asubfolder's contents") + "Expected '#{expect_uuid}' in asubproject's contents") assert_equal(expect_name, oi.name_for(expect_uuid), "Expected name_for '#{expect_uuid}' to be '#{expect_name}'") end diff --git a/apps/workbench/test/unit/helpers/folders_helper_test.rb b/apps/workbench/test/unit/helpers/folders_helper_test.rb deleted file mode 100644 index 5b4c55754f..0000000000 --- a/apps/workbench/test/unit/helpers/folders_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class FoldersHelperTest < ActionView::TestCase -end diff --git a/apps/workbench/test/unit/helpers/projects_helper_test.rb b/apps/workbench/test/unit/helpers/projects_helper_test.rb new file mode 100644 index 0000000000..a591e4e785 --- /dev/null +++ b/apps/workbench/test/unit/helpers/projects_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ProjectsHelperTest < ActionView::TestCase +end diff --git a/services/api/db/migrate/20140607150616_rename_folder_to_project.rb_deferred b/services/api/db/migrate/20140607150616_rename_folder_to_project.rb_deferred new file mode 100644 index 0000000000..2a3c1d36c9 --- /dev/null +++ b/services/api/db/migrate/20140607150616_rename_folder_to_project.rb_deferred @@ -0,0 +1,9 @@ +class RenameFolderToProject < ActiveRecord::Migration + def up + Group.update_all("group_class = 'project'", "group_class = 'folder'") + end + + def down + Group.update_all("group_class = 'folder'", "group_class = 'project'") + end +end diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml index 96db93c35e..e41ca8a5c5 100644 --- a/services/api/test/fixtures/groups.yml +++ b/services/api/test/fixtures/groups.yml @@ -44,7 +44,7 @@ testusergroup_admins: owner_uuid: zzzzz-tpzed-000000000000000 name: Administrators of a subset of users -afolder: +aproject: uuid: zzzzz-j7d0g-v955i6s2oi1cbso owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz created_at: 2014-04-21 15:37:48 -0400 @@ -52,11 +52,11 @@ afolder: modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz modified_at: 2014-04-21 15:37:48 -0400 updated_at: 2014-04-21 15:37:48 -0400 - name: A Folder - description: Test folder belonging to active user - group_class: folder + name: A Project + description: Test project belonging to active user + group_class: project -asubfolder: +asubproject: uuid: zzzzz-j7d0g-axqo7eu9pwvna1x owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso created_at: 2014-04-21 15:37:48 -0400 @@ -64,8 +64,8 @@ asubfolder: modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz modified_at: 2014-04-21 15:37:48 -0400 updated_at: 2014-04-21 15:37:48 -0400 - name: A Subfolder - description: "Test folder belonging to active user's first test folder" + name: A Subproject + description: "Test project belonging to active user's first test project" group_class: folder bad_group_has_ownership_cycle_a: diff --git a/services/api/test/fixtures/links.yml b/services/api/test/fixtures/links.yml index 1fb1608f4d..397659e46d 100644 --- a/services/api/test/fixtures/links.yml +++ b/services/api/test/fixtures/links.yml @@ -304,7 +304,7 @@ test_timestamps: name: test properties: {} -specimen_is_in_two_folders: +specimen_is_in_two_projects: uuid: zzzzz-o0j2j-ryhm1bn83ni03sn owner_uuid: zzzzz-j7d0g-axqo7eu9pwvna1x created_at: 2014-04-21 15:37:48 -0400 @@ -315,10 +315,10 @@ specimen_is_in_two_folders: tail_uuid: zzzzz-j7d0g-axqo7eu9pwvna1x head_uuid: zzzzz-j58dm-5gid26432uujf79 link_class: name - name: "I'm in a subfolder, too" + name: "I'm in a subproject, too" properties: {} -template_name_in_afolder: +template_name_in_aproject: uuid: zzzzz-o0j2j-4kpwf3d6rwkeqhl owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz created_at: 2014-04-29 16:47:26 -0400 @@ -329,10 +329,10 @@ template_name_in_afolder: tail_uuid: zzzzz-j7d0g-v955i6s2oi1cbso head_uuid: zzzzz-p5p6p-aox0k0ofxrystgw link_class: name - name: "I'm a template in a folder" + name: "I'm a template in a project" properties: {} -job_name_in_afolder: +job_name_in_aproject: uuid: zzzzz-o0j2j-1kt6dppqcxbl1yt owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz created_at: 2014-04-29 16:47:26 -0400 @@ -343,11 +343,11 @@ job_name_in_afolder: tail_uuid: zzzzz-j7d0g-v955i6s2oi1cbso head_uuid: zzzzz-8i9sb-pshmckwoma9plh7 link_class: name - name: "I'm a job in a folder" + name: "I'm a job in a project" properties: {} -foo_collection_name_in_afolder: - uuid: zzzzz-o0j2j-foofoldername12 +foo_collection_name_in_aproject: + uuid: zzzzz-o0j2j-fooprojectname1 owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz created_at: 2014-04-21 15:37:48 -0400 modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr @@ -358,7 +358,7 @@ foo_collection_name_in_afolder: head_uuid: 1f4b0bc7583c2a7f9102c395f4ffc5e3+45 link_class: name # This should resemble the default name assigned when a - # Collection is added to a Folder. + # Collection is added to a Project. name: "1f4b0bc7583c2a7f9102c395f4ffc5e3+45 added sometime" properties: {} diff --git a/services/api/test/fixtures/specimens.yml b/services/api/test/fixtures/specimens.yml index c48bff7147..4528070a52 100644 --- a/services/api/test/fixtures/specimens.yml +++ b/services/api/test/fixtures/specimens.yml @@ -16,25 +16,25 @@ owned_by_spectator: created_at: 2014-04-21 15:37:48 -0400 modified_at: 2014-04-21 15:37:48 -0400 -in_afolder: +in_aproject: uuid: zzzzz-j58dm-7r18rnd5nzhg5yk owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso created_at: 2014-04-21 15:37:48 -0400 modified_at: 2014-04-21 15:37:48 -0400 -in_asubfolder: +in_asubproject: uuid: zzzzz-j58dm-c40lddwcqqr1ffs owner_uuid: zzzzz-j7d0g-axqo7eu9pwvna1x created_at: 2014-04-21 15:37:48 -0400 modified_at: 2014-04-21 15:37:48 -0400 -in_afolder_linked_from_asubfolder: +in_aproject_linked_from_asubproject: uuid: zzzzz-j58dm-5gid26432uujf79 owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso created_at: 2014-04-21 15:37:48 -0400 modified_at: 2014-04-21 15:37:48 -0400 -owned_by_afolder_with_no_name_link: +owned_by_aproject_with_no_name_link: uuid: zzzzz-j58dm-ypsjlol9dofwijz owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso created_at: 2014-05-05 04:11:52 -0400 diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb index a5582e66b5..2e8e231a97 100644 --- a/services/api/test/functional/arvados/v1/filters_test.rb +++ b/services/api/test/functional/arvados/v1/filters_test.rb @@ -5,12 +5,12 @@ class Arvados::V1::FiltersTest < ActionController::TestCase @controller = Arvados::V1::GroupsController.new authorize_with :admin get :index, { - filters: [ ['group_class', 'not in', ['folder']] ], + filters: [ ['group_class', 'not in', ['project']] ], controller: 'groups', } assert_response :success found = assigns(:objects) assert_includes(found.collect(&:group_class), nil, - "'group_class not in ['folder']' filter should pass null") + "'group_class not in ['project']' filter should pass null") end end diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb index f8f9eaeb0d..49e9b7d6c6 100644 --- a/services/api/test/functional/arvados/v1/groups_controller_test.rb +++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb @@ -14,22 +14,22 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase assert_response 403 end - test "get list of folders" do + test "get list of projects" do authorize_with :active - get :index, filters: [['group_class', '=', 'folder']], format: :json + get :index, filters: [['group_class', 'in', ['project', 'folder']]], format: :json assert_response :success group_uuids = [] json_response['items'].each do |group| - assert_equal 'folder', group['group_class'] + assert_includes ['folder', 'project'], group['group_class'] group_uuids << group['uuid'] end - assert_includes group_uuids, groups(:afolder).uuid - assert_includes group_uuids, groups(:asubfolder).uuid + assert_includes group_uuids, groups(:aproject).uuid + assert_includes group_uuids, groups(:asubproject).uuid assert_not_includes group_uuids, groups(:system_group).uuid assert_not_includes group_uuids, groups(:private).uuid end - test "get list of groups that are not folders" do + test "get list of groups that are not projects" do authorize_with :active get :index, filters: [['group_class', '=', nil]], format: :json assert_response :success @@ -38,8 +38,8 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase assert_equal nil, group['group_class'] group_uuids << group['uuid'] end - assert_not_includes group_uuids, groups(:afolder).uuid - assert_not_includes group_uuids, groups(:asubfolder).uuid + assert_not_includes group_uuids, groups(:aproject).uuid + assert_not_includes group_uuids, groups(:asubproject).uuid assert_includes group_uuids, groups(:private).uuid end @@ -57,7 +57,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test 'get group-owned objects' do authorize_with :active get :contents, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, format: :json, include_linked: true, } @@ -72,7 +72,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test 'get group-owned objects with limit' do authorize_with :active get :contents, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, limit: 1, format: :json, } @@ -84,7 +84,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test 'get group-owned objects with limit and offset' do authorize_with :active get :contents, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, limit: 1, offset: 12345, format: :json, @@ -97,7 +97,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test 'get group-owned objects with additional filter matching nothing' do authorize_with :active get :contents, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, filters: [['uuid', 'in', ['foo_not_a_uuid','bar_not_a_uuid']]], format: :json, } @@ -107,10 +107,10 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase end test 'get group-owned objects without include_linked' do - unexpected_uuid = specimens(:in_afolder_linked_from_asubfolder).uuid + unexpected_uuid = specimens(:in_aproject_linked_from_asubproject).uuid authorize_with :active get :contents, { - id: groups(:asubfolder).uuid, + id: groups(:asubproject).uuid, format: :json, } assert_response :success @@ -119,10 +119,10 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase end test 'get group-owned objects with include_linked' do - expected_uuid = specimens(:in_afolder_linked_from_asubfolder).uuid + expected_uuid = specimens(:in_aproject_linked_from_asubproject).uuid authorize_with :active get :contents, { - id: groups(:asubfolder).uuid, + id: groups(:asubproject).uuid, include_linked: true, format: :json, } @@ -130,7 +130,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase uuids = json_response['items'].collect { |i| i['uuid'] } assert_includes uuids, expected_uuid, "Did not get #{expected_uuid}" - expected_name = links(:specimen_is_in_two_folders).name + expected_name = links(:specimen_is_in_two_projects).name found_specimen_name = false assert(json_response['links'].any?, "Expected a non-empty array of links in response") @@ -158,7 +158,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase # times within a test. @json_response = nil get :contents, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, include_linked: inc_ind, limit: limit, offset: offset, @@ -180,7 +180,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase owner_received[item['owner_uuid']] = true offset += 1 if not inc_ind - assert_equal groups(:afolder).uuid, item['owner_uuid'] + assert_equal groups(:aproject).uuid, item['owner_uuid'] end end break if offset >= items_available @@ -197,7 +197,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test "Raise error on bogus #{arg} parameter #{val.inspect}" do authorize_with :active get :contents, { - :id => groups(:afolder).uuid, + :id => groups(:aproject).uuid, :format => :json, arg => val, } @@ -209,7 +209,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test 'get writable_by list for owned group' do authorize_with :active get :show, { - id: groups(:afolder).uuid, + id: groups(:aproject).uuid, format: :json } assert_response :success diff --git a/services/api/test/functional/arvados/v1/links_controller_test.rb b/services/api/test/functional/arvados/v1/links_controller_test.rb index dfce78b13f..d5b42665c3 100644 --- a/services/api/test/functional/arvados/v1/links_controller_test.rb +++ b/services/api/test/functional/arvados/v1/links_controller_test.rb @@ -271,11 +271,11 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase end test "refuse duplicate name" do - the_name = links(:job_name_in_afolder).name - the_folder = links(:job_name_in_afolder).tail_uuid + the_name = links(:job_name_in_aproject).name + the_project = links(:job_name_in_aproject).tail_uuid authorize_with :active post :create, link: { - tail_uuid: the_folder, + tail_uuid: the_project, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: the_name, diff --git a/services/api/test/unit/group_test.rb b/services/api/test/unit/group_test.rb index 597af62ec8..97977a5d56 100644 --- a/services/api/test/unit/group_test.rb +++ b/services/api/test/unit/group_test.rb @@ -18,7 +18,7 @@ class GroupTest < ActiveSupport::TestCase assert_equal false, s.save, "should not save object with #{g.uuid} as owner" # Use the group as the new owner of an existing object - s = specimens(:in_afolder) + s = specimens(:in_aproject) s.owner_uuid = groups(:bad_group_has_ownership_cycle_b).uuid assert s.valid?, "ownership should pass validation" assert_equal false, s.save, "should not save object with #{g.uuid} as owner" diff --git a/services/api/test/unit/link_test.rb b/services/api/test/unit/link_test.rb index 10f2b5eca5..56a38045e4 100644 --- a/services/api/test/unit/link_test.rb +++ b/services/api/test/unit/link_test.rb @@ -8,13 +8,13 @@ class LinkTest < ActiveSupport::TestCase end test 'name links with the same tail_uuid must be unique' do - a = Link.create!(tail_uuid: groups(:afolder).uuid, + a = Link.create!(tail_uuid: groups(:aproject).uuid, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: 'foo') assert a.valid?, a.errors.to_s assert_raises ActiveRecord::RecordNotUnique do - b = Link.create!(tail_uuid: groups(:afolder).uuid, + b = Link.create!(tail_uuid: groups(:aproject).uuid, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: 'foo') @@ -22,12 +22,12 @@ class LinkTest < ActiveSupport::TestCase end test 'name links with different tail_uuid need not be unique' do - a = Link.create!(tail_uuid: groups(:afolder).uuid, + a = Link.create!(tail_uuid: groups(:aproject).uuid, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: 'foo') assert a.valid?, a.errors.to_s - b = Link.create!(tail_uuid: groups(:asubfolder).uuid, + b = Link.create!(tail_uuid: groups(:asubproject).uuid, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: 'foo') @@ -38,7 +38,7 @@ class LinkTest < ActiveSupport::TestCase [nil, '', false].each do |name| test "name links cannot have name=#{name.inspect}" do - a = Link.create(tail_uuid: groups(:afolder).uuid, + a = Link.create(tail_uuid: groups(:aproject).uuid, head_uuid: specimens(:owned_by_active_user).uuid, link_class: 'name', name: name) diff --git a/services/api/test/unit/owner_test.rb b/services/api/test/unit/owner_test.rb index f159294f6b..c177bc3901 100644 --- a/services/api/test/unit/owner_test.rb +++ b/services/api/test/unit/owner_test.rb @@ -73,7 +73,7 @@ class OwnerTest < ActiveSupport::TestCase end end - ['users(:active)', 'groups(:afolder)'].each do |ofixt| + ['users(:active)', 'groups(:aproject)'].each do |ofixt| test "delete #{ofixt} that owns other objects" do o = eval ofixt assert_equal(true, Specimen.where(owner_uuid: o.uuid).any?, -- 2.30.2