From 713ab837ba59c4a7c0b60cb8e8be4b27f4520e52 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 8 Nov 2014 14:00:06 -0600 Subject: Convert mirror status tables to Jinja2 Yay for way improved performance. Local testing showed render times going from 265 ms to 135 ms. Signed-off-by: Dan McGee --- templates/mirrors/error_table.html | 24 ------------------------ templates/mirrors/error_table.html.jinja | 22 ++++++++++++++++++++++ templates/mirrors/mirror_details.html | 2 +- templates/mirrors/status.html | 6 +++--- templates/mirrors/status_table.html | 30 ------------------------------ templates/mirrors/status_table.html.jinja | 28 ++++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 58 deletions(-) delete mode 100644 templates/mirrors/error_table.html create mode 100644 templates/mirrors/error_table.html.jinja delete mode 100644 templates/mirrors/status_table.html create mode 100644 templates/mirrors/status_table.html.jinja (limited to 'templates') diff --git a/templates/mirrors/error_table.html b/templates/mirrors/error_table.html deleted file mode 100644 index cd7265af..00000000 --- a/templates/mirrors/error_table.html +++ /dev/null @@ -1,24 +0,0 @@ -{% load cycle from future %} -{% load flags mirror_status %} - - - - - - - - - - - - - {% for log in error_logs %} - - - - - - - {% endfor %} - -
Mirror URLProtocolCountryError MessageLast OccurredOccurrences (last {{ cutoff|hours }})
{{ log.url__url }}{{ log.url__protocol__protocol }}{% country_flag log.country %}{{ log.country.name }}{{ log.error|linebreaksbr }}{{ log.last_occurred|date:'Y-m-d H:i' }}{{ log.error_count }}
diff --git a/templates/mirrors/error_table.html.jinja b/templates/mirrors/error_table.html.jinja new file mode 100644 index 00000000..52f68135 --- /dev/null +++ b/templates/mirrors/error_table.html.jinja @@ -0,0 +1,22 @@ + + + + + + + + + + + + + {% for log in error_logs %} + + + + + + + {% endfor %} + +
Mirror URLProtocolCountryError MessageLast OccurredOccurrences (last {{ cutoff|hours }})
{{ log.url__url }}{{ log.url__protocol__protocol }}{{ country_flag(log.country) }}{{ log.country.name }}{{ log.error|linebreaksbr }}{{ log.last_occurred|date('Y-m-d H:i') }}{{ log.error_count }}
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html index 2ff41828..e4ae55b4 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -132,7 +132,7 @@

Available URLs

Error Log

- {% include "mirrors/error_table.html" %} + {% include "mirrors/error_table.html.jinja" %}
diff --git a/templates/mirrors/status.html b/templates/mirrors/status.html index 24408be7..530e3ff5 100644 --- a/templates/mirrors/status.html +++ b/templates/mirrors/status.html @@ -60,18 +60,18 @@

Mirror Status{% if tier != None %} - Tier {{ tier }}{% endif %}

Out of Sync Mirrors

{% with urls=bad_urls table_id='outofsync_mirrors' %} - {% include "mirrors/status_table.html" %} + {% include "mirrors/status_table.html.jinja" %} {% endwith %}

Successfully Syncing Mirrors

{% with urls=good_urls table_id='successful_mirrors' %} - {% include "mirrors/status_table.html" %} + {% include "mirrors/status_table.html.jinja" %} {% endwith %}

Mirror Syncing Error Log

- {% include "mirrors/error_table.html" %} + {% include "mirrors/error_table.html.jinja" %}
{% endblock %} diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html deleted file mode 100644 index 83538303..00000000 --- a/templates/mirrors/status_table.html +++ /dev/null @@ -1,30 +0,0 @@ -{% load cycle from future %} -{% load flags mirror_status %} - - - - - - - - - - - - - - - - {% for m_url in urls %} - - - - - - - - - - {% endfor %} - -
Mirror URLProtocolCountryCompletion %μ Delay (hh:mm)μ Duration (s)σ Duration (s)Mirror Score
{{ m_url.url }}{{ m_url.protocol }}{% country_flag m_url.country %}{{ m_url.country.name }}{{ m_url.completion_pct|percentage:1 }}{{ m_url.delay|duration|default:'unknown' }}{{ m_url.duration_avg|floatvalue:2 }}{{ m_url.duration_stddev|floatvalue:2 }}{{ m_url.score|floatvalue:1|default:'∞' }}details
diff --git a/templates/mirrors/status_table.html.jinja b/templates/mirrors/status_table.html.jinja new file mode 100644 index 00000000..598a1af0 --- /dev/null +++ b/templates/mirrors/status_table.html.jinja @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + {% for m_url in urls %} + + + + + + + + + + {% endfor %} + +
Mirror URLProtocolCountryCompletion %μ Delay (hh:mm)μ Duration (s)σ Duration (s)Mirror Score
{{ m_url.url }}{{ m_url.protocol }}{{ country_flag(m_url.country) }}{{ m_url.country.name }}{{ m_url.completion_pct|percentage(1) }}{{ m_url.delay|duration|default('unknown') }}{{ m_url.duration_avg|floatvalue(2) }}{{ m_url.duration_stddev|floatvalue(2) }}{{ m_url.score|floatvalue(1)|default('∞') }}details
-- cgit v1.2.3-54-g00ecf