mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-16 17:38:18 +08:00
Added timeout and debugging statuses to webhooks
- Added a user-configurable timeout option to webhooks. - Added webhook fields for last-call/error datetime, in addition to last error string, which are shown on webhook edit view. Related to #3122
This commit is contained in:
@ -8,9 +8,19 @@
|
||||
@include('settings.parts.navbar', ['selected' => 'webhooks'])
|
||||
</div>
|
||||
|
||||
<form action="{{ url("/settings/webhooks/create") }}" method="POST">
|
||||
@include('settings.webhooks.parts.form', ['title' => trans('settings.webhooks_create')])
|
||||
</form>
|
||||
<div class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ trans('settings.webhooks_create') }}</h1>
|
||||
|
||||
<form action="{{ url("/settings/webhooks/create") }}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
@include('settings.webhooks.parts.form', ['title' => trans('settings.webhooks_create')])
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ url("/settings/webhooks") }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<button type="submit" class="button">{{ trans('settings.webhooks_save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@include('settings.webhooks.parts.format-example')
|
||||
</div>
|
||||
|
@ -7,10 +7,46 @@
|
||||
@include('settings.parts.navbar', ['selected' => 'webhooks'])
|
||||
</div>
|
||||
|
||||
<form action="{{ $webhook->getUrl() }}" method="POST">
|
||||
{!! method_field('PUT') !!}
|
||||
@include('settings.webhooks.parts.form', ['model' => $webhook, 'title' => trans('settings.webhooks_edit')])
|
||||
</form>
|
||||
<div class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ trans('settings.webhooks_edit') }}</h1>
|
||||
|
||||
|
||||
<div class="setting-list">
|
||||
<div class="grid half">
|
||||
<div>
|
||||
<label class="setting-list-label">{{ trans('settings.webhooks_status') }}</label>
|
||||
<p class="mb-none">
|
||||
{{ trans('settings.webhooks_last_called') }} {{ $webhook->last_called_at ? $webhook->last_called_at->diffForHumans() : trans('common.never') }}
|
||||
<br>
|
||||
{{ trans('settings.webhooks_last_errored') }} {{ $webhook->last_errored_at ? $webhook->last_errored_at->diffForHumans() : trans('common.never') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
<br>
|
||||
@if($webhook->last_error)
|
||||
{{ trans('settings.webhooks_last_error_message') }} <br>
|
||||
<span class="text-warn text-small">{{ $webhook->last_error }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
<form action="{{ $webhook->getUrl() }}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
{!! method_field('PUT') !!}
|
||||
@include('settings.webhooks.parts.form', ['model' => $webhook, 'title' => trans('settings.webhooks_edit')])
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ url("/settings/webhooks") }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<a href="{{ $webhook->getUrl('/delete') }}" class="button outline">{{ trans('settings.webhooks_delete') }}</a>
|
||||
<button type="submit" class="button">{{ trans('settings.webhooks_save') }}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@include('settings.webhooks.parts.format-example')
|
||||
</div>
|
||||
|
@ -1,75 +1,64 @@
|
||||
{!! csrf_field() !!}
|
||||
<div class="setting-list">
|
||||
|
||||
<div class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ $title }}</h1>
|
||||
|
||||
<div class="setting-list">
|
||||
|
||||
<div class="grid half">
|
||||
<div class="grid half">
|
||||
<div>
|
||||
<label class="setting-list-label">{{ trans('settings.webhooks_details') }}</label>
|
||||
<p class="small">{{ trans('settings.webhooks_details_desc') }}</p>
|
||||
<div>
|
||||
<label class="setting-list-label">{{ trans('settings.webhooks_details') }}</label>
|
||||
<p class="small">{{ trans('settings.webhooks_details_desc') }}</p>
|
||||
<div>
|
||||
@include('form.toggle-switch', [
|
||||
'name' => 'active',
|
||||
'value' => old('active') ?? $model->active ?? true,
|
||||
'label' => trans('settings.webhooks_active'),
|
||||
])
|
||||
@include('form.errors', ['name' => 'active'])
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="name">{{ trans('settings.webhooks_name') }}</label>
|
||||
@include('form.text', ['name' => 'name'])
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="endpoint">{{ trans('settings.webhooks_endpoint') }}</label>
|
||||
@include('form.text', ['name' => 'endpoint'])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div component="webhook-events">
|
||||
<label class="setting-list-label">{{ trans('settings.webhooks_events') }}</label>
|
||||
@include('form.errors', ['name' => 'events'])
|
||||
|
||||
<p class="small">{{ trans('settings.webhooks_events_desc') }}</p>
|
||||
<p class="text-warn small">{{ trans('settings.webhooks_events_warning') }}</p>
|
||||
|
||||
<div class="toggle-switch-list">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'events[]',
|
||||
'value' => 'all',
|
||||
'label' => trans('settings.webhooks_events_all'),
|
||||
'checked' => old('events') ? in_array('all', old('events')) : (isset($webhook) ? $webhook->tracksEvent('all') : false),
|
||||
@include('form.toggle-switch', [
|
||||
'name' => 'active',
|
||||
'value' => old('active') ?? $model->active ?? true,
|
||||
'label' => trans('settings.webhooks_active'),
|
||||
])
|
||||
</div>
|
||||
|
||||
<hr class="my-s">
|
||||
|
||||
<div class="dual-column-content toggle-switch-list">
|
||||
@foreach(\BookStack\Actions\ActivityType::all() as $activityType)
|
||||
<div>
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'events[]',
|
||||
'value' => $activityType,
|
||||
'label' => $activityType,
|
||||
'checked' => old('events') ? in_array($activityType, old('events')) : (isset($webhook) ? $webhook->tracksEvent($activityType) : false),
|
||||
])
|
||||
</div>
|
||||
@endforeach
|
||||
@include('form.errors', ['name' => 'active'])
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="name">{{ trans('settings.webhooks_name') }}</label>
|
||||
@include('form.text', ['name' => 'name'])
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="endpoint">{{ trans('settings.webhooks_endpoint') }}</label>
|
||||
@include('form.text', ['name' => 'endpoint'])
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="endpoint">{{ trans('settings.webhooks_timeout') }}</label>
|
||||
@include('form.number', ['name' => 'timeout', 'min' => 1, 'max' => 600])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ url("/settings/webhooks") }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
@if ($webhook->id ?? false)
|
||||
<a href="{{ $webhook->getUrl('/delete') }}" class="button outline">{{ trans('settings.webhooks_delete') }}</a>
|
||||
@endif
|
||||
<button type="submit" class="button">{{ trans('settings.webhooks_save') }}</button>
|
||||
<div component="webhook-events">
|
||||
<label class="setting-list-label">{{ trans('settings.webhooks_events') }}</label>
|
||||
@include('form.errors', ['name' => 'events'])
|
||||
|
||||
<p class="small">{{ trans('settings.webhooks_events_desc') }}</p>
|
||||
<p class="text-warn small">{{ trans('settings.webhooks_events_warning') }}</p>
|
||||
|
||||
<div class="toggle-switch-list">
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'events[]',
|
||||
'value' => 'all',
|
||||
'label' => trans('settings.webhooks_events_all'),
|
||||
'checked' => old('events') ? in_array('all', old('events')) : (isset($webhook) ? $webhook->tracksEvent('all') : false),
|
||||
])
|
||||
</div>
|
||||
|
||||
<hr class="my-s">
|
||||
|
||||
<div class="dual-column-content toggle-switch-list">
|
||||
@foreach(\BookStack\Actions\ActivityType::all() as $activityType)
|
||||
<div>
|
||||
@include('form.custom-checkbox', [
|
||||
'name' => 'events[]',
|
||||
'value' => $activityType,
|
||||
'label' => $activityType,
|
||||
'checked' => old('events') ? in_array($activityType, old('events')) : (isset($webhook) ? $webhook->tracksEvent($activityType) : false),
|
||||
])
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user