forked from GithubBackups/healthchecks
Use local timezone for dates and times in ping log.
This commit is contained in:
parent
d456c37781
commit
f4939f4c91
@ -1,3 +1,7 @@
|
|||||||
|
#log {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
#log th {
|
#log th {
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
border-bottom: 1px solid #E5E5E5;
|
border-bottom: 1px solid #E5E5E5;
|
||||||
|
@ -69,7 +69,7 @@ $(function () {
|
|||||||
pips: {
|
pips: {
|
||||||
mode: 'values',
|
mode: 'values',
|
||||||
values: [60, 1800, 3600, 43200, 86400, 604800, 2592000],
|
values: [60, 1800, 3600, 43200, 86400, 604800, 2592000],
|
||||||
density: 5,
|
density: 4,
|
||||||
format: {
|
format: {
|
||||||
to: secsToText,
|
to: secsToText,
|
||||||
from: function() {}
|
from: function() {}
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
function switchDateFormat(format) {
|
||||||
|
$("#log td.datetime").each(function(index, cell) {
|
||||||
|
var dt = moment(cell.getAttribute("data-raw"));
|
||||||
|
format == "local" ? dt.local() : dt.utc();
|
||||||
|
|
||||||
|
$(".date", cell).text(dt.format("MMM D"));
|
||||||
|
$(".time", cell).text(dt.format("HH:mm"));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$("#format-switcher").click(function(ev) {
|
||||||
|
var format = ev.target.getAttribute("data-format");
|
||||||
|
switchDateFormat(format);
|
||||||
|
});
|
||||||
|
|
||||||
|
switchDateFormat("local");
|
||||||
|
// The table is initially hidden to avoid flickering as we convert dates.
|
||||||
|
// Once it's ready, set it to visible:
|
||||||
|
$("#log").css("visibility", "visible");
|
||||||
});
|
});
|
7
static/js/moment.min.js
vendored
Normal file
7
static/js/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -12,14 +12,23 @@
|
|||||||
<li><a href="{% url 'hc-checks' %}">Checks</a></li>
|
<li><a href="{% url 'hc-checks' %}">Checks</a></li>
|
||||||
<li>{{ check.name_then_code }}</li>
|
<li>{{ check.name_then_code }}</li>
|
||||||
<li class="active">Log</li>
|
<li class="active">Log</li>
|
||||||
|
|
||||||
|
<div class="pull-right">
|
||||||
|
<div id="format-switcher" class="btn-group" data-toggle="buttons">
|
||||||
|
<label class="btn btn-default btn-xs" data-format="utc">
|
||||||
|
<input type="radio" name="date-format" autocomplete="off" checked>
|
||||||
|
UTC
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-default btn-xs active" data-format="local">
|
||||||
|
<input type="radio" name="date-format" autocomplete="off">
|
||||||
|
Local Time
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
{% if pings %}
|
{% if pings %}
|
||||||
|
|
||||||
<p class="log-notes">
|
|
||||||
Note: Dates and times are displayed in <strong>UTC</strong>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table" id="log">
|
<table class="table" id="log">
|
||||||
<tr>
|
<tr>
|
||||||
@ -40,14 +49,10 @@
|
|||||||
<span class="hash">#</span>{{ record.ping.n }}
|
<span class="hash">#</span>{{ record.ping.n }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="datetime">
|
<td class="datetime" data-raw="{{ record.ping.created.isoformat }}">
|
||||||
<div>
|
<div>
|
||||||
<span class="date">
|
<span class="date"></span>
|
||||||
{{ record.ping.created|date:"N j" }}
|
<span class="time"></span>
|
||||||
</span>
|
|
||||||
<span class="time">
|
|
||||||
{{ record.ping.created|date:"H:i" }}
|
|
||||||
</span>
|
|
||||||
{% if record.early %}
|
{% if record.early %}
|
||||||
<span class="label label-tag">early</span>
|
<span class="label label-tag">early</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -70,14 +75,10 @@
|
|||||||
<td class="n-cell">
|
<td class="n-cell">
|
||||||
<span class="glyphicon glyphicon-remove"></span>
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="datetime">
|
<td class="datetime" data-raw="{{ record.placeholder_date.isoformat }}">
|
||||||
<div>
|
<div>
|
||||||
<span class="date">
|
<span class="date"></span>
|
||||||
{{ record.placeholder_date|date:"N j" }}
|
<span class="time"></span>
|
||||||
</span>
|
|
||||||
<span class="time">
|
|
||||||
{{ record.placeholder_date|date:"H:i" }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
@ -110,6 +111,7 @@
|
|||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
|
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
|
||||||
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
<script src="{% static 'js/bootstrap.min.js' %}"></script>
|
||||||
|
<script src="{% static 'js/moment.min.js' %}"></script>
|
||||||
<script src="{% static 'js/log.js' %}"></script>
|
<script src="{% static 'js/log.js' %}"></script>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user