X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/84d176d4e66d3eea140220ac8ec127ceba0f34a8..b6cbf9d7dc789ce57cc324ad02569187c8db8c54:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 77ec68bdb0..5312e733f4 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -95,7 +95,7 @@ class ApplicationController < ActionController::Base # exception here than in a template.) unless current_user.nil? begin - my_starred_projects current_user + my_starred_projects current_user, 'project' build_my_wanted_projects_tree current_user rescue ArvadosApiClient::ApiError # Fall back to the default-setting code later. @@ -239,7 +239,7 @@ class ApplicationController < ActionController::Base if objects.respond_to?(:result_offset) and objects.respond_to?(:result_limit) next_offset = objects.result_offset + objects.result_limit - if objects.respond_to?(:items_available) and (next_offset < objects.items_available) + if objects.respond_to?(:items_available) and (objects.items_available != nil) and (next_offset < objects.items_available) next_offset elsif @objects.results.size > 0 and (params[:count] == 'none' or (params[:controller] == 'search' and params[:action] == 'choose')) @@ -417,7 +417,11 @@ class ApplicationController < ActionController::Base respond_to do |f| f.json { render json: @object } f.html { - redirect_to(params[:return_to] || :back) + if params[:return_to] + redirect_to(params[:return_to]) + else + redirect_back(fallback_location: root_path) + end } f.js { render } end @@ -519,7 +523,7 @@ class ApplicationController < ActionController::Base redirect_to arvados_api_client.arvados_login_url(return_to: strip_token_from_path(request.url)) else flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request." - redirect_to :back + redirect_back(fallback_location: root_path) end false # For convenience to return from callbacks end @@ -760,7 +764,7 @@ class ApplicationController < ActionController::Base if current_user && !profile_config.empty? current_user_profile = current_user.prefs[:profile] profile_config.each do |k, entry| - if entry['Required'] + if entry[:Required] if !current_user_profile || !current_user_profile[k] || current_user_profile[k].empty? @@ -824,7 +828,7 @@ class ApplicationController < ActionController::Base helper_method :all_projects def all_projects @all_projects ||= Group. - filter([['group_class','=','project']]).order('name') + filter([['group_class','IN',['project','filter']]]).order('name') end helper_method :my_projects @@ -925,13 +929,17 @@ class ApplicationController < ActionController::Base end helper_method :my_starred_projects - def my_starred_projects user + def my_starred_projects user, group_class return if defined?(@starred_projects) && @starred_projects - links = Link.filter([['owner_uuid', 'in', ["#{Rails.configuration.ClusterID}-j7d0g-fffffffffffffff", user.uuid]], + links = Link.filter([['owner_uuid', 'in', ["#{Rails.configuration.ClusterID}-j7d0g-publicfavorites", user.uuid]], ['link_class', '=', 'star'], ['head_uuid', 'is_a', 'arvados#group']]).with_count("none").select(%w(head_uuid)) uuids = links.collect { |x| x.head_uuid } - starred_projects = Group.filter([['uuid', 'in', uuids]]).order('name').with_count("none") + if group_class == "" + starred_projects = Group.filter([['uuid', 'in', uuids]]).order('name').with_count("none") + else + starred_projects = Group.filter([['uuid', 'in', uuids],['group_class', '=', group_class]]).order('name').with_count("none") + end @starred_projects = starred_projects.results end @@ -949,7 +957,7 @@ class ApplicationController < ActionController::Base @too_many_projects = false @reached_level_limit = false while from_top.size <= page_size*2 - current_level = Group.filter([['group_class','=','project'], + current_level = Group.filter([['group_class','IN',['project','filter']], ['owner_uuid', 'in', uuids]]) .order('name').limit(page_size*2) break if current_level.results.size == 0