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:
|
else:
|
||||||
return settings.SITE_NAME
|
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
|
@register.filter
|
||||||
def break_underscore(s):
|
def break_underscore(s):
|
||||||
if len(s) > 30:
|
if len(s) > 30:
|
||||||
|
@ -24,7 +24,8 @@ from hc.front.forms import (AddWebhookForm, NameTagsForm,
|
|||||||
TimeoutForm, AddUrlForm, AddEmailForm,
|
TimeoutForm, AddUrlForm, AddEmailForm,
|
||||||
AddOpsGenieForm, CronForm, AddSmsForm)
|
AddOpsGenieForm, CronForm, AddSmsForm)
|
||||||
from hc.front.schemas import telegram_callback
|
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 hc.lib import jsonschema
|
||||||
from pytz import all_timezones
|
from pytz import all_timezones
|
||||||
from pytz.exceptions import UnknownTimeZoneError
|
from pytz.exceptions import UnknownTimeZoneError
|
||||||
@ -391,6 +392,7 @@ def status_single(request, code):
|
|||||||
doc = {
|
doc = {
|
||||||
"status": status,
|
"status": status,
|
||||||
"status_text": STATUS_TEXT_TMPL.render({"check": check}),
|
"status_text": STATUS_TEXT_TMPL.render({"check": check}),
|
||||||
|
"title": down_title(check),
|
||||||
"updated": updated
|
"updated": updated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,10 @@ $(function () {
|
|||||||
$("#log-container").html(data.events);
|
$("#log-container").html(data.events);
|
||||||
switchDateFormat(lastFormat);
|
switchDateFormat(lastFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.title != data.title) {
|
||||||
|
document.title = data.title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, true);
|
}, true);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load compress humanize static hc_extras %}
|
{% load compress humanize static hc_extras %}
|
||||||
|
|
||||||
{% block title %}My Checks - {% site_name %}{% endblock %}
|
{% block title %}{{ check|down_title }}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user