From: radhika Date: Wed, 26 Apr 2017 16:15:24 +0000 (-0400) Subject: 10112: add Run button to workflow#show page X-Git-Tag: 1.1.0~258^2~8 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/ac3bafbcbc8e6d6c6b3be13e3e29b7ab7cf4ad7a 10112: add Run button to workflow#show page --- 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 index fd79535517..7f90af2eec 100644 --- 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 @@ -1,7 +1,6 @@ <% if @object.state == 'Final' %> <%= link_to(copy_container_request_path('id' => @object.uuid), class: 'btn btn-sm 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 %> diff --git a/apps/workbench/app/views/workflows/show.html.erb b/apps/workbench/app/views/workflows/show.html.erb new file mode 100644 index 0000000000..f14ac1ee53 --- /dev/null +++ b/apps/workbench/app/views/workflows/show.html.erb @@ -0,0 +1,20 @@ +<% if current_user.andand.is_active %> + <% content_for :tab_line_buttons do %> + <%= link_to(choose_projects_path(id: "run-workflow-button", + title: 'Choose project', + editable: true, + action_name: 'Choose', + action_href: work_units_path, + action_method: 'post', + action_data: {'selection_param' => 'work_unit[owner_uuid]', + 'work_unit[template_uuid]' => @object.uuid, + 'success' => 'redirect-to-created-object' + }.to_json), + { class: "btn btn-primary btn-sm", title: "Run #{@object.name}", remote: true } + ) do %> + Run this workflow + <% end %> + <% end %> +<% end %> + +<%= render file: 'application/show.html.erb', locals: local_assigns %> diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb index f9f5addb15..87a9771d2b 100644 --- a/apps/workbench/test/integration/work_units_test.rb +++ b/apps/workbench/test/integration/work_units_test.rb @@ -278,4 +278,21 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest assert_text "This container request was created from the workflow #{wf_name}" assert_match /Provide a value for .* then click the \"Run\" button to start the workflow/, page.text end + + test 'Run workflow from show page' do + visit page_with_token('active', '/workflows/zzzzz-7fd4e-validwithinputs') + + find('a,button', text: 'Run this workflow').click + + # Choose project for the container_request being created + within('.modal-dialog') do + find('.selectable', text: 'A Project').click + find('button', text: 'Choose').click + end + + # In newly created container_request page now + assert_text 'A Project' # CR created in "A Project" + assert_text "This container request was created from the workflow" + assert_match /Provide a value for .* then click the \"Run\" button to start the workflow/, page.text + end end