<%= form_for @webhook, url: (@webhook.new_record? ? webhooks_path : webhook_path(id: @webhook)) do |f| %> <%= base_errors_for @webhook %> <%= text_f f, :name %> <%= text_f f, :target_url, help_inline: _('Target URL that should be called by Foreman') %> <%= text_f f, :user, help_block: _('Authentication credentials') %> <%= password_f f, :password, keep_value: true %> <%= selectable_f f, :http_method, Webhook::ALLOWED_HTTP_METHODS, { include_blank: false, selected: @webhook.http_method }, { label: _('HTTP Method'), label_help: _(f.object.try(:description)), required: true } %> <%= text_f f, :http_content_type %> <%= render('templates', f: f) %> <%= selectable_f f, :event, Webhook.available_events.sort.map { |e| e.delete_suffix(Webhook::EVENT_POSTFIX) }, { include_blank: false, selected: @webhook.event&.delete_suffix(Webhook::EVENT_POSTFIX) }, { label: _('Subscribe to'), label_help: _(f.object.try(:description)), required: true } %> <%= checkbox_f f, :enabled, help_inline: _('If unchecked, the webhook will be inactive') %> <%= checkbox_f f, :verify_ssl, help_inline: _("Uncheck this option to disable validation of the receiver's SSL certificate") %> <%= textarea_f f, :ssl_ca_certs, label: _('X509 Certification Authorities'), size: 'col-md-8', rows: 10, placeholder: _("Optional CAs in PEM format concatenated to verify the receiver's SSL certificate.") %> <%= checkbox_f f, :proxy_authorization, help_inline: _("Authorize with Foreman client certificate and validate smart-proxy CA from Settings.") %> <%= textarea_f f, :http_headers, label: _('Optional HTTP headers as JSON (ERB allowed)'), size: 'col-md-8', rows: 6, placeholder: "{\n\"X-Shellhook-Arg-1\": \"value\"\n}" %> <%= submit_or_cancel(f, false, { react_cancel_button: true, cancel_path: '/webhooks' }) %> <% end %>