Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2021-01-30 22:35:17 +0100
committerArthur de Jong <arthur@arthurdejong.org>2021-01-30 22:38:56 +0100
commitc65f18fede255d708a6cd173268a516161e11802 (patch)
tree781fb33653861bc7c2791b7417d4640095969f68
parenta1b7bd382609c76b5c7fc7064c57bfe71c102cd1 (diff)
Support more timestamp formats
This results in slightly more compact URLs without escaped spaces.
-rw-r--r--muninplot/wsgi.py2
-rw-r--r--src/munin-plot.js2
2 files changed, 3 insertions, 1 deletions
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 = []