Browse Source

Remove Check.last_ping_body field. CSS tweaks for the "Ping Details" modal.

pull/163/head
Pēteris Caune 7 years ago
parent
commit
218d0c6873
7 changed files with 60 additions and 13 deletions
  1. +19
    -0
      hc/api/migrations/0039_remove_check_last_ping_body.py
  2. +0
    -1
      hc/api/models.py
  3. +1
    -2
      hc/front/tests/test_ping_details.py
  4. +4
    -0
      static/css/log.css
  5. +1
    -1
      static/css/my_checks.css
  6. +2
    -2
      templates/front/log.html
  7. +33
    -7
      templates/front/ping_details.html

+ 19
- 0
hc/api/migrations/0039_remove_check_last_ping_body.py View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-03-18 13:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0038_auto_20180318_1306'),
]
operations = [
migrations.RemoveField(
model_name='check',
name='last_ping_body',
),
]

+ 0
- 1
hc/api/models.py View File

@ -70,7 +70,6 @@ class Check(models.Model):
tz = models.CharField(max_length=36, default="UTC")
n_pings = models.IntegerField(default=0)
last_ping = models.DateTimeField(null=True, blank=True)
last_ping_body = models.CharField(max_length=10000, blank=True)
has_confirmation_link = models.BooleanField(default=False)
alert_after = models.DateTimeField(null=True, blank=True, editable=False)
status = models.CharField(max_length=6, choices=STATUSES, default="new")


+ 1
- 2
hc/front/tests/test_ping_details.py View File

@ -21,10 +21,9 @@ class LastPingTestCase(BaseTestCase):
def test_it_accepts_n(self):
check = Check(user=self.alice)
check.last_ping_body = "this is body"
check.save()
# remote_addr, scheme, method, ua, body):
# remote_addr, scheme, method, ua, body:
check.ping("1.2.3.4", "http", "post", "tester", "foo-123")
check.ping("1.2.3.4", "http", "post", "tester", "bar-456")


+ 4
- 0
static/css/log.css View File

@ -43,6 +43,10 @@
font-size: 11px;
}
#log td.actions {
white-space: nowrap;
}
#log .ok {
color: #5cb85c;
}


+ 1
- 1
static/css/my_checks.css View File

@ -18,7 +18,7 @@
}
@media (min-width: 992px) {
#update-timeout-modal .modal-dialog, #last-ping-modal .modal-dialog {
#update-timeout-modal .modal-dialog, #ping-details-modal .modal-dialog {
width: 800px;
}
}


+ 2
- 2
templates/front/log.html View File

@ -68,7 +68,7 @@
{{ event.ua }}
</td>
<td>
<td class="actions">
{% if event.body %}
<a href="#" class="details-btn" data-url="{% url 'hc-ping-details' check.code event.n %}">show body</a>
{% endif %}
@ -86,7 +86,7 @@
<span class="time"></span>
</div>
</td>
<td colspan="3" class="alert-info">
<td colspan="4" class="alert-info">
{% if event.channel.kind == "email" %}
Sent email alert to {{ event.channel.value }}
{% elif event.channel.kind == "slack" %}


+ 33
- 7
templates/front/ping_details.html View File

@ -7,23 +7,49 @@
<strong>Time Received</strong>
<code>{{ ping.created.isoformat }}</code>
</p>
</div>
{% if ping.remote_addr %}
<div class="col-sm-6">
<p>
<strong>Source</strong>
{% if ping.scheme == "email" %}
{{ ping.ua }}
{% else %}
{{ ping.scheme|upper }} {{ ping.method }} from {{ ping.remote_addr }}
{% endif %}
<strong>Client IP</strong>
{{ ping.remote_addr }}
</p>
</div>
{% endif %}
{% if ping.scheme %}
<div class="col-sm-6">
<p>
<strong>Protocol</strong>
{{ ping.scheme }}
</p>
</div>
{% if ping.scheme != "email" %}
{% endif %}
{% if ping.method %}
<div class="col-sm-6">
<p>
<strong>Method</strong>
{{ ping.method }}
</p>
</div>
{% endif %}
{% if ping.scheme == "email" %}
<div class="col-sm-6">
<p>
<strong>From</strong>
{{ ping.ua }}
</p>
</div>
{% else %}
<div class="col-sm-12">
<p>
<strong>User Agent</strong>
<span class="ua">{{ ping.ua }}</span>
</p>
</div>
{% endif %}
</div>
{% if ping.body %}


Loading…
Cancel
Save