forked from GithubBackups/healthchecks
Display "late" status in My Checks page and in alerts.
This commit is contained in:
parent
e18fcf424f
commit
fe78275d3f
@ -57,3 +57,17 @@ class Check(models.Model):
|
|||||||
send(self.user.email, "emails/alert", ctx)
|
send(self.user.email, "emails/alert", ctx)
|
||||||
else:
|
else:
|
||||||
raise NotImplemented("Unexpected status: %s" % self.status)
|
raise NotImplemented("Unexpected status: %s" % self.status)
|
||||||
|
|
||||||
|
def get_status(self):
|
||||||
|
if self.status == "new":
|
||||||
|
return "new"
|
||||||
|
|
||||||
|
now = timezone.now()
|
||||||
|
|
||||||
|
if self.last_ping + self.timeout > now:
|
||||||
|
return "up"
|
||||||
|
|
||||||
|
if self.last_ping + self.timeout + self.grace > now:
|
||||||
|
return "grace"
|
||||||
|
|
||||||
|
return "down"
|
||||||
|
@ -77,7 +77,7 @@ body {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glyphicon.up, .glyphicon.new, .glyphicon.down {
|
.glyphicon.up, .glyphicon.new, .glyphicon.grace, .glyphicon.down {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +89,10 @@ body {
|
|||||||
color: #AAA;
|
color: #AAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.glyphicon.grace {
|
||||||
|
color: #f0ad4e;
|
||||||
|
}
|
||||||
|
|
||||||
.glyphicon.down {
|
.glyphicon.down {
|
||||||
color: #d9534f;
|
color: #d9534f;
|
||||||
}
|
}
|
||||||
@ -131,6 +135,11 @@ table.table tr > th.th-name {
|
|||||||
border: 1px dotted #AAA;
|
border: 1px dotted #AAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.my-checks-name.unnamed {
|
||||||
|
color: #999;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
.url-cell {
|
.url-cell {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ $(function () {
|
|||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
$("#update-name-form").attr("action", $this.data("url"));
|
$("#update-name-form").attr("action", $this.data("url"));
|
||||||
$("#update-name-input").val($this.text());
|
$("#update-name-input").val($this.data("name"));
|
||||||
$('#update-name-modal').modal("show");
|
$('#update-name-modal').modal("show");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
|
|
||||||
.new { background: #AAA; }
|
.new { background: #AAA; }
|
||||||
.up { background: #5cb85c; }
|
.up { background: #5cb85c; }
|
||||||
|
.grace { background: #f0ad4e; }
|
||||||
.down { background: #d9534f; }
|
.down { background: #d9534f; }
|
||||||
|
|
||||||
|
|
||||||
.unnamed {
|
.unnamed {
|
||||||
color: #888;
|
color: #888;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
@ -44,11 +47,13 @@
|
|||||||
{% for check in checks %}
|
{% for check in checks %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if check.status == "new" %}
|
{% if check.get_status == "new" %}
|
||||||
<span class="badge new">NEW</span>
|
<span class="badge new">NEW</span>
|
||||||
{% elif now < check.alert_after %}
|
{% elif check.get_status == "up" %}
|
||||||
<span class="badge up">UP</span>
|
<span class="badge up">UP</span>
|
||||||
{% else %}
|
{% elif check.get_status == "grace" %}
|
||||||
|
<span class="badge grace">LATE</span>
|
||||||
|
{% elif check.get_status == "down" %}
|
||||||
<span class="badge down">DOWN</span>
|
<span class="badge down">DOWN</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -24,17 +24,23 @@
|
|||||||
{% for check in checks %}
|
{% for check in checks %}
|
||||||
<tr class="checks-row">
|
<tr class="checks-row">
|
||||||
<td class="indicator-cell">
|
<td class="indicator-cell">
|
||||||
{% if check.status == "new" %}
|
{% if check.get_status == "new" %}
|
||||||
<span class="glyphicon glyphicon-question-sign new"></span>
|
<span class="glyphicon glyphicon-question-sign new"></span>
|
||||||
{% elif now < check.alert_after %}
|
{% elif check.get_status == "up" %}
|
||||||
<span class="glyphicon glyphicon-ok-sign up"></span>
|
<span class="glyphicon glyphicon-ok-sign up"></span>
|
||||||
{% else %}
|
{% elif check.get_status == "grace" %}
|
||||||
|
<span class="glyphicon glyphicon-exclamation-sign grace"></span>
|
||||||
|
{% elif check.get_status == "down" %}
|
||||||
<span class="glyphicon glyphicon-exclamation-sign down"></span>
|
<span class="glyphicon glyphicon-exclamation-sign down"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="name-cell">
|
<td class="name-cell">
|
||||||
<span data-url="{% url 'hc-update-name' check.code %}"
|
<span
|
||||||
class="my-checks-name">{{ check.name }}</span>
|
data-name="{{ check.name }}"
|
||||||
|
data-url="{% url 'hc-update-name' check.code %}"
|
||||||
|
class="my-checks-name {% if not check.name %}unnamed{% endif %}">
|
||||||
|
{{ check.name|default:"unnamed" }}
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="url-cell">
|
<td class="url-cell">
|
||||||
<code>{{ check.url }}</code>
|
<code>{{ check.url }}</code>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user