From: Lucas Di Pentima Date: Fri, 16 Dec 2016 17:46:49 +0000 (-0300) Subject: Merge branch '10383-arv-put-incremental-upload' X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/f2e2487ddba3944d3acd46fae3424a87fc624be9?hp=dcca309415bc0683f57f38ad65c30b539d80e191 Merge branch '10383-arv-put-incremental-upload' Closes #10383 --- diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb index b67d100887..b286a9456e 100644 --- a/apps/workbench/app/controllers/container_requests_controller.rb +++ b/apps/workbench/app/controllers/container_requests_controller.rb @@ -59,4 +59,32 @@ class ContainerRequestsController < ApplicationController end end + def copy + src = @object + + @object = ContainerRequest.new + + @object.command = src.command + @object.container_image = src.container_image + @object.cwd = src.cwd + @object.description = src.description + @object.environment = src.environment + @object.mounts = src.mounts + @object.name = src.name + @object.output_path = src.output_path + @object.priority = 1 + @object.properties[:template_uuid] = src.properties[:template_uuid] + @object.runtime_constraints = src.runtime_constraints + @object.scheduling_parameters = src.scheduling_parameters + @object.state = 'Uncommitted' + @object.use_existing = false + + # set owner_uuid to that of source, provided it is a project and writable by current user + current_project = Group.find(src.owner_uuid) rescue nil + if (current_project && current_project.writable_by.andand.include?(current_user.uuid)) + @object.owner_uuid = src.owner_uuid + end + + super + end end diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb index c5fbda0cf3..83fe0dda46 100644 --- a/apps/workbench/app/controllers/pipeline_instances_controller.rb +++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb @@ -53,7 +53,7 @@ class PipelineInstancesController < ApplicationController end @object.state = 'New' - # set owner_uuid to that of source, provided it is a project and wriable by current user + # set owner_uuid to that of source, provided it is a project and writable by current user current_project = Group.find(source.owner_uuid) rescue nil if (current_project && current_project.writable_by.andand.include?(current_user.uuid)) @object.owner_uuid = source.owner_uuid diff --git a/apps/workbench/app/views/application/_extra_tab_line_buttons.html.erb b/apps/workbench/app/views/application/_extra_tab_line_buttons.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/workbench/app/views/application/_title_and_buttons.html.erb b/apps/workbench/app/views/application/_title_and_buttons.html.erb index 398f248a39..46a949aa12 100644 --- a/apps/workbench/app/views/application/_title_and_buttons.html.erb +++ b/apps/workbench/app/views/application/_title_and_buttons.html.erb @@ -13,6 +13,9 @@ <% if @object.class.goes_in_projects? && @object.uuid != current_user.andand.uuid # Not the "Home" project %> <% content_for :tab_line_buttons do %> + <% if current_user.andand.is_active %> + <%= render partial: 'extra_tab_line_buttons' %> + <% end %> <% if current_user.andand.is_active && @object.class.copies_to_projects? %> <%= link_to( choose_projects_path( diff --git a/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb b/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb new file mode 100644 index 0000000000..662309ffe8 --- /dev/null +++ b/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb @@ -0,0 +1,10 @@ +<% if @object.state == 'Final' %> + <%= link_to(copy_container_request_path('id' => @object.uuid), + class: 'btn btn-primary', + title: 'Re-run', + data: {toggle: :tooltip, placement: :top}, title: 'This will make a copy and take you there. You can then make any needed changes and run it', + method: :post, + ) do %> + Re-run + <% end %> +<% end %> diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb index 7c2312c1ce..21cb7c40bc 100644 --- a/apps/workbench/config/routes.rb +++ b/apps/workbench/config/routes.rb @@ -26,6 +26,7 @@ ArvadosWorkbench::Application.routes.draw do resources :containers resources :container_requests do post 'cancel', :on => :member + post 'copy', on: :member end get '/virtual_machines/:id/webshell/:login' => 'virtual_machines#webshell', :as => :webshell_virtual_machine resources :authorized_keys diff --git a/apps/workbench/test/controllers/container_requests_controller_test.rb b/apps/workbench/test/controllers/container_requests_controller_test.rb index 8dbbbd07c1..70e042cd3d 100644 --- a/apps/workbench/test/controllers/container_requests_controller_test.rb +++ b/apps/workbench/test/controllers/container_requests_controller_test.rb @@ -29,4 +29,31 @@ class ContainerRequestsControllerTest < ActionController::TestCase assert_includes @response.body, '