مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-16 21:23:37 +00:00
initial commit from appmail
هذا الالتزام موجود في:
44
app/views/webhooks/_form.html.haml
Normal file
44
app/views/webhooks/_form.html.haml
Normal file
@@ -0,0 +1,44 @@
|
||||
= form_for [organization, @server, @webhook], :remote => true do |f|
|
||||
= f.error_messages
|
||||
%fieldset.fieldSet
|
||||
.fieldSet__field
|
||||
= f.label :name, :class => 'fieldSet__label'
|
||||
.fieldSet__input
|
||||
= f.text_field :name, :autofocus => true, :class => 'input input--text'
|
||||
%p.fieldSet__text
|
||||
Enter a name to describe this webhook. This is used so you can identify this webhook later in the web interface.
|
||||
|
||||
.fieldSet__field
|
||||
= f.label :url, :class => 'fieldSet__label'
|
||||
.fieldSet__input
|
||||
= f.text_field :url, :class => 'input input--text'
|
||||
%p.fieldSet__text
|
||||
Enter the URL that you'd like us to send requests to. All requests will be POST requests with
|
||||
a JSON-encoded payload in the body of the request.
|
||||
.fieldSet__field
|
||||
= f.label :enabled, :class => 'fieldSet__label'
|
||||
.fieldSet__input
|
||||
= f.select :enabled, [["Yes - send requests to this webhook", true], ["No - do not send requests at the moment", false]], {},:class => 'input input--select'
|
||||
%p.fieldSet__text
|
||||
You can enable or disable this webhook without fully removing it from the system. If there are any outstanding
|
||||
webhook deliveries, they will still be completed even if disabled.
|
||||
|
||||
.fieldSet__field
|
||||
= f.label :all_events, 'Events', :class => 'fieldSet__label'
|
||||
.fieldSet__input
|
||||
= hidden_field_tag 'webhook[events][]'
|
||||
= f.select :all_events, [["Yes - send all events to this URL", true], ["No - I'll choose which requests to send", false]], {},:class => 'input input--select fieldSet__checkboxListAfter js-checkbox-list-toggle'
|
||||
%ul.checkboxList{:class => [@webhook.all_events? ? 'is-hidden' : '']}
|
||||
- for event in WebhookEvent::EVENTS
|
||||
%li.checkboxList__item
|
||||
.checkboxList__checkbox= check_box_tag "webhook[events][]", event, @webhook.events.include?(event), :id => "event_#{event}"
|
||||
.checkboxList__label
|
||||
= label_tag "event_#{event}", event, :class => 'checkboxList__actualLabel checkboxList__devEvent'
|
||||
%p.checkBoxList__text= t("webhook_events.#{event.underscore}")
|
||||
|
||||
.fieldSetSubmit.buttonSet
|
||||
= f.submit @webhook.new_record? ? "Create Webhook" : "Save Webhook", :class => 'button button--positive js-form-submit'
|
||||
.fieldSetSubmit__delete
|
||||
- if f.object.persisted?
|
||||
= link_to "Delete Webhook", [organization, @server, @webhook], :remote => true, :class => 'button button--danger', :method => :delete, :data => {:confirm => "Are you sure you wish to delete this webhook?"}
|
||||
|
||||
5
app/views/webhooks/_header.html.haml
Normal file
5
app/views/webhooks/_header.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.navBar.navBar--secondary
|
||||
%ul
|
||||
%li.navBar__item= link_to "Manage Webhooks", [organization, @server, :webhooks], :class => ['navBar__link', active_nav == :webhooks ? 'is-active' : '']
|
||||
%li.navBar__item= link_to "View History", [:history, organization, @server, :webhooks], :class => ['navBar__link', active_nav == :history ? 'is-active' : '']
|
||||
|
||||
10
app/views/webhooks/edit.html.haml
Normal file
10
app/views/webhooks/edit.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
- page_title << @server.name
|
||||
- page_title << "Webhooks"
|
||||
- page_title << "Edit"
|
||||
|
||||
= render 'servers/sidebar', :active_server => @server
|
||||
= render 'servers/header', :active_nav => :webhooks
|
||||
= render 'header', :active_nav => :webhooks
|
||||
.pageContent.pageContent--compact
|
||||
= render 'form'
|
||||
|
||||
32
app/views/webhooks/history.html.haml
Normal file
32
app/views/webhooks/history.html.haml
Normal file
@@ -0,0 +1,32 @@
|
||||
- page_title << @server.name
|
||||
- page_title << "Webhooks"
|
||||
- page_title << "History"
|
||||
|
||||
= render 'servers/sidebar', :active_server => @server
|
||||
= render 'servers/header', :active_nav => :webhooks
|
||||
= render 'header', :active_nav => :history
|
||||
|
||||
.pageContent.pageContent--compact
|
||||
- if @requests[:records].empty?
|
||||
.noData.noData--clean.noData--cat3
|
||||
%h2.noData__title No webhook requests recorded.
|
||||
%p.noData__text
|
||||
This page shows the last 10 days worth of webhook requests that have been sent by Postal. This page will
|
||||
populate automatically as webhooks are dispatched.
|
||||
|
||||
- else
|
||||
%p.pageContent__intro.u-margin
|
||||
This page shows a list of all webhook requests which have been sent for this server. These are kept for 10 days before being
|
||||
removed. Click on a request for additional information.
|
||||
%ul.webhookRequestList
|
||||
- for req in @requests[:records]
|
||||
%li.webhookRequestList__item
|
||||
= link_to history_request_organization_server_webhooks_path(organization, @server, req.uuid), :class => 'webhookRequestList__link' do
|
||||
.webhookRequestList__top
|
||||
%p.webhookRequestList__status
|
||||
%span.label{:class => "label--http-status-#{req.status_code.to_s[0,1]}"}= req.status_code
|
||||
%p.webhookRequestList__time= req.timestamp.strftime("%d/%m/%Y at %H:%M:%S")
|
||||
%p.webhookRequestList__event= req.event
|
||||
%p.webhookRequestList__url= req.url || "Unknown"
|
||||
|
||||
= render 'shared/message_db_pagination', :data => @requests, :name => 'request'
|
||||
34
app/views/webhooks/history_request.html.haml
Normal file
34
app/views/webhooks/history_request.html.haml
Normal file
@@ -0,0 +1,34 @@
|
||||
- page_title << @server.name
|
||||
- page_title << "Webhooks"
|
||||
- page_title << "History"
|
||||
|
||||
= render 'servers/sidebar', :active_server => @server
|
||||
= render 'servers/header', :active_nav => :webhooks
|
||||
= render 'header', :active_nav => :history
|
||||
|
||||
.pageContent.pageContent--compact
|
||||
%dl.pageContent__definitions.u-margin
|
||||
%dt URL
|
||||
%dd= @req.url
|
||||
%dt Event
|
||||
%dd= @req.event
|
||||
%dt UUID
|
||||
%dd= @req.uuid
|
||||
|
||||
%dt Timestamp
|
||||
%dd= @req.timestamp.strftime("%d/%m/%Y at %H:%M:%S")
|
||||
%dt HTTP Status Code
|
||||
%dd
|
||||
%span.label.label--large{:class => "label--http-status-#{@req.status_code.to_s[0,1]}"}= @req.status_code
|
||||
|
||||
%dt Attempt
|
||||
%dd
|
||||
= @req.attempt
|
||||
- if @req.will_retry?
|
||||
(will be retried)
|
||||
|
||||
%p.pageContent__title Payload
|
||||
%pre.codeBlock.u-margin.codeBlock--whitespace~ preserve @req.pretty_payload
|
||||
%p.pageContent__title Response Body
|
||||
%pre.codeBlock.u-margin= @req.body
|
||||
%p.u-margin= link_to "Back to history", [:history, organization, @server, :webhooks], :class => "button button--neutral"
|
||||
35
app/views/webhooks/index.html.haml
Normal file
35
app/views/webhooks/index.html.haml
Normal file
@@ -0,0 +1,35 @@
|
||||
- page_title << @server.name
|
||||
- page_title << "Webhooks"
|
||||
|
||||
= render 'servers/sidebar', :active_server => @server
|
||||
= render 'servers/header', :active_nav => :webhooks
|
||||
= render 'header', :active_nav => :webhooks
|
||||
.pageContent.pageContent--compact
|
||||
- if @webhooks.empty?
|
||||
.noData.noData--clean.noData--lion
|
||||
%h2.noData__title You've got no webhooks. We're not lion.
|
||||
%p.noData__text
|
||||
You haven't added any webhooks for this server yet. A webhook enables your web
|
||||
application to be notified when certain events occur in the lifecycle of the mail server.
|
||||
%p.noData__button= link_to "Add your first webhook", [:new, organization, @server, :webhook], :class => "button button--positive"
|
||||
- else
|
||||
%ul.webhookList.u-margin
|
||||
- for webhook in @webhooks
|
||||
%li.webhookList__item
|
||||
.webhookList__top
|
||||
%p.webhookList__name= link_to webhook.name, [:edit, organization, @server, webhook]
|
||||
%p.webhookList__labels
|
||||
- if webhook.enabled?
|
||||
%span.label.label--green Enabled
|
||||
- else
|
||||
%span.label.label--red Disabled
|
||||
.webhookList__bottom
|
||||
%p.webhookList__usageTime
|
||||
- if webhook.last_used_at
|
||||
Last sent request #{distance_of_time_in_words_to_now webhook.last_used_at}.
|
||||
- else
|
||||
Not used yet.
|
||||
%ul.webhookList__links
|
||||
%li.webhookList__link= link_to "Edit Webhook", [:edit, organization, @server, webhook]
|
||||
|
||||
%p.u-center= link_to "Add another webhook", [:new, organization, @server, :webhook], :class => 'button button--positive'
|
||||
10
app/views/webhooks/new.html.haml
Normal file
10
app/views/webhooks/new.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
- page_title << @server.name
|
||||
- page_title << "Webhooks"
|
||||
- page_title << "New"
|
||||
|
||||
= render 'servers/sidebar', :active_server => @server
|
||||
= render 'servers/header', :active_nav => :webhooks
|
||||
= render 'header', :active_nav => :webhooks
|
||||
.pageContent.pageContent--compact
|
||||
= render 'form'
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم