mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-08 06:30:05 +00:00
Fix regression in log auto-updating code
Also switch back to using integers for the slider min and max values, and for the hc.front.forms.LogFilterForm.
This commit is contained in:
parent
47894f6add
commit
df6895ed1f
4 changed files with 8 additions and 7 deletions
|
@ -383,7 +383,7 @@ class SearchForm(forms.Form):
|
|||
|
||||
class LogFiltersForm(forms.Form):
|
||||
# min_value is 2010-01-01, max_value is 2030-01-01
|
||||
end = forms.FloatField(min_value=1262296800, max_value=1893448800, required=False)
|
||||
end = forms.IntegerField(min_value=1262296800, max_value=1893448800, required=False)
|
||||
|
||||
def clean_end(self) -> datetime | None:
|
||||
if self.cleaned_data["end"]:
|
||||
|
|
|
@ -189,7 +189,7 @@ class LogTestCase(BaseTestCase):
|
|||
|
||||
def test_it_accepts_end_query_parameter(self) -> None:
|
||||
dt = datetime(2020, 1, 1, tzinfo=timezone.utc)
|
||||
ts = str(dt.timestamp())
|
||||
ts = str(int(dt.timestamp()))
|
||||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.get(self.url + "?end=" + ts)
|
||||
|
|
|
@ -11,7 +11,7 @@ $(function () {
|
|||
|
||||
function updateSliderPreview() {
|
||||
var toFormatted = "now";
|
||||
if (slider.value < parseInt(slider.max)) {
|
||||
if (slider.value != slider.max) {
|
||||
toFormatted = fromUnix(slider.value).format("MMM D, HH:mm");
|
||||
}
|
||||
$("#end-formatted").text(toFormatted);
|
||||
|
@ -19,7 +19,8 @@ $(function () {
|
|||
|
||||
$("#end").on("input", updateSliderPreview);
|
||||
$("#end").on("change", function() {
|
||||
$("#end").attr("disabled", slider.value == parseInt(slider.max));
|
||||
// Don't send the end parameter if slider is set to "now"
|
||||
$("#end").attr("disabled", slider.value == slider.max);
|
||||
$("#filters").submit();
|
||||
});
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
id="end"
|
||||
type="range"
|
||||
name="end"
|
||||
min="{{ min|timestamp }}"
|
||||
max="{{ max|timestamp }}"
|
||||
value="{{ end|timestamp }}">
|
||||
min="{{ min|timestamp|floatformat:"0" }}"
|
||||
max="{{ max|timestamp|floatformat:"0" }}"
|
||||
value="{{ end|timestamp|floatformat:"0" }}">
|
||||
|
||||
<p id="end-help" class="text-muted">⬆<br>{{ min|date:"M d, Y"}}</p>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Reference in a new issue