From 937948651210172ffae119a467d3a998f398d468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Rossigneux?= Date: Wed, 6 Feb 2013 01:21:19 +0100 Subject: [PATCH] Graph auto-refresh improvements. Use HTTP 304 responses. Add a trailing slash to URLs. Change-Id: I76efa82ed206a59ba709551c7f408b909cecb953 --- kwapi/plugins/rrd/templates/index.html | 15 +++++++-------- kwapi/plugins/rrd/v1.py | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/kwapi/plugins/rrd/templates/index.html b/kwapi/plugins/rrd/templates/index.html index face765..43cb691 100644 --- a/kwapi/plugins/rrd/templates/index.html +++ b/kwapi/plugins/rrd/templates/index.html @@ -10,11 +10,11 @@ // @@ -38,9 +37,9 @@ @@ -52,11 +51,11 @@ {% if probes|count > 0 %}

Summary

- Summary graph + Summary graph

Details

{% for probe in probes %} - Graph {{ probe }} + Graph {{ probe }} {% endfor %} {% else %}

No probes found.

@@ -65,7 +64,7 @@ {% elif view == 'probe' %} {% for scale in scales %} - Graph {{ probe }} + Graph {{ probe }} {% endfor %} {% endif %} diff --git a/kwapi/plugins/rrd/v1.py b/kwapi/plugins/rrd/v1.py index a614d28..7690c13 100644 --- a/kwapi/plugins/rrd/v1.py +++ b/kwapi/plugins/rrd/v1.py @@ -63,7 +63,7 @@ def send_summary_graph(scale): scale = scale.encode('utf-8') png_file = rrd.build_graph(scale) try: - return flask.send_file(png_file) + return flask.send_file(png_file, cache_timeout=0, conditional=True) except: flask.abort(404) @@ -75,6 +75,6 @@ def send_probe_graph(scale, probe): scale = scale.encode('utf-8') png_file = rrd.build_graph(scale, probe) try: - return flask.send_file(png_file) + return flask.send_file(png_file, cache_timeout=0, conditional=True) except: flask.abort(404)