Skip to content

Commit

Permalink
Refs #36974 - show run job button to rex users
Browse files Browse the repository at this point in the history
(cherry picked from commit 5194ef0)
  • Loading branch information
MariaAga authored and adamruzicka committed Apr 5, 2024
1 parent 84a3f4b commit 77eea6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def permitted_actions(template)
original = super(template)

if template.is_a?(JobTemplate)
original.unshift(display_link_if_authorized(_('Run'), hash_for_new_job_invocation_path(:template_id => template.id).merge(:authorizer => authorizer))) unless template.snippet
original.unshift(authorized_for(controller: :job_invocations, action: :create) ? link_to(_('Run'), hash_for_new_job_invocation_path(:template_id => template.id).merge(:authorizer => authorizer)) : nil) unless template.snippet
end

original
Expand Down
4 changes: 2 additions & 2 deletions app/views/job_invocations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<% stylesheet 'foreman_remote_execution/foreman_remote_execution' %>
<% title _('Job invocation') %>
<% if(request.path_parameters[:action] == "rerun") %>
<%= display_link_if_authorized(_('Use new job wizard'), hash_for_rerun_job_invocation_path({:id => request.path_parameters[:id]}).merge(request.query_parameters)) %>
<%= authorized_for(controller: :job_invocations, action: :create) ? link_to(_('Use new job wizard'), hash_for_rerun_job_invocation_path({:id => request.path_parameters[:id]}).merge(request.query_parameters)) : nil %>
<% else %>
<%= display_link_if_authorized(_('Use new job wizard'), hash_for_new_job_invocation_path().merge(request.query_parameters)) %>
<%= authorized_for(controller: :job_invocations, action: :create) ? link_to(_('Use new job wizard'), hash_for_new_job_invocation_path().merge(request.query_parameters)) : nil %>
<%end%>
<%= render :partial => 'form' %>
2 changes: 1 addition & 1 deletion app/views/job_invocations/welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<p><%= link_to _('Learn more about this in the documentation.'),
documentation_url('1.ForemanRemoteExecution1.3Manual', :root_url => 'https://www.theforeman.org/plugins/foreman_remote_execution/1.3/index.html#'), :rel => 'external' %></p>
<div class="blank-slate-pf-main-action">
<%= display_link_if_authorized(_("Run Job"), { :action => :create }, { :class => "btn btn-primary btn-lg" }) %>
<%= authorized_for(controller: :job_invocations, action: :create) ? link_to(_("Run Job"), { :action => :create }, { :class => "btn btn-primary btn-lg" }) : nil %>
</div>
</div>

0 comments on commit 77eea6b

Please sign in to comment.