forked from GithubBackups/healthchecks
"Integration Details" modal dialogs for webhook integrations.
This commit is contained in:
parent
7c7919fdb4
commit
edfcac5942
@ -32,9 +32,10 @@ class ChannelsTestCase(BaseTestCase):
|
||||
r = self.client.get("/integrations/")
|
||||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, "<td>http://down.example.com</td>")
|
||||
self.assertContains(r, "<td>http://up.example.com</td>")
|
||||
self.assertContains(r, "<td>foobar</td>")
|
||||
# These are inside a modal:
|
||||
self.assertContains(r, "<code>http://down.example.com</code>")
|
||||
self.assertContains(r, "<code>http://up.example.com</code>")
|
||||
self.assertContains(r, "<code>foobar</code>")
|
||||
|
||||
def test_it_shows_pushover_details(self):
|
||||
ch = Channel(kind="po", user=self.alice)
|
||||
|
@ -193,6 +193,26 @@ table.channels-table > tbody > tr > th {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.channel-details table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.channel-details td, .channel-details th {
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.channel-details tr:last-child td, .channel-details tr:last-child th {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
.channel-details .missing {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
/* Add Webhook */
|
||||
|
||||
.webhook-header input.form-control {
|
||||
|
@ -70,32 +70,19 @@
|
||||
{{ ch.value }}
|
||||
{% endif %}
|
||||
{% elif ch.kind == "webhook" %}
|
||||
<table>
|
||||
{% if ch.url_down %}
|
||||
<tr>
|
||||
<td class="preposition">down </td>
|
||||
<td>{{ ch.url_down }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if ch.url_up %}
|
||||
<tr>
|
||||
<td class="preposition">up </td>
|
||||
<td>{{ ch.url_up }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if ch.post_data %}
|
||||
<tr>
|
||||
<td class="preposition">body </td>
|
||||
<td>{{ ch.post_data }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if ch.headers %}
|
||||
<tr>
|
||||
<td class="preposition">headers </td>
|
||||
<td>{{ ch.headers }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% if ch.url_down %}
|
||||
<span class="preposition">down</span> {{ ch.url_down }}
|
||||
{% endif %}
|
||||
{% if ch.url_up and not ch.url_down %}
|
||||
<span class="preposition">up</span> {{ ch.url_up }}
|
||||
{% endif %}
|
||||
{% if ch.url_up or ch.post_data or ch.headers %}
|
||||
<a href="#"
|
||||
data-toggle="modal"
|
||||
data-target="#channel-details-{{ ch.code }}">(details)</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% elif ch.kind == "pushbullet" %}
|
||||
<span class="preposition">API key</span>
|
||||
{{ ch.value }}
|
||||
@ -329,6 +316,72 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for ch in channels %}
|
||||
{% if ch.kind == "webhook" %}
|
||||
<div id="channel-details-{{ ch.code }}" class="modal channel-details">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4>Integration Details</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Request Method</th>
|
||||
<td>
|
||||
{% if ch.post_data %}
|
||||
POST
|
||||
{% else %}
|
||||
GET
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>URL for "down" events</th>
|
||||
<td>
|
||||
{% if ch.url_down %}
|
||||
<code>{{ ch.url_down }}</code>
|
||||
{% else %}
|
||||
<span class="missing">(not set)</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if ch.url_up %}
|
||||
<tr>
|
||||
<th>URL for "up" events</th>
|
||||
<td>
|
||||
{% if ch.url_up %}
|
||||
<code>{{ ch.url_up }}</code>
|
||||
{% else %}
|
||||
<span class="missing">(not set)</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if ch.post_data %}
|
||||
<tr>
|
||||
<th>POST data</th>
|
||||
<td><code>{{ ch.post_data }}</code></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for k, v in ch.headers.items %}
|
||||
<tr>
|
||||
<th>Header <code>{{ k }}</code></th>
|
||||
<td><code>{{ v }}</code></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user