<% 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 %>
--- /dev/null
+<% 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 %>
+ <i class="fa fa-fw fa-gear"></i> Run this workflow
+ <% end %>
+ <% end %>
+<% end %>
+
+<%= render file: 'application/show.html.erb', locals: local_assigns %>
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