Add webhook management to feed detail page and corresponding tests
This commit is contained in:
parent
b025d5b136
commit
7435bba6f8
3 changed files with 109 additions and 0 deletions
|
|
@ -171,6 +171,47 @@
|
|||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<section class="mt-4 pt-3 border-top border-secondary-subtle">
|
||||
<h3 class="h6 text-uppercase text-muted mb-3">Webhook</h3>
|
||||
{% if current_webhook_name %}
|
||||
<p class="text-muted mb-3">
|
||||
Current webhook:
|
||||
<strong>{{ current_webhook_name }}</strong>
|
||||
</p>
|
||||
{% elif current_webhook_url %}
|
||||
<p class="text-warning mb-3">This feed references a missing webhook. Choose a webhook below to reattach it.</p>
|
||||
{% else %}
|
||||
<p class="text-warning mb-3">No webhook is attached to this feed yet.</p>
|
||||
{% endif %}
|
||||
{% if webhooks %}
|
||||
<form action="/attach_feed_webhook"
|
||||
method="post"
|
||||
class="d-flex flex-wrap align-items-center gap-2 mb-0">
|
||||
<input type="hidden" name="feed_url" value="{{ feed.url }}" />
|
||||
<input type="hidden"
|
||||
name="redirect_to"
|
||||
value="/feed?feed_url={{ feed.url|encode_url }}" />
|
||||
<select name="webhook_dropdown"
|
||||
class="form-select form-select-sm bg-dark border-dark text-muted"
|
||||
required>
|
||||
<option value=""
|
||||
disabled
|
||||
{% if not current_webhook_name %}selected{% endif %}>
|
||||
Select webhook...
|
||||
</option>
|
||||
{% for hook in webhooks %}
|
||||
<option value="{{ hook.name }}"
|
||||
{% if hook.name == current_webhook_name %}selected{% endif %}>
|
||||
{{ hook.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button class="btn btn-outline-light btn-sm" type="submit">Save webhook</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="text-muted mb-0">Add a webhook first to attach this feed.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
<section class="mt-4 pt-3 border-top border-secondary-subtle">
|
||||
<h3 class="h6 text-uppercase text-muted mb-3">Feed Information</h3>
|
||||
<div class="row g-2 text-muted small">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue