From c65f18fede255d708a6cd173268a516161e11802 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 30 Jan 2021 22:35:17 +0100 Subject: Support more timestamp formats This results in slightly more compact URLs without escaped spaces. --- muninplot/wsgi.py | 2 ++ src/munin-plot.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/muninplot/wsgi.py b/muninplot/wsgi.py index 5c859ad..6979a2a 100644 --- a/muninplot/wsgi.py +++ b/muninplot/wsgi.py @@ -102,7 +102,9 @@ def _parse_timestamp(timestamp): """Return a timestamp value from the specified string.""" formats = ( '%Y-%m-%d %H:%M:%S', + '%Y-%m-%dT%H:%M:%S', '%Y-%m-%d %H:%M', + '%Y-%m-%dT%H:%M', '%Y-%m-%d') for fmt in formats: try: diff --git a/src/munin-plot.js b/src/munin-plot.js index 7ffc837..942fc43 100644 --- a/src/munin-plot.js +++ b/src/munin-plot.js @@ -403,7 +403,7 @@ $(document).ready(function () { if (plot.layout) { // range of the x axis const [amin, amax] = plot.layout.xaxis.range - const url = 'data/' + plot.graph.name + '?start=' + amin.substring(0, 16) + '&end=' + amax.substring(0, 16) + const url = 'data/' + plot.graph.name + '?start=' + amin.substring(0, 16).replace(' ', 'T') + '&end=' + amax.substring(0, 16).replace(' ', 'T') Plotly.d3.csv(url, function (data) { Object.keys(plot.tracebyfield).forEach(function (field) { plot.tracebyfield[field].x = [] -- cgit v1.2.3