From: radhika Date: Thu, 29 Jun 2017 00:47:23 +0000 (-0400) Subject: 11870: link repositories menu item in user menu to repositories index page. X-Git-Tag: 1.1.0~162^2~6 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/528ce62a2e3efeda48378be0b9b093a50545e034 11870: link repositories menu item in user menu to repositories index page. Arvados-DCO-1.1-Signed-off-by: Radhika Chippada --- diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb index 350f297af3..d3b8bfe99c 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -256,28 +256,6 @@ class UsersController < ApplicationController end end - def repositories - # all repositories accessible by current user - all_repositories = Hash[Repository.all.order('name asc').collect {|repo| [repo.uuid, repo]}] - - @my_repositories = [] # we want them ordered as owned and the rest - @repo_writable = {} - - # owned repos - all_repositories.each do |_, repo| - if repo.owner_uuid == current_user.uuid - @repo_writable[repo.uuid] = 'can_write' - @my_repositories << repo - end - end - - # rest of the repos - handled = @my_repositories.map(&:uuid) - all_repositories.each do |_, repo| - @my_repositories << repo if !repo.uuid.in?(handled) - end - end - def virtual_machines @my_vm_logins = {} Link.where(tail_uuid: @object.uuid, diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb index 456f15f218..0357866d44 100644 --- a/apps/workbench/app/views/layouts/body.html.erb +++ b/apps/workbench/app/views/layouts/body.html.erb @@ -62,11 +62,7 @@ Virtual machines <% end %> -
  • - <%= link_to repositories_user_path(current_user), role: 'menu-item' do %> - Repositories - <% end %> -
  • +
  • Repositories
  • Current token
  • <%= link_to ssh_keys_user_path(current_user), role: 'menu-item' do %> diff --git a/apps/workbench/app/views/repositories/_show_help.html.erb b/apps/workbench/app/views/repositories/_show_help.html.erb index 50ec8809dc..0983d87385 100644 --- a/apps/workbench/app/views/repositories/_show_help.html.erb +++ b/apps/workbench/app/views/repositories/_show_help.html.erb @@ -1,4 +1,10 @@ -<% if (example = @objects.select(&:push_url).first) %> +<% + filters = @filters + [["owner_uuid", "=", current_user.uuid]] + example = Repository.all.order("name ASC").limit(1).filter(filters).results.first + example = Repository.all.order("name ASC").limit(1).results.first if !example +%> + +<% if example %>

    Sample git quick start: diff --git a/apps/workbench/app/views/repositories/_show_repositories.html.erb b/apps/workbench/app/views/repositories/_show_repositories.html.erb index d52229388e..1a74eabaf2 100644 --- a/apps/workbench/app/views/repositories/_show_repositories.html.erb +++ b/apps/workbench/app/views/repositories/_show_repositories.html.erb @@ -1,18 +1,28 @@ <%= render partial: "add_repository_modal" %>

    -
    - <%= link_to raw(' Add new repository'), "#", - {class: 'btn btn-xs btn-primary', 'data-toggle' => "modal", - 'data-target' => '#add-repository-modal'} %> +
    +
    +

    + When you are using an Arvados virtual machine, you should clone the https:// URLs. This will authenticate automatically using your API token. +

    +

    + In order to clone git repositories using SSH, <%= link_to ssh_keys_user_path(current_user) do%> add an SSH key to your account<%end%> and clone the git@ URLs. +

    +
    +
    + <%= link_to raw(' Add new repository'), "#", + {class: 'btn btn-xs btn-primary', 'data-toggle' => "modal", + 'data-target' => '#add-repository-modal'} %> +
    - + - + diff --git a/apps/workbench/app/views/users/_repositories.html.erb b/apps/workbench/app/views/users/_repositories.html.erb deleted file mode 100644 index ba91b9c3f1..0000000000 --- a/apps/workbench/app/views/users/_repositories.html.erb +++ /dev/null @@ -1,67 +0,0 @@ -
    -
    -
    - <%= link_to raw(' Add new repository'), "#", - {class: 'btn btn-xs btn-primary', 'data-toggle' => "modal", - 'data-target' => '#add-repository-modal'} %> -
    -

    - <%= link_to repositories_user_path(current_user) do%> - Repositories - <%end%> -

    -
    - -
    -

    - When you are using an Arvados virtual machine, you should clone the https:// URLs. This will authenticate automatically using your API token. -

    -

    - In order to clone git repositories using SSH, <%= link_to ssh_keys_user_path(current_user) do%> add an SSH key to your account<%end%> and clone the git@ URLs. -

    - - <% if !@my_repositories.any? %> - You do not seem to have access to any repositories. If you would like to request access, please contact your system admin. - <% else %> -
    - - - - - - - - - - - - - - - - <% @my_repositories.andand.each do |repo| %> - - - - - - - <% end %> - -
    Name URL
    - <%= render :partial => "show_object_button", :locals => {object: repo, size: 'xs' } %> - - <%= repo[:name] %> - - <%= repo.http_fetch_url %>
    - <%= @repo_writable[repo.uuid] ? repo.push_url : repo.fetch_url %> -
    - <% if repo.editable? %> - <%= link_to(repository_path(id: repo.uuid), method: :delete, class: 'btn btn-sm', data: {confirm: "Really delete '#{repo.name || repo.uuid}'?"}) do %> - - <% end %> - <% end %> -
    - <% end %> -
    -
    diff --git a/apps/workbench/app/views/users/repositories.html.erb b/apps/workbench/app/views/users/repositories.html.erb deleted file mode 100644 index 98a171544b..0000000000 --- a/apps/workbench/app/views/users/repositories.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<%= render :partial => 'repositories' %> -<%= render partial: "add_repository_modal" %>