forked from GithubBackups/healthchecks
Update document.title
This commit is contained in:
parent
8fa9a6f3f6
commit
8ab8e15c4e
@ -82,6 +82,15 @@ def num_down_title(num_down):
|
||||
else:
|
||||
return settings.SITE_NAME
|
||||
|
||||
|
||||
@register.filter
|
||||
def down_title(check):
|
||||
s = "%s – %s" % (check.name_then_code(), settings.SITE_NAME)
|
||||
if check.get_status() == "down":
|
||||
s = "DOWN – " + s
|
||||
return s
|
||||
|
||||
|
||||
@register.filter
|
||||
def break_underscore(s):
|
||||
if len(s) > 30:
|
||||
|
@ -24,7 +24,8 @@ from hc.front.forms import (AddWebhookForm, NameTagsForm,
|
||||
TimeoutForm, AddUrlForm, AddEmailForm,
|
||||
AddOpsGenieForm, CronForm, AddSmsForm)
|
||||
from hc.front.schemas import telegram_callback
|
||||
from hc.front.templatetags.hc_extras import num_down_title, sortchecks
|
||||
from hc.front.templatetags.hc_extras import (num_down_title, down_title,
|
||||
sortchecks)
|
||||
from hc.lib import jsonschema
|
||||
from pytz import all_timezones
|
||||
from pytz.exceptions import UnknownTimeZoneError
|
||||
@ -391,6 +392,7 @@ def status_single(request, code):
|
||||
doc = {
|
||||
"status": status,
|
||||
"status_text": STATUS_TEXT_TMPL.render({"check": check}),
|
||||
"title": down_title(check),
|
||||
"updated": updated
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,10 @@ $(function () {
|
||||
$("#log-container").html(data.events);
|
||||
switchDateFormat(lastFormat);
|
||||
}
|
||||
|
||||
if (document.title != data.title) {
|
||||
document.title = data.title;
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% load compress humanize static hc_extras %}
|
||||
|
||||
{% block title %}My Checks - {% site_name %}{% endblock %}
|
||||
{% block title %}{{ check|down_title }}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user