activity: basic webhook alerts for automation failures
This commit is contained in:
parent
eb372bec59
commit
ac4f9b4942
12 changed files with 300 additions and 3 deletions
|
@ -114,6 +114,12 @@
|
|||
{{ icon("file-earmark-excel") }} Block Lists
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if section == "webhook" %} active{% endif %}"
|
||||
href="{{ url_for("portal.webhook.webhook_list") }}">
|
||||
{{ icon("activity") }} Webhooks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||
<span>Infrastructure</span>
|
||||
|
|
|
@ -44,4 +44,21 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<div class="card h-100">
|
||||
<h3 class="h4 card-header">Activity</h3>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
{% for a in activity %}
|
||||
<tr>
|
||||
<td>{{ a.text }}</td>
|
||||
<td>{{ a.added | format_datetime }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,5 +1,11 @@
|
|||
{% macro icon(i) %}
|
||||
{% if i == "arrow-down-up" %}
|
||||
{% if i == "activity" %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-activity"
|
||||
viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd"
|
||||
d="M6 2a.5.5 0 0 1 .47.33L10 12.036l1.53-4.208A.5.5 0 0 1 12 7.5h3.5a.5.5 0 0 1 0 1h-3.15l-1.88 5.17a.5.5 0 0 1-.94 0L6 3.964 4.47 8.171A.5.5 0 0 1 4 8.5H.5a.5.5 0 0 1 0-1h3.15l1.88-5.17A.5.5 0 0 1 6 2Z"/>
|
||||
</svg>
|
||||
{% elif i == "arrow-down-up" %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-up"
|
||||
viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "base.html.j2" %}
|
||||
{% from "tables.html.j2" import alarms_table, automations_table, bridgeconfs_table, bridges_table, eotk_table,
|
||||
groups_table, mirrorlists_table, origins_table, origin_onion_table, onions_table, proxies_table %}
|
||||
groups_table, mirrorlists_table, origins_table, origin_onion_table, onions_table, proxies_table,
|
||||
webhook_table %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="h2 mt-3">{{ title }}</h1>
|
||||
|
@ -34,5 +35,7 @@
|
|||
{{ origins_table(items) }}
|
||||
{% elif item == "proxy" %}
|
||||
{{ proxies_table(items) }}
|
||||
{% elif item == "webhook" %}
|
||||
{{ webhook_table(items) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -529,4 +529,33 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro webhook_table(webhooks) %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Format</th>
|
||||
<th scope="col">URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for webhook in webhooks %}
|
||||
{% if not webhook.destroyed %}
|
||||
<tr class="align-middle">
|
||||
<td>{{ webhook.description }}</td>
|
||||
<td>{{ webhook.format | webhook_format_name }}</td>
|
||||
<td><code>{{ webhook.url }}</code></td>
|
||||
<td>
|
||||
<a href="{{ url_for("portal.webhook.webhook_destroy", webhook_id=webhook.id) }}"
|
||||
class="btn btn-danger btn-sm">Destroy</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endmacro %}
|
Loading…
Add table
Add a link
Reference in a new issue