Sha256: e569d8f17ce44859f5d4a61ef70d320ea1f7e7c25a1ff439cf483814c5970b6c

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

module ForemanRemoteExecution
  module HostsHelperExtensions
    def multiple_actions
      super + [ [_('Schedule Remote Job'), new_job_invocation_path, false] ]
    end

    def schedule_job_multi_button(*args)
      host_features = RemoteExecutionFeature.with_host_action_button.order(:label).map do |feature|
        link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [args.first.id], :feature => feature.label), :method => :post)
      end

      if host_features.present?
        action_buttons(schedule_job_button(*args), *host_features)
      else
        schedule_job_button(*args)
      end
    end

    def schedule_job_button(*args)
      link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button, :class => 'btn btn-default')
    end

    def web_console_button(host, *args)
      return unless authorized_for(permission: 'cockpit_hosts', auth_object: host)
      url = SSHExecutionProvider.cockpit_url_for_host(host.name)
      url ? link_to(_('Web Console'), url, :class => 'btn btn-default') : nil
    end

    def host_title_actions(*args)
      title_actions(button_group(schedule_job_multi_button(*args)),
                    button_group(web_console_button(*args)))
      super(*args)
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_remote_execution-2.0.5 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-2.0.4 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-2.0.3 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-2.0.2 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-2.0.1 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-2.0.0 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-1.8.4 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-1.8.3 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-1.8.2 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-1.8.1 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
foreman_remote_execution-1.8.0 app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb