mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-15 09:24:11 +00:00
Three choices in timezone switcher (UTC / check's timezone / browser's timezone). Fixes #278
This commit is contained in:
parent
dd83ec2214
commit
dfd449b101
10 changed files with 35 additions and 29 deletions
|
@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
|
|||
- Show the number of downtimes and total downtime minutes in "Check Details" page
|
||||
- Add the `pruneflips` management command
|
||||
- Add Mattermost integration (#276)
|
||||
- Three choices in timezone switcher (UTC / check's timezone / browser's timezone) (#278)
|
||||
|
||||
## Bug Fixes
|
||||
- Fix javascript code to construct correct URLs when running from a subdirectory (#273)
|
||||
|
|
|
@ -22,7 +22,7 @@ class LogTestCase(BaseTestCase):
|
|||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.get(self.url)
|
||||
self.assertContains(r, "Local Time", status_code=200)
|
||||
self.assertContains(r, "Browser's time zone", status_code=200)
|
||||
|
||||
def test_team_access_works(self):
|
||||
|
||||
|
|
|
@ -109,12 +109,11 @@ $(function () {
|
|||
var lastFormat = "local";
|
||||
function switchDateFormat(format) {
|
||||
lastFormat = format;
|
||||
var tz = format == "local" ? spacetime().timezone().name : format;
|
||||
$("#log tr").each(function(index, row) {
|
||||
var dt = moment(row.getAttribute("data-dt"));
|
||||
format == "local" ? dt.local() : dt.utc();
|
||||
|
||||
$(".date", row).text(dt.format("MMM D"));
|
||||
$(".time", row).text(dt.format("HH:mm"));
|
||||
var s = spacetime(row.getAttribute("data-dt")).goto(tz);
|
||||
$(".date", row).text(s.unixFmt("MMM d"));
|
||||
$(".time", row).text(s.unixFmt("h:mm"));
|
||||
})
|
||||
|
||||
// The table is initially hidden to avoid flickering as we convert dates.
|
||||
|
|
|
@ -4,19 +4,18 @@ $(function () {
|
|||
$('#ping-details-modal').modal("show");
|
||||
|
||||
$.get(this.dataset.url, function(data) {
|
||||
$("#ping-details-body" ).html(data);
|
||||
$("#ping-details-body").html(data);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function switchDateFormat(format) {
|
||||
var tz = format == "local" ? spacetime().timezone().name : format;
|
||||
$("#log tr").each(function(index, row) {
|
||||
var dt = moment(row.getAttribute("data-dt"));
|
||||
format == "local" ? dt.local() : dt.utc();
|
||||
|
||||
$(".date", row).text(dt.format("MMM D"));
|
||||
$(".time", row).text(dt.format("HH:mm"));
|
||||
var s = spacetime(row.getAttribute("data-dt")).goto(tz);
|
||||
$(".date", row).text(s.unixFmt("MMM d"));
|
||||
$(".time", row).text(s.unixFmt("h:mm"));
|
||||
})
|
||||
}
|
||||
|
||||
|
|
7
static/js/moment.min.js
vendored
7
static/js/moment.min.js
vendored
File diff suppressed because one or more lines are too long
1
static/js/spacetime.min.js
vendored
Normal file
1
static/js/spacetime.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -163,5 +163,6 @@ $(function () {
|
|||
$(".kind-cron").click(showCron);
|
||||
|
||||
$("#schedule").on("keyup", updateCronPreview);
|
||||
$("#tz").on("change", updateCronPreview);
|
||||
|
||||
});
|
||||
|
|
|
@ -208,14 +208,21 @@
|
|||
Log
|
||||
<small>Click on individual items for details</small>
|
||||
<div id="format-switcher" class="btn-group pull-right" data-toggle="buttons">
|
||||
<label class="btn btn-default btn-xs" data-format="utc">
|
||||
<input type="radio" name="date-format" checked>
|
||||
<label class="btn btn-default btn-xs" data-format="UTC">
|
||||
<input type="radio" name="date-format">
|
||||
UTC
|
||||
</label>
|
||||
</label>
|
||||
|
||||
{% if check.kind == "cron" and check.tz != "UTC" %}
|
||||
<label class="btn btn-default btn-xs" data-format="{{ check.tz }}">
|
||||
<input type="radio" name="date-format">
|
||||
{{ check.tz }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<label class="btn btn-default btn-xs active" data-format="local">
|
||||
<input type="radio" name="date-format">
|
||||
Local Time
|
||||
Browser's time zone
|
||||
</label>
|
||||
</div>
|
||||
</h2>
|
||||
|
@ -255,7 +262,7 @@
|
|||
<script src="{% static 'js/bootstrap-select.min.js' %}"></script>
|
||||
<script src="{% static 'js/nouislider.min.js' %}"></script>
|
||||
<script src="{% static 'js/snippet-copy.js' %}"></script>
|
||||
<script src="{% static 'js/moment.min.js' %}"></script>
|
||||
<script src="{% static 'js/spacetime.min.js' %}"></script>
|
||||
<script src="{% static 'js/update-timeout-modal.js' %}"></script>
|
||||
<script src="{% static 'js/adaptive-setinterval.js' %}"></script>
|
||||
<script src="{% static 'js/details.js' %}"></script>
|
||||
|
|
|
@ -87,11 +87,9 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% if check.n_pings > 20 %}
|
||||
<p class="text-center">
|
||||
<a href="{% url 'hc-log' check.code %}">Show More…</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="alert alert-info">This check has not received any pings yet.</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -19,14 +19,21 @@
|
|||
|
||||
<li id="format-switcher-container" class="pull-right">
|
||||
<div id="format-switcher" class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-default btn-xs" data-format="utc">
|
||||
<label class="btn btn-default btn-xs" data-format="UTC">
|
||||
<input type="radio" name="date-format" checked>
|
||||
UTC
|
||||
</label>
|
||||
|
||||
{% if check.kind == "cron" and check.tz != "UTC" %}
|
||||
<label class="btn btn-default btn-xs" data-format="{{ check.tz }}">
|
||||
<input type="radio" name="date-format">
|
||||
{{ check.tz }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<label class="btn btn-default btn-xs active" data-format="local">
|
||||
<input type="radio" name="date-format">
|
||||
Local Time
|
||||
Browser's time zone
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -164,7 +171,7 @@
|
|||
{% compress js %}
|
||||
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
|
||||
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
||||
<script src="{% static 'js/moment.min.js' %}"></script>
|
||||
<script src="{% static 'js/spacetime.min.js' %}"></script>
|
||||
<script src="{% static 'js/log.js' %}"></script>
|
||||
{% endcompress %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Reference in a new issue