mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-14 08:58:29 +00:00
Change "Settings - Email Reports" page to allow manual tz selection
This commit is contained in:
parent
86262ef620
commit
15cbb39bd3
4 changed files with 27 additions and 8 deletions
|
@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Add ntfy integration (#728)
|
- Add ntfy integration (#728)
|
||||||
- Add ".txt" suffix to the filename when downloading ping body (#738)
|
- Add ".txt" suffix to the filename when downloading ping body (#738)
|
||||||
- Add API support for fetching ping bodies (#737)
|
- Add API support for fetching ping bodies (#737)
|
||||||
|
- Change "Settings - Email Reports" page to allow manual timezone selection
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
- Fix the most recent ping lookup in the "Ping Details" dialog
|
- Fix the most recent ping lookup in the "Ping Details" dialog
|
||||||
|
|
|
@ -29,6 +29,7 @@ from hc.accounts import forms
|
||||||
from hc.accounts.decorators import require_sudo_mode
|
from hc.accounts.decorators import require_sudo_mode
|
||||||
from hc.accounts.models import Credential, Member, Profile, Project
|
from hc.accounts.models import Credential, Member, Profile, Project
|
||||||
from hc.api.models import Channel, Check, TokenBucket
|
from hc.api.models import Channel, Check, TokenBucket
|
||||||
|
from hc.lib.tz import all_timezones
|
||||||
from hc.lib.webauthn import CreateHelper, GetHelper
|
from hc.lib.webauthn import CreateHelper, GetHelper
|
||||||
from hc.payments.models import Subscription
|
from hc.payments.models import Subscription
|
||||||
|
|
||||||
|
@ -505,7 +506,12 @@ def project(request, code):
|
||||||
def notifications(request):
|
def notifications(request):
|
||||||
profile = request.profile
|
profile = request.profile
|
||||||
|
|
||||||
ctx = {"status": "default", "page": "profile", "profile": profile}
|
ctx = {
|
||||||
|
"status": "default",
|
||||||
|
"page": "profile",
|
||||||
|
"profile": profile,
|
||||||
|
"timezones": all_timezones,
|
||||||
|
}
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = forms.ReportSettingsForm(request.POST)
|
form = forms.ReportSettingsForm(request.POST)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
$("#tz").val(Intl.DateTimeFormat().resolvedOptions().timeZone);
|
$("select[name=tz]").selectize();
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h2>Email Reports</h2>
|
<h2>Email Reports</h2>
|
||||||
|
|
||||||
<input id="tz" type="hidden" name="tz" value="{{ profile.tz }}" />
|
|
||||||
|
|
||||||
<p>Periodic email reports:</p>
|
<p>Periodic email reports:</p>
|
||||||
<label class="radio-container">
|
<label class="radio-container">
|
||||||
<input
|
<input
|
||||||
|
@ -94,16 +92,29 @@
|
||||||
Remind me <strong>hourly</strong>
|
Remind me <strong>hourly</strong>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<p>Time zone:</p>
|
||||||
|
<select id="tz" name="tz" class="form-control" value="{{ profile.tz }}">
|
||||||
|
<option{% if profile.tz == "UTC" %} selected{% endif %}>UTC</option>
|
||||||
|
{% for tz in timezones %}
|
||||||
|
<option{% if profile.tz == tz %} selected{% endif %}>{{ tz }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
Reports will be delivered to {{ profile.user.email }}. <br />
|
{% site_name %} will send reports to
|
||||||
{% if profile.next_report_date %}
|
<strong>{{ profile.user.email }}</strong>,
|
||||||
|
between 9:00 and 11:00 in your selected time zone.
|
||||||
|
</p>
|
||||||
|
{% if profile.next_report_date %}
|
||||||
|
<p class="text-muted">
|
||||||
{% timezone profile.tz %}
|
{% timezone profile.tz %}
|
||||||
Next {{ profile.reports }} report date is
|
Next {{ profile.reports }} report date is
|
||||||
{{ profile.next_report_date|date:"F j, Y" }}.
|
{{ profile.next_report_date|date:"F j, Y" }}.
|
||||||
{% endtimezone %}
|
{% endtimezone 0%}
|
||||||
{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
<br />
|
<br />
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
|
@ -124,6 +135,7 @@
|
||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
|
<script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
|
||||||
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
||||||
|
<script src="{% static 'js/selectize.min.js' %}"></script>
|
||||||
<script src="{% static 'js/notifications.js' %}"></script>
|
<script src="{% static 'js/notifications.js' %}"></script>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue